Selaa lähdekoodia

[security] Bases of main Hive page

Romain Rigaux 11 vuotta sitten
vanhempi
commit
b2e6e24
1 muutettua tiedostoa jossa 19 lisäystä ja 1 poistoa
  1. 19 1
      apps/security/static/js/hive.ko.js

+ 19 - 1
apps/security/static/js/hive.ko.js

@@ -70,7 +70,25 @@ var Assist = function (vm) {
   var self = this;
 
   self.path = ko.observable('');
+  self.path.subscribe(function () {
+	self.fetchDatabases();
+  });
   self.files = ko.observableArray();
+  
+  self.fetchDatabases = function() {
+    var request = {
+      url: '/beeswax/api/autocomplete', // impala too
+      dataType: 'json',
+      type: 'GET',
+      success: function(data) {
+        self.files(data.databases);
+      },
+      cache: false
+    };
+    $.ajax(request).fail(function (xhr, textStatus, errorThrown) {
+      $(document).trigger("error", xhr.responseText);
+    });
+  };
 }
 
 
@@ -86,9 +104,9 @@ var HiveViewModel = function (initial) {
   // Edition
   self.role = new Role();
 
-  
   self.init = function() {
     self.list_sentry_roles_by_group();
+    self.assist.fetchDatabases();
   };
 
   self.list_sentry_roles_by_group = function() {