Browse Source

HUE-4160 [editor] Do not create multiple coordinator for a new saved query

If we save a new query, and open another query, and come back,
the coordinator id is not persisted as we did not click on save.
Here we fetch it dynamically from the list of dependencies.
Romain Rigaux 9 years ago
parent
commit
1e325e2

+ 3 - 0
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -1136,6 +1136,9 @@
     self.dependentsCoordinator = ko.computed(function() {
       return $.grep(self.dependents(), function(doc) { return doc.type() == 'oozie-coordinator2' && doc.is_managed() == true ;})
     });
+    if (self.dependentsCoordinator().length > 0 && ! self.coordinatorUuid()) {
+      self.coordinatorUuid(self.dependentsCoordinator()[0]);
+    }
     self.history = ko.observableArray(vm.selectedNotebook() ? vm.selectedNotebook().history() : []);
     self.historyFilter = ko.observable('');
     self.historyFilterVisible = ko.observable(false);