Просмотр исходного кода

HUE-1176 [jb] Reload a page with a workflow id and keep the breadcrumbs

Romain Rigaux 8 лет назад
Родитель
Сommit
cb8a94a

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

@@ -88,7 +88,7 @@ class WorkflowApi(Api):
         'status': workflow.status,
         'apiStatus': self._api_status(workflow.status),
         'progress': workflow.get_progress(),
-        'type': 'workflow'
+        'type': 'workflow',
     }
 
     request = MockDjangoRequest(self.user)
@@ -96,6 +96,8 @@ class WorkflowApi(Api):
     common['properties'] = json.loads(response.content)
     common['properties']['xml'] = ''
     common['properties']['properties'] = ''
+    common['properties']['coordinator_id'] = workflow.get_parent_job_id()
+    common['properties']['bundle_id'] = workflow.conf_dict.get('oozie.bundle.id')
 
     return common
 
@@ -160,6 +162,10 @@ class WorkflowActionApi(Api):
     common['action_type'] = common['type']
     common['type'] = 'workflow-action'
 
+    common['properties'] = {
+      'workflow_id': appid.split('@', 1)[0]
+    }
+
     return common
 
 

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

@@ -1059,7 +1059,13 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
         var interface = vm.interface();
         if (/oozie-oozi-W/.test(self.id())) {
           interface = 'workflows';
-        };
+        }
+        else if (/oozie-oozi-C/.test(self.id())) {
+          interface = 'schedules';
+        } 
+        else if (/oozie-oozi-B/.test(self.id())) {
+          interface = 'bundles';
+        }
 
         $.post("/jobbrowser/api/job", {
           app_id: ko.mapping.toJSON(self.id),
@@ -1079,6 +1085,19 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
             if (/^task_/.test(vm.job().id())) {
               crumbs.push({'id': vm.job().properties['app_id'], 'name': vm.job().properties['app_id'], 'type': 'app'});
             }
+
+            if (/-oozie-oozi-W@/.test(vm.job().id())) {
+              crumbs.push({'id': vm.job().properties['workflow_id'], 'name': vm.job().properties['workflow_id'], 'type': 'workflow'});
+            }
+            else if (/-oozie-oozi-W/.test(vm.job().id())) {
+              if (vm.job().properties['bundle_id']()) {
+                crumbs.push({'id': vm.job().properties['bundle_id'](), 'name': vm.job().properties['bundle_id'](), 'type': 'bundle'});
+              }
+              if (vm.job().properties['coordinator_id']()) {
+                crumbs.push({'id': vm.job().properties['coordinator_id'](), 'name': vm.job().properties['coordinator_id'](), 'type': 'schedule'});
+              }
+            }
+
             crumbs.push({'id': vm.job().id(), 'name': vm.job().name(), 'type': vm.job().type()});
             vm.resetBreadcrumbs(crumbs);