Browse Source

HUE-1123 [pig] Introduce progress bar instead of textual percentage

update progress bar
it never goes to 100% or update the running status
Romain Rigaux 12 năm trước cách đây
mục cha
commit
9c2d407

+ 1 - 1
apps/catalog/src/catalog/templates/describe_table.mako

@@ -68,7 +68,7 @@ ${ commonheader(_("%s : %s") % (view_or_table_noun, table.name), app_name, user)
             </div>
         </div>
         <div class="span9">
-            % if table.comment is not None:
+            % if table.comment:
                 <div class="alert alert-info">${ _('Comment:') } ${ table.comment }</div>
             % endif
 

+ 10 - 8
apps/pig/src/pig/api.py

@@ -94,14 +94,16 @@ class OozieApi:
 
     workflow_actions = []
 
-    if oozie_workflow.get_working_actions():
-      for action in oozie_workflow.get_working_actions():
-        appendable = {
-          'name': action.name,
-          'status': action.status,
-          'logs': logs.get(action.name, '')
-        }
-        workflow_actions.append(appendable)
+    # Only one Pig action
+    for action in oozie_workflow.get_working_actions():
+      appendable = {
+        'name': action.name,
+        'status': action.status,
+        'logs': logs.get(action.name, ''),
+        'progress': oozie_workflow.get_progress(),
+        'progressPercent': '%d%%' % oozie_workflow.get_progress()
+      }
+      workflow_actions.append(appendable)
 
     return logs, workflow_actions
 

+ 7 - 2
apps/pig/src/pig/templates/app.mako

@@ -110,7 +110,7 @@ ${ commonheader(_('Pig'), "pig", user, "100px") | n,unicode }
               <a href="#" title="${ _('New script') }" rel="tooltip" data-placement="right">
                 <i class="icon-plus-sign"></i> ${ _('New script') }
               </a>
-            </li>            
+            </li>
             <li class="nav-header">${_('Properties')}</li>
             <li data-bind="click: editScriptProperties" data-section="properties">
               <a href="#"><i class="icon-reorder"></i> ${ _('Edit properties') }</a>
@@ -176,7 +176,12 @@ ${ commonheader(_('Pig'), "pig", user, "100px") | n,unicode }
         <div data-bind="template: {name: 'logTemplate', foreach: currentScript().actions}"></div>
         <script id="logTemplate" type="text/html">
           <div data-bind="css:{'alert-modified': name != '', 'alert': name != '', 'alert-success': status == 'SUCCEEDED' || status == 'OK', 'alert-error': status != 'RUNNING' && status != 'SUCCEEDED' && status != 'OK' && status != 'PREP'}">
-            <div class="pull-right" data-bind="text: status"></div><h4>${ _('Progress: 50%') } '<span data-bind="text: name"></span>'</h4></div>
+            <div class="pull-right" data-bind="text: status"></div>
+              <h4>${ _('Progress:') } <span data-bind="text: progress"></span>${ _('%') }</h4>
+              <div class="progress">
+                <div class="bar" data-bind="css: {'width': progressPercent}" style="width: 50%"></div>
+              </div>
+          </div>
           <pre data-bind="visible: logs == ''">${ _('No available logs.') }</pre>
           <pre data-bind="visible: logs != '', text: logs"></pre>
         </script>

+ 3 - 3
desktop/core/src/desktop/auth/views.py

@@ -152,7 +152,7 @@ def _profile_dict(user):
     email=user.email)
 
 
-# Oauth is based on Twitter as example.
+# OAuth is based on Twitter as example.
 
 @login_notrequired
 def oauth_login(request):
@@ -163,7 +163,7 @@ def oauth_login(request):
                   }))
 
   if resp['status'] != '200':
-    raise Exception(_("Invalid response from Oauth provider: %s") % resp)
+    raise Exception(_("Invalid response from OAuth provider: %s") % resp)
 
   request.session['request_token'] = dict(cgi.parse_qsl(content))
 
@@ -180,7 +180,7 @@ def oauth_authenticated(request):
 
   resp, content = client.request(OAUTH.ACCESS_TOKEN_URL.get(), "GET")
   if resp['status'] != '200':
-      raise Exception(_("Invalid response from Oauth provider: %s") % resp)
+      raise Exception(_("Invalid response from OAuth provider: %s") % resp)
 
   access_token = dict(cgi.parse_qsl(content))