Ver Fonte

HUE-5127 [jb] Remove coordinator actions from the editor

Romain Rigaux há 9 anos atrás
pai
commit
4f9c93f

+ 7 - 1
apps/jobbrowser/src/jobbrowser/apis/schedule_api.py

@@ -30,6 +30,7 @@ LOG = logging.getLogger(__name__)
 
 try:
   from oozie.conf import OOZIE_JOBS_COUNT
+  from oozie.views.dashboard import massaged_coordinator_actions_for_json
 except Exception, e:
   LOG.exception('Some application are not enabled: %s' % e)
 
@@ -56,4 +57,9 @@ class ScheduleApi(Api):
     oozie_api = get_oozie(self.user)
     coordinator = oozie_api.get_coordinator(jobid=appid)
 
-    return {'id': coordinator.coordJobId, 'name': coordinator.coordJobName, 'status': coordinator.status, 'actions': coordinator.actions}
+    return {
+        'id': coordinator.coordJobId,
+        'name': coordinator.coordJobName,
+        'status': coordinator.status,
+        'actions': massaged_coordinator_actions_for_json(coordinator, None)
+    }

+ 7 - 7
apps/jobbrowser/src/jobbrowser/templates/apps.mako

@@ -123,18 +123,18 @@ ${ assist.assistPanel() }
               </h2>
             </a>
             <!-- /ko -->
-          
+
             <!-- ko if: $root.section() == 'apps' -->
             <h2>${ _('Apps') }</h2>
             ${_('Username')} <input id="userFilter" type="text" class="input-medium search-query" placeholder="${_('Search for username')}" value="${ user_filter or '' }">
             &nbsp;&nbsp;${_('Text')} <input id="textFilter" type="text" class="input-xlarge search-query" placeholder="${_('Search for id, name, status...')}" value="${ text_filter or '' }">
-          
+
             <span>
               <span><input class="btn btn-status" type="radio" name="interface" value="jobs" data-bind="checked: interface" />${ _('Jobs') }</span>
               <span><input class="btn btn-status" type="radio" name="interface" value="batches" data-bind="checked: interface" />${ _('Batches') }</span>
               <span><input class="btn btn-status" type="radio" name="interface" value="schedules" data-bind="checked: interface" />${ _('Schedules') }</span>
             </span>
-          
+
             <span class="btn-group">
               <span class="btn-group">
                 <a class="btn btn-status btn-success" data-value="completed">${ _('Succeeded') }</a>
@@ -142,7 +142,7 @@ ${ assist.assistPanel() }
                 <a class="btn btn-status btn-danger disable-feedback" data-value="failed">${ _('Failed') }</a>
               </span>
             </span>
-          
+
             <div class="card card-small">
               <table id="jobsTable" class="datatables table table-condensed">
                 <thead>
@@ -180,11 +180,11 @@ ${ assist.assistPanel() }
             <!-- ko if: $root.job().mainType() == 'jobs' && $root.interface() == 'jobs' -->
               <div data-bind="template: { name: 'job-page', data: $root.job() }"></div>
             <!-- /ko -->
-          
+
             <!-- ko if: $root.job().mainType() == 'batches' && $root.interface() == 'batches' -->
               <div data-bind="template: { name: 'batch-page', data: $root.job() }"></div>
             <!-- /ko -->
-          
+
             <!-- ko if: $root.job().mainType() == 'schedules' && $root.interface() == 'schedules' -->
               <div data-bind="template: { name: 'schedule-page', data: $root.job() }"></div>
             <!-- /ko -->
