Просмотр исходного кода

[frontend] Replace global totalStorage with native localStorage implementation

This takes care of an issue related to web components where global JQuery plugins aren't detected and included during packaging.

$.totalStorage has also become redundant as our target browsers support native localStorage now.
Johan Ahlen 5 лет назад
Родитель
Сommit
2bb10a2901
83 измененных файлов с 441 добавлено и 445 удалено
  1. 28 28
      apps/beeswax/src/beeswax/static/beeswax/js/autocomplete.utils.js
  2. 1 1
      apps/beeswax/src/beeswax/templates/create_database.mako
  3. 1 1
      apps/beeswax/src/beeswax/templates/create_table_manually.mako
  4. 7 7
      apps/beeswax/src/beeswax/templates/execute.mako
  5. 1 1
      apps/beeswax/src/beeswax/templates/import_wizard_choose_delimiter.mako
  6. 1 1
      apps/beeswax/src/beeswax/templates/import_wizard_choose_file.mako
  7. 1 1
      apps/beeswax/src/beeswax/templates/import_wizard_define_columns.mako
  8. 2 2
      apps/filebrowser/src/filebrowser/templates/listdir_components.mako
  9. 5 5
      apps/hbase/src/hbase/templates/app.mako
  10. 1 1
      apps/jobbrowser/src/jobbrowser/templates/job_browser.mako
  11. 1 1
      apps/oozie/src/oozie/templates/dashboard/list_oozie_bundle.mako
  12. 1 1
      apps/oozie/src/oozie/templates/dashboard/list_oozie_coordinator.mako
  13. 1 1
      apps/oozie/src/oozie/templates/dashboard/list_oozie_workflow.mako
  14. 1 1
      apps/oozie/src/oozie/templates/dashboard/list_oozie_workflow_action.mako
  15. 2 2
      apps/oozie/src/oozie/templates/editor2/workflow_editor.mako
  16. 3 3
      apps/pig/src/pig/templates/app.mako
  17. 18 18
      apps/rdbms/src/rdbms/static/rdbms/js/autocomplete.utils.js
  18. 3 3
      apps/rdbms/src/rdbms/static/rdbms/js/rdbms.vm.js
  19. 5 5
      apps/rdbms/src/rdbms/templates/execute.mako
  20. 3 3
      apps/sqoop/src/sqoop/static/sqoop/js/sqoop.autocomplete.js
  21. 30 35
      desktop/core/src/desktop/js/api/apiHelper.js
  22. 4 4
      desktop/core/src/desktop/js/apps/notebook/editorViewModel.js
  23. 1 1
      desktop/core/src/desktop/js/apps/notebook/notebook.js
  24. 8 8
      desktop/core/src/desktop/js/apps/notebook/snippet.js
  25. 11 11
      desktop/core/src/desktop/js/apps/notebook2/components/aceEditor/AceEditor.vue
  26. 1 1
      desktop/core/src/desktop/js/apps/notebook2/components/aceEditor/AceLocationHandler.ts
  27. 4 4
      desktop/core/src/desktop/js/apps/notebook2/editorViewModel.js
  28. 7 7
      desktop/core/src/desktop/js/apps/notebook2/snippet.js
  29. 1 1
      desktop/core/src/desktop/js/apps/tableBrowser/metastoreDatabase.js
  30. 2 2
      desktop/core/src/desktop/js/apps/tableBrowser/metastoreNamespace.js
  31. 1 1
      desktop/core/src/desktop/js/apps/tableBrowser/metastoreSource.js
  32. 3 3
      desktop/core/src/desktop/js/apps/tableBrowser/metastoreViewModel.js
  33. 2 2
      desktop/core/src/desktop/js/components/SqlText.vue
  34. 0 28
      desktop/core/src/desktop/js/ext/jquery.total-storage.1.1.3.min.js
  35. 0 1
      desktop/core/src/desktop/js/jest/jquery.setup.js
  36. 0 1
      desktop/core/src/desktop/js/jquery/jquery.common.js
  37. 119 109
      desktop/core/src/desktop/js/jquery/plugins/jquery.filechooser.js
  38. 8 13
      desktop/core/src/desktop/js/jquery/plugins/jquery.hdfs.autocomplete.js
  39. 6 6
      desktop/core/src/desktop/js/jquery/plugins/jquery.hiveautocomplete.js
  40. 1 1
      desktop/core/src/desktop/js/ko/bindings/ace/aceLocationHandler.js
  41. 12 12
      desktop/core/src/desktop/js/ko/bindings/ace/ko.aceEditor.js
  42. 4 3
      desktop/core/src/desktop/js/ko/bindings/ace/ko.aceResizer.js
  43. 2 2
      desktop/core/src/desktop/js/ko/bindings/ko.assistVerticalResizer.js
  44. 2 1
      desktop/core/src/desktop/js/ko/bindings/ko.highlight.js
  45. 3 2
      desktop/core/src/desktop/js/ko/bindings/ko.logResizer.js
  46. 2 1
      desktop/core/src/desktop/js/ko/bindings/ko.readOnlyAce.js
  47. 7 6
      desktop/core/src/desktop/js/ko/bindings/ko.splitDraggable.js
  48. 4 3
      desktop/core/src/desktop/js/ko/bindings/ko.splitFlexDraggable.js
  49. 3 3
      desktop/core/src/desktop/js/ko/components/assist/assistDbNamespace.js
  50. 2 2
      desktop/core/src/desktop/js/ko/components/assist/assistDbSource.js
  51. 1 1
      desktop/core/src/desktop/js/ko/components/assist/assistInnerPanel.js
  52. 4 4
      desktop/core/src/desktop/js/ko/components/assist/ko.assistDbPanel.js
  53. 4 4
      desktop/core/src/desktop/js/ko/components/assist/ko.assistDocumentsPanel.js
  54. 2 2
      desktop/core/src/desktop/js/ko/components/assist/ko.assistFunctionsPanel.js
  55. 2 2
      desktop/core/src/desktop/js/ko/components/assist/ko.assistGitPanel.js
  56. 2 2
      desktop/core/src/desktop/js/ko/components/assist/ko.assistHBasePanel.js
  57. 1 1
      desktop/core/src/desktop/js/ko/components/assist/ko.assistPanel.js
  58. 5 5
      desktop/core/src/desktop/js/ko/components/assist/ko.assistStoragePanel.js
  59. 2 2
      desktop/core/src/desktop/js/ko/components/assist/ko.rightAssistPanel.js
  60. 1 1
      desktop/core/src/desktop/js/ko/components/contextPopover/ko.contextPopover.js
  61. 1 1
      desktop/core/src/desktop/js/ko/components/contextPopover/resizeHelper.js
  62. 12 12
      desktop/core/src/desktop/js/ko/components/ko.contextSelector.js
  63. 7 7
      desktop/core/src/desktop/js/ko/components/ko.performanceGraph.js
  64. 1 1
      desktop/core/src/desktop/js/ko/components/ko.sidebar.js
  65. 3 3
      desktop/core/src/desktop/js/ko/components/simpleAceEditor/ko.simpleAceEditor.js
  66. 4 4
      desktop/core/src/desktop/js/sidePanelViewModel.js
  67. 1 1
      desktop/core/src/desktop/js/topNavViewModel.js
  68. 1 1
      desktop/core/src/desktop/js/utils/hdfsAutocompleter.js
  69. 2 3
      desktop/core/src/desktop/js/utils/hdfsAutocompleter.test.js
  70. 22 0
      desktop/core/src/desktop/js/utils/hueUtils.ts
  71. 1 1
      desktop/core/src/desktop/static/desktop/js/home2.vm.js
  72. 5 5
      desktop/core/src/desktop/static/desktop/js/jquery.hiveautocomplete.js
  73. 1 1
      desktop/core/src/desktop/templates/assist_m.mako
  74. 1 1
      desktop/core/src/desktop/templates/common_header_m.mako
  75. 3 3
      desktop/core/src/desktop/templates/home.mako
  76. 2 2
      desktop/core/src/desktop/templates/sql_syntax_dropdown.mako
  77. 1 1
      desktop/libs/dashboard/src/dashboard/static/dashboard/js/search.ko.js
  78. 1 1
      desktop/libs/dashboard/src/dashboard/templates/common_search.mako
  79. 5 5
      desktop/libs/indexer/src/indexer/templates/importer.mako
  80. 1 1
      desktop/libs/indexer/src/indexer/templates/indexer.mako
  81. 1 1
      desktop/libs/indexer/src/indexer/templates/indexes.mako
  82. 5 5
      desktop/libs/indexer/src/indexer/templates/topics.mako
  83. 0 1
      ext/thirdparty/README.md

+ 28 - 28
apps/beeswax/src/beeswax/static/beeswax/js/autocomplete.utils.js

@@ -59,7 +59,7 @@ function hac_getTableAliases(textScanned) {
   return _aliases;
 }
 
-function hac_getTotalStorageUserPrefix() {
+function hac_getLocalStorageUserPrefix() {
   var _app = "";
   if (typeof HIVE_AUTOCOMPLETE_APP != "undefined") {
     _app = HIVE_AUTOCOMPLETE_APP;
@@ -80,9 +80,9 @@ function hac_getTableColumns(databaseName, tableName, textScanned, callback) {
     tableName = _aliases[tableName];
   }
 
-  if ($.totalStorage(hac_getTotalStorageUserPrefix() + 'columns_' + databaseName + '_' + tableName) != null && $.totalStorage(hac_getTotalStorageUserPrefix() + 'extended_columns_' + databaseName + '_' + tableName) != null) {
-    callback($.totalStorage(hac_getTotalStorageUserPrefix() + 'columns_' + databaseName + '_' + tableName), $.totalStorage(hac_getTotalStorageUserPrefix() + 'extended_columns_' + databaseName + '_' + tableName));
-    if ($.totalStorage(hac_getTotalStorageUserPrefix() + 'timestamp_columns_' + databaseName + '_' + tableName) == null || hac_hasExpired($.totalStorage(hac_getTotalStorageUserPrefix() + 'timestamp_columns_' + databaseName + '_' + tableName))){
+  if (hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'columns_' + databaseName + '_' + tableName) != null && hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'extended_columns_' + databaseName + '_' + tableName) != null) {
+    callback(hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'columns_' + databaseName + '_' + tableName), hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'extended_columns_' + databaseName + '_' + tableName));
+    if (hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'timestamp_columns_' + databaseName + '_' + tableName) == null || hac_hasExpired(hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'timestamp_columns_' + databaseName + '_' + tableName))){
       hac_jsoncalls({
         database: databaseName,
         table: tableName,
@@ -94,9 +94,9 @@ function hac_getTableColumns(databaseName, tableName, textScanned, callback) {
             hac_errorHandler(data);
           }
           else {
-            $.totalStorage(hac_getTotalStorageUserPrefix() + 'columns_' + databaseName + '_' + tableName, (data.columns ? "* " + data.columns.join(" ") : "*"));
-            $.totalStorage(hac_getTotalStorageUserPrefix() + 'extended_columns_' + databaseName + '_' + tableName, (data.extended_columns ? data.extended_columns : []));
-            $.totalStorage(hac_getTotalStorageUserPrefix() + 'timestamp_columns_' + databaseName + '_' + tableName, (new Date()).getTime());
+            hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'columns_' + databaseName + '_' + tableName, (data.columns ? "* " + data.columns.join(" ") : "*"));
+            hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'extended_columns_' + databaseName + '_' + tableName, (data.extended_columns ? data.extended_columns : []));
+            hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'timestamp_columns_' + databaseName + '_' + tableName, (new Date()).getTime());
           }
         }
       });
@@ -114,10 +114,10 @@ function hac_getTableColumns(databaseName, tableName, textScanned, callback) {
           hac_errorHandler(data);
         }
         else {
-          $.totalStorage(hac_getTotalStorageUserPrefix() + 'columns_' + databaseName + '_' + tableName, (data.columns ? "* " + data.columns.join(" ") : "*"));
-          $.totalStorage(hac_getTotalStorageUserPrefix() + 'extended_columns_' + databaseName + '_' + tableName, (data.extended_columns ? data.extended_columns : []));
-          $.totalStorage(hac_getTotalStorageUserPrefix() + 'timestamp_columns_' + databaseName + '_' + tableName, (new Date()).getTime());
-          callback($.totalStorage(hac_getTotalStorageUserPrefix() + 'columns_' + databaseName + '_' + tableName), $.totalStorage(hac_getTotalStorageUserPrefix() + 'extended_columns_' + databaseName + '_' + tableName));
+          hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'columns_' + databaseName + '_' + tableName, (data.columns ? "* " + data.columns.join(" ") : "*"));
+          hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'extended_columns_' + databaseName + '_' + tableName, (data.extended_columns ? data.extended_columns : []));
+          hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'timestamp_columns_' + databaseName + '_' + tableName, (new Date()).getTime());
+          callback(hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'columns_' + databaseName + '_' + tableName), hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'extended_columns_' + databaseName + '_' + tableName));
         }
       }
     });
@@ -135,9 +135,9 @@ function hac_tableHasAlias(tableName, textScanned) {
 }
 
 function hac_getTables(databaseName, callback) {
-  if ($.totalStorage(hac_getTotalStorageUserPrefix() + 'tables_' + databaseName) != null) {
-    callback($.totalStorage(hac_getTotalStorageUserPrefix() + 'tables_' + databaseName));
-    if ($.totalStorage(hac_getTotalStorageUserPrefix() + 'timestamp_tables_' + databaseName) == null || hac_hasExpired($.totalStorage(hac_getTotalStorageUserPrefix() + 'timestamp_tables_' + databaseName))){
+  if (hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'tables_' + databaseName) != null) {
+    callback(hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'tables_' + databaseName));
+    if (hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'timestamp_tables_' + databaseName) == null || hac_hasExpired(hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'timestamp_tables_' + databaseName))){
       hac_jsoncalls({
         database: databaseName,
         onDataReceived: function (data) {
@@ -148,8 +148,8 @@ function hac_getTables(databaseName, callback) {
             hac_errorHandler(data);
           }
           else {
-            $.totalStorage(hac_getTotalStorageUserPrefix() + 'tables_' + databaseName, data.tables.join(" "));
-            $.totalStorage(hac_getTotalStorageUserPrefix() + 'timestamp_tables_' + databaseName, (new Date()).getTime());
+            hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'tables_' + databaseName, data.tables.join(" "));
+            hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'timestamp_tables_' + databaseName, (new Date()).getTime());
           }
         }
       });
@@ -167,9 +167,9 @@ function hac_getTables(databaseName, callback) {
         }
         else {
           if (data.tables) {
-            $.totalStorage(hac_getTotalStorageUserPrefix() + 'tables_' + databaseName, data.tables.join(" "));
-            $.totalStorage(hac_getTotalStorageUserPrefix() + 'timestamp_tables_' + databaseName, (new Date()).getTime());
-            callback($.totalStorage(hac_getTotalStorageUserPrefix() + 'tables_' + databaseName));
+            hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'tables_' + databaseName, data.tables.join(" "));
+            hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'timestamp_tables_' + databaseName, (new Date()).getTime());
+            callback(hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'tables_' + databaseName));
           }
         }
       }
@@ -178,9 +178,9 @@ function hac_getTables(databaseName, callback) {
 }
 
 function hac_getDatabases(callback) {
-  if ($.totalStorage(hac_getTotalStorageUserPrefix() + 'databases') != null) {
-    callback($.totalStorage(hac_getTotalStorageUserPrefix() + 'databases'));
-    if ($.totalStorage(hac_getTotalStorageUserPrefix() + 'timestamp_databases') == null || hac_hasExpired($.totalStorage(hac_getTotalStorageUserPrefix() + 'timestamp_databases'))){
+  if (hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'databases') != null) {
+    callback(hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'databases'));
+    if (hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'timestamp_databases') == null || hac_hasExpired(hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'timestamp_databases'))){
       hac_jsoncalls({
         onDataReceived: function (data) {
           if (typeof HIVE_AUTOCOMPLETE_GLOBAL_CALLBACK == "function") {
@@ -190,8 +190,8 @@ function hac_getDatabases(callback) {
             hac_errorHandler(data);
           }
           else {
-            $.totalStorage(hac_getTotalStorageUserPrefix() + 'databases', data.databases);
-            $.totalStorage(hac_getTotalStorageUserPrefix() + 'timestamp_databases', (new Date()).getTime());
+            hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'databases', data.databases);
+            hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'timestamp_databases', (new Date()).getTime());
           }
         }
       });
@@ -208,9 +208,9 @@ function hac_getDatabases(callback) {
         }
         else {
           if (data.databases) {
-            $.totalStorage(hac_getTotalStorageUserPrefix() + 'databases', data.databases);
-            $.totalStorage(hac_getTotalStorageUserPrefix() + 'timestamp_databases', (new Date()).getTime());
-            callback($.totalStorage(hac_getTotalStorageUserPrefix() + 'databases'));
+            hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'databases', data.databases);
+            hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'timestamp_databases', (new Date()).getTime());
+            callback(hueUtils.hueLocalStorage(hac_getLocalStorageUserPrefix() + 'databases'));
           }
         }
       }
@@ -228,4 +228,4 @@ function hac_errorHandler(data) {
       $(document).trigger('error', data.error);
     }
   }
-}
+}

+ 1 - 1
apps/beeswax/src/beeswax/templates/create_database.mako

@@ -222,7 +222,7 @@ ${layout.metastore_menubar()}
 
       self.assistAvailable = ko.observable(true);
       self.isLeftPanelVisible = ko.observable();
