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

[fb] Enable the Oozie app to be blacklisted without breaking

https://github.com/cloudera/hue/issues/214
Romain Rigaux 10 жил өмнө
parent
commit
83da765

+ 8 - 4
apps/filebrowser/src/filebrowser/templates/listdir_components.mako

@@ -1207,10 +1207,14 @@ from django.utils.translation import ugettext as _
       };
 
       self.submitSelected = function() {
-        $.get("${ url('oozie:submit_external_job', application_path='/') }../" + self.selectedFile().path, function (response) {
-          $('#submit-wf-modal').html(response);
-          $('#submit-wf-modal').modal('show');
-        });
+        % if 'oozie' in apps:
+          $.get("${ url('oozie:submit_external_job', application_path='/') }../" + self.selectedFile().path, function (response) {
+            $('#submit-wf-modal').html(response);
+            $('#submit-wf-modal').modal('show');
+          });
+        % else:
+          $.jHueNotify.warn("${ _('Submitting is not available as the Oozie app is disabled') }");
+        % endif
       };
 
       self.createDirectory = function (formElement) {

+ 3 - 1
apps/filebrowser/src/filebrowser/views.py

@@ -47,6 +47,7 @@ from cStringIO import StringIO
 from gzip import GzipFile
 from avro import datafile, io
 
+from desktop import appmanager
 from desktop.lib import i18n, paginator
 from desktop.lib.conf import coerce_bool
 from desktop.lib.django_util import make_absolute, render, render_json, format_preserving_redirect
@@ -445,7 +446,8 @@ def listdir_paged(request, path):
         'users': is_fs_superuser and [str(x) for x in User.objects.values_list('username', flat=True)] or [],
         'superuser': request.fs.superuser,
         'supergroup': request.fs.supergroup,
-        'is_sentry_managed': request.fs.is_sentry_managed(path)
+        'is_sentry_managed': request.fs.is_sentry_managed(path),
+        'apps': appmanager.get_apps_dict(request.user).keys()
     }
     return render('listdir.mako', request, data)