浏览代码

HUE-6444 [assist] Update the documents panel on any document modifications

Johan Ahlen 8 年之前
父节点
当前提交
55686bb9b9

+ 2 - 1
apps/oozie/src/oozie/static/oozie/js/workflow-editor.ko.js

@@ -1172,7 +1172,7 @@ var WorkflowEditorViewModel = function (layout_json, workflow_json, credentials_
       widget.name(_newName);
       $(document).trigger("drawArrows");
     }
-  }
+  };
 
   self.save = function () {
     if (! self.isSaving()) {
@@ -1195,6 +1195,7 @@ var WorkflowEditorViewModel = function (layout_json, workflow_json, credentials_
             window.location.hash = '#workflow=' + data.id;
           }
           self.workflow.tracker().markCurrentStateAsClean();
+          huePubSub.publish('assist.document.refresh');
         }
         else {
           $(document).trigger("error", data.message);

+ 16 - 4
desktop/core/src/desktop/static/desktop/js/document/hueFileEntry.js

@@ -100,7 +100,7 @@ var HueFileEntry = (function () {
         'uuids': uuids,
         'data': 'false',
         'dependencies': 'true'
-      }
+      };
 
       $.get('/desktop/api2/doc/', data, function (response) {
         var docsWithDependents = [];
@@ -113,7 +113,7 @@ var HueFileEntry = (function () {
       }).fail(function (response) {
         $(document).trigger("error", "Error getting document data: " + response.responseText);
       });
-    }
+    };
 
     self.isTrash = ko.pureComputed(function () {
       return self.definition().name === '.Trash';
@@ -177,6 +177,7 @@ var HueFileEntry = (function () {
     self.uploadComplete = ko.observable(false);
     self.uploadFailed = ko.observable(false);
     self.selectedImportFile = ko.observable('');
+
     self.importEnabled = ko.pureComputed(function () {
       return self.selectedImportFile() !== '';
     });
@@ -334,6 +335,7 @@ var HueFileEntry = (function () {
             destinationId: self.definition().uuid
           });
         } else {
+          huePubSub.publish('assist.document.refresh');
           if (self !== self.activeEntry()) {
             self.load();
           }
@@ -525,6 +527,7 @@ var HueFileEntry = (function () {
     if (self.selectedEntries().length > 0 && (self.superuser || !self.sharedWithMeSelected())) {
       self.entriesToDelete(self.selectedEntries());
       self.removeDocuments(false);
+      huePubSub.publish('assist.document.refresh');
     }
   };
 
@@ -574,6 +577,7 @@ var HueFileEntry = (function () {
             }
           });
         } else {
+          huePubSub.publish('assist.document.refresh');
           self.activeEntry().load();
         }
       };
@@ -611,6 +615,7 @@ var HueFileEntry = (function () {
         successCallback: function (data) {
           self.uploading(false);
           self.uploadComplete(true);
+          huePubSub.publish('assist.document.refresh');
           self.load();
 
           $('#importDocumentsModal').modal('hide');
@@ -697,6 +702,7 @@ var HueFileEntry = (function () {
         self.apiHelper.restoreDocument({
           uuids: uuids,
           successCallback: function () {
+            huePubSub.publish('assist.document.refresh');
             self.activeEntry().load();
           },
           errorCallback: function () {
@@ -714,7 +720,10 @@ var HueFileEntry = (function () {
     var self = this;
     if (name && self.app === 'documents') {
       self.apiHelper.createDocumentsFolder({
-        successCallback: self.load.bind(self),
+        successCallback: function () {
+          huePubSub.publish('assist.document.refresh');
+          self.load()
+        },
         parentUuid: self.definition().uuid,
         name: name
       });
@@ -726,7 +735,10 @@ var HueFileEntry = (function () {
     var self = this;
     if (name && self.app === 'documents') {
       self.apiHelper.updateDocument({
-        successCallback: self.load.bind(self),
+        successCallback: function () {
+          huePubSub.publish('assist.document.refresh');
+          self.load();
+        },
         uuid: self.definition().uuid,
         name: name
       });

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

@@ -2246,7 +2246,7 @@ var SearchViewModel = function (collection_json, query_json, initial_json) {
       });
 
       return _analyse;
-    }
+    };
 
     self.save = function () {
       $.post("/dashboard/save", {
@@ -2259,6 +2259,7 @@ var SearchViewModel = function (collection_json, query_json, initial_json) {
           if (window.location.search.indexOf("collection") == -1) {
             hueUtils.changeURL((IS_HUE_4 ? '/hue' : '') + '/dashboard/?collection=' + data.id);
           }
+          huePubSub.publish('assist.document.refresh');
         }
         else {
           $(document).trigger("error", data.message);
@@ -2267,7 +2268,7 @@ var SearchViewModel = function (collection_json, query_json, initial_json) {
         $(document).trigger("error", xhr.responseText);
       });
     };
-  }
+  };
 
   self.reset = function() {
     self.intervalOptions(ko.bindingHandlers.daterangepicker.INTERVAL_OPTIONS);

+ 5 - 8
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -2053,8 +2053,7 @@ var EditorViewModel = (function() {
                 existingQuery[0].description(data.description);
                 existingQuery[0].last_modified(data.last_modified);
               }
-            }
-            else {
+            } else {
               self.snippets()[0].queries.unshift(ko.mapping.fromJS(data));
             }
 
@@ -2065,19 +2064,17 @@ var EditorViewModel = (function() {
 
             if (vm.isHue4()){
               vm.changeURL(vm.URLS.hue4 + '?editor=' + data.id);
-            }
-            else {
+            } else {
               vm.changeURL('/notebook/editor' + (vm.isMobile() ? '_m' : '') + '?editor=' + data.id);
             }
-          }
-          else {
+          } else {
             if (vm.isHue4()){
               vm.changeURL(vm.URLS.hue4_notebook + '?notebook=' + data.id);
-            }
-            else {
+            } else {
               vm.changeURL('/notebook/notebook?notebook=' + data.id);
             }
           }
+          huePubSub.publish('assist.document.refresh');
         }
         else {
           $(document).trigger("error", data.message);