@@ -365,7 +365,7 @@ ${ assist.assistPanel() }
           if (data.status == 0) {
             vm.job(new Job(vm, data.app));
             if (self.mainType() == 'schedules') {
-              self.coordVM.setActions(data.actions);
+              vm.job().coordVM.setActions(data.app.actions);
             }
           } else {
             $(document).trigger("error", data.message);

+ 4 - 0
apps/oozie/src/oozie/templates/dashboard/list_oozie_coordinator.mako

@@ -117,6 +117,7 @@ ${ layout.menubar(section='coordinators', dashboard=True) }
                       data-url="${ url('oozie:manage_oozie_jobs', job_id=oozie_coordinator.id, action='suspend') }"
                       data-confirmation-header="${ _('Are you sure you want to suspend this job?') }"
                       data-confirmation-footer="normal"
+                      href="javascript:void(0)"
                       class="confirmationModal
                       % if not oozie_coordinator.is_running():
                       hide
@@ -126,6 +127,7 @@ ${ layout.menubar(section='coordinators', dashboard=True) }
                       data-url="${ url('oozie:manage_oozie_jobs', job_id=oozie_coordinator.id, action='resume') }"
                       data-confirmation-header="${ _('Are you sure you want to resume this job?') }"
                       data-confirmation-footer="normal"
+                      href="javascript:void(0)"
                       class="confirmationModal
                       % if oozie_coordinator.is_running():
                       hide
@@ -144,6 +146,7 @@ ${ layout.menubar(section='coordinators', dashboard=True) }
                      data-message="${ _('Successfully updated Coordinator Job Properties') }"
                      data-confirmation-header="${ _('Update Coordinator Job Properties') }"
                      data-confirmation-footer="update"
+                     href="javascript:void(0)"
                      class="btn btn-small confirmationModal
                      % if not oozie_coordinator.is_running():
                      hide
@@ -154,6 +157,7 @@ ${ layout.menubar(section='coordinators', dashboard=True) }
                   <ul class="dropdown-menu">
                     <li><a title="${ _('Sync Workflow') }" id="sync-wf-btn"
                       data-sync-url="${ url('oozie:sync_coord_workflow', job_id=oozie_coordinator.id) }"
+                      href="javascript:void(0)"
                       class="sync-wf-btn"> ${ _('Workflow') }
                     </a></li>
                   </ul>

+ 1 - 17
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -1895,23 +1895,7 @@ var EditorViewModel = (function() {
       self.save();
     });
     self.loadingScheduler = ko.observable(false);
-    self.viewSchedulerInfo = ko.observable();
-    self.viewScheduler = function() {
-      if (typeof vm.RunningCoordinatorModel !== 'undefined') {
-        logGA('schedule/view');
-        self.loadingScheduler(true);
-        $.get("/oozie/list_oozie_coordinator/" + self.viewSchedulerId(), {
-          format: 'json'
-        }, function (data) {
-          self.schedulerViewerViewModel(new vm.RunningCoordinatorModel(data.actions));
-          self.viewSchedulerInfo(ko.mapping.fromJS(data));
-        }).fail(function (xhr) {
-          $(document).trigger("error", xhr.responseText);
-        }).always(function () {
-          self.loadingScheduler(false);
-        });
-      }
-    };
+
 
     self.exportJupyterNotebook = function () {
       function addCell(type, code) {

+ 0 - 50
desktop/libs/notebook/src/notebook/templates/editor_components.mako

@@ -1073,7 +1073,6 @@ ${ hueIcons.symbols() }
       % if ENABLE_QUERY_SCHEDULING.get():
       <!-- ko if: $root.selectedNotebook() && $root.selectedNotebook().isBatchable() -->
         <li><a href="#scheduleTab" data-toggle="tab">${_('Schedule')}</a></li>
-        <li><a href="#scheduledJobsTab" data-toggle="tab">${_('Instances')}</a></li>
       <!-- /ko -->
       % endif
     </ul>
@@ -1152,55 +1151,6 @@ ${ hueIcons.symbols() }
     <!-- /ko -->
     <!-- /ko -->
 
-    <!-- ko if: $root.selectedNotebook() && $root.selectedNotebook().isBatchable() -->
-    <!-- ko with: $root.selectedNotebook() -->
-    ## To move to 'notification' panel
-    <div class="tab-pane" id="scheduledJobsTab">
-      <!-- ko if: $root.selectedNotebook().isSaved() -->
-        <a class="pointer" data-bind="click: viewScheduler">Refresh</a>
-
-        <!-- ko if: loadingScheduler -->
-        <div style="padding: 20px">
-          <i class="fa fa-spinner fa-spin muted"></i>
-        </div>
-        <!-- /ko -->
-
-        <!-- ko if: viewSchedulerInfo -->
-        <span data-bind="text: viewSchedulerInfo().data"></span>
-        <!-- /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 -->
-    </div>
-    <!-- /ko -->
-    <!-- /ko -->
-
     <!-- /ko -->
     % endif