Browse Source

HUE-8394 [frontend] Add a debug function to clear the cached data catalog entries

In the console run hueDebug.clearCaches()
Johan Ahlen 7 years ago
parent
commit
f52e1ed50f
1 changed files with 20 additions and 0 deletions
  1. 20 0
      desktop/core/src/desktop/static/desktop/js/hue.utils.js

+ 20 - 0
desktop/core/src/desktop/static/desktop/js/hue.utils.js

@@ -701,6 +701,26 @@ var hueDrop = (function () {
   };
 })();
 
+if (!window.hueDebug) {
+  window.hueDebug = {};
+}
+
+window.hueDebug.clearCaches = function () {
+  var promises = [];
+  var clearInstance = function(prefix) {
+    promises.push(localforage.createInstance({ name: prefix + LOGGED_USERNAME }).clear());
+  };
+  clearInstance('HueContextCatalog_');
+  clearInstance('HueDataCatalog_');
+  clearInstance('HueDataCatalog_hive_');
+  clearInstance('HueDataCatalog_hive_multiTable_');
+  clearInstance('HueDataCatalog_impala_');
+  clearInstance('HueDataCatalog_impala_multiTable_');
+  Promise.all(promises).then(function () {
+    console.log('Done! Refresh the browser.');
+  })
+};
+
 var hueDebugTimer = (function () {
   var initialTime = null;
   var times = [];