瀏覽代碼

[pig] Avoid 500 error when polling logs for the first time

Move Run button to the top.
Add spinner when waiting for the first available log lines.
Romain Rigaux 12 年之前
父節點
當前提交
73a6738
共有 2 個文件被更改,包括 7 次插入10 次删除
  1. 1 1
      apps/pig/src/pig/api.py
  2. 6 9
      apps/pig/src/pig/templates/app.mako

+ 1 - 1
apps/pig/src/pig/api.py

@@ -130,8 +130,8 @@ class OozieApi:
     workflow_actions = []
 
     # Only one Pig action
-    progress = get_progress(oozie_workflow, logs.get(action.name, ''))
     for action in oozie_workflow.get_working_actions():
+      progress = get_progress(oozie_workflow, logs.get(action.name, ''))
       appendable = {
         'name': action.name,
         'status': action.status,

+ 6 - 9
apps/pig/src/pig/templates/app.mako

@@ -118,11 +118,6 @@ ${ commonheader(_('Pig'), "pig", user, "100px") | n,unicode }
             ##<li><a href="#createDataset">${ _('New') }</a></li>
             ##<li><a href="#createDataset">${ _('List') }</a></li>
             <li class="nav-header">${_('Actions')}</li>
-            <li data-bind="click: saveScript">
-              <a href="#" title="${ _('Save the script') }" rel="tooltip" data-placement="right">
-                <i class="icon-save"></i> ${ _('Save') }
-              </a>
-            </li>
             <li data-bind="click: runOrShowSubmissionModal, visible: !currentScript().isRunning()">
               <a href="#" title="${ _('Run the script') }" rel="tooltip" data-placement="right">
                 <i class="icon-play"></i> ${ _('Run') }
@@ -133,6 +128,11 @@ ${ commonheader(_('Pig'), "pig", user, "100px") | n,unicode }
                 <i class="icon-ban-circle"></i> ${ _('Stop') }
               </a>
             </li>
+            <li data-bind="click: saveScript">
+              <a href="#" title="${ _('Save the script') }" rel="tooltip" data-placement="right">
+                <i class="icon-save"></i> ${ _('Save') }
+              </a>
+            </li>
             <li data-bind="visible: currentScript().id() != -1, click: copyScript">
               <a href="#" title="${ _('Copy the script') }" rel="tooltip" data-placement="right">
                 <i class="icon-retweet"></i> ${ _('Copy') }
@@ -249,9 +249,6 @@ ${ commonheader(_('Pig'), "pig", user, "100px") | n,unicode }
 
       <div id="logs" class="section hide">
           <div class="alert alert-info"><h3>${ _('Logs for') } '<span data-bind="text: currentScript().name"></span>'</h3></div>
-          <div data-bind="visible: currentScript().actions().length == 0">
-            <img src="/static/art/spinner.gif" />
-          </div>
           <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' && status != 'SUSPENDED'}">
@@ -264,7 +261,7 @@ ${ commonheader(_('Pig'), "pig", user, "100px") | n,unicode }
               </div>
             </div>
           </script>
-          <pre id="withoutLogs" class="hide">${ _('No available logs.') }</pre>
+          <pre id="withoutLogs" class="hide"><img src="/static/art/spinner.gif" /> ${ _('No available logs.') }</pre>
           <pre id="withLogs" class="hide scroll"></pre>
         </div>