-      self.apiHelper.withTotalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
+      self.apiHelper.withLocalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
 
       huePubSub.subscribe("assist.table.selected", function (entry) {
         location.href = '/metastore/table/' + entry.path[0] + '/' + entry.name + '?connector_id=' + entry.getConnector().id + '&namespace=' + entry.namespace.id;

+ 1 - 1
apps/beeswax/src/beeswax/templates/create_table_manually.mako

@@ -542,7 +542,7 @@ ${ layout.metastore_menubar() }
       self.apiHelper = window.apiHelper;
       self.assistAvailable = ko.observable(true);
       self.isLeftPanelVisible = ko.observable();
-      self.apiHelper.withTotalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
+      self.apiHelper.withLocalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
 
       huePubSub.subscribe("assist.table.selected", function (entry) {
         location.href = '/metastore/table/' + entry.path[0] + '/' + entry.name + '?connector_id=' + entry.getConnector().id + '&namespace=' + entry.namespace.id;

+ 7 - 7
apps/beeswax/src/beeswax/templates/execute.mako

@@ -1117,7 +1117,7 @@ ${ commonshare() | n,unicode }
 <script type="text/javascript">
 
 // avoid blinking of the panels
-var leftPanelWidth = $.totalStorage("${app_name}_left_panel_width") != null ? $.totalStorage("${app_name}_left_panel_width") : 250;
+var leftPanelWidth = hueUtils.hueLocalStorage("${app_name}_left_panel_width") != null ? hueUtils.hueLocalStorage("${app_name}_left_panel_width") : 250;
 $(".left-panel").css("width", leftPanelWidth + "px");
 $(".content-panel").css("left", leftPanelWidth + 20 + "px");
 
@@ -1170,7 +1170,7 @@ var autocompleter = new AceAutocompleteWrapper({
   timeout: AUTOCOMPLETE_TIMEOUT
 });
 
-var totalStorageUserPrefix = apiHelper.getTotalStorageUserPrefix(snippetType);
+var localStorageUserPrefix = apiHelper.getlocalStorageUserPrefix(snippetType);
 
 var truncateOutput = function (obj) {
   //default to 20 characters (column output displays first 21 chars so we need to consider the length of both column name and type
@@ -1709,9 +1709,9 @@ $(document).ready(function () {
   });
 
   % if not (design and design.id) and not ( query_history and query_history.id ):
-    if ($.totalStorage(totalStorageUserPrefix + "${app_name}_temp_query") != null && $.totalStorage(totalStorageUserPrefix + "${app_name}_temp_query") != "") {
+    if (hueUtils.hueLocalStorage(localStorageUserPrefix + "${app_name}_temp_query") != null && hueUtils.hueLocalStorage(localStorageUserPrefix + "${app_name}_temp_query") != "") {
       viewModel.queryEditorBlank(true);
-      codeMirror.setValue($.totalStorage(totalStorageUserPrefix + "${app_name}_temp_query"));
+      codeMirror.setValue(hueUtils.hueLocalStorage(localStorageUserPrefix + "${app_name}_temp_query"));
     }
   % endif
 
@@ -2089,7 +2089,7 @@ function addResults(viewModel, dataTable, startRow, nextRow) {
 
 function resultsTable(e, data) {
   $("#results .dataTables_wrapper").animate({opacity: '1'}, 50);
-  $.totalStorage(totalStorageUserPrefix + "${app_name}_temp_query", null);
+  hueUtils.hueLocalStorage(localStorageUserPrefix + "${app_name}_temp_query", null);
   if (viewModel.design.results.columns().length > 0) {
     if (!dataTable) {
       if (viewModel.design.results.columns().length < 500) {
@@ -2369,7 +2369,7 @@ function tryCancelQuery() {
 }
 
 function createNewQuery() {
-  $.totalStorage(totalStorageUserPrefix + "${app_name}_temp_query", null);
+  hueUtils.hueLocalStorage(localStorageUserPrefix + "${app_name}_temp_query", null);
   location.href="${ url(app_name + ':execute_query') }";
 }
 
@@ -2765,7 +2765,7 @@ function cacheQueryTextEvents() {
     if (typeof codeMirror != "undefined") {
       codeMirror.on("change", function () {
         $(".query").val(codeMirror.getValue());
-        $.totalStorage(totalStorageUserPrefix + "${app_name}_temp_query", codeMirror.getValue());
+        hueUtils.hueLocalStorage(localStorageUserPrefix + "${app_name}_temp_query", codeMirror.getValue());
       });
       window.clearInterval(_waitForCodemirrorInit);
     }

+ 1 - 1
apps/beeswax/src/beeswax/templates/import_wizard_choose_delimiter.mako

@@ -182,7 +182,7 @@ ${ layout.metastore_menubar() }
       self.apiHelper = window.apiHelper;
       self.assistAvailable = ko.observable(true);
       self.isLeftPanelVisible = ko.observable();
-      self.apiHelper.withTotalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
+      self.apiHelper.withLocalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
 
 
       huePubSub.subscribe("assist.table.selected", function (entry) {

+ 1 - 1
apps/beeswax/src/beeswax/templates/import_wizard_choose_file.mako

@@ -189,7 +189,7 @@ ${ layout.metastore_menubar() }
       self.apiHelper = window.apiHelper;
       self.assistAvailable = ko.observable(true);
       self.isLeftPanelVisible = ko.observable();
-      self.apiHelper.withTotalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
+      self.apiHelper.withLocalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
 
 
       huePubSub.subscribe("assist.table.selected", function (entry) {

+ 1 - 1
apps/beeswax/src/beeswax/templates/import_wizard_define_columns.mako

@@ -217,7 +217,7 @@ ${ layout.metastore_menubar() }
       self.apiHelper = window.apiHelper;
       self.assistAvailable = ko.observable(true);
       self.isLeftPanelVisible = ko.observable();
-      self.apiHelper.withTotalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
+      self.apiHelper.withLocalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
 
 
       huePubSub.subscribe("assist.table.selected", function (entry) {

+ 2 - 2
apps/filebrowser/src/filebrowser/templates/listdir_components.mako

@@ -929,7 +929,7 @@ from filebrowser.conf import ENABLE_EXTRACT_UPLOADED_ARCHIVE
 
       self.page = ko.observable(new Page(page));
       self.recordsPerPageChoices = ["15", "30", "45", "60", "100", "200", "1000"],
-      self.recordsPerPage = ko.observable(apiHelper.getFromTotalStorage('fb', 'records_per_page', 45));
+      self.recordsPerPage = ko.observable(apiHelper.getFromLocalStorage('fb', 'records_per_page', 45));
       self.targetPageNum = ko.observable(1);
       self.targetPath = ko.observable("${current_request_path | n,unicode }");
       self.sortBy = ko.observable("name");
@@ -1263,7 +1263,7 @@ from filebrowser.conf import ENABLE_EXTRACT_UPLOADED_ARCHIVE
       };
 
       self.recordsPerPage.subscribe(function (newValue) {
-        apiHelper.setInTotalStorage('fb', 'records_per_page', newValue)
+        apiHelper.setInLocalStorage('fb', 'records_per_page', newValue)
         self.retrieveData();
       });
 

+ 5 - 5
apps/hbase/src/hbase/templates/app.mako

@@ -705,7 +705,7 @@ ${ commonheader(None, "hbase", user, request) | n,unicode }
             editor.setOptions({
               readOnly: $('#ace_target').is(':disabled')
             });
-            editor.setTheme($.totalStorage('hue.ace.theme') || 'ace/theme/hue');
+            editor.setTheme(hueUtils.hueLocalStorage('hue.ace.theme') || 'ace/theme/hue');
             editor.getSession().setMode(aceMode);
             editor.setValue($(target).val(), -1);
 
@@ -2346,7 +2346,7 @@ ${ commonheader(None, "hbase", user, request) | n,unicode }
         },
         ':cluster/:table/query/:query': function (cluster, table, query) {
           hueAnalytics.log('hbase', 'query_table');
-          $.totalStorage('hbase_cluster', cluster);
+          hueUtils.hueLocalStorage('hbase_cluster', cluster);
           app.station('table');
           app.search.cur_input(query);
           Router.setTable(cluster, table);
@@ -2360,7 +2360,7 @@ ${ commonheader(None, "hbase", user, request) | n,unicode }
         },
         ':cluster/:table': function (cluster, table) {
           hueAnalytics.log('hbase', 'view_table');
-          $.totalStorage('hbase_cluster', cluster);
+          hueUtils.hueLocalStorage('hbase_cluster', cluster);
           Router.setTable(cluster, table);
           resetSearch();
           resetElements();
@@ -2373,7 +2373,7 @@ ${ commonheader(None, "hbase", user, request) | n,unicode }
             routie('');
           } else {
             hueAnalytics.log('hbase', 'view_cluster');
-            $.totalStorage('hbase_cluster', cluster);
+            hueUtils.hueLocalStorage('hbase_cluster', cluster);
             app.station('cluster');
             app.cluster(cluster);
             app.pageTitle(cluster);
@@ -2392,7 +2392,7 @@ ${ commonheader(None, "hbase", user, request) | n,unicode }
           routed = true;
         },
         '': function () {
-          var cluster = $.totalStorage('hbase_cluster');
+          var cluster = hueUtils.hueLocalStorage('hbase_cluster');
           if (cluster != null && $.inArray(cluster, app.clusterNames()) > -1) {
             routie(cluster);
           } else {

+ 1 - 1
apps/jobbrowser/src/jobbrowser/templates/job_browser.mako

@@ -3884,7 +3884,7 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
       self.apiHelper = window.apiHelper;
       self.assistAvailable = ko.observable(true);
       self.isLeftPanelVisible = ko.observable();
-      self.apiHelper.withTotalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
+      self.apiHelper.withLocalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
       self.appConfig = ko.observable();
       self.clusterType = ko.observable();
       self.isMini = ko.observable(false);

+ 1 - 1
apps/oozie/src/oozie/templates/dashboard/list_oozie_bundle.mako

@@ -377,7 +377,7 @@ ${ layout.menubar(section='bundles', dashboard=True) }
       readOnly: true,
       maxLines: Infinity
     });
-    editor.setTheme($.totalStorage("hue.ace.theme") || "ace/theme/hue");
+    editor.setTheme(hueUtils.hueLocalStorage("hue.ace.theme") || "ace/theme/hue");
     editor.getSession().setMode("ace/mode/xml");
 
     $(".confirmationModal").click(function(){

+ 1 - 1
apps/oozie/src/oozie/templates/dashboard/list_oozie_coordinator.mako

@@ -570,7 +570,7 @@ ${ layout.menubar(section='coordinators', dashboard=True) }
       readOnly: true,
       maxLines: Infinity
     });
-    editor.setTheme($.totalStorage("hue.ace.theme") || "ace/theme/hue");
+    editor.setTheme(hueUtils.hueLocalStorage("hue.ace.theme") || "ace/theme/hue");
     editor.getSession().setMode("ace/mode/xml");
 
     // force refresh on tab change

+ 1 - 1
apps/oozie/src/oozie/templates/dashboard/list_oozie_workflow.mako

@@ -547,7 +547,7 @@ ${ dashboard.import_layout() }
       readOnly: true,
       maxLines: Infinity
     });
-    editor.setTheme($.totalStorage("hue.ace.theme") || "ace/theme/hue");
+    editor.setTheme(hueUtils.hueLocalStorage("hue.ace.theme") || "ace/theme/hue");
     editor.getSession().setMode("ace/mode/xml");
 
     // force refresh on tab change

+ 1 - 1
apps/oozie/src/oozie/templates/dashboard/list_oozie_workflow_action.mako

@@ -214,7 +214,7 @@ ${ layout.menubar(section='workflows', dashboard=True) }
       readOnly: true,
       maxLines: Infinity
     });
-    editor.setTheme($.totalStorage("hue.ace.theme") || "ace/theme/hue");
+    editor.setTheme(hueUtils.hueLocalStorage("hue.ace.theme") || "ace/theme/hue");
     editor.getSession().setMode("ace/mode/xml");
   });
 </script>

+ 2 - 2
apps/oozie/src/oozie/templates/editor2/workflow_editor.mako

@@ -632,7 +632,7 @@ ${ utils.submit_popup_event() }
 
 
   % if ENABLE_DOCUMENT_ACTION.get():
-  var defaultSection = apiHelper.getFromTotalStorage('oozie', 'draggable_section', 'documents');
+  var defaultSection = apiHelper.getFromLocalStorage('oozie', 'draggable_section', 'documents');
   % else:
   var defaultSection = 'actions';
   % endif
@@ -887,7 +887,7 @@ ${ utils.submit_popup_event() }
     }, 'oozie');
 
     huePubSub.subscribe('oozie.draggable.section.change', function(val){
-      apiHelper.setInTotalStorage('oozie', 'draggable_section', val);
+      apiHelper.setInLocalStorage('oozie', 'draggable_section', val);
     });
 
     $(document).on("click", ".widget-main-section", function (e) {

+ 3 - 3
apps/pig/src/pig/templates/app.mako

@@ -793,15 +793,15 @@ ${ commonshare() | n,unicode }
 
     $("#navigatorHide").on("click", function () {
       hideNavigator();
-      $.totalStorage("huePigNavigatorHidden", true);
+      hueUtils.hueLocalStorage("huePigNavigatorHidden", true);
     });
 
     $("#navigatorShow").on("click", function () {
       showNavigator();
-      $.totalStorage("huePigNavigatorHidden", null);
+      hueUtils.hueLocalStorage("huePigNavigatorHidden", null);
     });
 
-    if ($.totalStorage("huePigNavigatorHidden") != null && $.totalStorage("huePigNavigatorHidden")) {
+    if (hueUtils.hueLocalStorage("huePigNavigatorHidden") != null && hueUtils.hueLocalStorage("huePigNavigatorHidden")) {
       hideNavigator();
     }
 

+ 18 - 18
apps/rdbms/src/rdbms/static/rdbms/js/autocomplete.utils.js

@@ -83,9 +83,9 @@ function rdbms_getTableColumns(serverName, databaseName, tableName, textScanned,
     tableName = _aliases[tableName];
   }
 
-  if ($.totalStorage('rdbms_columns_' + serverName + '_' + databaseName + '_' + tableName) && $.totalStorage('rdbms_extended_columns_' + serverName + '_' + databaseName + '_' + tableName)) {
-    callback($.totalStorage('rdbms_columns_' + serverName + '_' + databaseName + '_' + tableName), $.totalStorage('rdbms_extended_columns_' + serverName + '_' + databaseName + '_' + tableName));
-    if ($.totalStorage('rdbms_timestamp_columns_' + serverName + '_' + databaseName + '_' + tableName) === null || rdbms_hasExpired($.totalStorage('rdbms_timestamp_columns_' + serverName + '_' + databaseName + '_' + tableName))){
+  if (hueUtils.hueLocalStorage('rdbms_columns_' + serverName + '_' + databaseName + '_' + tableName) && hueUtils.hueLocalStorage('rdbms_extended_columns_' + serverName + '_' + databaseName + '_' + tableName)) {
+    callback(hueUtils.hueLocalStorage('rdbms_columns_' + serverName + '_' + databaseName + '_' + tableName), hueUtils.hueLocalStorage('rdbms_extended_columns_' + serverName + '_' + databaseName + '_' + tableName));
+    if (hueUtils.hueLocalStorage('rdbms_timestamp_columns_' + serverName + '_' + databaseName + '_' + tableName) === null || rdbms_hasExpired(hueUtils.hueLocalStorage('rdbms_timestamp_columns_' + serverName + '_' + databaseName + '_' + tableName))){
       rdbms_jsoncalls({
         server: serverName,
         database: databaseName,
@@ -100,9 +100,9 @@ function rdbms_getTableColumns(serverName, databaseName, tableName, textScanned,
             }
           }
           else {
-            $.totalStorage('rdbms_columns_' + serverName + '_' + databaseName + '_' + tableName, (data.columns ? "* " + data.columns.join(" ") : "*"));
-            $.totalStorage('rdbms_extended_columns_' + serverName + '_' + databaseName + '_' + tableName, (data.extended_columns ? data.extended_columns : []));
-            $.totalStorage('rdbms_timestamp_columns_' + serverName + '_' + databaseName + '_' + tableName, (new Date()).getTime());
+            hueUtils.hueLocalStorage('rdbms_columns_' + serverName + '_' + databaseName + '_' + tableName, (data.columns ? "* " + data.columns.join(" ") : "*"));
+            hueUtils.hueLocalStorage('rdbms_extended_columns_' + serverName + '_' + databaseName + '_' + tableName, (data.extended_columns ? data.extended_columns : []));
+            hueUtils.hueLocalStorage('rdbms_timestamp_columns_' + serverName + '_' + databaseName + '_' + tableName, (new Date()).getTime());
           }
         }
       });
@@ -123,10 +123,10 @@ function rdbms_getTableColumns(serverName, databaseName, tableName, textScanned,
           }
         }
         else {
-          $.totalStorage('rdbms_columns_' + serverName + '_' + databaseName + '_' + tableName, (data.columns ? "* " + data.columns.join(" ") : "*"));
-          $.totalStorage('rdbms_extended_columns_' + serverName + '_' + databaseName + '_' + tableName, (data.extended_columns ? data.extended_columns : []));
-          $.totalStorage('rdbms_timestamp_columns_' + serverName + '_' + databaseName + '_' + tableName, (new Date()).getTime());
-          callback($.totalStorage('rdbms_columns_' + serverName + '_' + databaseName + '_' + tableName), $.totalStorage('rdbms_extended_columns_' + serverName + '_' + databaseName + '_' + tableName));
+          hueUtils.hueLocalStorage('rdbms_columns_' + serverName + '_' + databaseName + '_' + tableName, (data.columns ? "* " + data.columns.join(" ") : "*"));
+          hueUtils.hueLocalStorage('rdbms_extended_columns_' + serverName + '_' + databaseName + '_' + tableName, (data.extended_columns ? data.extended_columns : []));
+          hueUtils.hueLocalStorage('rdbms_timestamp_columns_' + serverName + '_' + databaseName + '_' + tableName, (new Date()).getTime());
+          callback(hueUtils.hueLocalStorage('rdbms_columns_' + serverName + '_' + databaseName + '_' + tableName), hueUtils.hueLocalStorage('rdbms_extended_columns_' + serverName + '_' + databaseName + '_' + tableName));
         }
       }
     });
@@ -134,9 +134,9 @@ function rdbms_getTableColumns(serverName, databaseName, tableName, textScanned,
 }
 
 function rdbms_getTables(serverName, databaseName, callback) {
-  if ($.totalStorage('rdbms_tables_' + serverName + '_' + databaseName)) {
-    callback($.totalStorage('rdbms_tables_' + serverName + '_' + databaseName));
-    if ($.totalStorage('rdbms_timestamp_tables_' + serverName + '_' + databaseName) === null || rdbms_hasExpired($.totalStorage('rdbms_timestamp_tables_' + serverName + '_' + databaseName))){
+  if (hueUtils.hueLocalStorage('rdbms_tables_' + serverName + '_' + databaseName)) {
+    callback(hueUtils.hueLocalStorage('rdbms_tables_' + serverName + '_' + databaseName));
+    if (hueUtils.hueLocalStorage('rdbms_timestamp_tables_' + serverName + '_' + databaseName) === null || rdbms_hasExpired(hueUtils.hueLocalStorage('rdbms_timestamp_tables_' + serverName + '_' + databaseName))){
       rdbms_jsoncalls({
         server: serverName,
         database: databaseName,
@@ -150,8 +150,8 @@ function rdbms_getTables(serverName, databaseName, callback) {
             }
           }
           else {
-            $.totalStorage('rdbms_tables_' + serverName + '_' + databaseName, data.tables.join(" "));
-            $.totalStorage('rdbms_timestamp_tables_' + serverName + '_' + databaseName, (new Date()).getTime());
+            hueUtils.hueLocalStorage('rdbms_tables_' + serverName + '_' + databaseName, data.tables.join(" "));
+            hueUtils.hueLocalStorage('rdbms_timestamp_tables_' + serverName + '_' + databaseName, (new Date()).getTime());
           }
         }
       });
@@ -171,9 +171,9 @@ function rdbms_getTables(serverName, databaseName, callback) {
           }
         }
         else {
-          $.totalStorage('rdbms_tables_' + serverName + '_' + databaseName, data.tables.join(" "));
-          $.totalStorage('rdbms_timestamp_tables_' + serverName + '_' + databaseName, (new Date()).getTime());
-          callback($.totalStorage('rdbms_tables_' + serverName + '_' + databaseName));
+          hueUtils.hueLocalStorage('rdbms_tables_' + serverName + '_' + databaseName, data.tables.join(" "));
+          hueUtils.hueLocalStorage('rdbms_timestamp_tables_' + serverName + '_' + databaseName, (new Date()).getTime());
+          callback(hueUtils.hueLocalStorage('rdbms_tables_' + serverName + '_' + databaseName));
         }
       }
     });

+ 3 - 3
apps/rdbms/src/rdbms/static/rdbms/js/rdbms.vm.js

@@ -97,7 +97,7 @@ function RdbmsViewModel() {
     });
     self.servers(newServers);
 
-    var last = $.totalStorage('hueRdbmsLastServer') || ((newServers[0].length > 0) ? newServers[0].name() : null);
+    var last = hueUtils.hueLocalStorage('hueRdbmsLastServer') || ((newServers[0].length > 0) ? newServers[0].name() : null);
     if (last) {
       self.server(last);
       $.each(self.servers(), function(index, server) {
@@ -114,7 +114,7 @@ function RdbmsViewModel() {
     self.databases(databases);
 
     var key = 'hueRdbmsLastDatabase-' + self.server().name();
-    var last = $.totalStorage(key) || ((databases.length > 0) ? databases[0] : null);
+    var last = hueUtils.hueLocalStorage(key) || ((databases.length > 0) ? databases[0] : null);
     if (last) {
       self.database(last);
       self.chosenDatabase(last);
@@ -145,7 +145,7 @@ function RdbmsViewModel() {
       self.initialChoose = false;
     }
     else {
-      $.totalStorage('hueRdbmsLastServer', self.server().name());
+      hueUtils.hueLocalStorage('hueRdbmsLastServer', self.server().name());
     }
     self.fetchDatabases();
   });

+ 5 - 5
apps/rdbms/src/rdbms/templates/execute.mako

@@ -430,7 +430,7 @@ ${ commonshare() | n,unicode }
       $(".CodeMirror-spinner").remove();
       $("<i class='fa fa-spinner fa-spin CodeMirror-spinner'></i>").css("top", pos.top + "px").css("left", (pos.left - 4) + "px").appendTo('body');
 
-      if ($.totalStorage('rdbms_tables_' + viewModel.server().name() + "_" + viewModel.database()) == null) {
+      if (hueUtils.hueLocalStorage('rdbms_tables_' + viewModel.server().name() + "_" + viewModel.database()) == null) {
         CodeMirror.showHint(cm, AUTOCOMPLETE_SET);
         rdbms_getTables(viewModel.server().name(), viewModel.database(), function () {
         }); // if preload didn't work, tries again
@@ -663,14 +663,14 @@ ${ commonshare() | n,unicode }
 
   function checkLastDatabase(server, database) {
     var key = "hueRdbmsLastDatabase-" + server;
-    if (database != $.totalStorage(key)) {
-      $.totalStorage(key, database);
+    if (database != hueUtils.hueLocalStorage(key)) {
+      hueUtils.hueLocalStorage(key, database);
     }
   }
 
   function getLastDatabase(server) {
     var key = "hueRdbmsLastDatabase-" + server;
-    return $.totalStorage(key);
+    return hueUtils.hueLocalStorage(key);
   }
 
   $(".chosen-server").chosen({
@@ -687,7 +687,7 @@ ${ commonshare() | n,unicode }
     if (value != null){
       var key = 'hueRdbmsLastDatabase-' + viewModel.server().name();
       viewModel.selectedDatabase(viewModel.databases.indexOf(value.selected));
-      $.totalStorage(key, value.selected);
+      hueUtils.hueLocalStorage(key, value.selected);
     }
   });
 

+ 3 - 3
apps/sqoop/src/sqoop/static/sqoop/js/sqoop.autocomplete.js

@@ -29,9 +29,9 @@ var autocomplete = (function($) {
         key = 'sqoop_' + server_type;
       }
     }
-    var val = $.totalStorage(key) || [];
+    var val = hueUtils.hueLocalStorage(key) || [];
     if (value) {
-      $.totalStorage(key, value);
+      hueUtils.hueLocalStorage(key, value);
     }
     return val;
   }
@@ -107,4 +107,4 @@ var autocomplete = (function($) {
       return cas(server_type, database, table);
     }
   };
-})($);
+})($);

+ 30 - 35
desktop/core/src/desktop/js/api/apiHelper.js

@@ -28,8 +28,7 @@ import apiQueueManager from 'api/apiQueueManager';
 import CancellableJqPromise from 'api/cancellableJqPromise';
 import hueDebug from 'utils/hueDebug';
 import huePubSub from 'utils/huePubSub';
-import hueUtils from 'utils/hueUtils';
-import { EXECUTION_STATUS } from 'apps/notebook2/execution/executable';
+import hueUtils, { hueLocalStorage } from 'utils/hueUtils';
 import * as URLS from './urls';
 
 export const LINK_SHARING_PERMS = {
@@ -63,19 +62,19 @@ class ApiHelper {
     this.cancelActiveRequest = cancelActiveRequest; // TODO: Remove when job_browser.mako is in webpack
 
     huePubSub.subscribe('assist.clear.git.cache', () => {
-      $.totalStorage(this.getAssistCacheIdentifier({ sourceType: 'git' }), {});
+      hueLocalStorage(this.getAssistCacheIdentifier({ sourceType: 'git' }), {});
     });
 
     huePubSub.subscribe('assist.clear.collections.cache', () => {
-      $.totalStorage(this.getAssistCacheIdentifier({ sourceType: 'collections' }), {});
+      hueLocalStorage(this.getAssistCacheIdentifier({ sourceType: 'collections' }), {});
     });
 
     huePubSub.subscribe('assist.clear.hbase.cache', () => {
-      $.totalStorage(this.getAssistCacheIdentifier({ sourceType: 'hbase' }), {});
+      hueLocalStorage(this.getAssistCacheIdentifier({ sourceType: 'hbase' }), {});
     });
 
     huePubSub.subscribe('assist.clear.document.cache', () => {
-      $.totalStorage(this.getAssistCacheIdentifier({ sourceType: 'document' }), {});
+      hueLocalStorage(this.getAssistCacheIdentifier({ sourceType: 'document' }), {});
     });
 
     const clearAllCaches = () => {
@@ -87,14 +86,14 @@ class ApiHelper {
         sourceType: 'impala',
         clearAll: true
       });
-      $.totalStorage(this.getAssistCacheIdentifier({ sourceType: 'hdfs' }), {});
-      $.totalStorage(this.getAssistCacheIdentifier({ sourceType: 'adls' }), {});
-      $.totalStorage(this.getAssistCacheIdentifier({ sourceType: 'abfs' }), {});
-      $.totalStorage(this.getAssistCacheIdentifier({ sourceType: 'git' }), {});
-      $.totalStorage(this.getAssistCacheIdentifier({ sourceType: 's3' }), {});
-      $.totalStorage(this.getAssistCacheIdentifier({ sourceType: 'collections' }), {});
-      $.totalStorage(this.getAssistCacheIdentifier({ sourceType: 'hbase' }), {});
-      $.totalStorage(this.getAssistCacheIdentifier({ sourceType: 'document' }), {});
+      hueLocalStorage(this.getAssistCacheIdentifier({ sourceType: 'hdfs' }), {});
+      hueLocalStorage(this.getAssistCacheIdentifier({ sourceType: 'adls' }), {});
+      hueLocalStorage(this.getAssistCacheIdentifier({ sourceType: 'abfs' }), {});
+      hueLocalStorage(this.getAssistCacheIdentifier({ sourceType: 'git' }), {});
+      hueLocalStorage(this.getAssistCacheIdentifier({ sourceType: 's3' }), {});
+      hueLocalStorage(this.getAssistCacheIdentifier({ sourceType: 'collections' }), {});
+      hueLocalStorage(this.getAssistCacheIdentifier({ sourceType: 'hbase' }), {});
+      hueLocalStorage(this.getAssistCacheIdentifier({ sourceType: 'document' }), {});
     };
 
     huePubSub.subscribe('assist.clear.all.caches', clearAllCaches);
@@ -108,7 +107,7 @@ class ApiHelper {
   }
 
   clearStorageCache(sourceType) {
-    $.totalStorage(this.getAssistCacheIdentifier({ sourceType: sourceType }), {});
+    hueLocalStorage(this.getAssistCacheIdentifier({ sourceType: sourceType }), {});
   }
 
   hasExpired(timestamp, cacheType) {
@@ -133,7 +132,7 @@ class ApiHelper {
    */
   fetchCached(options) {
     const cacheIdentifier = this.getAssistCacheIdentifier(options);
-    const cachedData = $.totalStorage(cacheIdentifier) || {};
+    const cachedData = hueLocalStorage(cacheIdentifier) || {};
     const cachedId = options.hash ? options.url + options.hash : options.url;
 
     if (
@@ -150,7 +149,7 @@ class ApiHelper {
           data: data
         };
         try {
-          $.totalStorage(cacheIdentifier, cachedData);
+          hueLocalStorage(cacheIdentifier, cachedData);
         } catch (e) {}
       });
     } else {
@@ -166,7 +165,7 @@ class ApiHelper {
    * @param {string} sourceType
    * @returns {string}
    */
-  getTotalStorageUserPrefix(sourceType) {
+  getlocalStorageUserPrefix(sourceType) {
     return sourceType + '_' + window.LOGGED_USERNAME + '_' + window.location.hostname;
   }
 
@@ -181,7 +180,7 @@ class ApiHelper {
       'hue.assist.' +
       (options.cacheType || 'default') +
       '.' +
-      this.getTotalStorageUserPrefix(options.sourceType)
+      this.getlocalStorageUserPrefix(options.sourceType)
     );
   }
 
@@ -191,20 +190,16 @@ class ApiHelper {
    * @param {string} id
    * @param {*} [value] - Optional, undefined and null will remove the value
    */
-  setInTotalStorage(owner, id, value) {
+  setInLocalStorage(owner, id, value) {
     try {
       const cachedData =
-        $.totalStorage('hue.user.settings.' + this.getTotalStorageUserPrefix(owner)) || {};
+        hueLocalStorage('hue.user.settings.' + this.getlocalStorageUserPrefix(owner)) || {};
       if (typeof value !== 'undefined' && value !== null) {
         cachedData[id] = value;
-        $.totalStorage('hue.user.settings.' + this.getTotalStorageUserPrefix(owner), cachedData, {
-          secure: window.location.protocol.indexOf('https') > -1
-        });
+        hueLocalStorage('hue.user.settings.' + this.getlocalStorageUserPrefix(owner), cachedData);
       } else if (cachedData[id]) {
         delete cachedData[id];
-        $.totalStorage('hue.user.settings.' + this.getTotalStorageUserPrefix(owner), cachedData, {
-          secure: window.location.protocol.indexOf('https') > -1
-        });
+        hueLocalStorage('hue.user.settings.' + this.getlocalStorageUserPrefix(owner), cachedData);
       }
     } catch (e) {}
   }
@@ -216,9 +211,9 @@ class ApiHelper {
    * @param {*} [defaultValue]
    * @returns {*}
    */
-  getFromTotalStorage(owner, id, defaultValue) {
+  getFromLocalStorage(owner, id, defaultValue) {
     const cachedData =
-      $.totalStorage('hue.user.settings.' + this.getTotalStorageUserPrefix(owner)) || {};
+      hueLocalStorage('hue.user.settings.' + this.getlocalStorageUserPrefix(owner)) || {};
     return typeof cachedData[id] !== 'undefined' ? cachedData[id] : defaultValue;
   }
 
@@ -228,8 +223,8 @@ class ApiHelper {
    * @param {Observable} observable
    * @param {*} [defaultValue] - Optional default value to use if not in total storage initially
    */
-  withTotalStorage(owner, id, observable, defaultValue, noInit) {
-    const cachedValue = this.getFromTotalStorage(owner, id, defaultValue);
+  withLocalStorage(owner, id, observable, defaultValue, noInit) {
+    const cachedValue = this.getFromLocalStorage(owner, id, defaultValue);
 
     if (!noInit && cachedValue !== 'undefined') {
       observable(cachedValue);
@@ -239,7 +234,7 @@ class ApiHelper {
       if (owner === 'assist' && id === 'assist_panel_visible') {
         huePubSub.publish('assist.forceRender');
       }
-      this.setInTotalStorage(owner, id, newValue);
+      this.setInLocalStorage(owner, id, newValue);
     });
     return observable;
   }
@@ -1263,7 +1258,7 @@ class ApiHelper {
   clearDbCache(options) {
     const cacheIdentifier = this.getAssistCacheIdentifier(options);
     if (options.clearAll) {
-      $.totalStorage(cacheIdentifier, {});
+      hueLocalStorage(cacheIdentifier, {});
     } else {
       let url = URLS.AUTOCOMPLETE_API_PREFIX;
       if (options.databaseName) {
@@ -1275,9 +1270,9 @@ class ApiHelper {
       if (options.fields) {
         url += options.fields.length > 0 ? '/' + options.fields.join('/') : '';
       }
-      const cachedData = $.totalStorage(cacheIdentifier) || {};
+      const cachedData = hueLocalStorage(cacheIdentifier) || {};
       delete cachedData[url];
-      $.totalStorage(cacheIdentifier, cachedData);
+      hueLocalStorage(cacheIdentifier, cachedData);
     }
   }
 

+ 4 - 4
desktop/core/src/desktop/js/apps/notebook/editorViewModel.js

@@ -281,21 +281,21 @@ class EditorViewModel {
     self.assistWithoutStorage = ko.observable(false);
 
     self.isLeftPanelVisible = ko.observable(
-      apiHelper.getFromTotalStorage('assist', 'assist_panel_visible', true)
+      apiHelper.getFromLocalStorage('assist', 'assist_panel_visible', true)
     );
     self.isLeftPanelVisible.subscribe(val => {
       if (!self.assistWithoutStorage()) {
-        apiHelper.setInTotalStorage('assist', 'assist_panel_visible', val);
+        apiHelper.setInLocalStorage('assist', 'assist_panel_visible', val);
       }
     });
 
     self.isRightPanelAvailable = ko.observable(options.assistAvailable && HAS_OPTIMIZER);
     self.isRightPanelVisible = ko.observable(
-      apiHelper.getFromTotalStorage('assist', 'right_assist_panel_visible', true)
+      apiHelper.getFromLocalStorage('assist', 'right_assist_panel_visible', true)
     );
     self.isRightPanelVisible.subscribe(val => {
       if (!self.assistWithoutStorage()) {
-        apiHelper.setInTotalStorage('assist', 'right_assist_panel_visible', val);
+        apiHelper.setInLocalStorage('assist', 'right_assist_panel_visible', val);
       }
     });
 

+ 1 - 1
desktop/core/src/desktop/js/apps/notebook/notebook.js

@@ -912,7 +912,7 @@ class Notebook {
       () => {
         if (self.type().indexOf('query') === 0) {
           const whenDatabaseAvailable = function (snippet) {
-            const lastSelectedDb = apiHelper.getFromTotalStorage(
+            const lastSelectedDb = apiHelper.getFromLocalStorage(
               'assist_' + snippet.type() + '_' + snippet.namespace().id,
               'lastSelectedDb'
             );

+ 8 - 8
desktop/core/src/desktop/js/apps/notebook/snippet.js

@@ -24,7 +24,7 @@ import apiHelper from 'api/apiHelper';
 import dataCatalog from 'catalog/dataCatalog';
 import hueAnalytics from 'utils/hueAnalytics';
 import huePubSub from 'utils/huePubSub';
-import hueUtils from 'utils/hueUtils';
+import hueUtils, { hueLocalStorage } from 'utils/hueUtils';
 import Result from 'apps/notebook/result';
 import Session from 'apps/notebook/session';
 import sqlStatementsParser from 'parse/sqlStatementsParser';
@@ -345,7 +345,7 @@ class Snippet {
 
     self.database.subscribe(newValue => {
       if (newValue !== null) {
-        apiHelper.setInTotalStorage('editor', 'last.selected.database', newValue);
+        apiHelper.setInLocalStorage('editor', 'last.selected.database', newValue);
         if (previousDatabase !== null && previousDatabase !== newValue) {
           huePubSub.publish(REFRESH_STATEMENT_LOCATIONS_EVENT, self.id());
         }
@@ -1021,8 +1021,8 @@ class Snippet {
         : false
     );
     let defaultShowLogs = true;
-    if (vm.editorMode() && $.totalStorage('hue.editor.showLogs')) {
-      defaultShowLogs = $.totalStorage('hue.editor.showLogs');
+    if (vm.editorMode() && hueLocalStorage('hue.editor.showLogs')) {
+      defaultShowLogs = hueLocalStorage('hue.editor.showLogs');
     }
     self.showLogs = ko.observable(
       typeof snippet.showLogs !== 'undefined' && snippet.showLogs != null
@@ -1192,12 +1192,12 @@ class Snippet {
         self.getLogs();
       }
       if (vm.editorMode()) {
-        $.totalStorage('hue.editor.showLogs', val);
+        hueLocalStorage('hue.editor.showLogs', val);
       }
     });
 
     self.isLoading = ko.computed(() => {
-      return self.status() == 'loading';
+      return self.status() === 'loading';
     });
 
     self.resultsKlass = ko.computed(() => {
@@ -1456,11 +1456,11 @@ class Snippet {
     self.compatibilityTargetPlatform = ko.observable(COMPATIBILITY_TARGET_PLATFORMS[self.type()]);
 
     self.showOptimizer = ko.observable(
-      apiHelper.getFromTotalStorage('editor', 'show.optimizer', false)
+      apiHelper.getFromLocalStorage('editor', 'show.optimizer', false)
     );
     self.showOptimizer.subscribe(newValue => {
       if (newValue !== null) {
-        apiHelper.setInTotalStorage('editor', 'show.optimizer', newValue);
+        apiHelper.setInLocalStorage('editor', 'show.optimizer', newValue);
       }
     });
 

+ 11 - 11
desktop/core/src/desktop/js/apps/notebook2/components/aceEditor/AceEditor.vue

@@ -112,7 +112,7 @@
       editor.session.setMode(getAceMode(this.executor.connector().dialect));
 
       if ((<hueWindow>window).ENABLE_SQL_SYNTAX_CHECK && window.Worker) {
-        let errorHighlightingEnabled = apiHelper.getFromTotalStorage(
+        let errorHighlightingEnabled = apiHelper.getFromLocalStorage(
           'hue.ace',
           'errorHighlightingEnabled',
           true
@@ -124,7 +124,7 @@
 
         editor.customMenuOptions.setErrorHighlighting = (enabled: boolean) => {
           errorHighlightingEnabled = enabled;
-          apiHelper.setInTotalStorage('hue.ace', 'errorHighlightingEnabled', enabled);
+          apiHelper.setInLocalStorage('hue.ace', 'errorHighlightingEnabled', enabled);
           if (this.aceLocationHandler) {
             if (enabled) {
               this.aceLocationHandler.attachSqlSyntaxWorker();
@@ -135,7 +135,7 @@
         };
         editor.customMenuOptions.getErrorHighlighting = () => errorHighlightingEnabled;
         editor.customMenuOptions.setClearIgnoredSyntaxChecks = () => {
-          apiHelper.setInTotalStorage('hue.syntax.checker', 'suppressedRules', {});
+          apiHelper.setInLocalStorage('hue.syntax.checker', 'suppressedRules', {});
           $('#setClearIgnoredSyntaxChecks')
             .hide()
             .before('<div style="margin-top:5px;float:right;">done</div>');
@@ -421,7 +421,7 @@
     }
 
     addCustomAceConfigOptions(editor: Ace.Editor): void {
-      let darkThemeEnabled = apiHelper.getFromTotalStorage('ace', 'dark.theme.enabled', false);
+      let darkThemeEnabled = apiHelper.getFromLocalStorage('ace', 'dark.theme.enabled', false);
 
       editor.setTheme(darkThemeEnabled ? 'ace/theme/hue_dark' : 'ace/theme/hue');
 
@@ -434,13 +434,13 @@
       editor.customMenuOptions = {
         setEnableDarkTheme: (enabled: boolean): void => {
           darkThemeEnabled = enabled;
-          apiHelper.setInTotalStorage('ace', 'dark.theme.enabled', darkThemeEnabled);
+          apiHelper.setInLocalStorage('ace', 'dark.theme.enabled', darkThemeEnabled);
           editor.setTheme(darkThemeEnabled ? 'ace/theme/hue_dark' : 'ace/theme/hue');
         },
         getEnableDarkTheme: () => darkThemeEnabled,
         setEnableAutocompleter: (enabled: boolean): void => {
           editor.setOption('enableBasicAutocompletion', enabled);
-          apiHelper.setInTotalStorage('hue.ace', 'enableBasicAutocompletion', enabled);
+          apiHelper.setInLocalStorage('hue.ace', 'enableBasicAutocompletion', enabled);
           const $enableLiveAutocompletionChecked = $('#setEnableLiveAutocompletion:checked');
           const $setEnableLiveAutocompletion = $('#setEnableLiveAutocompletion');
           if (enabled && $enableLiveAutocompletionChecked.length === 0) {
@@ -452,7 +452,7 @@
         getEnableAutocompleter: () => editor.getOption('enableBasicAutocompletion'),
         setEnableLiveAutocompletion: (enabled: boolean): void => {
           editor.setOption('enableLiveAutocompletion', enabled);
-          apiHelper.setInTotalStorage('hue.ace', 'enableLiveAutocompletion', enabled);
+          apiHelper.setInLocalStorage('hue.ace', 'enableLiveAutocompletion', enabled);
           if (enabled && $('#setEnableAutocompleter:checked').length === 0) {
             $('#setEnableAutocompleter').trigger('click');
           }
@@ -463,7 +463,7 @@
             size += 'px';
           }
           editor.setOption('fontSize', size);
-          apiHelper.setInTotalStorage('hue.ace', 'fontSize', size);
+          apiHelper.setInLocalStorage('hue.ace', 'fontSize', size);
         },
         getFontSize: (): string => {
           let size = <string>editor.getOption('fontSize');
@@ -476,7 +476,7 @@
     }
 
     configureEditorOptions(editor: Ace.Editor): void {
-      const enableBasicAutocompletion = apiHelper.getFromTotalStorage(
+      const enableBasicAutocompletion = apiHelper.getFromLocalStorage(
         'hue.ace',
         'enableBasicAutocompletion',
         true
@@ -484,12 +484,12 @@
 
       const enableLiveAutocompletion =
         enableBasicAutocompletion &&
-        apiHelper.getFromTotalStorage('hue.ace', 'enableLiveAutocompletion', true);
+        apiHelper.getFromLocalStorage('hue.ace', 'enableLiveAutocompletion', true);
 
       const editorOptions: Ace.Options = {
         enableBasicAutocompletion,
         enableLiveAutocompletion,
-        fontSize: apiHelper.getFromTotalStorage(
+        fontSize: apiHelper.getFromLocalStorage(
           'hue.ace',
           'fontSize',
           navigator.platform && navigator.platform.toLowerCase().indexOf('linux') > -1

+ 1 - 1
desktop/core/src/desktop/js/apps/notebook2/components/aceEditor/AceLocationHandler.ts

@@ -825,7 +825,7 @@ export default class AceLocationHandler implements Disposable {
         return;
       }
 
-      const suppressedRules = apiHelper.getFromTotalStorage(
+      const suppressedRules = apiHelper.getFromLocalStorage(
         'hue.syntax.checker',
         'suppressedRules',
         {}

+ 4 - 4
desktop/core/src/desktop/js/apps/notebook2/editorViewModel.js

@@ -145,21 +145,21 @@ class EditorViewModel {
     this.assistWithoutStorage = ko.observable(false);
 
     this.isLeftPanelVisible = ko.observable(
-      apiHelper.getFromTotalStorage('assist', 'assist_panel_visible', true)
+      apiHelper.getFromLocalStorage('assist', 'assist_panel_visible', true)
     );
     this.isLeftPanelVisible.subscribe(val => {
       if (!this.assistWithoutStorage()) {
-        apiHelper.setInTotalStorage('assist', 'assist_panel_visible', val);
+        apiHelper.setInLocalStorage('assist', 'assist_panel_visible', val);
       }
     });
 
     this.isRightPanelAvailable = ko.observable(options.assistAvailable && HAS_OPTIMIZER);
     this.isRightPanelVisible = ko.observable(
-      apiHelper.getFromTotalStorage('assist', 'right_assist_panel_visible', true)
+      apiHelper.getFromLocalStorage('assist', 'right_assist_panel_visible', true)
     );
     this.isRightPanelVisible.subscribe(val => {
       if (!this.assistWithoutStorage()) {
-        apiHelper.setInTotalStorage('assist', 'right_assist_panel_visible', val);
+        apiHelper.setInLocalStorage('assist', 'right_assist_panel_visible', val);
       }
     });
 

+ 7 - 7
desktop/core/src/desktop/js/apps/notebook2/snippet.js

@@ -34,7 +34,7 @@ import apiHelper from 'api/apiHelper';
 import Executor from 'apps/notebook2/execution/executor';
 import hueAnalytics from 'utils/hueAnalytics';
 import huePubSub from 'utils/huePubSub';
-import hueUtils, { defer } from 'utils/hueUtils';
+import hueUtils, { defer, hueLocalStorage } from 'utils/hueUtils';
 import sessionManager from 'apps/notebook2/execution/sessionManager';
 import SqlExecutable from 'apps/notebook2/execution/sqlExecutable';
 import { HIDE_FIXED_HEADERS_EVENT, REDRAW_FIXED_HEADERS_EVENT } from 'apps/notebook2/events';
@@ -290,7 +290,7 @@ export default class Snippet {
 
     this.database.subscribe(newValue => {
       if (newValue !== null) {
-        apiHelper.setInTotalStorage('editor', 'last.selected.database', newValue);
+        apiHelper.setInLocalStorage('editor', 'last.selected.database', newValue);
         if (previousDatabase !== null && previousDatabase !== newValue) {
           huePubSub.publish(REFRESH_STATEMENT_LOCATIONS_EVENT, this.id());
         }
@@ -488,8 +488,8 @@ export default class Snippet {
     });
 
     let defaultShowLogs = true;
-    if (this.parentVm.editorMode() && $.totalStorage('hue.editor.showLogs')) {
-      defaultShowLogs = $.totalStorage('hue.editor.showLogs');
+    if (this.parentVm.editorMode() && hueLocalStorage('hue.editor.showLogs')) {
+      defaultShowLogs = hueLocalStorage('hue.editor.showLogs');
     }
     this.showLogs = ko.observable(snippetRaw.showLogs || defaultShowLogs);
     this.jobs = ko.observableArray(snippetRaw.jobs || []);
@@ -500,7 +500,7 @@ export default class Snippet {
     this.showLogs.subscribe(val => {
       huePubSub.publish(REDRAW_FIXED_HEADERS_EVENT);
       if (this.parentVm.editorMode()) {
-        $.totalStorage('hue.editor.showLogs', val);
+        hueLocalStorage('hue.editor.showLogs', val);
       }
     });
 
@@ -557,11 +557,11 @@ export default class Snippet {
     );
 
     this.showOptimizer = ko.observable(
-      apiHelper.getFromTotalStorage('editor', 'show.optimizer', false)
+      apiHelper.getFromLocalStorage('editor', 'show.optimizer', false)
     );
     this.showOptimizer.subscribe(newValue => {
       if (newValue !== null) {
-        apiHelper.setInTotalStorage('editor', 'show.optimizer', newValue);
+        apiHelper.setInLocalStorage('editor', 'show.optimizer', newValue);
       }
     });
 

+ 1 - 1
desktop/core/src/desktop/js/apps/tableBrowser/metastoreDatabase.js

@@ -179,7 +179,7 @@ class MetastoreDatabase {
         this.loadingAnalysis(false);
       });
 
-    apiHelper.setInTotalStorage('metastore', 'last.selected.database', this.name);
+    apiHelper.setInLocalStorage('metastore', 'last.selected.database', this.name);
   }
 
   setTableByName(tableName, callback) {

+ 2 - 2
desktop/core/src/desktop/js/apps/tableBrowser/metastoreNamespace.js

@@ -143,8 +143,8 @@ class MetastoreNamespace {
     const whenLoaded = clearCacheOnMissing => {
       if (!databaseName) {
         databaseName =
-          apiHelper.getFromTotalStorage('editor', 'last.selected.database') ||
-          apiHelper.getFromTotalStorage('metastore', 'last.selected.database') ||
+          apiHelper.getFromLocalStorage('editor', 'last.selected.database') ||
+          apiHelper.getFromLocalStorage('metastore', 'last.selected.database') ||
           'default';
         clearCacheOnMissing = false;
       }

+ 1 - 1
desktop/core/src/desktop/js/apps/tableBrowser/metastoreSource.js

@@ -63,7 +63,7 @@ class MetastoreSource {
 
     huePubSub.subscribe(ASSIST_DB_PANEL_IS_READY_EVENT, () => {
       this.lastLoadNamespacesDeferred.done(() => {
-        let lastSelectedDb = apiHelper.getFromTotalStorage(
+        let lastSelectedDb = apiHelper.getFromLocalStorage(
           'assist_' + this.type + '_' + this.namespace.id,
           'lastSelectedDb'
         );

+ 3 - 3
desktop/core/src/desktop/js/apps/tableBrowser/metastoreViewModel.js

@@ -41,7 +41,7 @@ class MetastoreViewModel {
     this.partitionsLimit = options.partitionsLimit;
     this.assistAvailable = ko.observable(true);
     this.isLeftPanelVisible = ko.observable();
-    apiHelper.withTotalStorage('assist', 'assist_panel_visible', this.isLeftPanelVisible, true);
+    apiHelper.withLocalStorage('assist', 'assist_panel_visible', this.isLeftPanelVisible, true);
     this.optimizerEnabled = ko.observable(options.optimizerEnabled || false);
     this.navigatorEnabled = ko.observable(options.navigatorEnabled || false);
     this.appConfig = ko.observable();
@@ -406,9 +406,9 @@ class MetastoreViewModel {
 
       if (
         !namespaceId &&
-        apiHelper.getFromTotalStorage('contextSelector', 'lastSelectedNamespace')
+        apiHelper.getFromLocalStorage('contextSelector', 'lastSelectedNamespace')
       ) {
-        namespaceId = apiHelper.getFromTotalStorage('contextSelector', 'lastSelectedNamespace').id;
+        namespaceId = apiHelper.getFromLocalStorage('contextSelector', 'lastSelectedNamespace').id;
       }
 
       this.source().lastLoadNamespacesDeferred.done(() => {

+ 2 - 2
desktop/core/src/desktop/js/components/SqlText.vue

@@ -25,6 +25,7 @@
 <script lang="ts">
   import { formatSql } from 'apps/notebook2/apiUtils';
   import $ from 'jquery';
+  import { hueLocalStorage } from 'utils/hueUtils';
   import Vue from 'vue';
   import Component from 'vue-class-component';
   import { Prop, Watch } from 'vue-property-decorator';
@@ -69,8 +70,7 @@
       const res: string[] = [];
 
       // eslint-disable-next-line @typescript-eslint/ban-ts-comment
-      // @ts-ignore: totalStorage interface missing
-      config.loadModule(['theme', $.totalStorage('hue.ace.theme') || 'ace/theme/hue']);
+      config.loadModule(['theme', hueLocalStorage('hue.ace.theme') || 'ace/theme/hue']);
 
       const Text = text.Text;
 

+ 0 - 28
desktop/core/src/desktop/js/ext/jquery.total-storage.1.1.3.min.js

@@ -1,28 +0,0 @@
-/**
- * TotalStorage
- *
- * Copyright (c) 2012 Jared Novack & Upstatement (upstatement.com)
- * Dual licensed under the MIT and GPL licenses:
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.gnu.org/licenses/gpl.html
- *
- * Total Storage is the conceptual the love child of jStorage by Andris Reinman,
- * and Cookie by Klaus Hartl -- though this is not connected to either project.
- *
- * @name $.totalStorage
- * @cat Plugins/Cookie
- * @author Jared Novack/jared@upstatement.com
- * @version 1.1.3
- * @url http://upstatement.com/blog/2012/01/jquery-local-storage-done-right-and-easy/
- */
-
-import jQuery from 'jquery';
-
-!function(t,e){var o,r,n="test"
-if("localStorage"in window)try{r="undefined"==typeof window.localStorage?e:window.localStorage,o="undefined"!=typeof r&&"undefined"!=typeof window.JSON,window.localStorage.setItem(n,"1"),window.localStorage.removeItem(n)}catch(t){o=!1}t.totalStorage=function(e,o,r){return t.totalStorage.impl.init(e,o,r)},t.totalStorage.setItem=function(e,o,r){return t.totalStorage.impl.setItem(e,o,r)},t.totalStorage.getItem=function(e){return t.totalStorage.impl.getItem(e)},t.totalStorage.getAll=function(){return t.totalStorage.impl.getAll()},t.totalStorage.deleteItem=function(e){return t.totalStorage.impl.deleteItem(e)},t.totalStorage.impl={init:function(t,e,o){return"undefined"!=typeof e?this.setItem(t,e,o):this.getItem(t)},setItem:function(e,n,a){if(!o)try{return t.cookie(e,n,a),n}catch(t){console.log("Local Storage not supported by this browser. Install the cookie plugin on your site to take advantage of the same functionality. You can get it at https://github.com/carhartl/jquery-cookie")}var l=JSON.stringify(n)
-return r.setItem(e,l),this.parseResult(l)},getItem:function(e){if(!o)try{return this.parseResult(t.cookie(e))}catch(t){return null}var n=r.getItem(e)
-return this.parseResult(n)},deleteItem:function(e){if(!o)try{return t.cookie(e,null),!0}catch(t){return!1}return r.removeItem(e),!0},getAll:function(){var e=[]
-if(o)for(var n in r)n.length&&e.push({key:n,value:this.parseResult(r.getItem(n))})
-else try{for(var a=document.cookie.split(";"),l=0;l<a.length;l++){var i=a[l].split("="),u=i[0]
-e.push({key:u,value:this.parseResult(t.cookie(u))})}}catch(t){return null}return e},parseResult:function(t){var e
-try{e=JSON.parse(t),"undefined"==typeof e&&(e=t),"true"==e&&(e=!0),"false"==e&&(e=!1),parseFloat(e)==e&&"object"!=typeof e&&(e=parseFloat(e))}catch(o){e=t}return e}}}(jQuery)

+ 0 - 1
desktop/core/src/desktop/js/jest/jquery.setup.js

@@ -16,7 +16,6 @@
 
 import $ from 'jquery';
 import 'jquery.cookie';
-import 'ext/jquery.total-storage.1.1.3.min';
 
 global.$ = $;
 global.jQuery = $;

+ 0 - 1
desktop/core/src/desktop/js/jquery/jquery.common.js

@@ -33,7 +33,6 @@ import 'jquery-ui/ui/widgets/sortable';
 import 'ext/jquery.chosen.1.0.0.min';
 import 'ext/jquery.dataTables.1.8.2.min';
 import 'ext/jquery.select2.3.5.1.min';
-import 'ext/jquery.total-storage.1.1.3.min';
 
 import 'jquery/plugins/jquery.datatables.sorting';
 import 'jquery/plugins/jquery.delayedinput';

+ 119 - 109
desktop/core/src/desktop/js/jquery/plugins/jquery.filechooser.js

@@ -19,121 +19,124 @@ import * as ko from 'knockout';
 import qq from 'ext/fileuploader.custom';
 
 import huePubSub from 'utils/huePubSub';
+import { hueLocalStorage } from 'utils/hueUtils';
 import I18n from 'utils/i18n';
 
 /*
  * jHue fileChooser plugin
  */
 
-const pluginName = 'jHueFileChooser',
-  defaults = {
-    initialPath: '',
-    forceRefresh: false,
-    errorRedirectPath: '',
-    createFolder: true,
-    uploadFile: true,
-    selectFolder: false,
-    suppressErrors: false,
-    displayOnlyFolders: false,
-    showExtraHome: false,
-    extraHomeProperties: {},
-    filterExtensions: '',
-    labels: {
-      BACK: 'Back',
-      SELECT_FOLDER: 'Select this folder',
-      CREATE_FOLDER: 'Create folder',
-      FOLDER_NAME: 'Folder name',
-      CANCEL: 'Cancel',
-      FILE_NOT_FOUND: 'The file has not been found',
-      UPLOAD_FILE: 'Upload a file',
-      FAILED: 'Failed',
-      HOME: 'Home'
+const pluginName = 'jHueFileChooser';
+
+const defaults = {
+  initialPath: '',
+  forceRefresh: false,
+  errorRedirectPath: '',
+  createFolder: true,
+  uploadFile: true,
+  selectFolder: false,
+  suppressErrors: false,
+  displayOnlyFolders: false,
+  showExtraHome: false,
+  extraHomeProperties: {},
+  filterExtensions: '',
+  labels: {
+    BACK: 'Back',
+    SELECT_FOLDER: 'Select this folder',
+    CREATE_FOLDER: 'Create folder',
+    FOLDER_NAME: 'Folder name',
+    CANCEL: 'Cancel',
+    FILE_NOT_FOUND: 'The file has not been found',
+    UPLOAD_FILE: 'Upload a file',
+    FAILED: 'Failed',
+    HOME: 'Home'
+  },
+  filesystems: ['hdfs'],
+  filesysteminfo: {
+    '': {
+      scheme: '',
+      root: '/',
+      home: '/?default_to_home',
+      icon: {
+        brand: 'fa-files-o',
+        home: 'fa-home'
+      },
+      label: {
+        home: 'home',
+        name: 'HDFS'
+      }
     },
-    filesystems: ['hdfs'],
-    filesysteminfo: {
-      '': {
-        scheme: '',
-        root: '/',
-        home: '/?default_to_home',
-        icon: {
-          brand: 'fa-files-o',
-          home: 'fa-home'
-        },
-        label: {
-          home: 'home',
-          name: 'HDFS'
-        }
+    hdfs: {
+      scheme: '',
+      root: '/',
+      home: '/?default_to_home',
+      icon: {
+        brand: 'fa-files-o',
+        home: 'fa-home'
       },
-      hdfs: {
-        scheme: '',
-        root: '/',
-        home: '/?default_to_home',
-        icon: {
-          brand: 'fa-files-o',
-          home: 'fa-home'
-        },
-        label: {
-          home: 'home',
-          name: 'HDFS'
-        }
+      label: {
+        home: 'home',
+        name: 'HDFS'
+      }
+    },
+    s3a: {
+      scheme: 's3a',
+      root: 's3a://',
+      home: 's3a://',
+      icon: {
+        brand: 'fa-cubes',
+        home: 'fa-cubes'
       },
-      s3a: {
-        scheme: 's3a',
-        root: 's3a://',
-        home: 's3a://',
-        icon: {
-          brand: 'fa-cubes',
-          home: 'fa-cubes'
+      label: {
+        home: '',
+        name: 'S3'
+      }
+    },
+    adl: {
+      scheme: 'adl',
+      root: 'adl:/',
+      home: 'adl:/',
+      icon: {
+        svg: {
+          brand: '#hi-adls',
+          home: '#hi-adls'
         },
-        label: {
-          home: '',
-          name: 'S3'
-        }
+        brand: 'fa-windows',
+        home: 'fa-windows'
       },
-      adl: {
-        scheme: 'adl',
-        root: 'adl:/',
-        home: 'adl:/',
-        icon: {
-          svg: {
-            brand: '#hi-adls',
-            home: '#hi-adls'
-          },
-          brand: 'fa-windows',
-          home: 'fa-windows'
+      label: {
+        home: '',
+        name: 'ADLS'
+      }
+    },
+    abfs: {
+      scheme: 'abfs',
+      root: 'abfs://',
+      home: 'abfs://',
+      icon: {
+        svg: {
+          brand: '#hi-adls',
+          home: '#hi-adls'
         },
-        label: {
-          home: '',
-          name: 'ADLS'
-        }
+        brand: 'fa-windows',
+        home: 'fa-windows'
       },
-      abfs: {
-        scheme: 'abfs',
-        root: 'abfs://',
-        home: 'abfs://',
-        icon: {
-          svg: {
-            brand: '#hi-adls',
-            home: '#hi-adls'
-          },
-          brand: 'fa-windows',
-          home: 'fa-windows'
-        },
-        label: {
-          home: '',
-          name: 'ABFS'
-        }
+      label: {
+        home: '',
+        name: 'ABFS'
       }
-    },
-    fsSelected: 'hdfs',
-    user: '',
-    onNavigate: function () {},
-    onFileChoose: function () {},
-    onFolderChoose: function () {},
-    onFolderChange: function () {},
-    onError: function () {}
+    }
   },
-  STORAGE_PREFIX = 'hueFileBrowserLastPathForUser_';
+  fsSelected: 'hdfs',
+  user: '',
+  onNavigate: function () {},
+  onFileChoose: function () {},
+  onFolderChoose: function () {},
+  onFolderChange: function () {},
+  onError: function () {}
+};
+
+const STORAGE_PREFIX = 'hueFileBrowserLastPathForUser_';
 
 const DEFAULT_I18n = {
   BACK: I18n('Back'),
@@ -177,16 +180,20 @@ Plugin.prototype.setOptions = function (options) {
     if (initialPath != '') {
       self.navigateTo(self.options.initialPath);
     } else if (
-      $.totalStorage(STORAGE_PREFIX + self.options.user + self.options.fsSelected) != null
+      hueLocalStorage(STORAGE_PREFIX + self.options.user + self.options.fsSelected) != null
     ) {
-      self.navigateTo($.totalStorage(STORAGE_PREFIX + self.options.user + self.options.fsSelected));
+      self.navigateTo(
+        hueLocalStorage(STORAGE_PREFIX + self.options.user + self.options.fsSelected)
+      );
     } else {
       self.navigateTo('/?default_to_home');
     }
   } else if (initialPath != '') {
     self.navigateTo(self.options.initialPath);
-  } else if ($.totalStorage(STORAGE_PREFIX + self.options.user + self.options.fsSelected) != null) {
-    self.navigateTo($.totalStorage(STORAGE_PREFIX + self.options.user + self.options.fsSelected));
+  } else if (
+    hueLocalStorage(STORAGE_PREFIX + self.options.user + self.options.fsSelected) != null
+  ) {
+    self.navigateTo(hueLocalStorage(STORAGE_PREFIX + self.options.user + self.options.fsSelected));
   }
 };
 
@@ -246,7 +253,7 @@ Plugin.prototype.setFileSystems = function (filesystems) {
         $(this).siblings().removeClass('active');
         $(this).addClass('active');
         self.options.fsSelected = fs;
-        const storedPath = $.totalStorage(
+        const storedPath = hueLocalStorage(
           STORAGE_PREFIX + self.options.user + self.options.fsSelected
         );
         if (storedPath !== null) {
@@ -353,11 +360,12 @@ Plugin.prototype.navigateTo = function (path) {
         });
       _previousLink.appendTo($(_parent.element).find('.filechooser-tree'));
     } else {
-      if (data.type == 'file') {
+      if (data.type === 'file') {
         _parent.navigateTo(data.view.dirname);
         return;
       }
-      $.totalStorage(STORAGE_PREFIX + _parent.options.user + _parent.options.fsSelected, path);
+      hueLocalStorage(STORAGE_PREFIX + _parent.options.user + _parent.options.fsSelected, path);
+
       _parent.previousPath = path;
       _parent.options.onNavigate(_parent.previousPath);
 
@@ -813,9 +821,11 @@ Plugin.prototype.init = function () {
     if (initialPath != '') {
       self.navigateTo(self.options.initialPath);
     } else if (
-      $.totalStorage(STORAGE_PREFIX + self.options.user + self.options.fsSelected) != null
+      hueLocalStorage(STORAGE_PREFIX + self.options.user + self.options.fsSelected) != null
     ) {
-      self.navigateTo($.totalStorage(STORAGE_PREFIX + self.options.user + self.options.fsSelected));
+      self.navigateTo(
+        hueLocalStorage(STORAGE_PREFIX + self.options.user + self.options.fsSelected)
+      );
     } else {
       self.navigateTo('/?default_to_home');
     }

+ 8 - 13
desktop/core/src/desktop/js/jquery/plugins/jquery.hdfs.autocomplete.js

@@ -15,8 +15,7 @@
 // limitations under the License.
 
 import $ from 'jquery';
-
-import hueUtils from 'utils/hueUtils';
+import { escapeOutput, hueLocalStorage } from 'utils/hueUtils';
 
 /*
  * jHue HDFS autocomplete plugin
@@ -106,16 +105,12 @@ Plugin.prototype.init = function () {
   });
 
   function smartTooltipMaker() {
-    if (
-      _this.options.smartTooltip != '' &&
-      typeof $.totalStorage != 'undefined' &&
-      $.totalStorage('jHueHdfsAutocompleteTooltip') != -1
-    ) {
+    if (_this.options.smartTooltip !== '' && hueLocalStorage('jHueHdfsAutocompleteTooltip') != -1) {
       let cnt = 0;
-      if ($.totalStorage('jHueHdfsAutocompleteTooltip') != null) {
-        cnt = $.totalStorage('jHueHdfsAutocompleteTooltip') + 1;
+      if (hueLocalStorage('jHueHdfsAutocompleteTooltip') != null) {
+        cnt = hueLocalStorage('jHueHdfsAutocompleteTooltip') + 1;
       }
-      $.totalStorage('jHueHdfsAutocompleteTooltip', cnt);
+      hueLocalStorage('jHueHdfsAutocompleteTooltip', cnt);
       if (cnt >= _this.options.smartTooltipThreshold) {
         _el
           .tooltip({
@@ -128,7 +123,7 @@ Plugin.prototype.init = function () {
         window.setTimeout(() => {
           _el.tooltip('hide');
         }, 10000);
-        $.totalStorage('jHueHdfsAutocompleteTooltip', -1);
+        hueLocalStorage('jHueHdfsAutocompleteTooltip', -1);
       }
     }
   }
@@ -255,11 +250,11 @@ Plugin.prototype.init = function () {
             }
             _currentFiles.push(
               '<li class="hdfsAutocompleteItem" data-value="' +
-                hueUtils.escapeOutput(item.name) +
+                escapeOutput(item.name) +
                 '"><i class="fa ' +
                 ico +
                 '"></i> ' +
-                hueUtils.escapeOutput(item.name) +
+                escapeOutput(item.name) +
                 '</li>'
             );
           }

+ 6 - 6
desktop/core/src/desktop/js/jquery/plugins/jquery.hiveautocomplete.js

@@ -18,6 +18,7 @@ import $ from 'jquery';
 
 import contextCatalog from 'catalog/contextCatalog';
 import dataCatalog from 'catalog/dataCatalog';
+import { hueLocalStorage } from 'utils/hueUtils';
 
 /*
  * jHue generic autocomplete plugin
@@ -146,14 +147,13 @@ Plugin.prototype.init = function () {
   function smartTooltipMaker() {
     if (
       self.options.smartTooltip !== '' &&
-      typeof $.totalStorage !== 'undefined' &&
-      $.totalStorage('jHueGenericAutocompleteTooltip') !== -1
+      hueLocalStorage('jHueGenericAutocompleteTooltip') !== -1
     ) {
       let cnt = 0;
-      if ($.totalStorage('jHueGenericAutocompleteTooltip')) {
-        cnt = $.totalStorage('jHueGenericAutocompleteTooltip') + 1;
+      if (hueLocalStorage('jHueGenericAutocompleteTooltip')) {
+        cnt = hueLocalStorage('jHueGenericAutocompleteTooltip') + 1;
       }
-      $.totalStorage('jHueGenericAutocompleteTooltip', cnt);
+      hueLocalStorage('jHueGenericAutocompleteTooltip', cnt);
       if (cnt >= self.options.smartTooltipThreshold) {
         $el
           .tooltip({
@@ -166,7 +166,7 @@ Plugin.prototype.init = function () {
         window.setTimeout(() => {
           $el.tooltip('hide');
         }, 10000);
-        $.totalStorage('jHueGenericAutocompleteTooltip', -1);
+        hueLocalStorage('jHueGenericAutocompleteTooltip', -1);
       }
     }
   }

+ 1 - 1
desktop/core/src/desktop/js/ko/bindings/ace/aceLocationHandler.js

@@ -785,7 +785,7 @@ class AceLocationHandler {
         return;
       }
 
-      const suppressedRules = window.apiHelper.getFromTotalStorage(
+      const suppressedRules = window.apiHelper.getFromLocalStorage(
         'hue.syntax.checker',
         'suppressedRules',
         {}

+ 12 - 12
desktop/core/src/desktop/js/ko/bindings/ace/ko.aceEditor.js

@@ -96,7 +96,7 @@ registerBinding(NAME, {
 
     editor.session.setMode(snippet.getAceMode());
     editor.setOptions({
-      fontSize: apiHelper.getFromTotalStorage(
+      fontSize: apiHelper.getFromLocalStorage(
         'hue.ace',
         'fontSize',
         navigator.platform && navigator.platform.toLowerCase().indexOf('linux') > -1
@@ -152,7 +152,7 @@ registerBinding(NAME, {
       aceErrorsSub.dispose();
     });
 
-    let darkThemeEnabled = apiHelper.getFromTotalStorage('ace', 'dark.theme.enabled', false);
+    let darkThemeEnabled = apiHelper.getFromLocalStorage('ace', 'dark.theme.enabled', false);
     editor.setTheme(darkThemeEnabled ? 'ace/theme/hue_dark' : 'ace/theme/hue');
 
     const editorOptions = {
@@ -174,7 +174,7 @@ registerBinding(NAME, {
     editor.customMenuOptions = {
       setEnableDarkTheme: function (enabled) {
         darkThemeEnabled = enabled;
-        apiHelper.setInTotalStorage('ace', 'dark.theme.enabled', darkThemeEnabled);
+        apiHelper.setInLocalStorage('ace', 'dark.theme.enabled', darkThemeEnabled);
         editor.setTheme(darkThemeEnabled ? 'ace/theme/hue_dark' : 'ace/theme/hue');
       },
       getEnableDarkTheme: function () {
@@ -182,7 +182,7 @@ registerBinding(NAME, {
       },
       setEnableAutocompleter: function (enabled) {
         editor.setOption('enableBasicAutocompletion', enabled);
-        apiHelper.setInTotalStorage('hue.ace', 'enableBasicAutocompletion', enabled);
+        apiHelper.setInLocalStorage('hue.ace', 'enableBasicAutocompletion', enabled);
         const $enableLiveAutocompletionChecked = $('#setEnableLiveAutocompletion:checked');
         const $setEnableLiveAutocompletion = $('#setEnableLiveAutocompletion');
         if (enabled && $enableLiveAutocompletionChecked.length === 0) {
@@ -196,7 +196,7 @@ registerBinding(NAME, {
       },
       setEnableLiveAutocompletion: function (enabled) {
         editor.setOption('enableLiveAutocompletion', enabled);
-        apiHelper.setInTotalStorage('hue.ace', 'enableLiveAutocompletion', enabled);
+        apiHelper.setInLocalStorage('hue.ace', 'enableLiveAutocompletion', enabled);
         if (enabled && $('#setEnableAutocompleter:checked').length === 0) {
           $('#setEnableAutocompleter').trigger('click');
         }
@@ -209,7 +209,7 @@ registerBinding(NAME, {
           size += 'px';
         }
         editor.setOption('fontSize', size);
-        apiHelper.setInTotalStorage('hue.ace', 'fontSize', size);
+        apiHelper.setInLocalStorage('hue.ace', 'fontSize', size);
       },
       getFontSize: function () {
         let size = editor.getOption('fontSize');
@@ -221,7 +221,7 @@ registerBinding(NAME, {
     };
 
     if (window.ENABLE_SQL_SYNTAX_CHECK && window.Worker) {
-      let errorHighlightingEnabled = apiHelper.getFromTotalStorage(
+      let errorHighlightingEnabled = apiHelper.getFromLocalStorage(
         'hue.ace',
         'errorHighlightingEnabled',
         true
@@ -233,7 +233,7 @@ registerBinding(NAME, {
 
       editor.customMenuOptions.setErrorHighlighting = function (enabled) {
         errorHighlightingEnabled = enabled;
-        apiHelper.setInTotalStorage('hue.ace', 'errorHighlightingEnabled', enabled);
+        apiHelper.setInLocalStorage('hue.ace', 'errorHighlightingEnabled', enabled);
         if (enabled) {
           aceLocationHandler.attachSqlSyntaxWorker();
         } else {
@@ -244,7 +244,7 @@ registerBinding(NAME, {
         return errorHighlightingEnabled;
       };
       editor.customMenuOptions.setClearIgnoredSyntaxChecks = function () {
-        apiHelper.setInTotalStorage('hue.syntax.checker', 'suppressedRules', {});
+        apiHelper.setInLocalStorage('hue.syntax.checker', 'suppressedRules', {});
         $('#setClearIgnoredSyntaxChecks')
           .hide()
           .before('<div style="margin-top:5px;float:right;">done</div>');
@@ -256,13 +256,13 @@ registerBinding(NAME, {
 
     $.extend(editorOptions, aceOptions);
 
-    editorOptions['enableBasicAutocompletion'] = apiHelper.getFromTotalStorage(
+    editorOptions['enableBasicAutocompletion'] = apiHelper.getFromLocalStorage(
       'hue.ace',
       'enableBasicAutocompletion',
       true
     );
     if (editorOptions['enableBasicAutocompletion']) {
-      editorOptions['enableLiveAutocompletion'] = apiHelper.getFromTotalStorage(
+      editorOptions['enableLiveAutocompletion'] = apiHelper.getFromLocalStorage(
         'hue.ace',
         'enableLiveAutocompletion',
         true
@@ -500,7 +500,7 @@ registerBinding(NAME, {
       bindKey: { win: 'Ctrl-Alt-t', mac: 'Command-Alt-t' },
       exec: function () {
         darkThemeEnabled = !darkThemeEnabled;
-        apiHelper.setInTotalStorage('ace', 'dark.theme.enabled', darkThemeEnabled);
+        apiHelper.setInLocalStorage('ace', 'dark.theme.enabled', darkThemeEnabled);
         editor.setTheme(darkThemeEnabled ? 'ace/theme/hue_dark' : 'ace/theme/hue');
       }
     });

+ 4 - 3
desktop/core/src/desktop/js/ko/bindings/ace/ko.aceResizer.js

@@ -18,6 +18,7 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 
 import huePubSub from 'utils/huePubSub';
+import { hueLocalStorage } from 'utils/hueUtils';
 
 ko.bindingHandlers.aceResizer = {
   init: function (element, valueAccessor) {
@@ -29,7 +30,7 @@ ko.bindingHandlers.aceResizer = {
     const $execStatus = $resizer.prev('.snippet-execution-status');
     const $variables = $resizer.siblings('.snippet-row').find('.variables');
 
-    let lastEditorSize = $.totalStorage('hue.editor.editor.size') || 131;
+    let lastEditorSize = hueLocalStorage('hue.editor.editor.size') || 131;
     let editorHeight = Math.floor(lastEditorSize / 16);
     $target.height(lastEditorSize);
     let autoExpand =
@@ -51,7 +52,7 @@ ko.bindingHandlers.aceResizer = {
           $target.height(
             Math.max(
               ace().session.getLength() * 16,
-              $.totalStorage('hue.editor.editor.size') || 131
+              hueLocalStorage('hue.editor.editor.size') || 131
             )
           );
           resized = true;
@@ -97,7 +98,7 @@ ko.bindingHandlers.aceResizer = {
       stop: function (event, ui) {
         ui.offset.top = 0;
         ui.position.top = 0;
-        $.totalStorage('hue.editor.editor.size', $target.height());
+        hueLocalStorage('hue.editor.editor.size', $target.height());
         huePubSub.publish('redraw.fixed.headers');
         $(document).trigger('editorSizeChanged');
       }

+ 2 - 2
desktop/core/src/desktop/js/ko/bindings/ko.assistVerticalResizer.js

@@ -85,7 +85,7 @@ ko.bindingHandlers.assistVerticalResizer = {
       return;
     }
 
-    const panelRatios = apiHelper.getFromTotalStorage('assist', 'innerPanelRatios', {});
+    const panelRatios = apiHelper.getFromLocalStorage('assist', 'innerPanelRatios', {});
 
     let totalRatios = 0;
     $.each($allPanels, (idx, panel) => {
@@ -253,7 +253,7 @@ ko.bindingHandlers.assistVerticalResizer = {
             panelRatios[panelDefinitions()[idx].type] =
               $(panel).outerHeight(true) / totalHeightForPanels;
           });
-          apiHelper.setInTotalStorage('assist', 'innerPanelRatios', panelRatios);
+          apiHelper.setInLocalStorage('assist', 'innerPanelRatios', panelRatios);
         }
       });
     });

+ 2 - 1
desktop/core/src/desktop/js/ko/bindings/ko.highlight.js

@@ -16,6 +16,7 @@
 
 import $ from 'jquery';
 import * as ko from 'knockout';
+import { hueLocalStorage } from 'utils/hueUtils';
 
 // TODO: Depends on Ace
 
@@ -58,7 +59,7 @@ ko.bindingHandlers.highlight = {
             Rules = impalaRules.ImpalaHighlightRules;
           }
 
-          config.loadModule(['theme', $.totalStorage('hue.ace.theme') || 'ace/theme/hue']);
+          config.loadModule(['theme', hueLocalStorage('hue.ace.theme') || 'ace/theme/hue']);
 
           const Text = text.Text;
 

+ 3 - 2
desktop/core/src/desktop/js/ko/bindings/ko.logResizer.js

@@ -16,6 +16,7 @@
 
 import $ from 'jquery';
 import * as ko from 'knockout';
+import { hueLocalStorage } from 'utils/hueUtils';
 
 ko.bindingHandlers.logResizer = {
   init: function (element, valueAccessor) {
@@ -26,7 +27,7 @@ ko.bindingHandlers.logResizer = {
       onStart = options.onStart,
       onResize = options.onResize;
 
-    const initialHeight = $.totalStorage('hue.editor.logs.size') || 80;
+    const initialHeight = hueLocalStorage('hue.editor.logs.size') || 80;
 
     window.setTimeout(() => {
       $target.css('height', initialHeight + 'px');
@@ -44,7 +45,7 @@ ko.bindingHandlers.logResizer = {
         if (options.minHeight && currentHeight < options.minHeight) {
           currentHeight = options.minHeight;
         }
-        $.totalStorage('hue.editor.logs.size', currentHeight);
+        hueLocalStorage('hue.editor.logs.size', currentHeight);
         $target.css('height', currentHeight + 'px');
         ui.offset.top = 0;
         ui.position.top = 0;

+ 2 - 1
desktop/core/src/desktop/js/ko/bindings/ko.readOnlyAce.js

@@ -16,6 +16,7 @@
 
 import $ from 'jquery';
 import * as ko from 'knockout';
+import { hueLocalStorage } from 'utils/hueUtils';
 
 // TODO: Depends on Ace
 
@@ -29,7 +30,7 @@ ko.bindingHandlers.readOnlyAce = {
       readOnly: true,
       maxLines: Infinity
     });
-    editor.setTheme($.totalStorage('hue.ace.theme') || 'ace/theme/hue');
+    editor.setTheme(hueLocalStorage('hue.ace.theme') || 'ace/theme/hue');
     $(element).data('aceEditor', editor);
   },
   update: function (element, valueAccessor, allBindingsAccessor) {

+ 7 - 6
desktop/core/src/desktop/js/ko/bindings/ko.splitDraggable.js

@@ -18,17 +18,18 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 
 import huePubSub from 'utils/huePubSub';
+import { hueLocalStorage } from 'utils/hueUtils';
 
 ko.bindingHandlers.splitDraggable = {
   init: function (element, valueAccessor) {
     const options = ko.unwrap(valueAccessor());
     let leftPanelWidth =
-      $.totalStorage(options.appName + '_left_panel_width') != null
-        ? Math.max($.totalStorage(options.appName + '_left_panel_width'), 250)
+      hueLocalStorage(options.appName + '_left_panel_width') != null
+        ? Math.max(hueLocalStorage(options.appName + '_left_panel_width'), 250)
         : 250;
     let rightPanelWidth =
-      $.totalStorage(options.appName + '_right_panel_width') != null
-        ? Math.max($.totalStorage(options.appName + '_right_panel_width'), 250)
+      hueLocalStorage(options.appName + '_right_panel_width') != null
+        ? Math.max(hueLocalStorage(options.appName + '_right_panel_width'), 250)
         : 290;
 
     const containerSelector = options.containerSelector || '.panel-container';
@@ -154,9 +155,9 @@ ko.bindingHandlers.splitDraggable = {
       },
       stop: function () {
         if (isRightPanel) {
-          $.totalStorage(options.appName + '_right_panel_width', rightPanelWidth);
+          hueLocalStorage(options.appName + '_right_panel_width', rightPanelWidth);
         } else {
-          $.totalStorage(options.appName + '_left_panel_width', leftPanelWidth);
+          hueLocalStorage(options.appName + '_left_panel_width', leftPanelWidth);
         }
         window.setTimeout(positionPanels, 100);
         huePubSub.publish('split.panel.resized');

+ 4 - 3
desktop/core/src/desktop/js/ko/bindings/ko.splitFlexDraggable.js

@@ -18,13 +18,14 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 
 import huePubSub from 'utils/huePubSub';
+import { hueLocalStorage } from 'utils/hueUtils';
 
 ko.bindingHandlers.splitFlexDraggable = {
   init: function (element, valueAccessor) {
     const options = ko.unwrap(valueAccessor());
     let sidePanelWidth =
-      $.totalStorage(options.appName + '_' + options.orientation + '_panel_width') != null
-        ? $.totalStorage(options.appName + '_' + options.orientation + '_panel_width')
+      hueLocalStorage(options.appName + '_' + options.orientation + '_panel_width') != null
+        ? hueLocalStorage(options.appName + '_' + options.orientation + '_panel_width')
         : 290;
 
     const $resizer = $(element);
@@ -56,7 +57,7 @@ ko.bindingHandlers.splitFlexDraggable = {
       },
       stop: function () {
         sidePanelWidth = $sidePanel.width();
-        $.totalStorage(
+        hueLocalStorage(
           options.appName + '_' + options.orientation + '_panel_width',
           sidePanelWidth
         );

+ 3 - 3
desktop/core/src/desktop/js/ko/components/assist/assistDbNamespace.js

@@ -156,7 +156,7 @@ class AssistDbNamespace {
         }
         if (!self.navigationSettings.rightAssist) {
           const entry = self.selectedDatabase().catalogEntry;
-          apiHelper.setInTotalStorage(
+          apiHelper.setInLocalStorage(
             'assist_' + entry.getConnector().id + '_' + entry.namespace.id,
             'lastSelectedDb',
             entry.name
@@ -164,7 +164,7 @@ class AssistDbNamespace {
           huePubSub.publish('assist.database.set', entry);
         }
       } else {
-        apiHelper.setInTotalStorage(
+        apiHelper.setInLocalStorage(
           'assist_' + self.connector.id + '_' + self.namespace.id,
           'lastSelectedDb',
           ''
@@ -189,7 +189,7 @@ class AssistDbNamespace {
         self.selectedDatabaseChanged();
         return;
       }
-      let lastSelectedDb = apiHelper.getFromTotalStorage(
+      let lastSelectedDb = apiHelper.getFromLocalStorage(
         'assist_' + self.sourceType + '_' + self.namespace.id,
         'lastSelectedDb'
       );

+ 2 - 2
desktop/core/src/desktop/js/ko/components/assist/assistDbSource.js

@@ -47,10 +47,10 @@ class AssistDbSource {
     self.navigationSettings = options.navigationSettings;
     self.initialNamespace =
       options.initialNamespace ||
-      apiHelper.getFromTotalStorage('contextSelector', 'lastSelectedNamespace');
+      apiHelper.getFromLocalStorage('contextSelector', 'lastSelectedNamespace');
     self.initialCompute =
       options.initialCompute ||
-      apiHelper.getFromTotalStorage('contextSelector', 'lastSelectedCompute');
+      apiHelper.getFromLocalStorage('contextSelector', 'lastSelectedCompute');
 
     self.selectedNamespace = ko.observable();
     self.namespaces = ko.observableArray();

+ 1 - 1
desktop/core/src/desktop/js/ko/components/assist/assistInnerPanel.js

@@ -40,7 +40,7 @@ class AssistInnerPanel {
     self.iconSvg = options.iconSvg;
 
     self.visible = ko.observable(options.visible || true);
-    apiHelper.withTotalStorage(
+    apiHelper.withLocalStorage(
       'assist',
       'showingPanel_' + self.type,
       self.visible,

+ 4 - 4
desktop/core/src/desktop/js/ko/components/assist/ko.assistDbPanel.js

@@ -675,7 +675,7 @@ class AssistDbPanel {
                     assistDbSource.selectedNamespace().selectedDatabase().catalogEntry
                   );
                 } else {
-                  let lastSelectedDb = apiHelper.getFromTotalStorage(
+                  let lastSelectedDb = apiHelper.getFromLocalStorage(
                     'assist_' +
                       connector.id +
                       '_' +
@@ -732,9 +732,9 @@ class AssistDbPanel {
           if (newSource.namespaces().length === 0) {
             newSource.loadNamespaces();
           }
-          apiHelper.setInTotalStorage('assist', 'lastSelectedSource', newSource.sourceType);
+          apiHelper.setInLocalStorage('assist', 'lastSelectedSource', newSource.sourceType);
         } else {
-          apiHelper.setInTotalStorage('assist', 'lastSelectedSource');
+          apiHelper.setInLocalStorage('assist', 'lastSelectedSource');
         }
       });
     }
@@ -855,7 +855,7 @@ class AssistDbPanel {
 
       if (sources.indexOf(this.selectedSource()) === -1) {
         if (sources.length) {
-          const storageSourceType = apiHelper.getFromTotalStorage('assist', 'lastSelectedSource');
+          const storageSourceType = apiHelper.getFromLocalStorage('assist', 'lastSelectedSource');
           this.selectedSource(this.sourceIndex[storageSourceType] || sources[0]);
         } else {
           this.selectedSource(undefined);

+ 4 - 4
desktop/core/src/desktop/js/ko/components/assist/ko.assistDocumentsPanel.js

@@ -253,7 +253,7 @@ class AssistDocumentsPanel {
 
     self.highlightTypeFilter = ko.observable(false);
 
-    const lastOpenedUuid = apiHelper.getFromTotalStorage('assist', 'last.opened.assist.doc.uuid');
+    const lastOpenedUuid = apiHelper.getFromLocalStorage('assist', 'last.opened.assist.doc.uuid');
 
     if (lastOpenedUuid) {
       self.activeEntry(
@@ -283,7 +283,7 @@ class AssistDocumentsPanel {
             newEntry.definition() &&
             newEntry.definition().uuid
           ) {
-            apiHelper.setInTotalStorage(
+            apiHelper.setInLocalStorage(
               'assist',
               'last.opened.assist.doc.uuid',
               newEntry.definition().uuid
@@ -292,7 +292,7 @@ class AssistDocumentsPanel {
           loadedSub.dispose();
         });
       } else if (!newEntry.hasErrors() && newEntry.definition() && newEntry.definition().uuid) {
-        apiHelper.setInTotalStorage(
+        apiHelper.setInLocalStorage(
           'assist',
           'last.opened.assist.doc.uuid',
           newEntry.definition().uuid
@@ -396,7 +396,7 @@ class AssistDocumentsPanel {
       (self.activeEntry().definition() &&
         (self.activeEntry().definition().path !== '/' || self.activeEntry().definition().uuid))
     ) {
-      apiHelper.setInTotalStorage('assist', 'last.opened.assist.doc.uuid', null);
+      apiHelper.setInLocalStorage('assist', 'last.opened.assist.doc.uuid', null);
       self.activeEntry(
         new HueFileEntry({
           activeEntry: self.activeEntry,

+ 2 - 2
desktop/core/src/desktop/js/ko/components/assist/ko.assistFunctionsPanel.js

@@ -268,7 +268,7 @@ class AssistFunctionsPanel {
 
     this.activeConnectorUdfs.subscribe(async activeConnectorUdfs => {
       await activeConnectorUdfs.init();
-      apiHelper.setInTotalStorage(
+      apiHelper.setInLocalStorage(
         'assist',
         'function.panel.active.connector.type',
         activeConnectorUdfs.connector.type
@@ -293,7 +293,7 @@ class AssistFunctionsPanel {
     const configUpdated = () => {
       const lastActiveConnectorType =
         (this.activeConnector() && this.activeConnector().type) ||
-        apiHelper.getFromTotalStorage('assist', 'function.panel.active.connector.type');
+        apiHelper.getFromLocalStorage('assist', 'function.panel.active.connector.type');
 
       const availableConnectorUdfs = filterEditorConnectors(hasUdfCategories).map(
         connector => new ConnectorUdfCategories(connector)

+ 2 - 2
desktop/core/src/desktop/js/ko/components/assist/ko.assistGitPanel.js

@@ -95,7 +95,7 @@ class AssistGitPanel {
 
     self.selectedGitEntry = ko.observable();
     self.reload = function () {
-      const lastKnownPath = apiHelper.getFromTotalStorage(
+      const lastKnownPath = apiHelper.getFromLocalStorage(
         'assist',
         'currentGitPath',
         window.USER_HOME_DIR
@@ -119,7 +119,7 @@ class AssistGitPanel {
 
     huePubSub.subscribe('assist.selectGitEntry', entry => {
       self.selectedGitEntry(entry);
-      apiHelper.setInTotalStorage('assist', 'currentGitPath', entry.path);
+      apiHelper.setInLocalStorage('assist', 'currentGitPath', entry.path);
     });
 
     huePubSub.subscribe('assist.git.refresh', () => {

+ 2 - 2
desktop/core/src/desktop/js/ko/components/assist/ko.assistHBasePanel.js

@@ -117,7 +117,7 @@ class AssistHBasePanel {
     self.reload = () => {
       self.selectedHBaseEntry(root);
       root.loadEntries(() => {
-        const lastOpenendPath = apiHelper.getFromTotalStorage(
+        const lastOpenendPath = apiHelper.getFromLocalStorage(
           'assist',
           'last.opened.hbase.entry',
           null
@@ -136,7 +136,7 @@ class AssistHBasePanel {
 
     self.selectedHBaseEntry.subscribe(newEntry => {
       if (newEntry !== root || (newEntry === root && newEntry.loaded)) {
-        apiHelper.setInTotalStorage('assist', 'last.opened.hbase.entry', newEntry.path);
+        apiHelper.setInLocalStorage('assist', 'last.opened.hbase.entry', newEntry.path);
       }
     });
 

+ 1 - 1
desktop/core/src/desktop/js/ko/components/assist/ko.assistPanel.js

@@ -92,7 +92,7 @@ class AssistPanel {
     self.visiblePanel = ko.observable();
 
     self.lastOpenPanelType = ko.observable();
-    apiHelper.withTotalStorage('assist', 'last.open.panel', self.lastOpenPanelType);
+    apiHelper.withLocalStorage('assist', 'last.open.panel', self.lastOpenPanelType);
 
     // TODO: Support dynamic config changes
     huePubSub.publish(GET_KNOWN_CONFIG_EVENT, clusterConfig => {

+ 5 - 5
desktop/core/src/desktop/js/ko/components/assist/ko.assistStoragePanel.js

@@ -184,7 +184,7 @@ class AssistStoragePanel {
   constructor(options) {
     this.sources = ko.observableArray(options.sources);
 
-    const lastSourceType = apiHelper.getFromTotalStorage('assist', 'lastStorageSource', 'hdfs');
+    const lastSourceType = apiHelper.getFromLocalStorage('assist', 'lastStorageSource', 'hdfs');
 
     let foundLastSource = this.sources().find(source => source.type === lastSourceType);
 
@@ -202,7 +202,7 @@ class AssistStoragePanel {
     this.activeSource.subscribe(newValue => {
       if (newValue) {
         this.rootPath = getRootFilePath(this.activeSource());
-        apiHelper.setInTotalStorage('assist', 'lastStorageSource', newValue.type);
+        apiHelper.setInLocalStorage('assist', 'lastStorageSource', newValue.type);
         this.selectedStorageEntry(undefined);
         this.reload();
       }
@@ -210,7 +210,7 @@ class AssistStoragePanel {
 
     huePubSub.subscribe('assist.selectStorageEntry', entry => {
       this.selectedStorageEntry(entry);
-      apiHelper.setInTotalStorage('assist', 'currentStoragePath_' + entry.source.type, entry.path);
+      apiHelper.setInLocalStorage('assist', 'currentStoragePath_' + entry.source.type, entry.path);
     });
 
     huePubSub.subscribe('assist.storage.refresh', () => {
@@ -224,7 +224,7 @@ class AssistStoragePanel {
           ? '/'
           : window.USER_HOME_DIR;
       this.loadPath(path);
-      apiHelper.setInTotalStorage('assist', 'currentStoragePath_' + this.activeSource().type, path);
+      apiHelper.setInLocalStorage('assist', 'currentStoragePath_' + this.activeSource().type, path);
     });
 
     this.init();
@@ -258,7 +258,7 @@ class AssistStoragePanel {
 
   reload() {
     this.loadPath(
-      apiHelper.getFromTotalStorage(
+      apiHelper.getFromLocalStorage(
         'assist',
         'currentStoragePath_' + this.activeSource().type,
         this.activeSource().type === 'hdfs' ? window.USER_HOME_DIR : '/'

+ 2 - 2
desktop/core/src/desktop/js/ko/components/assist/ko.rightAssistPanel.js

@@ -132,13 +132,13 @@ class RightAssistPanel {
     );
     this.schedulesTabAvailable = ko.observable(false);
 
-    this.lastActiveTabEditor = apiHelper.withTotalStorage(
+    this.lastActiveTabEditor = apiHelper.withLocalStorage(
       'assist',
       'last.open.right.panel',
       ko.observable(),
       EDITOR_ASSISTANT_TAB
     );
-    this.lastActiveTabDashboard = apiHelper.withTotalStorage(
+    this.lastActiveTabDashboard = apiHelper.withLocalStorage(
       'assist',
       'last.open.right.panel.dashboard',
       ko.observable(),

+ 1 - 1
desktop/core/src/desktop/js/ko/components/contextPopover/ko.contextPopover.js

@@ -569,7 +569,7 @@ class ContextPopoverViewModel {
     self.left = ko.observable(0);
     self.top = ko.observable(0);
 
-    const popoverSize = apiHelper.getFromTotalStorage('assist', 'popover.size', {
+    const popoverSize = apiHelper.getFromLocalStorage('assist', 'popover.size', {
       width: 450,
       height: 400
     });

+ 1 - 1
desktop/core/src/desktop/js/ko/components/contextPopover/resizeHelper.js

@@ -68,7 +68,7 @@ class ResizeHelper {
     initOriginalValues(0);
 
     self.saveSize = function () {
-      apiHelper.setInTotalStorage('assist', 'popover.size', {
+      apiHelper.setInLocalStorage('assist', 'popover.size', {
         width: $('.hue-popover').width(),
         height: $('.hue-popover').height()
       });

+ 12 - 12
desktop/core/src/desktop/js/ko/components/ko.contextSelector.js

@@ -104,7 +104,7 @@ const TYPES_INDEX = {
     hide: 'hideClusters',
     lastPromise: 'lastClustersPromise',
     contextCatalogFn: 'getClusters',
-    totalStorageId: 'lastSelectedCluster',
+    localStorageId: 'lastSelectedCluster',
     onSelect: 'onClusterSelect'
   },
   compute: {
@@ -114,7 +114,7 @@ const TYPES_INDEX = {
     hide: 'hideComputes',
     lastPromise: 'lastComputesPromise',
     contextCatalogFn: 'getComputes',
-    totalStorageId: 'lastSelectedCompute',
+    localStorageId: 'lastSelectedCompute',
     onSelect: 'onComputeSelect'
   },
   namespace: {
@@ -124,7 +124,7 @@ const TYPES_INDEX = {
     hide: 'hideNamespaces',
     lastPromise: 'lastNamespacesPromise',
     contextCatalogFn: 'getNamespaces',
-    totalStorageId: 'lastSelectedNamespace',
+    localStorageId: 'lastSelectedNamespace',
     onSelect: 'onNamespaceSelect'
   }
 };
@@ -193,7 +193,7 @@ const HueContextSelector = function (params) {
       if (params[type.onSelect]) {
         params[type.onSelect](selectedVal, previousVal);
       }
-      apiHelper.setInTotalStorage('contextSelector', type.totalStorageId, selectedVal);
+      apiHelper.setInLocalStorage('contextSelector', type.localStorageId, selectedVal);
 
       if (selectedVal && type === TYPES_INDEX.compute) {
         self.setMatchingNamespace(selectedVal);
@@ -274,9 +274,9 @@ HueContextSelector.prototype.setMatchingNamespace = function (compute) {
         const found = self[TYPES_INDEX.namespace.available]().some(namespace => {
           if (compute.namespace === namespace.id) {
             self[TYPES_INDEX.namespace.name](namespace);
-            apiHelper.setInTotalStorage(
+            apiHelper.setInLocalStorage(
               'contextSelector',
-              TYPES_INDEX.namespace.totalStorageId,
+              TYPES_INDEX.namespace.localStorageId,
               namespace
             );
             return true;
@@ -306,9 +306,9 @@ HueContextSelector.prototype.setMatchingCompute = function (namespace) {
         const found = self[TYPES_INDEX.compute.available]().some(compute => {
           if (namespace.id === compute.namespace) {
             self[TYPES_INDEX.compute.name](compute);
-            apiHelper.setInTotalStorage(
+            apiHelper.setInLocalStorage(
               'contextSelector',
-              TYPES_INDEX.compute.totalStorageId,
+              TYPES_INDEX.compute.localStorageId,
               namespace
             );
             return true;
@@ -360,11 +360,11 @@ HueContextSelector.prototype.reload = function (type) {
 
         if (
           !self[type.name]() &&
-          apiHelper.getFromTotalStorage('contextSelector', type.totalStorageId)
+          apiHelper.getFromLocalStorage('contextSelector', type.localStorageId)
         ) {
-          const lastSelected = apiHelper.getFromTotalStorage(
+          const lastSelected = apiHelper.getFromLocalStorage(
             'contextSelector',
-            type.totalStorageId
+            type.localStorageId
           );
           const found = available.some(other => {
             if (other.id === lastSelected.id) {
@@ -441,7 +441,7 @@ HueContextSelector.prototype.reloadDatabases = function () {
                   self.availableDatabases([]);
                 })
                 .always(() => {
-                  let lastSelectedDb = apiHelper.getFromTotalStorage(
+                  let lastSelectedDb = apiHelper.getFromLocalStorage(
                     'assist_' +
                       ko.unwrap(self.connector).id +
                       '_' +

+ 7 - 7
desktop/core/src/desktop/js/ko/components/ko.performanceGraph.js

@@ -75,7 +75,7 @@ class PerformanceGraph {
 
     self.selectedGranularity = ko.observable(
       self.availableGranularities[
-        apiHelper.getFromTotalStorage('warehouses', 'performanceGraphGranularity', 0)
+        apiHelper.getFromLocalStorage('warehouses', 'performanceGraphGranularity', 0)
       ]
     );
     self.clusterName = ko.observable(params.clusterName);
@@ -101,7 +101,7 @@ class PerformanceGraph {
         self.selectedGranularity.subscribe(granularity => {
           for (let i = 0; i < self.availableGranularities.length; i++) {
             if (granularity === self.availableGranularities[i]) {
-              apiHelper.setInTotalStorage('warehouses', 'performanceGraphGranularity', i);
+              apiHelper.setInLocalStorage('warehouses', 'performanceGraphGranularity', i);
               break;
             }
           }
@@ -335,7 +335,7 @@ class PerformanceGraph {
         tooltip: options.tooltip,
         toggle: function () {
           enabled = !enabled;
-          apiHelper.setInTotalStorage('warehouses', options.id + 'GraphEnabled', enabled);
+          apiHelper.setInLocalStorage('warehouses', options.id + 'GraphEnabled', enabled);
           mainGroup
             .select('.highlight-point-' + options.id)
             .style('display', enabled ? null : 'none');
@@ -389,7 +389,7 @@ class PerformanceGraph {
       createLineGraph({
         id: 'queries',
         label: I18n('Queries'),
-        enabled: apiHelper.getFromTotalStorage('warehouses', 'queriesGraphEnabled', true),
+        enabled: apiHelper.getFromLocalStorage('warehouses', 'queriesGraphEnabled', true),
         color: '#A9DBF1',
         subLineColor: '#DCDCDC',
         area: true,
@@ -418,7 +418,7 @@ class PerformanceGraph {
       }),
       createLineGraph({
         id: 'cpu',
-        enabled: apiHelper.getFromTotalStorage('warehouses', 'cpuGraphEnabled', false),
+        enabled: apiHelper.getFromLocalStorage('warehouses', 'cpuGraphEnabled', false),
         label: I18n('CPU'),
         color: '#654C94',
         subLine: true,
@@ -434,7 +434,7 @@ class PerformanceGraph {
       }),
       createLineGraph({
         id: 'memory',
-        enabled: apiHelper.getFromTotalStorage('warehouses', 'memoryGraphEnabled', false),
+        enabled: apiHelper.getFromLocalStorage('warehouses', 'memoryGraphEnabled', false),
         label: I18n('Memory'),
         color: '#83C1B9',
         subLine: true,
@@ -450,7 +450,7 @@ class PerformanceGraph {
       }),
       createLineGraph({
         id: 'io',
-        enabled: apiHelper.getFromTotalStorage('warehouses', 'ioGraphEnabled', false),
+        enabled: apiHelper.getFromLocalStorage('warehouses', 'ioGraphEnabled', false),
         label: I18n('IO'),
         color: '#D4965E',
         subLine: true,

+ 1 - 1
desktop/core/src/desktop/js/ko/components/ko.sidebar.js

@@ -267,7 +267,7 @@ class Sidebar {
       }
     });
 
-    apiHelper.withTotalStorage('hue.sidebar', 'collabse', this.collapsed, true);
+    apiHelper.withLocalStorage('hue.sidebar', 'collabse', this.collapsed, true);
 
     this.items = ko.observableArray();
 

+ 3 - 3
desktop/core/src/desktop/js/ko/components/simpleAceEditor/ko.simpleAceEditor.js

@@ -20,7 +20,7 @@ import ace from 'ext/aceHelper';
 
 import AceLocationHandler from 'ko/bindings/ace/aceLocationHandler';
 import componentUtils from 'ko/components/componentUtils';
-import hueUtils from 'utils/hueUtils';
+import { hueLocalStorage, UUID } from 'utils/hueUtils';
 import huePubSub from 'utils/huePubSub';
 import SolrFormulaAutocompleter from './solrFormulaAutocompleter';
 import SolrQueryAutocompleter from './solrQueryAutocompleter';
@@ -74,7 +74,7 @@ class SimpleAceEditor {
     let aceOptions = params.aceOptions || {};
 
     if (!$element.attr('id')) {
-      $element.attr('id', hueUtils.UUID());
+      $element.attr('id', UUID());
     }
 
     const editor = ace.edit($element.find('.ace-editor')[0]);
@@ -82,7 +82,7 @@ class SimpleAceEditor {
       editor.getSession().setMode('ace/mode/' + ko.unwrap(params.mode));
     }
     editor.$blockScrolling = Infinity;
-    editor.setTheme($.totalStorage('hue.ace.theme') || 'ace/theme/hue');
+    editor.setTheme(hueLocalStorage('hue.ace.theme') || 'ace/theme/hue');
     self.ace(editor);
 
     if (params.activeExecutable) {

+ 4 - 4
desktop/core/src/desktop/js/sidePanelViewModel.js

@@ -28,11 +28,11 @@ class SidePanelViewModel {
     const self = this;
     self.assistWithoutStorage = ko.observable(false);
     self.leftAssistVisible = ko.observable(
-      apiHelper.getFromTotalStorage('assist', 'left_assist_panel_visible', true)
+      apiHelper.getFromLocalStorage('assist', 'left_assist_panel_visible', true)
     );
     self.leftAssistVisible.subscribe(val => {
       if (!self.assistWithoutStorage()) {
-        apiHelper.setInTotalStorage('assist', 'left_assist_panel_visible', val);
+        apiHelper.setInLocalStorage('assist', 'left_assist_panel_visible', val);
       }
       hueAnalytics.convert('hue', 'leftAssistVisible/' + val);
       window.setTimeout(() => {
@@ -42,11 +42,11 @@ class SidePanelViewModel {
     });
 
     self.rightAssistVisible = ko.observable(
-      apiHelper.getFromTotalStorage('assist', 'right_assist_panel_visible', true)
+      apiHelper.getFromLocalStorage('assist', 'right_assist_panel_visible', true)
     );
     self.rightAssistVisible.subscribe(val => {
       if (!self.assistWithoutStorage()) {
-        apiHelper.setInTotalStorage('assist', 'right_assist_panel_visible', val);
+        apiHelper.setInLocalStorage('assist', 'right_assist_panel_visible', val);
       }
       hueAnalytics.convert('hue', 'rightAssistVisible/' + val);
       window.setTimeout(() => {

+ 1 - 1
desktop/core/src/desktop/js/topNavViewModel.js

@@ -32,7 +32,7 @@ class TopNavViewModel {
 
     // TODO: Drop. Just for PoC
     self.pocClusterMode = ko.observable();
-    apiHelper.withTotalStorage('topNav', 'multiCluster', self.pocClusterMode, 'dw');
+    apiHelper.withLocalStorage('topNav', 'multiCluster', self.pocClusterMode, 'dw');
     huePubSub.subscribe('set.multi.cluster.mode', self.pocClusterMode);
 
     self.hasJobBrowser = ko.observable(window.HAS_JOB_BROWSER);

+ 1 - 1
desktop/core/src/desktop/js/utils/hdfsAutocompleter.js

@@ -34,7 +34,7 @@ class HdfsAutocompleter {
     self.timeout = options.timeout;
   }
 
-  getTotalStorageUserPrefix() {
+  getlocalStorageUserPrefix() {
     const self = this;
     return self.user;
   }

+ 2 - 3
desktop/core/src/desktop/js/utils/hdfsAutocompleter.test.js

@@ -16,6 +16,7 @@
 
 import $ from 'jquery';
 import * as ko from 'knockout';
+import * as hueUtilsMock from './hueUtils';
 
 import HdfsAutocompleter from './hdfsAutocompleter';
 describe('hdfsAutocompleter.js', () => {
@@ -37,9 +38,7 @@ describe('hdfsAutocompleter.js', () => {
   };
 
   beforeAll(() => {
-    $.totalStorage = function (key, value) {
-      return null;
-    };
+    jest.spyOn(hueUtilsMock, 'hueLocalStorage').mockImplementation(() => null);
 
     jest.spyOn($, 'ajax').mockImplementation(options => {
       const firstUrlPart = options.url.split('?')[0];

+ 22 - 0
desktop/core/src/desktop/js/utils/hueUtils.ts

@@ -584,6 +584,27 @@ export const defer = async (callback: () => void): Promise<void> => {
   }
 };
 
+export const hueLocalStorage = <T = string>(key: string, value?: T): T | null => {
+  if (window.localStorage) {
+    if (typeof value !== 'undefined') {
+      if (value === null) {
+        window.localStorage.removeItem(key);
+      } else {
+        window.localStorage.setItem(key, JSON.stringify(value));
+      }
+      return value;
+    }
+    const storedValue = window.localStorage.getItem(key);
+    if (storedValue && storedValue.length) {
+      try {
+        return JSON.parse(storedValue);
+      } catch (e) {}
+      return <T>(<unknown>storedValue);
+    }
+  }
+  return null;
+};
+
 export default {
   bootstrapRatios,
   changeURL,
@@ -600,6 +621,7 @@ export default {
   getStyleFromCSSClass,
   goFullScreen,
   highlight,
+  hueLocalStorage,
   html2text,
   htmlEncode,
   isFullScreen,

+ 1 - 1
desktop/core/src/desktop/static/desktop/js/home2.vm.js

@@ -31,7 +31,7 @@ var HomeViewModel = (function () {
     self.apiHelper = window.apiHelper;
     self.isLeftPanelVisible = ko.observable(false);
     // Uncomment to enable the assist panel
-    // self.apiHelper.withTotalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
+    // self.apiHelper.withLocalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
 
     self.sharingEnabled = ko.observable(false);
 

+ 5 - 5
desktop/core/src/desktop/static/desktop/js/jquery.hiveautocomplete.js

@@ -129,12 +129,12 @@
     });
 
     function smartTooltipMaker() {
-      if (self.options.smartTooltip !== "" && typeof $.totalStorage !== "undefined" && $.totalStorage("jHueGenericAutocompleteTooltip") !== -1) {
+      if (self.options.smartTooltip !== "" && hueUtils && hueUtils.hueLocalStorage && hueUtils.hueLocalStorage("jHueGenericAutocompleteTooltip") !== -1) {
         var cnt = 0;
-        if ($.totalStorage("jHueGenericAutocompleteTooltip")) {
-          cnt = $.totalStorage("jHueGenericAutocompleteTooltip") + 1;
+        if (hueUtils.hueLocalStorage("jHueGenericAutocompleteTooltip")) {
+          cnt = hueUtils.hueLocalStorage("jHueGenericAutocompleteTooltip") + 1;
         }
-        $.totalStorage("jHueGenericAutocompleteTooltip", cnt);
+        hueUtils.hueLocalStorage("jHueGenericAutocompleteTooltip", cnt);
         if (cnt >= self.options.smartTooltipThreshold) {
           $el.tooltip({
             animation: true,
@@ -145,7 +145,7 @@
           window.setTimeout(function () {
             $el.tooltip("hide");
           }, 10000);
-          $.totalStorage("jHueGenericAutocompleteTooltip", -1);
+          hueUtils.hueLocalStorage("jHueGenericAutocompleteTooltip", -1);
         }
       }
     }

+ 1 - 1
desktop/core/src/desktop/templates/assist_m.mako

@@ -62,7 +62,7 @@ ${ commonheader_m(_('Assist'), 'assist', user, request) | n,unicode }
       self.apiHelper = window.apiHelper;
       self.assistAvailable = ko.observable(true);
       self.isLeftPanelVisible = ko.observable();
-      self.apiHelper.withTotalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
+      self.apiHelper.withLocalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
 
       self.sqlSourceTypes = [];
       self.availableLanguages = [];

+ 1 - 1
desktop/core/src/desktop/templates/common_header_m.mako

@@ -157,7 +157,7 @@ if USE_NEW_EDITOR.get():
     }
 
     // sets global apiHelper TTL
-    $.totalStorage('hue.cacheable.ttl', ${conf.CUSTOM.CACHEABLE_TTL.get()});
+    hueUtils.hueLocalStorage('hue.cacheable.ttl', ${conf.CUSTOM.CACHEABLE_TTL.get()});
 
     var IDLE_SESSION_TIMEOUT = -1;
 

+ 3 - 3
desktop/core/src/desktop/templates/home.mako

@@ -355,7 +355,7 @@ ${ commonshare() | n,unicode }
 
     viewModel.selectedTag.subscribe(function (value) {
       $("#searchInput").val("");
-      $.totalStorage("hueHomeSelectedTag", value.id());
+      hueUtils.hueLocalStorage("hueHomeSelectedTag", value.id());
     });
 
     function getFirstAvailableDoc() {
@@ -378,8 +378,8 @@ ${ commonshare() | n,unicode }
       return viewModel.history();
     }
 
-    if ($.totalStorage("hueHomeSelectedTag") != null) {
-      var _preselectedTag = viewModel.getTagById($.totalStorage("hueHomeSelectedTag"));
+    if (hueUtils.hueLocalStorage("hueHomeSelectedTag") != null) {
+      var _preselectedTag = viewModel.getTagById(hueUtils.hueLocalStorage("hueHomeSelectedTag"));
       if (_preselectedTag != null) {
         viewModel.filterDocs(_preselectedTag);
       }

+ 2 - 2
desktop/core/src/desktop/templates/sql_syntax_dropdown.mako

@@ -66,9 +66,9 @@ from django.utils.translation import ugettext as _
 
         var selectedSub = self.selected.subscribe(function (newValue) {
           if (typeof newValue.suppressRule !== 'undefined') {
-            var suppressedRules = window.apiHelper.getFromTotalStorage('hue.syntax.checker', 'suppressedRules', {});
+            var suppressedRules = window.apiHelper.getFromLocalStorage('hue.syntax.checker', 'suppressedRules', {});
             suppressedRules[newValue.suppressRule] = true;
-            window.apiHelper.setInTotalStorage('hue.syntax.checker', 'suppressedRules', suppressedRules);
+            window.apiHelper.setInLocalStorage('hue.syntax.checker', 'suppressedRules', suppressedRules);
             huePubSub.publish('editor.refresh.statement.locations', params.editorId);
           } else {
             params.editor.session.replace(params.range, newValue);

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

@@ -2057,7 +2057,7 @@ var SearchViewModel = function (collection_json, query_json, initial_json, has_g
   self.hasNewAdd = ko.observable(!!has_new_add_method);
   self.isQueryBuilder = ko.observable(false);
 
-  if ($.totalStorage('hue.enable.gridster') === false) {
+  if (hueUtils.hueLocalStorage('hue.enable.gridster') === false) {
     self.isGridster(false);
   }
 

+ 1 - 1
desktop/libs/dashboard/src/dashboard/templates/common_search.mako

@@ -5042,7 +5042,7 @@ $(document).ready(function () {
   huePubSub.subscribe('app.dom.unload', function (app) {
     if (app === 'dashboard') {
       %if is_report:
-      if (window.apiHelper.getFromTotalStorage('assist', 'right_assist_panel_visible', false)) {
+      if (window.apiHelper.getFromLocalStorage('assist', 'right_assist_panel_visible', false)) {
         huePubSub.publish('right.assist.show');
       }
       %endif

+ 5 - 5
desktop/libs/indexer/src/indexer/templates/importer.mako

@@ -2031,8 +2031,8 @@ ${ commonheader(_("Importer"), "indexer", user, request, "60px") | n,unicode }
       self.kafkaSelectedTopics.subscribe(function(newValue) {
         if (newValue) {
           viewModel.createWizard.guessFieldTypes();
-          self.kafkaFieldNames($.totalStorage('pai' + '_kafka_topics_' + newValue + '_kafkaFieldNames'));
-          self.kafkaFieldTypes($.totalStorage('pai' + '_kafka_topics_' + newValue + '_kafkaFieldTypes'));
+          self.kafkaFieldNames(hueUtils.hueLocalStorage('pai' + '_kafka_topics_' + newValue + '_kafkaFieldNames'));
+          self.kafkaFieldTypes(hueUtils.hueLocalStorage('pai' + '_kafka_topics_' + newValue + '_kafkaFieldTypes'));
         }
       });
       self.kafkaSchemaManual = ko.observable('detect');
@@ -2040,12 +2040,12 @@ ${ commonheader(_("Importer"), "indexer", user, request, "60px") | n,unicode }
       self.kafkaFieldDelimiter = ko.observable(',');
       self.kafkaFieldNames = ko.observable('');
       self.kafkaFieldNames.subscribe(function(newValue) {
-        $.totalStorage('pai' + '_kafka_topics_' + self.kafkaSelectedTopics() + '_kafkaFieldNames', newValue);
+        hueUtils.hueLocalStorage('pai' + '_kafka_topics_' + self.kafkaSelectedTopics() + '_kafkaFieldNames', newValue);
         viewModel.createWizard.guessFieldTypes();
       });
       self.kafkaFieldTypes = ko.observable('');
       self.kafkaFieldTypes.subscribe(function(newValue) {
-        $.totalStorage('pai' + '_kafka_topics_' + self.kafkaSelectedTopics() + '_kafkaFieldTypes', newValue);
+        hueUtils.hueLocalStorage('pai' + '_kafka_topics_' + self.kafkaSelectedTopics() + '_kafkaFieldTypes', newValue);
         viewModel.createWizard.guessFieldTypes();
       });
       self.kafkaFieldSchemaPath = ko.observable('');
@@ -3061,7 +3061,7 @@ ${ commonheader(_("Importer"), "indexer", user, request, "60px") | n,unicode }
 
       self.assistAvailable = ko.observable(true);
       self.isLeftPanelVisible = ko.observable();
-      self.apiHelper.withTotalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
+      self.apiHelper.withLocalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
       self.loadDefaultField = loadDefaultField;
 
       self.createWizard = new CreateWizard(self);

+ 1 - 1
desktop/libs/indexer/src/indexer/templates/indexer.mako

@@ -923,7 +923,7 @@ ${ commonheader(_("Solr Indexes"), "search", user, request, "60px") | n,unicode
       self.apiHelper = window.apiHelper;
       self.assistAvailable = ko.observable(true);
       self.isLeftPanelVisible = ko.observable();
-      self.apiHelper.withTotalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
+      self.apiHelper.withLocalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
 
       // wizard related
       self.wizardEnabled = ko.observable(false);

+ 1 - 1
desktop/libs/indexer/src/indexer/templates/indexes.mako

@@ -654,7 +654,7 @@ ${ commonheader(_("Index Browser"), "search", user, request, "60px") | n,unicode
       self.assistAvailable = ko.observable(true);
       self.apiHelper = window.apiHelper;
       self.isLeftPanelVisible = ko.observable();
-      self.apiHelper.withTotalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
+      self.apiHelper.withLocalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
 
       self.section = ko.observable('list-indexes');
       self.tab = ko.observable('');

+ 5 - 5
desktop/libs/indexer/src/indexer/templates/topics.mako

@@ -513,13 +513,13 @@ ${ commonheader(_("Streams Browser"), "search", user, request, "60px") | n,unico
 
       // Should come from Kafka Schema or ZooKeeper
       var userPrefix = 'pai';
-      self.kafkaFieldNames = ko.observable($.totalStorage(userPrefix + '_kafka_topics_' + self.name() + '_kafkaFieldNames'));
+      self.kafkaFieldNames = ko.observable(hueUtils.hueLocalStorage(userPrefix + '_kafka_topics_' + self.name() + '_kafkaFieldNames'));
       self.kafkaFieldNames.subscribe(function(newValue) {
-        $.totalStorage(userPrefix + '_kafka_topics_' + self.name() + '_kafkaFieldNames', newValue);
+        hueUtils.hueLocalStorage(userPrefix + '_kafka_topics_' + self.name() + '_kafkaFieldNames', newValue);
       });
-      self.kafkaFieldTypes = ko.observable($.totalStorage(userPrefix + '_kafka_topics_' + self.name() + '_kafkaFieldTypes'));
+      self.kafkaFieldTypes = ko.observable(hueUtils.hueLocalStorage(userPrefix + '_kafka_topics_' + self.name() + '_kafkaFieldTypes'));
       self.kafkaFieldTypes.subscribe(function(newValue) {
-        $.totalStorage(userPrefix + '_kafka_topics_' + self.name() + '_kafkaFieldTypes', newValue)
+        hueUtils.hueLocalStorage(userPrefix + '_kafka_topics_' + self.name() + '_kafkaFieldTypes', newValue)
       });
 
       self.sample = ko.observableArray();
@@ -585,7 +585,7 @@ ${ commonheader(_("Streams Browser"), "search", user, request, "60px") | n,unico
       self.assistAvailable = ko.observable(true);
       self.apiHelper = window.apiHelper;
       self.isLeftPanelVisible = ko.observable();
-      self.apiHelper.withTotalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
+      self.apiHelper.withLocalStorage('assist', 'assist_panel_visible', self.isLeftPanelVisible, true);
 
       self.section = ko.observable('list-indexes');
       self.tab = ko.observable('');

+ 0 - 1
ext/thirdparty/README.md

@@ -192,7 +192,6 @@ Frontend third party dependencies (some checked in and some via npm)
 |Sprintf-js|1.1.2|BSD|https://www.npmjs.com/package/sprintf-js|
 |Tether|0.6.5|MIT|https://github.com/HubSpot/tether|
 |TopoJSON|1.0.0|BSD|https://github.com/topojson/topojson|
-|TotalStorage|1.1.3|MIT|https://github.com/Upstatement/jquery-total-storage|
 |TouchSwipe|1.6.18|MIT|https://github.com/mattbryson/TouchSwipe-Jquery-Plugin|
 |tzdetect.js|?|MIT|https://github.com/Canop/tzdetect.js|
 |Webpack|4.29.0|MIT|https://www.npmjs.com/package/webpack|