|
|
@@ -49,75 +49,91 @@ ${ dashboard.import_layout() }
|
|
|
|
|
|
${ utils.slaGlobal() }
|
|
|
|
|
|
- % if layout_json != '':
|
|
|
- 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.cleanNode($("#${graph_element_id}")[0]);
|
|
|
- ko.applyBindings(viewModel, $("#${graph_element_id}")[0]);
|
|
|
- viewModel.isViewer = ko.observable(true);
|
|
|
- viewModel.isEmbeddable = ko.observable(true);
|
|
|
- viewModel.init();
|
|
|
- fullLayout(viewModel);
|
|
|
-
|
|
|
- var globalFilechooserOptions = {
|
|
|
- skipInitialPathIfEmpty: true,
|
|
|
- showExtraHome: true,
|
|
|
- uploadFile: true,
|
|
|
- createFolder: true,
|
|
|
- extraHomeProperties: {
|
|
|
- label: '${ _('Workspace') }',
|
|
|
- icon: 'fa-folder-open',
|
|
|
- path: viewModel.workflow.properties.deployment_dir()
|
|
|
- },
|
|
|
- deploymentDir: viewModel.workflow.properties.deployment_dir()
|
|
|
- }
|
|
|
-
|
|
|
- function refreshView() {
|
|
|
- $.getJSON("${ oozie_workflow.get_absolute_url(format='json') }", function (data) {
|
|
|
-
|
|
|
- if (data.actions){
|
|
|
- % if layout_json != '':
|
|
|
- ko.utils.arrayForEach(data.actions, function(action) {
|
|
|
- var _w, actionId = action.id.substr(action.id.length - 4);
|
|
|
- if (actionId === '@End'){
|
|
|
- _w = viewModel.getWidgetById('33430f0f-ebfa-c3ec-f237-3e77efa03d0a');
|
|
|
- }
|
|
|
- else {
|
|
|
- _w = viewModel.getWidgetById($("[id^=wdg_" + actionId.toLowerCase() + "]").attr("id").substr(4));
|
|
|
- }
|
|
|
- if (_w != null) {
|
|
|
- if (['SUCCEEDED', 'OK', 'DONE'].indexOf(action.status) > -1) {
|
|
|
- _w.status("success");
|
|
|
- _w.progress(100);
|
|
|
- }
|
|
|
- else if (['RUNNING', 'READY', 'PREP', 'WAITING', 'SUSPENDED', 'PREPSUSPENDED', 'PREPPAUSED', 'PAUSED', 'SUBMITTED', 'SUSPENDEDWITHERROR', 'PAUSEDWITHERROR'].indexOf(action.status) > -1) {
|
|
|
- _w.status("running");
|
|
|
- _w.progress(50);
|
|
|
- }
|
|
|
- else {
|
|
|
- _w.status("failed");
|
|
|
- _w.progress(100);
|
|
|
- }
|
|
|
- _w.actionURL(action.url);
|
|
|
- _w.logsURL(action.log);
|
|
|
- _w.externalIdUrl(action.externalIdUrl);
|
|
|
- _w.externalId(action.id);
|
|
|
- }
|
|
|
- });
|
|
|
- %endif
|
|
|
- }
|
|
|
- if (data.status != "RUNNING" && data.status != "PREP"){
|
|
|
- return;
|
|
|
- }
|
|
|
- window.setTimeout(refreshView, 1000);
|
|
|
- });
|
|
|
- }
|
|
|
+ var globalFilechooserOptions;
|
|
|
|
|
|
- %endif
|
|
|
+ (function () {
|
|
|
|
|
|
- $(document).ready(function() {
|
|
|
% if layout_json != '':
|
|
|
- drawArrows();
|
|
|
- refreshView();
|
|
|
+ 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.cleanNode($("#${graph_element_id}")[0]);
|
|
|
+ ko.applyBindings(viewModel, $("#${graph_element_id}")[0]);
|
|
|
+ viewModel.isViewer = ko.observable(true);
|
|
|
+ viewModel.isEmbeddable = ko.observable(true);
|
|
|
+ viewModel.init();
|
|
|
+ fullLayout(viewModel);
|
|
|
+
|
|
|
+ globalFilechooserOptions = {
|
|
|
+ skipInitialPathIfEmpty: true,
|
|
|
+ showExtraHome: true,
|
|
|
+ uploadFile: true,
|
|
|
+ createFolder: true,
|
|
|
+ extraHomeProperties: {
|
|
|
+ label: '${ _('Workspace') }',
|
|
|
+ icon: 'fa-folder-open',
|
|
|
+ path: viewModel.workflow.properties.deployment_dir()
|
|
|
+ },
|
|
|
+ deploymentDir: viewModel.workflow.properties.deployment_dir()
|
|
|
+ }
|
|
|
+
|
|
|
+ var refreshViewTimeout = -1;
|
|
|
+
|
|
|
+ function refreshView() {
|
|
|
+ $.getJSON("${ oozie_workflow.get_absolute_url(format='json') }", function (data) {
|
|
|
+
|
|
|
+ if (data.actions) {
|
|
|
+ % if layout_json != '':
|
|
|
+ ko.utils.arrayForEach(data.actions, function (action) {
|
|
|
+ var _w, actionId = action.id.substr(action.id.length - 4);
|
|
|
+ if (actionId === '@End') {
|
|
|
+ _w = viewModel.getWidgetById('33430f0f-ebfa-c3ec-f237-3e77efa03d0a');
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ if ($("[id^=wdg_" + actionId.toLowerCase() + "]").length > 0) {
|
|
|
+ _w = viewModel.getWidgetById($("[id^=wdg_" + actionId.toLowerCase() + "]").attr("id").substr(4));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ _w = viewModel.getWidgetById('33430f0f-ebfa-c3ec-f237-3e77efa03d0a');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (_w != null) {
|
|
|
+ if (['SUCCEEDED', 'OK', 'DONE'].indexOf(action.status) > -1) {
|
|
|
+ _w.status("success");
|
|
|
+ _w.progress(100);
|
|
|
+ }
|
|
|
+ else if (['RUNNING', 'READY', 'PREP', 'WAITING', 'SUSPENDED', 'PREPSUSPENDED', 'PREPPAUSED', 'PAUSED', 'SUBMITTED', 'SUSPENDEDWITHERROR', 'PAUSEDWITHERROR'].indexOf(action.status) > -1) {
|
|
|
+ _w.status("running");
|
|
|
+ _w.progress(50);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ _w.status("failed");
|
|
|
+ _w.progress(100);
|
|
|
+ }
|
|
|
+ _w.actionURL(action.url);
|
|
|
+ _w.logsURL(action.log);
|
|
|
+ _w.externalIdUrl(action.externalIdUrl);
|
|
|
+ _w.externalId(action.id);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ %endif
|
|
|
+ }
|
|
|
+ if (data.status != "RUNNING" && data.status != "PREP") {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ refreshViewTimeout = window.setTimeout(refreshView, 1000);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ huePubSub.subscribe('stop.refresh.view', function(){
|
|
|
+ window.clearTimeout(refreshViewTimeout);
|
|
|
+ });
|
|
|
+
|
|
|
%endif
|
|
|
- });
|
|
|
+
|
|
|
+ $(document).ready(function () {
|
|
|
+ % if layout_json != '':
|
|
|
+ viewModel.drawArrows();
|
|
|
+ refreshView();
|
|
|
+ %endif
|
|
|
+ });
|
|
|
+ })();
|
|
|
</script>
|