瀏覽代碼

HUE-7018 [jb] disable_killing_jobs option is not supported in the new job browser

Ying Chen 8 年之前
父節點
當前提交
c45dcde
共有 2 個文件被更改,包括 5 次插入1 次删除
  1. 2 0
      apps/jobbrowser/src/jobbrowser/api2.py
  2. 3 1
      apps/jobbrowser/src/jobbrowser/templates/job_browser.mako

+ 2 - 0
apps/jobbrowser/src/jobbrowser/api2.py

@@ -23,6 +23,7 @@ from desktop.lib.i18n import smart_unicode
 from desktop.lib.django_util import JsonResponse
 
 from jobbrowser.apis.base_api import get_api
+from jobbrowser.conf import DISABLE_KILLING_JOBS
 
 
 LOG = logging.getLogger(__name__)
@@ -54,6 +55,7 @@ def jobs(request):
 
   jobs = get_api(request.user, interface).apps(filters)
 
+  response['disable_killing_jobs'] = DISABLE_KILLING_JOBS.get();
   response['apps'] = jobs['apps']
   response['total'] = jobs.get('total')
   response['status'] = 0

+ 3 - 1
apps/jobbrowser/src/jobbrowser/templates/job_browser.mako

@@ -944,7 +944,7 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
     <!-- /ko -->
 
     <!-- ko if: hasKill -->
-    <button class="btn btn-danger disable-feedback" title="${_('Stop selected')}" data-bind="click: function() { control('kill'); }, enable: killEnabled">
+    <button class="btn btn-danger disable-feedback" title="${_('Stop selected')}" data-bind="visible: ! disableKillingJobs(), click: function() { control('kill'); }, enable: killEnabled">
       ## TODO confirmation
       <i class="fa fa-times"></i> <!-- ko ifnot: $root.isMini -->${_('Kill')}<!-- /ko -->
     </button>
@@ -1991,6 +1991,7 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
 
       self.apps = ko.observableArray().extend({ rateLimit: 50 });
       self.totalApps = ko.observable(null);
+      self.disableKillingJobs = ko.observable(true);
       self.isCoordinator = ko.observable(false);
 
       self.loadingJobs = ko.observable(false);
@@ -2149,6 +2150,7 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
           }
           self.apps(apps);
           self.totalApps(data.total);
+          self.disableKillingJobs(data.disable_killing_jobs);
         }).always(function () {
           self.loadingJobs(false);
         });