소스 검색

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

Johan Ahlen 7 년 전
부모
커밋
4253f9aa71
1개의 변경된 파일3개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 2
      desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

+ 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();