Эх сурвалжийг харах

HUE-4290 [editor] Style the coordinator history on the context panel

Enrico Berti 9 жил өмнө
parent
commit
798ce11

+ 3 - 2
apps/oozie/src/oozie/static/oozie/js/list-oozie-coordinator.ko.js

@@ -27,6 +27,7 @@
 }(this, function (ko) {
 
   var RunningCoordinatorModel = function (actions) {
+
     var self = this;
 
     self.Action = function (action) {
@@ -57,9 +58,9 @@
 
     self.isLoading = ko.observable(true);
 
-    self.actions = ko.observableArray(ko.utils.arrayMap(actions), function (action) {
+    self.actions = ko.observableArray(ko.utils.arrayMap(actions, function (action) {
       return new self.Action(action);
-    });
+    }));
 
     self.allSelected = ko.observable(false);
 

+ 3 - 6
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -1268,7 +1268,8 @@
       self.fetchHistory();
     });
 
-    self.schedulerViewModel;
+    self.schedulerViewModel = null;
+    self.schedulerViewerViewModel = ko.observable();
 
     self.retryModalConfirm = null;
     self.retryModalCancel = null;
@@ -1757,11 +1758,7 @@
       $.get("/oozie/list_oozie_coordinator/" + self.viewSchedulerId(), {
         format: 'json'
       }, function (data) {
-        $("#schedulerViewer").text(ko.mapping.toJSON(data));
-
-        // var viewModel = new RunningCoordinatorModel(data.actions);
-        // ko.cleanNode($("#schedulerViewer")[0]);
-        // ko.applyBindings(viewModel, $("#schedulerViewer")[0]);
+        self.schedulerViewerViewModel(new RunningCoordinatorModel(data.actions));
       }).fail(function (xhr) {
         $(document).trigger("error", xhr.responseText);
       }).always(function(){

+ 29 - 1
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -44,6 +44,7 @@ from notebook.conf import ENABLE_QUERY_BUILDER, ENABLE_QUERY_SCHEDULING
 <script src="${ static('desktop/ext/js/markdown.min.js') }"></script>
 <script src="${ static('desktop/ext/js/jquery/plugins/jquery.hotkeys.js') }"></script>
 <script src="${ static('desktop/ext/js/jquery/plugins/jquery.mousewheel.min.js') }"></script>
+<script src="${ static('oozie/js/dashboard-utils.js') }" type="text/javascript" charset="utf-8"></script>
 
 %if ENABLE_QUERY_BUILDER.get():
 <!-- For query builder -->
@@ -1071,7 +1072,8 @@ ${ hueIcons.symbols() }
     ## To move to 'notification' panel
     <div class="tab-pane" id="scheduledJobsTab">
       <!-- ko if: $root.selectedNotebook() -->
-      <!-- ko with: $root.selectedNotebook() -->    
+      <!-- ko with: $root.selectedNotebook() -->
+      <!-- ko if: $root.selectedNotebook().isSaved() -->
         <input type="text" data-bind="value: viewSchedulerId" /> <a class="pointer" data-bind="click: viewScheduler">load</a>
 
         <!-- ko if: loadingScheduler -->
@@ -1079,8 +1081,34 @@ ${ hueIcons.symbols() }
           <i class="fa fa-spinner fa-spin muted"></i>
         </div>
         <!-- /ko -->
+        <!-- ko with: schedulerViewerViewModel -->
         <div id="schedulerViewer">
+          <table class="table table-striped table-condensed margin-top-10">
+            <tbody data-bind="foreach: filteredActions">
+              <tr data-bind="css: { disabled: url == '' }">
+                <td data-bind="css: { disabled: url == '' }">
+                  <a data-bind="attr: {href: url != '' ? url : 'javascript:void(0)', title: url ? '' : '${ _ko('Workflow not available or instantiated yet') }' }, css: { disabled: url == '' }" target="_blank">
+                    <span data-bind="text: title, attr: {'class': statusClass, 'id': 'date-' + $index()}"></span>
+                  </a>
+                  <span class="pull-right">
+                  <i class="fa fa-exclamation-triangle" data-bind="visible: (errorMessage == null || errorMessage == '') && (missingDependencies == null || missingDependencies == '') && url == '', attr: {title: '${ _ko('Workflow not available or instantiated yet') }'}"></i><i class="fa fa-exclamation-triangle" data-bind="visible: errorMessage != null && errorMessage != '', attr: {title: errorMessage}"></i> <i class="fa fa-exclamation-triangle" data-bind="visible:missingDependencies !='' && missingDependencies != null, attr: { title: '${ _ko('Missing')} ' + missingDependencies }"></i>
+                  </span>
+                </td>
+              </tr>
+            </tbody>
+            <tfoot>
+              <tr data-bind="visible: filteredActions().length == 0 && !$parent.loadingScheduler()">
+                <td>
+                  <div class="alert">
+                    ${ _('There are no actions to be shown.') }
+                  </div>
+                </td>
+              </tr>
+            </tfoot>
+          </table>
         </div>
+        <!-- /ko -->
+      <!-- /ko -->
       <!-- /ko -->
       <!-- /ko -->
     </div>