Explorar el Código

HUE-8654 [editor] Prevent setting empty object for namespace and compute

Johan Ahlen hace 7 años
padre
commit
4253f9a

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

@@ -384,8 +384,9 @@ var EditorViewModel = (function() {
       return ApiHelper.getInstance(vm);
     };
 
-    self.namespace = ko.observable(snippet.namespace);
-    self.compute = ko.observable(snippet.compute);
+    // namespace and compute might be initialized as empty object {}
+    self.namespace = ko.observable(snippet.namespace && snippet.namespace.id ? snippet.namespace : undefined);
+    self.compute = ko.observable(snippet.compute && snippet.compute.id ? snippet.compute : undefined);
 
     self.availableDatabases = ko.observableArray();
     self.database = ko.observable();