Browse Source

HUE-1176 [jb] The graph actions shouldn't link away from JB2

Enrico Berti 8 years ago
parent
commit
e971f62

+ 10 - 0
apps/jobbrowser/src/jobbrowser/templates/job_browser.mako

@@ -1059,6 +1059,16 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
 
     var viewModel;
 
+    huePubSub.subscribe('oozie.action.logs.click', function (widget) {
+      viewModel.job().id(widget.externalId());
+      viewModel.job().fetchJob();
+    });
+
+    huePubSub.subscribe('oozie.action.click', function (widget) {
+      viewModel.job().id(widget.externalId());
+      viewModel.job().fetchJob();
+    });
+
     $(document).ready(function () {
       var options = {
         user: '${ user.username }',

+ 1 - 0
apps/oozie/src/oozie/static/oozie/js/workflow-editor.ko.js

@@ -1361,6 +1361,7 @@ var ExtendedWidget = function (params) {
   self.progress = ko.observable(0);
   self.actionURL = ko.observable("");
   self.logsURL = ko.observable("");
+  self.externalId = ko.observable("");
   self.externalIdUrl = ko.observable("");
   return self;
 }

+ 2 - 0
apps/oozie/src/oozie/templates/dashboard/list_oozie_workflow_graph.mako

@@ -49,6 +49,7 @@ ${ workflow.render() }
   var viewModel = new WorkflowEditorViewModel(${ layout_json | n,unicode }, ${ workflow_json | n,unicode }, ${ credentials_json | n,unicode }, ${ workflow_properties_json | n,unicode }, ${ subworkflows_json | n,unicode }, ${ can_edit_json | n,unicode });
   ko.applyBindings(viewModel, $("#${graph_element_id}")[0]);
   viewModel.isViewer = ko.observable(true);
+  viewModel.isEmbeddable = ko.observable(true);
   viewModel.init();
   fullLayout(viewModel);
 
@@ -94,6 +95,7 @@ ${ workflow.render() }
               _w.actionURL(action.url);
               _w.logsURL(action.log);
               _w.externalIdUrl(action.externalIdUrl);
+              _w.externalId(action.id);
             }
           });
           %endif

+ 11 - 1
apps/oozie/src/oozie/templates/editor2/common_workflow.mako

@@ -231,7 +231,12 @@
       <!-- /ko -->
 
       <span data-bind="visible: typeof $root.isViewer == 'undefined' || ! $root.isViewer(), editable: name, editableOptions: {enabled: $root.isEditing(), placement: 'right'}, attr: {'title': id().slice(0, 4)}"></span>
-      <a class="pointer" data-bind="visible: typeof $root.isViewer != 'undefined' && $root.isViewer(), click: function(){ location.href = actionURL(); }, text: name" title="${ _('View workflow action') }"></a>
+      <!-- ko if: typeof $root.isEmbeddable !== 'undefined' -->
+        <a class="pointer" data-bind="visible: typeof $root.isEmbeddable != 'undefined' && $root.isEmbeddable(), click: function(){ huePubSub.publish('oozie.action.click', $data); }, text: name" title="${ _('View workflow action') }"></a>
+      <!-- /ko -->
+      <!-- ko if: typeof $root.isEmbeddable === 'undefined' -->
+        <a class="pointer" data-bind="visible: typeof $root.isViewer != 'undefined' && $root.isViewer(), click: function(){ location.href = actionURL(); }, text: name" title="${ _('View workflow action') }"></a>
+      <!-- /ko -->
 
       <div class="inline pull-right" data-bind="visible: (typeof $root.isViewer == 'undefined' || ! $root.isViewer()) && !$root.isEditing()" style="margin-right: 4px">
         <a href="javascript:void(0)" data-bind="click: function(w) { viewModel.showSubmitActionPopup(w); }"><i class="fa fa-play-circle-o"></i></a>
@@ -660,7 +665,12 @@
 
 <script type="text/html" id="logs-icon">
   <!-- ko if: $parent.widgetType() != 'subworkflow-widget' && $parent.logsURL() != '' && $parent.logsURL() != null -->
+    <!-- ko if: typeof $root.isEmbeddable !== 'undefined' -->
+    <a class="pull-right pointer logs-icon" data-bind="click: function(){ huePubSub.publish('oozie.action.logs.click', $parent); }" title="${ _('View logs') }"><i class="fa fa-tasks"></i></a>
+    <!-- /ko -->
+    <!-- ko if: typeof $root.isEmbeddable === 'undefined' -->
     <a class="pull-right pointer logs-icon" data-bind="click: function(){ location.href = $parent.logsURL(); }" title="${ _('View logs') }"><i class="fa fa-tasks"></i></a>
+    <!-- /ko -->
   <!-- /ko -->
   <!-- ko if: $parent.widgetType() == 'subworkflow-widget' && $parent.externalIdUrl()-->
     <a class="pull-right pointer logs-icon" data-bind="attr: { href: $parent.externalIdUrl() }" title="${ _('View the workflow') }"><img src="${static('oozie/art/icon_oozie_workflow_48.png')}" class="app-icon"/></a>