Przeglądaj źródła

HUE-9377 [ui] Apply new linting rules

Johan Ahlen 5 lat temu
rodzic
commit
6d34924d40
100 zmienionych plików z 967 dodań i 1781 usunięć
  1. 5 15
      desktop/core/src/desktop/js/api/apiHelper.js
  2. 2 4
      desktop/core/src/desktop/js/api/apiUtils.js
  3. 1 3
      desktop/core/src/desktop/js/api/cancellablePromise.js
  4. 1 1
      desktop/core/src/desktop/js/apps/notebook/aceAutocompleteWrapper.js
  5. 6 6
      desktop/core/src/desktop/js/apps/notebook/aceAutocompleteWrapper.test.js
  6. 43 101
      desktop/core/src/desktop/js/apps/notebook/app.js
  7. 7 7
      desktop/core/src/desktop/js/apps/notebook/chartTransformers.js
  8. 20 23
      desktop/core/src/desktop/js/apps/notebook/editorViewModel.js
  9. 36 39
      desktop/core/src/desktop/js/apps/notebook/notebook.js
  10. 5 5
      desktop/core/src/desktop/js/apps/notebook/result.js
  11. 67 82
      desktop/core/src/desktop/js/apps/notebook/snippet.js
  12. 20 54
      desktop/core/src/desktop/js/apps/notebook2/app.js
  13. 2 3
      desktop/core/src/desktop/js/apps/notebook2/components/ko.executableActions.js
  14. 7 13
      desktop/core/src/desktop/js/apps/notebook2/components/ko.executableProgressBar.js
  15. 7 7
      desktop/core/src/desktop/js/apps/notebook2/components/resultChart/chartTransformers.js
  16. 3 9
      desktop/core/src/desktop/js/apps/notebook2/components/resultGrid/ko.resultDownloadModal.js
  17. 2 2
      desktop/core/src/desktop/js/apps/notebook2/components/resultGrid/ko.resultGrid.js
  18. 1 3
      desktop/core/src/desktop/js/apps/notebook2/editorViewModel.js
  19. 1 3
      desktop/core/src/desktop/js/apps/notebook2/notebook.js
  20. 8 2
      desktop/core/src/desktop/js/apps/notebook2/notebook.test.js
  21. 3 6
      desktop/core/src/desktop/js/apps/notebook2/snippet.js
  22. 1 3
      desktop/core/src/desktop/js/apps/tableBrowser/app.js
  23. 6 22
      desktop/core/src/desktop/js/apps/tableBrowser/metastoreSource.js
  24. 18 77
      desktop/core/src/desktop/js/apps/tableBrowser/metastoreViewModel.js
  25. 30 62
      desktop/core/src/desktop/js/catalog/dataCatalog.js
  26. 29 65
      desktop/core/src/desktop/js/catalog/dataCatalogEntry.js
  27. 3 5
      desktop/core/src/desktop/js/catalog/multiTableEntry.js
  28. 8 20
      desktop/core/src/desktop/js/doc/hueFileEntry.js
  29. 1 1
      desktop/core/src/desktop/js/jest/jest.init.js
  30. 2 2
      desktop/core/src/desktop/js/jest/sqlTestUtils.js
  31. 4 4
      desktop/core/src/desktop/js/jquery/jquery.migration.js
  32. 1 1
      desktop/core/src/desktop/js/jquery/plugins/jquery.datatables.sorting.js
  33. 4 4
      desktop/core/src/desktop/js/jquery/plugins/jquery.delayedinput.js
  34. 63 118
      desktop/core/src/desktop/js/jquery/plugins/jquery.filechooser.js
  35. 24 63
      desktop/core/src/desktop/js/jquery/plugins/jquery.hdfs.autocomplete.js
  36. 8 8
      desktop/core/src/desktop/js/jquery/plugins/jquery.hdfstree.js
  37. 37 105
      desktop/core/src/desktop/js/jquery/plugins/jquery.hiveautocomplete.js
  38. 8 14
      desktop/core/src/desktop/js/jquery/plugins/jquery.horizontalscrollbar.js
  39. 27 51
      desktop/core/src/desktop/js/jquery/plugins/jquery.huedatatable.js
  40. 11 23
      desktop/core/src/desktop/js/jquery/plugins/jquery.notify.js
  41. 5 7
      desktop/core/src/desktop/js/jquery/plugins/jquery.rowselector.js
  42. 7 12
      desktop/core/src/desktop/js/jquery/plugins/jquery.scrollleft.js
  43. 6 9
      desktop/core/src/desktop/js/jquery/plugins/jquery.scrollup.js
  44. 21 52
      desktop/core/src/desktop/js/jquery/plugins/jquery.selector.js
  45. 41 75
      desktop/core/src/desktop/js/jquery/plugins/jquery.tableextender.js
  46. 26 33
      desktop/core/src/desktop/js/jquery/plugins/jquery.tableextender2.js
  47. 15 34
      desktop/core/src/desktop/js/jquery/plugins/jquery.tablescroller.js
  48. 5 5
      desktop/core/src/desktop/js/jquery/plugins/jquery.titleupdater.js
  49. 14 14
      desktop/core/src/desktop/js/ko/bindings/ace/aceLocationHandler.js
  50. 28 31
      desktop/core/src/desktop/js/ko/bindings/ace/ko.aceEditor.js
  51. 4 4
      desktop/core/src/desktop/js/ko/bindings/ace/ko.aceResizer.js
  52. 43 123
      desktop/core/src/desktop/js/ko/bindings/charts/chartUtils.js
  53. 3 5
      desktop/core/src/desktop/js/ko/bindings/charts/ko.barChart.js
  54. 18 57
      desktop/core/src/desktop/js/ko/bindings/charts/ko.leafletMapChart.js
  55. 3 3
      desktop/core/src/desktop/js/ko/bindings/charts/ko.lineChart.js
  56. 8 16
      desktop/core/src/desktop/js/ko/bindings/charts/ko.partitionChart.js
  57. 6 24
      desktop/core/src/desktop/js/ko/bindings/charts/ko.pieChart.js
  58. 3 7
      desktop/core/src/desktop/js/ko/bindings/charts/ko.scatterChart.js
  59. 4 6
      desktop/core/src/desktop/js/ko/bindings/charts/ko.timelineChart.js
  60. 23 37
      desktop/core/src/desktop/js/ko/bindings/charts/mapchart/datamap.js
  61. 7 7
      desktop/core/src/desktop/js/ko/bindings/charts/mapchart/ko.mapChart.js
  62. 16 16
      desktop/core/src/desktop/js/ko/bindings/charts/plotly/ko.plotly.js
  63. 1 1
      desktop/core/src/desktop/js/ko/bindings/ko.appAwareTemplateContextMenu.js
  64. 2 4
      desktop/core/src/desktop/js/ko/bindings/ko.assistFileDraggable.js
  65. 1 1
      desktop/core/src/desktop/js/ko/bindings/ko.assistFileDroppable.js
  66. 8 8
      desktop/core/src/desktop/js/ko/bindings/ko.assistVerticalResizer.js
  67. 1 1
      desktop/core/src/desktop/js/ko/bindings/ko.attachViewModelToElementData.js
  68. 3 3
      desktop/core/src/desktop/js/ko/bindings/ko.augmentHtml.js
  69. 11 11
      desktop/core/src/desktop/js/ko/bindings/ko.autocomplete.js
  70. 2 2
      desktop/core/src/desktop/js/ko/bindings/ko.autogrowInput.js
  71. 2 2
      desktop/core/src/desktop/js/ko/bindings/ko.blurHide.js
  72. 6 6
      desktop/core/src/desktop/js/ko/bindings/ko.bytesize.js
  73. 1 1
      desktop/core/src/desktop/js/ko/bindings/ko.chosen.js
  74. 5 5
      desktop/core/src/desktop/js/ko/bindings/ko.clearable.js
  75. 1 1
      desktop/core/src/desktop/js/ko/bindings/ko.clickForAceFocus.js
  76. 1 1
      desktop/core/src/desktop/js/ko/bindings/ko.clickToCopy.js
  77. 3 7
      desktop/core/src/desktop/js/ko/bindings/ko.codemirror.js
  78. 5 5
      desktop/core/src/desktop/js/ko/bindings/ko.contextMenu.js
  79. 2 2
      desktop/core/src/desktop/js/ko/bindings/ko.contextSubMenu.js
  80. 4 4
      desktop/core/src/desktop/js/ko/bindings/ko.datalist.js
  81. 6 25
      desktop/core/src/desktop/js/ko/bindings/ko.dateRangePicker.js
  82. 1 1
      desktop/core/src/desktop/js/ko/bindings/ko.datepicker.js
  83. 2 2
      desktop/core/src/desktop/js/ko/bindings/ko.dblClick.js
  84. 1 1
      desktop/core/src/desktop/js/ko/bindings/ko.delayedOverflow.js
  85. 1 1
      desktop/core/src/desktop/js/ko/bindings/ko.dockable.js
  86. 7 7
      desktop/core/src/desktop/js/ko/bindings/ko.documentChooser.js
  87. 2 2
      desktop/core/src/desktop/js/ko/bindings/ko.documentContextPopover.js
  88. 5 5
      desktop/core/src/desktop/js/ko/bindings/ko.draggableText.js
  89. 1 1
      desktop/core/src/desktop/js/ko/bindings/ko.dropdown.js
  90. 9 15
      desktop/core/src/desktop/js/ko/bindings/ko.dropzone.js
  91. 5 5
      desktop/core/src/desktop/js/ko/bindings/ko.duration.js
  92. 1 1
      desktop/core/src/desktop/js/ko/bindings/ko.ellipsis.js
  93. 2 2
      desktop/core/src/desktop/js/ko/bindings/ko.fadeVisible.js
  94. 1 1
      desktop/core/src/desktop/js/ko/bindings/ko.fetchMore.js
  95. 1 1
      desktop/core/src/desktop/js/ko/bindings/ko.fileChooser.js
  96. 16 19
      desktop/core/src/desktop/js/ko/bindings/ko.foreachVisible.js
  97. 2 5
      desktop/core/src/desktop/js/ko/bindings/ko.fresherEditor.js
  98. 1 1
      desktop/core/src/desktop/js/ko/bindings/ko.hdfsAutocomplete.js
  99. 2 2
      desktop/core/src/desktop/js/ko/bindings/ko.hdfsTree.js
  100. 4 6
      desktop/core/src/desktop/js/ko/bindings/ko.highlight.js

+ 5 - 15
desktop/core/src/desktop/js/api/apiHelper.js

@@ -684,17 +684,13 @@ class ApiHelper {
 
   async fetchFavoriteApp(options) {
     return new Promise((resolve, reject) => {
-      simpleGet('/desktop/api2/user_preferences/default_app')
-        .done(resolve)
-        .fail(reject);
+      simpleGet('/desktop/api2/user_preferences/default_app').done(resolve).fail(reject);
     });
   }
 
   async setFavoriteAppAsync(options) {
     return new Promise((resolve, reject) => {
-      simplePost('/desktop/api2/user_preferences/default_app', options)
-        .done(resolve)
-        .fail(reject);
+      simplePost('/desktop/api2/user_preferences/default_app', options).done(resolve).fail(reject);
     });
   }
 
@@ -1079,9 +1075,7 @@ class ApiHelper {
    */
   async fetchDocumentAsync(options) {
     return new Promise((resolve, reject) => {
-      this.fetchDocument(options)
-        .done(resolve)
-        .fail(reject);
+      this.fetchDocument(options).done(resolve).fail(reject);
     });
   }
 
@@ -1561,9 +1555,7 @@ class ApiHelper {
               promises.pop();
               if (data.isSuccess) {
                 promises.push(
-                  this.fetchAnalysis(options)
-                    .done(deferred.resolve)
-                    .fail(deferred.reject)
+                  this.fetchAnalysis(options).done(deferred.resolve).fail(deferred.reject)
                 );
               } else if (data.isFailure) {
                 deferred.reject(data);
@@ -1769,9 +1761,7 @@ class ApiHelper {
       editorMode: options.editorMode
     };
     return new Promise((resolve, reject) => {
-      simplePost('/notebook/api/notebook/save', data)
-        .then(resolve)
-        .catch(reject);
+      simplePost('/notebook/api/notebook/save', data).then(resolve).catch(reject);
     });
   }
 

+ 2 - 4
desktop/core/src/desktop/js/api/apiUtils.js

@@ -144,7 +144,7 @@ export const simplePost = (url, data, options) => {
 
   const promise = deferred.promise();
 
-  promise.getReadyState = function() {
+  promise.getReadyState = function () {
     return request.readyState;
   };
 
@@ -168,9 +168,7 @@ export const simplePost = (url, data, options) => {
  */
 export const simplePostAsync = async (url, data, options) =>
   new Promise((resolve, reject) => {
-    simplePost(url, data, options)
-      .done(resolve)
-      .fail(reject);
+    simplePost(url, data, options).done(resolve).fail(reject);
   });
 
 export const cancelActiveRequest = request => {

+ 1 - 3
desktop/core/src/desktop/js/api/cancellablePromise.js

@@ -46,9 +46,7 @@ class CancellablePromise {
   cancel() {
     const self = this;
     if (self.cancelPrevented || self.cancelled || self.state() !== 'pending') {
-      return $.Deferred()
-        .resolve()
-        .promise();
+      return $.Deferred().resolve().promise();
     }
 
     self.cancelled = true;

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

@@ -32,7 +32,7 @@ class AceAutocompleteWrapper {
 
     self.topTables = {};
 
-    const initializeAutocompleter = function() {
+    const initializeAutocompleter = function () {
       self.autocompleter = new HdfsAutocompleter({
         user: options.user,
         snippet: options.snippet,

+ 6 - 6
desktop/core/src/desktop/js/apps/notebook/aceAutocompleteWrapper.test.js

@@ -22,11 +22,11 @@ describe('aceAutocompleteWrapper.js', () => {
   it('should not throw exceptions', done => {
     const subject = new AceAutocompleteWrapper({
       snippet: {
-        isSqlDialect: function() {
+        isSqlDialect: function () {
           return true;
         },
         type: ko.observable('hive'),
-        database: function() {
+        database: function () {
           return 'default';
         }
       }
@@ -35,17 +35,17 @@ describe('aceAutocompleteWrapper.js', () => {
     try {
       subject.getCompletions(
         {
-          getTextBeforeCursor: function() {
+          getTextBeforeCursor: function () {
             return 'SELECT * FROM (SELECT * FROM tbl) a JOIN (SELECT * FROM tbl) b ON a.c=';
           },
-          getTextAfterCursor: function() {
+          getTextAfterCursor: function () {
             return '';
           },
-          hideSpinner: function() {
+          hideSpinner: function () {
             expect(true).toBeTruthy(); // Prevent jasmine warning
             done();
           },
-          showSpinner: function() {}
+          showSpinner: function () {}
         },
         undefined,
         undefined,

+ 43 - 101
desktop/core/src/desktop/js/apps/notebook/app.js

@@ -73,25 +73,19 @@ if (window.ENABLE_NOTEBOOK_2) {
             (dt.types &&
               (dt.types.indexOf ? dt.types.indexOf('Files') !== -1 : dt.types.contains('Files'))))
         ) {
-          $(window.EDITOR_BINDABLE_ELEMENT)
-            .find('.hoverMsg')
-            .removeClass('hide');
+          $(window.EDITOR_BINDABLE_ELEMENT).find('.hoverMsg').removeClass('hide');
         }
       };
 
       const hideHoverMsg = vm => {
         if (vm.editorMode()) {
-          $(window.EDITOR_BINDABLE_ELEMENT)
-            .find('.hoverText')
-            .html(I18n('Drop a SQL file here'));
+          $(window.EDITOR_BINDABLE_ELEMENT).find('.hoverText').html(I18n('Drop a SQL file here'));
         } else {
           $(window.EDITOR_BINDABLE_ELEMENT)
             .find('.hoverText')
             .html(I18n('Drop iPython/Zeppelin notebooks here'));
         }
-        $(window.EDITOR_BINDABLE_ELEMENT)
-          .find('.hoverMsg')
-          .addClass('hide');
+        $(window.EDITOR_BINDABLE_ELEMENT).find('.hoverMsg').addClass('hide');
       };
 
       const createHueDatatable = (el, snippet, vm) => {
@@ -106,29 +100,18 @@ if (window.ENABLE_NOTEBOOK_2) {
             NO_RESULTS: I18n('No results found.'),
             OF: I18n('of')
           },
-          fnDrawCallback: function(oSettings) {
+          fnDrawCallback: function (oSettings) {
             if (vm.editorMode()) {
               $('#queryResults').removeAttr('style');
-              DATATABLES_MAX_HEIGHT =
-                $(window).height() -
-                $(el)
-                  .parent()
-                  .offset().top -
-                40;
-              $(el)
-                .parents('.dataTables_wrapper')
-                .css('overflow-x', 'hidden');
+              DATATABLES_MAX_HEIGHT = $(window).height() - $(el).parent().offset().top - 40;
+              $(el).parents('.dataTables_wrapper').css('overflow-x', 'hidden');
               $(el).jHueHorizontalScrollbar();
-              $(el)
-                .parents('.dataTables_wrapper')
-                .jHueScrollLeft();
+              $(el).parents('.dataTables_wrapper').jHueScrollLeft();
             } else if ($(el).data('fnDraws') === 1) {
-              $(el)
-                .parents('.dataTables_wrapper')
-                .jHueTableScroller({
-                  maxHeight: DATATABLES_MAX_HEIGHT,
-                  heightAfterCorrection: 0
-                });
+              $(el).parents('.dataTables_wrapper').jHueTableScroller({
+                maxHeight: DATATABLES_MAX_HEIGHT,
+                heightAfterCorrection: 0
+              });
             }
           },
           scrollable:
@@ -141,9 +124,7 @@ if (window.ENABLE_NOTEBOOK_2) {
 
         window.setTimeout(() => {
           if (vm.editorMode()) {
-            $(el)
-              .parents('.dataTables_wrapper')
-              .css('overflow-x', 'hidden');
+            $(el).parents('.dataTables_wrapper').css('overflow-x', 'hidden');
             const bannerTopHeight = window.BANNER_TOP_HTML ? 30 : 2;
             $(el).jHueTableExtender2({
               mainScrollable: window.MAIN_SCROLLABLE,
@@ -185,12 +166,8 @@ if (window.ENABLE_NOTEBOOK_2) {
         const dataTableEl = $(el).parents('.dataTables_wrapper');
 
         if (!vm.editorMode()) {
-          dataTableEl.bind('mousewheel DOMMouseScroll wheel', function(e) {
-            if (
-              $(el)
-                .closest('.results')
-                .css('overflow') === 'hidden'
-            ) {
+          dataTableEl.bind('mousewheel DOMMouseScroll wheel', function (e) {
+            if ($(el).closest('.results').css('overflow') === 'hidden') {
               return;
             }
             const _e = e.originalEvent,
@@ -219,7 +196,7 @@ if (window.ENABLE_NOTEBOOK_2) {
         }
 
         let resultFollowTimeout = -1;
-        const dataScroll = function() {
+        const dataScroll = function () {
           if (vm.editorMode()) {
             const snippetEl = $('#snippet_' + snippet.id());
             if (snippetEl.find('.dataTables_wrapper').length > 0 && snippet.showGrid()) {
@@ -313,7 +290,7 @@ if (window.ENABLE_NOTEBOOK_2) {
 
       let viewModel;
 
-      const hideFixedHeaders = function() {
+      const hideFixedHeaders = function () {
         $('.jHueTableExtenderClonedContainer').hide();
         $('.jHueTableExtenderClonedContainerColumn').hide();
         $('.jHueTableExtenderClonedContainerCell').hide();
@@ -325,8 +302,8 @@ if (window.ENABLE_NOTEBOOK_2) {
       window.hideFixedHeaders = hideFixedHeaders;
 
       let redrawTimeout = -1;
-      const redrawFixedHeaders = function(timeout) {
-        const renderer = function() {
+      const redrawFixedHeaders = function (timeout) {
+        const renderer = function () {
           if (!viewModel.selectedNotebook()) {
             return;
           }
@@ -507,7 +484,7 @@ if (window.ENABLE_NOTEBOOK_2) {
           }
         };
 
-        const handleFileSelect = function(evt) {
+        const handleFileSelect = function (evt) {
           evt.stopPropagation();
           evt.preventDefault();
           const dt = evt.dataTransfer;
@@ -520,8 +497,8 @@ if (window.ENABLE_NOTEBOOK_2) {
 
           for (let i = 0, f; (f = files[i]); i++) {
             const reader = new FileReader();
-            reader.onload = (function(file) {
-              return function(e) {
+            reader.onload = (function (file) {
+              return function (e) {
                 $('.hoverText').html("<i class='fa fa-spinner fa-spin'></i>");
                 parseExternalJSON(e.target.result);
               };
@@ -530,7 +507,7 @@ if (window.ENABLE_NOTEBOOK_2) {
           }
         };
 
-        const handleDragOver = function(evt) {
+        const handleDragOver = function (evt) {
           evt.stopPropagation();
           evt.preventDefault();
           evt.dataTransfer.dropEffect = 'copy';
@@ -624,7 +601,7 @@ if (window.ENABLE_NOTEBOOK_2) {
       });
 
       // Close the notebook snippets when leaving the page
-      window.onbeforeunload = function(e) {
+      window.onbeforeunload = function (e) {
         if (ignoreNextUnload) {
           ignoreNextUnload = false;
           return;
@@ -654,10 +631,7 @@ if (window.ENABLE_NOTEBOOK_2) {
             viewModel.editorType(),
             null,
             viewModel.selectedNotebook()
-              ? viewModel
-                  .selectedNotebook()
-                  .snippets()[0]
-                  .currentQueryTab()
+              ? viewModel.selectedNotebook().snippets()[0].currentQueryTab()
               : null
           );
         }
@@ -703,19 +677,12 @@ if (window.ENABLE_NOTEBOOK_2) {
         ) {
           if (
             viewModel.editorMode() &&
-            viewModel
-              .selectedNotebook()
-              .snippets()[0]
-              .currentQueryTab() === 'queryResults'
+            viewModel.selectedNotebook().snippets()[0].currentQueryTab() === 'queryResults'
           ) {
             e.preventDefault();
-            const $t = $(
-              '#snippet_' +
-                viewModel
-                  .selectedNotebook()
-                  .snippets()[0]
-                  .id()
-            ).find('.resultTable');
+            const $t = $('#snippet_' + viewModel.selectedNotebook().snippets()[0].id()).find(
+              '.resultTable'
+            );
             $t.hueDataTable().fnShowSearch();
             return false;
           }
@@ -737,10 +704,10 @@ if (window.ENABLE_NOTEBOOK_2) {
       const getDraggableOptions = minY => {
         return {
           axis: 'y',
-          start: function(e, ui) {
+          start: function (e, ui) {
             initialResizePosition = ui.offset.top;
           },
-          drag: function(e, ui) {
+          drag: function (e, ui) {
             draggableHelper($(this), e, ui);
             $('.jHueTableExtenderClonedContainer').hide();
             $('.jHueTableExtenderClonedContainerColumn').hide();
@@ -749,7 +716,7 @@ if (window.ENABLE_NOTEBOOK_2) {
             $('.fixed-first-cell').hide();
             $('.fixed-first-column').hide();
           },
-          stop: function(e, ui) {
+          stop: function (e, ui) {
             $('.jHueTableExtenderClonedContainer').show();
             $('.jHueTableExtenderClonedContainerColum').show();
             $('.jHueTableExtenderClonedContainerCell').show();
@@ -764,14 +731,8 @@ if (window.ENABLE_NOTEBOOK_2) {
         };
       };
 
-      $('.resize-panel a').each(function() {
-        $(this).draggable(
-          getDraggableOptions(
-            $(this)
-              .parents('.snippet')
-              .offset().top + 128
-          )
-        );
+      $('.resize-panel a').each(function () {
+        $(this).draggable(getDraggableOptions($(this).parents('.snippet').offset().top + 128));
       });
 
       const resetResultsResizer = snippet => {
@@ -786,10 +747,7 @@ if (window.ENABLE_NOTEBOOK_2) {
             .data('newWidth', hueUtils.bootstrapRatios.span9())
             .width(hueUtils.bootstrapRatios.span9() + '%');
         } else {
-          $snippet
-            .find('.table-results .grid-side')
-            .data('newWidth', 100)
-            .width('100%');
+          $snippet.find('.table-results .grid-side').data('newWidth', 100).width('100%');
         }
         $snippet.find('.resize-bar').css('left', '');
         try {
@@ -801,7 +759,7 @@ if (window.ENABLE_NOTEBOOK_2) {
         $snippet.find('.resize-bar').draggable({
           axis: 'x',
           containment: $snippet.find('.table-results'),
-          create: function() {
+          create: function () {
             const $snip = $('#snippet_' + snippet.id());
             initialPosition = $snip.find('.resize-bar').position().left;
             $snip
@@ -811,7 +769,7 @@ if (window.ENABLE_NOTEBOOK_2) {
               .find('.meta-filter')
               .width($snip.find('.table-results .column-side').width() - 28);
           },
-          drag: function(event, ui) {
+          drag: function (event, ui) {
             const $snip = $('#snippet_' + snippet.id());
             if (initialPosition === 0) {
               initialPosition = $snip.find('.resize-bar').position().left;
@@ -832,7 +790,7 @@ if (window.ENABLE_NOTEBOOK_2) {
               .find('.meta-filter')
               .width($snip.find('.table-results .column-side').width() - 28);
           },
-          stop: function() {
+          stop: function () {
             redrawFixedHeaders();
             huePubSub.publish('resize.leaflet.map');
           }
@@ -1009,10 +967,7 @@ if (window.ENABLE_NOTEBOOK_2) {
           huePubSub.subscribe(
             'editor.upload.query',
             query_id => {
-              viewModel
-                .selectedNotebook()
-                .snippets()[0]
-                .uploadQuery(query_id);
+              viewModel.selectedNotebook().snippets()[0].uploadQuery(query_id);
             },
             HUE_PUB_SUB_EDITOR_ID
           );
@@ -1022,10 +977,7 @@ if (window.ENABLE_NOTEBOOK_2) {
           huePubSub.subscribe(
             'editor.upload.table.stats',
             options => {
-              viewModel
-                .selectedNotebook()
-                .snippets()[0]
-                .uploadTableStats(options);
+              viewModel.selectedNotebook().snippets()[0].uploadTableStats(options);
             },
             HUE_PUB_SUB_EDITOR_ID
           );
@@ -1035,10 +987,7 @@ if (window.ENABLE_NOTEBOOK_2) {
           huePubSub.subscribe(
             'editor.upload.history',
             () => {
-              viewModel
-                .selectedNotebook()
-                .snippets()[0]
-                .uploadQueryHistory(5);
+              viewModel.selectedNotebook().snippets()[0].uploadQueryHistory(5);
             },
             HUE_PUB_SUB_EDITOR_ID
           );
@@ -1311,15 +1260,8 @@ if (window.ENABLE_NOTEBOOK_2) {
           };
           if (viewModel.selectedNotebook()) {
             if (viewModel.selectedNotebook().snippets().length === 1) {
-              result.editor = viewModel
-                .selectedNotebook()
-                .snippets()[0]
-                .ace();
-              result.risks =
-                viewModel
-                  .selectedNotebook()
-                  .snippets()[0]
-                  .complexity() || {};
+              result.editor = viewModel.selectedNotebook().snippets()[0].ace();
+              result.risks = viewModel.selectedNotebook().snippets()[0].complexity() || {};
             } else {
               viewModel
                 .selectedNotebook()
@@ -1378,7 +1320,7 @@ if (window.ENABLE_NOTEBOOK_2) {
             () => {
               let cumulativeWidth = 0;
               $('.editorComponents .hue-title-bar ul li:not(.skip-width-calculation)').each(
-                function() {
+                function () {
                   cumulativeWidth += $(this).outerWidth();
                 }
               );

+ 7 - 7
desktop/core/src/desktop/js/apps/notebook/chartTransformers.js

@@ -23,7 +23,7 @@ const isNotNullForCharts = val => val !== 'NULL' && val !== null;
 
 const jQuery = $;
 
-const pieChartTransformer = function(rawDatum) {
+const pieChartTransformer = function (rawDatum) {
   let _data = [];
 
   if (rawDatum.snippet.chartX() != null && rawDatum.snippet.chartYSingle() != null) {
@@ -67,7 +67,7 @@ const pieChartTransformer = function(rawDatum) {
   return _data;
 };
 
-const mapChartTransformer = function(rawDatum) {
+const mapChartTransformer = function (rawDatum) {
   let _data = [];
   if (rawDatum.snippet.chartX() != null && rawDatum.snippet.chartYSingle() != null) {
     let _idxRegion = -1;
@@ -105,7 +105,7 @@ const MAX_LAT = 90;
 const MIN_LNG = -180;
 const MAX_LNG = 180;
 
-const leafletMapChartTransformer = function(rawDatum) {
+const leafletMapChartTransformer = function (rawDatum) {
   let _data = [];
   if (rawDatum.snippet.chartX() != null && rawDatum.snippet.chartYSingle() != null) {
     let _idxLat = -1;
@@ -163,7 +163,7 @@ const leafletMapChartTransformer = function(rawDatum) {
   return _data;
 };
 
-const timelineChartTransformer = function(rawDatum) {
+const timelineChartTransformer = function (rawDatum) {
   const _datum = [];
   let _plottedSerie = 0;
 
@@ -220,7 +220,7 @@ const timelineChartTransformer = function(rawDatum) {
   return _datum;
 };
 
-const multiSerieChartTransformer = function(rawDatum) {
+const multiSerieChartTransformer = function (rawDatum) {
   let _datum = [];
 
   if (rawDatum.snippet.chartX() != null && rawDatum.snippet.chartYMulti().length > 0) {
@@ -400,7 +400,7 @@ const multiSerieChartTransformer = function(rawDatum) {
   return _datum;
 };
 
-const scatterChartTransformer = function(rawDatum) {
+const scatterChartTransformer = function (rawDatum) {
   const datum = {};
 
   if (rawDatum.snippet.chartX() != null && rawDatum.snippet.chartYSingle() != null) {
@@ -424,7 +424,7 @@ const scatterChartTransformer = function(rawDatum) {
     });
 
     if (idxX > -1 && idxY > -1) {
-      const createAndAddToArray = function(key, item) {
+      const createAndAddToArray = function (key, item) {
         if (!datum[key]) {
           datum[key] = [];
         }

+ 20 - 23
desktop/core/src/desktop/js/apps/notebook/editorViewModel.js

@@ -71,7 +71,7 @@ class EditorViewModel {
     });
 
     self.preEditorTogglingSnippet = ko.observable();
-    self.toggleEditorMode = function() {
+    self.toggleEditorMode = function () {
       const notebook = self.selectedNotebook();
       const newSnippets = [];
 
@@ -135,7 +135,7 @@ class EditorViewModel {
         huePubSub.publish('editor.redraw.data', { snippet: snippet });
       });
     };
-    self.togglePresentationMode = function() {
+    self.togglePresentationMode = function () {
       if (self.selectedNotebook().initialType !== 'notebook') {
         self.toggleEditorMode();
       }
@@ -154,10 +154,7 @@ class EditorViewModel {
       return (
         self.selectedNotebook() &&
         self.selectedNotebook().snippets().length === 1 &&
-        self
-          .selectedNotebook()
-          .snippets()[0]
-          .isSqlDialect()
+        self.selectedNotebook().snippets()[0].isSqlDialect()
       );
     });
     self.isResultFullScreenMode = ko.observable(false);
@@ -216,7 +213,7 @@ class EditorViewModel {
       self.activeSqlSourceType = null;
     }
 
-    self.displayCombinedContent = function() {
+    self.displayCombinedContent = function () {
       if (!self.selectedNotebook()) {
         self.combinedContent('');
       } else {
@@ -238,7 +235,7 @@ class EditorViewModel {
     self.isEditing.subscribe(() => {
       $(document).trigger('editingToggled');
     });
-    self.toggleEditing = function() {
+    self.toggleEditing = function () {
       self.isEditing(!self.isEditing());
     };
 
@@ -250,7 +247,7 @@ class EditorViewModel {
 
     self.removeSnippetConfirmation = ko.observable();
 
-    self.removeSnippet = function(notebook, snippet) {
+    self.removeSnippet = function (notebook, snippet) {
       let hasContent = snippet.statement_raw().length > 0;
       if (!hasContent) {
         $.each(snippet.properties(), (key, value) => {
@@ -291,7 +288,7 @@ class EditorViewModel {
       }
     });
 
-    this.withActiveSnippet = function(callback) {
+    this.withActiveSnippet = function (callback) {
       const notebook = self.selectedNotebook();
       let foundSnippet;
       if (notebook) {
@@ -337,7 +334,7 @@ class EditorViewModel {
             contents: activeSnippet.statement()
           };
           const options = {
-            successCallback: function(result) {
+            successCallback: function (result) {
               if (result && result.exists) {
                 $(document).trigger('info', result.path + ' saved successfully.');
               } else {
@@ -387,7 +384,7 @@ class EditorViewModel {
 
     self.editorMode = ko.observable(options.mode === 'editor');
 
-    self.getSnippetViewSettings = function(snippetType) {
+    self.getSnippetViewSettings = function (snippetType) {
       if (options.snippetViewSettings[snippetType]) {
         return options.snippetViewSettings[snippetType];
       }
@@ -400,7 +397,7 @@ class EditorViewModel {
         return item.name != ''; // Could filter out the ones already selected + yarn only or not
       });
     });
-    self.getSessionProperties = function(name) {
+    self.getSessionProperties = function (name) {
       let _prop = null;
       $.each(options.session_properties, (index, prop) => {
         if (prop.name == name) {
@@ -411,7 +408,7 @@ class EditorViewModel {
       return _prop;
     };
 
-    self.getSnippetName = function(snippetType) {
+    self.getSnippetName = function (snippetType) {
       const availableSnippets = self.availableSnippets();
       for (let i = 0; i < availableSnippets.length; i++) {
         if (availableSnippets[i].type() === snippetType) {
@@ -421,13 +418,13 @@ class EditorViewModel {
       return '';
     };
 
-    self.changeURL = function(url) {
+    self.changeURL = function (url) {
       if (!self.isNotificationManager()) {
         hueUtils.changeURL(url);
       }
     };
 
-    self.init = function() {
+    self.init = function () {
       if (editor_id) {
         self.openNotebook(editor_id);
       } else if (window.location.getParameter('gist') !== '') {
@@ -443,7 +440,7 @@ class EditorViewModel {
       }
     };
 
-    self.loadNotebook = function(notebookRaw, queryTab) {
+    self.loadNotebook = function (notebookRaw, queryTab) {
       let currentQueries;
       if (self.selectedNotebook() != null) {
         self.selectedNotebook().close();
@@ -502,7 +499,7 @@ class EditorViewModel {
       huePubSub.publish('recalculate.name.description.width');
     };
 
-    self.getPreviousChartOptions = function(snippet) {
+    self.getPreviousChartOptions = function (snippet) {
       return {
         chartLimit:
           typeof snippet.chartLimit() !== 'undefined'
@@ -559,7 +556,7 @@ class EditorViewModel {
       };
     };
 
-    self.openNotebook = function(uuid, queryTab, skipUrlChange, callback, session) {
+    self.openNotebook = function (uuid, queryTab, skipUrlChange, callback, session) {
       const deferredOpen = new $.Deferred();
       $.get(
         '/desktop/api2/doc/',
@@ -605,7 +602,7 @@ class EditorViewModel {
       return deferredOpen.promise();
     };
 
-    self.newNotebook = function(editorType, callback, queryTab) {
+    self.newNotebook = function (editorType, callback, queryTab) {
       const connectorId = editorType || options.editor_type;
 
       if (!self.isNotificationManager()) {
@@ -649,11 +646,11 @@ class EditorViewModel {
       );
     };
 
-    self.saveNotebook = function() {
+    self.saveNotebook = function () {
       self.selectedNotebook().save();
     };
 
-    self.saveAsNotebook = function() {
+    self.saveAsNotebook = function () {
       self.selectedNotebook().id(null);
       self.selectedNotebook().uuid(hueUtils.UUID());
       self.selectedNotebook().parentSavedQueryUuid(null);
@@ -662,7 +659,7 @@ class EditorViewModel {
       });
     };
 
-    self.showContextPopover = function(field, event) {
+    self.showContextPopover = function (field, event) {
       const $source = $(
         event.target && event.target.nodeName !== 'A' ? event.target.parentElement : event.target
       );

+ 36 - 39
desktop/core/src/desktop/js/apps/notebook/notebook.js

@@ -152,7 +152,7 @@ class Notebook {
     self.sessions = komapping.fromJS(
       typeof notebook.sessions != 'undefined' && notebook.sessions != null ? notebook.sessions : [],
       {
-        create: function(value) {
+        create: function (value) {
           return new Session(vm, value.data);
         }
       }
@@ -232,7 +232,7 @@ class Notebook {
     });
 
     self.isExecutingAll = ko.observable(!!notebook.isExecutingAll);
-    self.cancelExecutingAll = function() {
+    self.cancelExecutingAll = function () {
       const index = self.executingAllIndex();
       if (self.isExecutingAll() && self.snippets()[index]) {
         self.snippets()[index].cancel();
@@ -247,7 +247,7 @@ class Notebook {
 
     self.canSave = vm.canSave;
 
-    self.getSession = function(session_type) {
+    self.getSession = function (session_type) {
       let _s = null;
       $.each(self.sessions(), (index, s) => {
         if (s.type() == session_type) {
@@ -258,14 +258,14 @@ class Notebook {
       return _s;
     };
 
-    self.getSnippets = function(type) {
+    self.getSnippets = function (type) {
       return $.grep(self.snippets(), snippet => {
         return snippet.type() == type;
       });
     };
 
     self.unloaded = ko.observable(false);
-    self.unload = function() {
+    self.unload = function () {
       self.unloaded(true);
       let currentQueries = null;
       self.snippets().forEach(snippet => {
@@ -280,7 +280,7 @@ class Notebook {
       return currentQueries;
     };
 
-    self.restartSession = function(session, callback) {
+    self.restartSession = function (session, callback) {
       if (session.restarting()) {
         return;
       }
@@ -310,7 +310,7 @@ class Notebook {
       });
     };
 
-    self.addSession = function(session) {
+    self.addSession = function (session) {
       const toRemove = [];
       $.each(self.sessions(), (index, s) => {
         if (s.type() == session.type()) {
@@ -325,7 +325,7 @@ class Notebook {
       self.sessions.push(session);
     };
 
-    self.addSnippet = function(snippet, skipSession) {
+    self.addSnippet = function (snippet, skipSession) {
       const _snippet = new Snippet(vm, self, snippet);
       self.snippets.push(_snippet);
 
@@ -343,7 +343,7 @@ class Notebook {
       return _snippet;
     };
 
-    self.createSession = function(session, callback, failCallback) {
+    self.createSession = function (session, callback, failCallback) {
       if (self.creatingSessionLocks().indexOf(session.type()) != -1) {
         // Create one type of session max
         return;
@@ -359,7 +359,7 @@ class Notebook {
         }
       });
 
-      const fail = function(message) {
+      const fail = function (message) {
         $.each(self.getSnippets(session.type()), (index, snippet) => {
           snippet.status('failed');
         });
@@ -408,7 +408,7 @@ class Notebook {
         });
     };
 
-    self.authSession = function() {
+    self.authSession = function () {
       self.createSession(
         new Session(vm, {
           type: vm.authSessionType(),
@@ -421,7 +421,7 @@ class Notebook {
       );
     };
 
-    self.newSnippet = function(type) {
+    self.newSnippet = function (type) {
       if (type) {
         self.selectedSnippet(type);
       }
@@ -441,7 +441,7 @@ class Notebook {
       return snippet;
     };
 
-    self.newSnippetAbove = function(id) {
+    self.newSnippetAbove = function (id) {
       self.newSnippet();
       let idx = 0;
       self.snippets().forEach((snippet, cnt) => {
@@ -452,7 +452,7 @@ class Notebook {
       self.snippets(self.snippets().move(self.snippets().length - 1, idx));
     };
 
-    self.getContext = function() {
+    self.getContext = function () {
       return {
         id: self.id,
         uuid: self.uuid,
@@ -464,7 +464,7 @@ class Notebook {
       };
     };
 
-    self.save = function(callback) {
+    self.save = function (callback) {
       hueAnalytics.log('notebook', 'save');
 
       // Remove the result data from the snippets
@@ -535,10 +535,7 @@ class Notebook {
 
               if (
                 self.snippets()[0].downloadResultViewModel &&
-                self
-                  .snippets()[0]
-                  .downloadResultViewModel()
-                  .saveTarget() === 'dashboard'
+                self.snippets()[0].downloadResultViewModel().saveTarget() === 'dashboard'
               ) {
                 huePubSub.publish(
                   'open.link',
@@ -568,7 +565,7 @@ class Notebook {
       });
     };
 
-    self.close = function() {
+    self.close = function () {
       hueAnalytics.log('notebook', 'close');
       $.post('/notebook/api/notebook/close', {
         notebook: komapping.toJSON(self, NOTEBOOK_MAPPING),
@@ -576,14 +573,14 @@ class Notebook {
       });
     };
 
-    self.clearResults = function() {
+    self.clearResults = function () {
       $.each(self.snippets(), (index, snippet) => {
         snippet.result.clear();
         snippet.status('ready');
       });
     };
 
-    self.executeAll = function() {
+    self.executeAll = function () {
       if (self.isExecutingAll() || self.snippets().length === 0) {
         return;
       }
@@ -594,7 +591,7 @@ class Notebook {
       self.snippets()[self.executingAllIndex()].execute();
     };
 
-    self.saveDefaultUserProperties = function(session) {
+    self.saveDefaultUserProperties = function (session) {
       apiHelper.saveConfiguration({
         app: session.type(),
         properties: session.properties,
@@ -602,13 +599,13 @@ class Notebook {
       });
     };
 
-    self.closeAndRemoveSession = function(session) {
+    self.closeAndRemoveSession = function (session) {
       self.closeSession(session, false, () => {
         self.sessions.remove(session);
       });
     };
 
-    self.closeSession = function(session, silent, callback) {
+    self.closeSession = function (session, silent, callback) {
       $.post(
         '/notebook/api/close_session',
         {
@@ -630,7 +627,7 @@ class Notebook {
       });
     };
 
-    self.fetchHistory = function(callback) {
+    self.fetchHistory = function (callback) {
       const QUERIES_PER_PAGE = 50;
       self.loadingHistory(true);
 
@@ -670,20 +667,20 @@ class Notebook {
       });
     };
 
-    self.prevHistoryPage = function() {
+    self.prevHistoryPage = function () {
       if (self.historyCurrentPage() !== 1) {
         self.historyCurrentPage(self.historyCurrentPage() - 1);
       }
     };
 
-    self.nextHistoryPage = function() {
+    self.nextHistoryPage = function () {
       if (self.historyCurrentPage() < self.historyTotalPages()) {
         self.historyCurrentPage(self.historyCurrentPage() + 1);
       }
     };
 
     self.updateHistoryFailed = false;
-    self.updateHistory = function(statuses, interval) {
+    self.updateHistory = function (statuses, interval) {
       let items = $.grep(self.history(), item => {
         return statuses.indexOf(item.status()) != -1;
       }).slice(0, 25);
@@ -730,7 +727,7 @@ class Notebook {
       }
     };
 
-    self.makeHistoryRecord = function(url, statement, lastExecuted, status, name, uuid) {
+    self.makeHistoryRecord = function (url, statement, lastExecuted, status, name, uuid) {
       return komapping.fromJS({
         url: url,
         query: statement.substring(0, 1000) + (statement.length > 1000 ? '...' : ''),
@@ -741,7 +738,7 @@ class Notebook {
       });
     };
 
-    self.clearHistory = function(type) {
+    self.clearHistory = function (type) {
       hueAnalytics.log('notebook', 'clearHistory');
       $.post(
         '/notebook/api/clear_history',
@@ -766,7 +763,7 @@ class Notebook {
       $(document).trigger('hideHistoryModal');
     };
 
-    self.loadScheduler = function() {
+    self.loadScheduler = function () {
       if (typeof vm.CoordinatorEditorViewModel !== 'undefined' && self.isBatchable()) {
         let _action;
         if (self.coordinatorUuid()) {
@@ -776,7 +773,7 @@ class Notebook {
         }
         hueAnalytics.log('notebook', 'schedule/' + _action);
 
-        const getCoordinator = function() {
+        const getCoordinator = function () {
           $.get(
             '/scheduler/api/schedule/' + _action + '/',
             {
@@ -788,7 +785,7 @@ class Notebook {
               if ($('#schedulerEditor').length > 0) {
                 huePubSub.publish('hue4.process.headers', {
                   response: data.layout,
-                  callback: function(r) {
+                  callback: function (r) {
                     $('#schedulerEditor').html(r);
 
                     self.schedulerViewModel = new vm.CoordinatorEditorViewModel(
@@ -841,7 +838,7 @@ class Notebook {
       }
     };
 
-    self.saveScheduler = function() {
+    self.saveScheduler = function () {
       if (
         self.isBatchable() &&
         (!self.coordinatorUuid() || self.schedulerViewModel.coordinator.isDirty())
@@ -857,7 +854,7 @@ class Notebook {
       }
     };
 
-    self.showSubmitPopup = function() {
+    self.showSubmitPopup = function () {
       $.get(
         '/scheduler/api/schedule/submit/' + self.coordinatorUuid(),
         {
@@ -914,7 +911,7 @@ class Notebook {
       ASSIST_DB_PANEL_IS_READY_EVENT,
       () => {
         if (self.type().indexOf('query') === 0) {
-          const whenDatabaseAvailable = function(snippet) {
+          const whenDatabaseAvailable = function (snippet) {
             const lastSelectedDb = apiHelper.getFromTotalStorage(
               'assist_' + snippet.type() + '_' + snippet.namespace().id,
               'lastSelectedDb'
@@ -927,7 +924,7 @@ class Notebook {
             });
           };
 
-          const whenNamespaceAvailable = function(snippet) {
+          const whenNamespaceAvailable = function (snippet) {
             if (snippet.database()) {
               whenDatabaseAvailable(snippet);
             } else {
@@ -938,7 +935,7 @@ class Notebook {
             }
           };
 
-          const whenSnippetAvailable = function(snippet) {
+          const whenSnippetAvailable = function (snippet) {
             if (snippet.namespace()) {
               whenNamespaceAvailable(snippet);
             } else {

+ 5 - 5
desktop/core/src/desktop/js/apps/notebook/result.js

@@ -51,7 +51,7 @@ class Result {
       typeof result.meta != 'undefined' && result.meta != null ? result.meta : []
     );
 
-    const adaptMeta = function() {
+    const adaptMeta = function () {
       let i = 0;
       self.meta().forEach(item => {
         if (typeof item.checked === 'undefined') {
@@ -149,7 +149,7 @@ class Result {
       });
     });
 
-    self.autocompleteFromEntries = function(nonPartial, partial) {
+    self.autocompleteFromEntries = function (nonPartial, partial) {
       const result = [];
       const partialLower = partial.toLowerCase();
       self.meta().forEach(column => {
@@ -168,7 +168,7 @@ class Result {
 
       return result;
     };
-    self.clickFilteredMetaCheck = function() {
+    self.clickFilteredMetaCheck = function () {
       self.filteredMeta().forEach(item => {
         item.checked(self.filteredMetaChecked());
       });
@@ -257,7 +257,7 @@ class Result {
       return self.hasResultset() && self.data().length > 0; // status() == 'available'
     });
 
-    self.getContext = function() {
+    self.getContext = function () {
       return {
         id: self.id,
         type: self.type,
@@ -265,7 +265,7 @@ class Result {
       };
     };
 
-    self.clear = function() {
+    self.clear = function () {
       self.fetchedOnce(false);
       self.hasMore(false);
       self.statement_range({

+ 67 - 82
desktop/core/src/desktop/js/apps/notebook/snippet.js

@@ -93,7 +93,7 @@ const COMPATIBILITY_TARGET_PLATFORMS = {
   hive: { name: 'Hive', value: 'hive' }
 };
 
-const getDefaultSnippetProperties = function(snippetType) {
+const getDefaultSnippetProperties = function (snippetType) {
   const properties = {};
 
   if (snippetType == 'jar' || snippetType == 'py') {
@@ -240,7 +240,7 @@ class Snippet {
 
     let aceEditor = null;
 
-    self.ace = function(newVal) {
+    self.ace = function (newVal) {
       if (newVal) {
         aceEditor = newVal;
         if (!notebook.isPresentationMode()) {
@@ -272,7 +272,7 @@ class Snippet {
 
     self.editorMode = vm.editorMode;
 
-    self.getAceMode = function() {
+    self.getAceMode = function () {
       return vm.getSnippetViewSettings(self.type()).aceMode;
     };
 
@@ -280,7 +280,7 @@ class Snippet {
 
     self.showExecutionAnalysis = ko.observable(false);
 
-    self.getPlaceHolder = function() {
+    self.getPlaceHolder = function () {
       return vm.getSnippetViewSettings(self.type()).placeHolder;
     };
 
@@ -292,7 +292,7 @@ class Snippet {
       snippet.compute && snippet.compute.id ? snippet.compute : undefined
     );
 
-    self.whenContextSet = function() {
+    self.whenContextSet = function () {
       let namespaceSub;
       const namespaceDeferred = $.Deferred();
       if (self.namespace()) {
@@ -320,7 +320,7 @@ class Snippet {
 
       const result = $.when(namespaceDeferred, computeDeferred);
 
-      result.dispose = function() {
+      result.dispose = function () {
         if (namespaceSub) {
           namespaceSub.dispose();
         }
@@ -364,7 +364,7 @@ class Snippet {
         : []
     );
 
-    self.removeContextTab = function(context) {
+    self.removeContextTab = function (context) {
       if (context.tabId === self.currentQueryTab()) {
         self.currentQueryTab('queryHistory');
       }
@@ -377,18 +377,12 @@ class Snippet {
     self.queriesHasErrors = ko.observable(false);
     self.queriesCurrentPage = ko.observable(
       vm.selectedNotebook() && vm.selectedNotebook().snippets().length > 0
-        ? vm
-            .selectedNotebook()
-            .snippets()[0]
-            .queriesCurrentPage()
+        ? vm.selectedNotebook().snippets()[0].queriesCurrentPage()
         : 1
     );
     self.queriesTotalPages = ko.observable(
       vm.selectedNotebook() && vm.selectedNotebook().snippets().length > 0
-        ? vm
-            .selectedNotebook()
-            .snippets()[0]
-            .queriesTotalPages()
+        ? vm.selectedNotebook().snippets()[0].queriesTotalPages()
         : 1
     );
     self.queries = ko.observableArray([]);
@@ -402,7 +396,7 @@ class Snippet {
 
     let lastFetchQueriesRequest = null;
 
-    self.fetchQueries = function() {
+    self.fetchQueries = function () {
       cancelActiveRequest(lastFetchQueriesRequest);
 
       const QUERIES_PER_PAGE = 50;
@@ -410,13 +404,13 @@ class Snippet {
       self.loadingQueries(true);
       self.queriesHasErrors(false);
       lastFetchQueriesRequest = apiHelper.searchDocuments({
-        successCallback: function(result) {
+        successCallback: function (result) {
           self.queriesTotalPages(Math.ceil(result.count / QUERIES_PER_PAGE));
           self.queries(komapping.fromJS(result.documents)());
           self.loadingQueries(false);
           self.queriesHasErrors(false);
         },
-        errorCallback: function() {
+        errorCallback: function () {
           self.loadingQueries(false);
           self.queriesHasErrors(true);
         },
@@ -440,14 +434,14 @@ class Snippet {
       }
     });
 
-    self.prevQueriesPage = function() {
+    self.prevQueriesPage = function () {
       if (self.queriesCurrentPage() !== 1) {
         self.queriesCurrentPage(self.queriesCurrentPage() - 1);
         self.fetchQueries();
       }
     };
 
-    self.nextQueriesPage = function() {
+    self.nextQueriesPage = function () {
       if (self.queriesCurrentPage() !== self.queriesTotalPages()) {
         self.queriesCurrentPage(self.queriesCurrentPage() + 1);
         self.fetchQueries();
@@ -461,7 +455,7 @@ class Snippet {
     });
 
     let ignoreNextAssistDatabaseUpdate = false;
-    self.handleAssistSelection = function(entry) {
+    self.handleAssistSelection = function (entry) {
       if (ignoreNextAssistDatabaseUpdate) {
         ignoreNextAssistDatabaseUpdate = false;
       } else if (entry.getConnector().id === self.connector().id) {
@@ -501,7 +495,7 @@ class Snippet {
       self.getExternalStatement();
     });
     self.externalStatementLoaded = ko.observable(false);
-    self.getExternalStatement = function() {
+    self.getExternalStatement = function () {
       self.externalStatementLoaded(false);
       $.post(
         '/notebook/api/get_external_statement',
@@ -670,7 +664,7 @@ class Snippet {
     self.hasCurlyBracketParameters = ko.computed(() => {
       return self.type() != 'pig';
     });
-    self.getPigParameters = function() {
+    self.getPigParameters = function () {
       const params = {};
       const variables = self.statement_raw().match(/([^\\]|^)\$[^\d'"](\w*)/g);
       const declares = self.statement_raw().match(/%declare +([^ ])+/gi);
@@ -765,11 +759,7 @@ class Snippet {
             option.text = option.text && option.text.trim();
             option.value =
               option.value &&
-              option.value
-                .trim()
-                .replace(',', ',')
-                .replace('(', '(')
-                .replace(')', ')');
+              option.value.trim().replace(',', ',').replace('(', '(').replace(')', ')');
 
             if (value.placeholder || matchList[2]) {
               if (!value.options) {
@@ -883,7 +873,7 @@ class Snippet {
           variables[name] = location;
           return variables;
         }, {});
-      const updateVariableType = function(variable, sourceMeta) {
+      const updateVariableType = function (variable, sourceMeta) {
         let type;
         if (sourceMeta && sourceMeta.type) {
           type = sourceMeta.type.toLowerCase();
@@ -1037,7 +1027,7 @@ class Snippet {
 
     self.executeNextTimeout = -1;
     const refreshTimeouts = {};
-    self.onDdlExecute = function() {
+    self.onDdlExecute = function () {
       if (self.result.handle() && self.result.handle().has_more_statements) {
         window.clearTimeout(self.executeNextTimeout);
         const previousHash = self.result.handle().previous_statement_hash;
@@ -1377,7 +1367,7 @@ class Snippet {
         ? snippet.isResultSettingsVisible
         : false
     );
-    self.toggleResultSettings = function() {
+    self.toggleResultSettings = function () {
       self.isResultSettingsVisible(!self.isResultSettingsVisible());
     };
     self.isResultSettingsVisible.subscribe(() => {
@@ -1394,7 +1384,7 @@ class Snippet {
     self.checkStatusTimeout = null;
     self.getLogsTimeout = null;
 
-    self.getContext = function() {
+    self.getContext = function () {
       return {
         id: self.id,
         type: self.type,
@@ -1472,7 +1462,7 @@ class Snippet {
         .pureComputed(self.statement)
         .extend({ rateLimit: { method: 'notifyWhenChangesStop', timeout: 2000 } });
 
-      const handleRiskResponse = function(data) {
+      const handleRiskResponse = function (data) {
         if (data.status == 0) {
           self.hasSuggestion('');
           self.complexity(data.query_complexity);
@@ -1487,7 +1477,7 @@ class Snippet {
         lastCheckedComplexityStatement = self.statement();
       };
 
-      const clearActiveRisks = function() {
+      const clearActiveRisks = function () {
         if (self.hasSuggestion() !== null && typeof self.hasSuggestion() !== 'undefined') {
           self.hasSuggestion(null);
         }
@@ -1521,7 +1511,7 @@ class Snippet {
         }
       });
 
-      self.checkComplexity = function() {
+      self.checkComplexity = function () {
         if (!self.inFocus() || lastCheckedComplexityStatement === self.statement()) {
           return;
         }
@@ -1560,7 +1550,7 @@ class Snippet {
               notebook: komapping.toJSON(notebook.getContext()),
               snippet: komapping.toJSON(self.getContext())
             },
-            success: function(data) {
+            success: function (data) {
               knownResponses.unshift({
                 hash: hash,
                 data: data
@@ -1570,7 +1560,7 @@ class Snippet {
               }
               handleRiskResponse(data);
             },
-            always: function(data) {
+            always: function (data) {
               changeSubscription.dispose();
             }
           });
@@ -1589,7 +1579,7 @@ class Snippet {
       }
     }
 
-    self._ajaxError = function(data, callback) {
+    self._ajaxError = function (data, callback) {
       if (data.status == -2) {
         // Session expired
         const existingSession = notebook.getSession(self.type());
@@ -1607,11 +1597,11 @@ class Snippet {
         }
       } else if (data.status == -4) {
         // Operation timed out
-        notebook.retryModalCancel = function() {
+        notebook.retryModalCancel = function () {
           self.status('failed');
           huePubSub.publish('hide.retry.modal');
         };
-        notebook.retryModalConfirm = function() {
+        notebook.retryModalConfirm = function () {
           if (callback) {
             callback();
           }
@@ -1677,7 +1667,8 @@ class Snippet {
             (['jar', 'java', 'spark2', 'distcp'].indexOf(self.type()) == -1 &&
               self.statement() !== '') ||
             (['jar', 'java'].indexOf(self.type()) != -1 &&
-              (self.properties().app_jar() != '' && self.properties().class() != '')) ||
+              self.properties().app_jar() != '' &&
+              self.properties().class() != '') ||
             (['spark2'].indexOf(self.type()) != -1 && self.properties().jars().length > 0) ||
             (['shell'].indexOf(self.type()) != -1 && self.properties().command_path().length > 0) ||
             (['mapreduce'].indexOf(self.type()) != -1 && self.properties().app_jar().length > 0) ||
@@ -1722,7 +1713,7 @@ class Snippet {
     self.lastExecutedStatements = undefined;
     self.lastExecutedSelectionRange = undefined;
 
-    self.execute = function(automaticallyTriggered) {
+    self.execute = function (automaticallyTriggered) {
       self.clearActiveExecuteRequests();
 
       if (!automaticallyTriggered && self.ace()) {
@@ -1730,8 +1721,8 @@ class Snippet {
 
         if (
           self.lastExecutedSelectionRange &&
-          (selectionRange.start.row !== selectionRange.end.row &&
-            selectionRange.start.column !== selectionRange.end.column) &&
+          selectionRange.start.row !== selectionRange.end.row &&
+          selectionRange.start.column !== selectionRange.end.column &&
           (selectionRange.start.row !== self.lastExecutedSelectionRange.start.row ||
             selectionRange.start.column !== self.lastExecutedSelectionRange.start.column ||
             selectionRange.end.row !== self.lastExecutedSelectionRange.end.row ||
@@ -1948,7 +1939,7 @@ class Snippet {
         });
     };
 
-    self.reexecute = function() {
+    self.reexecute = function () {
       self.result.cancelBatchExecution();
       self.execute();
     };
@@ -1959,7 +1950,7 @@ class Snippet {
       ); // ie: 5000 lines at 80 chars per line
     });
 
-    self.createGist = function() {
+    self.createGist = function () {
       if (self.isSqlDialect()) {
         apiHelper
           .createGist({
@@ -1984,7 +1975,7 @@ class Snippet {
       hueAnalytics.log('gist', self.type());
     };
 
-    self.format = function() {
+    self.format = function () {
       if (self.isSqlDialect()) {
         apiHelper
           .formatSql({
@@ -2014,14 +2005,14 @@ class Snippet {
       hueAnalytics.log('notebook', 'format');
     };
 
-    self.clear = function() {
+    self.clear = function () {
       hueAnalytics.log('notebook', 'clear');
       self.ace().setValue('', 1);
       self.result.clear();
       self.status('ready');
     };
 
-    self.explain = function() {
+    self.explain = function () {
       hueAnalytics.log('notebook', 'explain');
 
       if (self.statement() == '' || self.status() == 'running' || self.status() === 'loading') {
@@ -2053,7 +2044,7 @@ class Snippet {
 
     let lastCompatibilityRequest;
 
-    self.checkCompatibility = function() {
+    self.checkCompatibility = function () {
       self.hasSuggestion(null);
       self.compatibilitySourcePlatform(COMPATIBILITY_SOURCE_PLATFORMS[self.type()]);
       self.compatibilityTargetPlatform(
@@ -2062,7 +2053,7 @@ class Snippet {
       self.queryCompatibility();
     };
 
-    self.queryCompatibility = function(targetPlatform) {
+    self.queryCompatibility = function (targetPlatform) {
       cancelActiveRequest(lastCompatibilityRequest);
 
       hueAnalytics.log('notebook', 'compatibility');
@@ -2136,7 +2127,7 @@ class Snippet {
         });
     };
 
-    self.fetchResult = function(rows, startOver) {
+    self.fetchResult = function (rows, startOver) {
       if (typeof startOver == 'undefined') {
         startOver = true;
       }
@@ -2146,7 +2137,7 @@ class Snippet {
 
     self.isFetchingData = false;
 
-    self.fetchExecutionAnalysis = function() {
+    self.fetchExecutionAnalysis = function () {
       if (self.type() === 'impala') {
         // TODO: Use real query ID
         huePubSub.publish('editor.update.execution.analysis', {
@@ -2162,7 +2153,7 @@ class Snippet {
       }
     };
 
-    self.fetchResultData = function(rows, startOver) {
+    self.fetchResultData = function (rows, startOver) {
       if (!self.isFetchingData) {
         if (self.status() === 'available') {
           startLongOperationTimeout();
@@ -2206,7 +2197,7 @@ class Snippet {
       }
     };
 
-    self.loadData = function(result, rows) {
+    self.loadData = function (result, rows) {
       rows -= result.data.length;
 
       if (result.data.length > 0) {
@@ -2277,7 +2268,7 @@ class Snippet {
       }
     };
 
-    self.fetchResultMetadata = function() {
+    self.fetchResultMetadata = function () {
       $.post(
         '/notebook/api/fetch_result_metadata',
         {
@@ -2299,7 +2290,7 @@ class Snippet {
       });
     };
 
-    self.fetchResultSize = function(n, query_id) {
+    self.fetchResultSize = function (n, query_id) {
       $.post(
         '/notebook/api/fetch_result_size',
         {
@@ -2329,8 +2320,8 @@ class Snippet {
       });
     };
 
-    self.checkStatus = function() {
-      const _checkStatus = function() {
+    self.checkStatus = function () {
+      const _checkStatus = function () {
         self.lastCheckStatusRequest = $.post(
           '/notebook/api/check_status',
           {
@@ -2410,7 +2401,7 @@ class Snippet {
         });
       };
       const activeStatus = ['running', 'starting', 'waiting'];
-      const _getLogs = function(isLastTime) {
+      const _getLogs = function (isLastTime) {
         window.clearTimeout(self.getLogsTimeout);
         self.getLogs().then(() => {
           const lastTime = activeStatus.indexOf(self.status()) < 0; // We to run getLogs at least one time after status is terminated to make sure we have last logs
@@ -2425,7 +2416,7 @@ class Snippet {
       _getLogs(activeStatus.indexOf(self.status()) < 0);
     };
 
-    self.checkDdlNotification = function() {
+    self.checkDdlNotification = function () {
       if (
         self.lastExecutedStatement() &&
         /ALTER|CREATE|DELETE|DROP|GRANT|INSERT|INVALIDATE|LOAD|SET|TRUNCATE|UPDATE|UPSERT|USE/i.test(
@@ -2440,7 +2431,7 @@ class Snippet {
 
     self.isCanceling = ko.observable(false);
 
-    self.cancel = function() {
+    self.cancel = function () {
       window.clearTimeout(self.executeNextTimeout);
       self.isCanceling(true);
       self.clearActiveExecuteRequests();
@@ -2489,7 +2480,7 @@ class Snippet {
       }
     };
 
-    self.close = function() {
+    self.close = function () {
       self.clearActiveExecuteRequests();
 
       $.post(
@@ -2513,7 +2504,7 @@ class Snippet {
       });
     };
 
-    self.clearActiveExecuteRequests = function() {
+    self.clearActiveExecuteRequests = function () {
       cancelActiveRequest(self.lastGetLogsRequest);
       if (self.getLogsTimeout !== null) {
         window.clearTimeout(self.getLogsTimeout);
@@ -2527,7 +2518,7 @@ class Snippet {
       }
     };
 
-    self.getLogs = function() {
+    self.getLogs = function () {
       cancelActiveRequest(self.lastGetLogsRequest);
 
       self.lastGetLogsRequest = $.post(
@@ -2615,7 +2606,7 @@ class Snippet {
       return self.lastGetLogsRequest;
     };
 
-    self.uploadQueryHistory = function(n) {
+    self.uploadQueryHistory = function (n) {
       hueAnalytics.log('notebook', 'upload_query_history');
 
       $.post(
@@ -2639,14 +2630,14 @@ class Snippet {
       );
     };
 
-    self.uploadQuery = function(query_id) {
+    self.uploadQuery = function (query_id) {
       $.post('/metadata/api/optimizer/upload/query', {
         query_id: query_id,
         sourcePlatform: self.type()
       });
     };
 
-    self.uploadTableStats = function(options) {
+    self.uploadTableStats = function (options) {
       hueAnalytics.log('notebook', 'load_table_stats');
       if (options.showProgress) {
         $(document).trigger('info', 'Preparing table data...');
@@ -2690,7 +2681,7 @@ class Snippet {
       });
     };
 
-    self.watchUploadStatus = function(workloadId, showProgress) {
+    self.watchUploadStatus = function (workloadId, showProgress) {
       $.post(
         '/metadata/api/optimizer/upload/status',
         {
@@ -2724,7 +2715,7 @@ class Snippet {
       );
     };
 
-    self.getSimilarQueries = function() {
+    self.getSimilarQueries = function () {
       hueAnalytics.log('notebook', 'get_query_similarity');
 
       $.post(
@@ -2752,7 +2743,7 @@ class Snippet {
       timeout: vm.autocompleteTimeout
     });
 
-    self.init = function() {
+    self.init = function () {
       if ((self.status() == 'running' || self.status() == 'available') && notebook.isHistory()) {
         self.checkStatus();
       } else if (self.status() == 'loading') {
@@ -2764,7 +2755,7 @@ class Snippet {
       }
     };
 
-    self.onKeydownInVariable = function(context, e) {
+    self.onKeydownInVariable = function (context, e) {
       if ((e.ctrlKey || e.metaKey) && e.which === 13) {
         // Ctrl-enter
         self.ace().commands.commands['execute'].exec();
@@ -2813,27 +2804,21 @@ class Snippet {
   }
 
   toggleAllResultColumns(linkElement) {
-    const $t = $(linkElement)
-      .parents('.snippet')
-      .find('table.resultTable:eq(0)');
+    const $t = $(linkElement).parents('.snippet').find('table.resultTable:eq(0)');
     const dt = $t.hueDataTable();
     dt.fnToggleAllCols(linkElement.checked);
     dt.fnDraw();
   }
 
   toggleResultColumn(linkElement, index) {
-    const $t = $(linkElement)
-      .parents('.snippet')
-      .find('table.resultTable:eq(0)');
+    const $t = $(linkElement).parents('.snippet').find('table.resultTable:eq(0)');
     const dt = $t.hueDataTable();
     dt.fnSetColumnVis(index, linkElement.checked);
   }
   scrollToResultColumn(linkElement) {
-    const $resultTable = $(linkElement)
-      .parents('.snippet')
-      .find('table.resultTable:eq(0)');
+    const $resultTable = $(linkElement).parents('.snippet').find('table.resultTable:eq(0)');
     const _text = $.trim($(linkElement).text());
-    const _col = $resultTable.find('th').filter(function() {
+    const _col = $resultTable.find('th').filter(function () {
       return $.trim($(this).text()) === _text;
     });
     $resultTable.find('.columnSelected').removeClass('columnSelected');

+ 20 - 54
desktop/core/src/desktop/js/apps/notebook2/app.js

@@ -76,25 +76,19 @@ export const initNotebook2 = () => {
             (dt.types &&
               (dt.types.indexOf ? dt.types.indexOf('Files') !== -1 : dt.types.contains('Files'))))
         ) {
-          $(window.EDITOR_BINDABLE_ELEMENT)
-            .find('.hoverMsg')
-            .removeClass('hide');
+          $(window.EDITOR_BINDABLE_ELEMENT).find('.hoverMsg').removeClass('hide');
         }
       };
 
       const hideHoverMsg = vm => {
         if (vm.editorMode()) {
-          $(window.EDITOR_BINDABLE_ELEMENT)
-            .find('.hoverText')
-            .html(I18n('Drop a SQL file here'));
+          $(window.EDITOR_BINDABLE_ELEMENT).find('.hoverText').html(I18n('Drop a SQL file here'));
         } else {
           $(window.EDITOR_BINDABLE_ELEMENT)
             .find('.hoverText')
             .html(I18n('Drop iPython/Zeppelin notebooks here'));
         }
-        $(window.EDITOR_BINDABLE_ELEMENT)
-          .find('.hoverMsg')
-          .addClass('hide');
+        $(window.EDITOR_BINDABLE_ELEMENT).find('.hoverMsg').addClass('hide');
       };
 
       if (ko.options) {
@@ -260,8 +254,8 @@ export const initNotebook2 = () => {
 
           for (let i = 0, f; (f = files[i]); i++) {
             const reader = new FileReader();
-            reader.onload = (function(file) {
-              return function(e) {
+            reader.onload = (function (file) {
+              return function (e) {
                 $('.hoverText').html("<i class='fa fa-spinner fa-spin'></i>");
                 parseExternalJSON(e.target.result);
               };
@@ -270,7 +264,7 @@ export const initNotebook2 = () => {
           }
         };
 
-        const handleDragOver = function(evt) {
+        const handleDragOver = function (evt) {
           evt.stopPropagation();
           evt.preventDefault();
           evt.dataTransfer.dropEffect = 'copy';
@@ -364,7 +358,7 @@ export const initNotebook2 = () => {
       });
 
       // Close the notebook snippets when leaving the page
-      window.onbeforeunload = function(e) {
+      window.onbeforeunload = function (e) {
         if (ignoreNextUnload) {
           ignoreNextUnload = false;
           return;
@@ -393,10 +387,7 @@ export const initNotebook2 = () => {
             viewModel.editorType(),
             null,
             viewModel.selectedNotebook()
-              ? viewModel
-                  .selectedNotebook()
-                  .snippets()[0]
-                  .currentQueryTab()
+              ? viewModel.selectedNotebook().snippets()[0].currentQueryTab()
               : null
           );
         }
@@ -442,10 +433,7 @@ export const initNotebook2 = () => {
         ) {
           if (
             viewModel.editorMode() &&
-            viewModel
-              .selectedNotebook()
-              .snippets()[0]
-              .currentQueryTab() === 'queryResults'
+            viewModel.selectedNotebook().snippets()[0].currentQueryTab() === 'queryResults'
           ) {
             e.preventDefault();
             huePubSub.publish(SHOW_GRID_SEARCH_EVENT);
@@ -469,14 +457,14 @@ export const initNotebook2 = () => {
       const getDraggableOptions = minY => {
         return {
           axis: 'y',
-          start: function(e, ui) {
+          start: function (e, ui) {
             initialResizePosition = ui.offset.top;
             huePubSub.publish(HIDE_FIXED_HEADERS_EVENT);
           },
-          drag: function(e, ui) {
+          drag: function (e, ui) {
             draggableHelper($(this), e, ui);
           },
-          stop: function(e, ui) {
+          stop: function (e, ui) {
             draggableHelper($(this), e, ui, true);
             huePubSub.publish(REDRAW_FIXED_HEADERS_EVENT);
             ui.helper.first().removeAttr('style');
@@ -485,14 +473,8 @@ export const initNotebook2 = () => {
         };
       };
 
-      $('.resize-panel a').each(function() {
-        $(this).draggable(
-          getDraggableOptions(
-            $(this)
-              .parents('.snippet')
-              .offset().top + 128
-          )
-        );
+      $('.resize-panel a').each(function () {
+        $(this).draggable(getDraggableOptions($(this).parents('.snippet').offset().top + 128));
       });
 
       // ======== PubSub ========
@@ -541,10 +523,7 @@ export const initNotebook2 = () => {
           huePubSub.subscribe(
             'editor.upload.query',
             query_id => {
-              viewModel
-                .selectedNotebook()
-                .snippets()[0]
-                .uploadQuery(query_id);
+              viewModel.selectedNotebook().snippets()[0].uploadQuery(query_id);
             },
             HUE_PUB_SUB_EDITOR_ID
           );
@@ -554,10 +533,7 @@ export const initNotebook2 = () => {
           huePubSub.subscribe(
             'editor.upload.table.stats',
             options => {
-              viewModel
-                .selectedNotebook()
-                .snippets()[0]
-                .uploadTableStats(options);
+              viewModel.selectedNotebook().snippets()[0].uploadTableStats(options);
             },
             HUE_PUB_SUB_EDITOR_ID
           );
@@ -567,10 +543,7 @@ export const initNotebook2 = () => {
           huePubSub.subscribe(
             'editor.upload.history',
             () => {
-              viewModel
-                .selectedNotebook()
-                .snippets()[0]
-                .uploadQueryHistory(5);
+              viewModel.selectedNotebook().snippets()[0].uploadQueryHistory(5);
             },
             HUE_PUB_SUB_EDITOR_ID
           );
@@ -769,15 +742,8 @@ export const initNotebook2 = () => {
           };
           if (viewModel.selectedNotebook()) {
             if (viewModel.selectedNotebook().snippets().length === 1) {
-              result.editor = viewModel
-                .selectedNotebook()
-                .snippets()[0]
-                .ace();
-              result.risks =
-                viewModel
-                  .selectedNotebook()
-                  .snippets()[0]
-                  .complexity() || {};
+              result.editor = viewModel.selectedNotebook().snippets()[0].ace();
+              result.risks = viewModel.selectedNotebook().snippets()[0].complexity() || {};
             } else {
               viewModel
                 .selectedNotebook()
@@ -808,7 +774,7 @@ export const initNotebook2 = () => {
             () => {
               let cumulativeWidth = 0;
               $('.editorComponents .hue-title-bar ul li:not(.skip-width-calculation)').each(
-                function() {
+                function () {
                   cumulativeWidth += $(this).outerWidth();
                 }
               );

+ 2 - 3
desktop/core/src/desktop/js/apps/notebook2/components/ko.executableActions.js

@@ -116,9 +116,8 @@ class ExecutableActions extends DisposableComponent {
 
       return (
         !this.lastSession() ||
-        (!executable ||
-          (executable.parsedStatement &&
-            WHITE_SPACE_REGEX.test(executable.parsedStatement.statement)))
+        !executable ||
+        (executable.parsedStatement && WHITE_SPACE_REGEX.test(executable.parsedStatement.statement))
       );
     });
 

+ 7 - 13
desktop/core/src/desktop/js/apps/notebook2/components/ko.executableProgressBar.js

@@ -73,20 +73,14 @@ class ExecutableProgressBar extends DisposableComponent {
         this.progress(executable.progress);
         if (executable.progress === 100) {
           await sleep(2000);
-          $(element)
-            .parent()
-            .find('.progress-snippet')
-            .animate(
-              {
-                height: '0'
-              },
-              100
-            );
+          $(element).parent().find('.progress-snippet').animate(
+            {
+              height: '0'
+            },
+            100
+          );
         } else {
-          $(element)
-            .parent()
-            .find('.progress-snippet')
-            .css('height', '');
+          $(element).parent().find('.progress-snippet').css('height', '');
         }
       }
     });

+ 7 - 7
desktop/core/src/desktop/js/apps/notebook2/components/resultChart/chartTransformers.js

@@ -31,7 +31,7 @@ const MAX_LNG = 180;
 
 const isNotNullForCharts = val => val !== 'NULL' && val !== null;
 
-export const pieChartTransformer = function(rawDatum) {
+export const pieChartTransformer = function (rawDatum) {
   let data = [];
 
   if (rawDatum.chartX() != null && rawDatum.chartYSingle() != null) {
@@ -76,7 +76,7 @@ export const pieChartTransformer = function(rawDatum) {
   return data;
 };
 
-export const mapChartTransformer = function(rawDatum) {
+export const mapChartTransformer = function (rawDatum) {
   let datum = [];
   if (rawDatum.chartX() != null && rawDatum.chartYSingle() != null) {
     let regionIndex = -1;
@@ -109,7 +109,7 @@ export const mapChartTransformer = function(rawDatum) {
   return datum;
 };
 
-export const leafletMapChartTransformer = function(rawDatum) {
+export const leafletMapChartTransformer = function (rawDatum) {
   let datum = [];
   if (rawDatum.chartX() != null && rawDatum.chartYSingle() != null) {
     let latIndex = -1;
@@ -154,7 +154,7 @@ export const leafletMapChartTransformer = function(rawDatum) {
   return datum;
 };
 
-export const timelineChartTransformer = function(rawDatum) {
+export const timelineChartTransformer = function (rawDatum) {
   const datum = [];
   let plottedSeries = 0;
 
@@ -211,7 +211,7 @@ export const timelineChartTransformer = function(rawDatum) {
   return datum;
 };
 
-export const multiSerieChartTransformer = function(rawDatum) {
+export const multiSerieChartTransformer = function (rawDatum) {
   let datum = [];
 
   if (rawDatum.chartX() != null && rawDatum.chartYMulti().length > 0) {
@@ -390,7 +390,7 @@ export const multiSerieChartTransformer = function(rawDatum) {
   return datum;
 };
 
-export const scatterChartTransformer = function(rawDatum) {
+export const scatterChartTransformer = function (rawDatum) {
   const datumIndex = {};
 
   if (rawDatum.chartX() != null && rawDatum.chartYSingle() != null) {
@@ -415,7 +415,7 @@ export const scatterChartTransformer = function(rawDatum) {
     });
 
     if (xIndex > -1 && yIndex > -1) {
-      const createAndAddToArray = function(key, item) {
+      const createAndAddToArray = function (key, item) {
         if (!datumIndex[key]) {
           datumIndex[key] = [];
         }

+ 3 - 9
desktop/core/src/desktop/js/apps/notebook2/components/resultGrid/ko.resultDownloadModal.js

@@ -126,15 +126,9 @@ class DownloadResultModal {
     $('<input type="hidden" name="csrfmiddlewaretoken" />')
       .val(window.CSRF_TOKEN)
       .appendTo($downloadForm);
-    $('<input type="hidden" name="notebook" />')
-      .val(jsonContext.notebook)
-      .appendTo($downloadForm);
-    $('<input type="hidden" name="snippet" />')
-      .val(jsonContext.snippet)
-      .appendTo($downloadForm);
-    $('<input type="hidden" name="format" />')
-      .val(format)
-      .appendTo($downloadForm);
+    $('<input type="hidden" name="notebook" />').val(jsonContext.notebook).appendTo($downloadForm);
+    $('<input type="hidden" name="snippet" />').val(jsonContext.snippet).appendTo($downloadForm);
+    $('<input type="hidden" name="format" />').val(format).appendTo($downloadForm);
     this.$downloadProgressModal.append($downloadForm);
     $downloadForm.submit();
   }

+ 2 - 2
desktop/core/src/desktop/js/apps/notebook2/components/resultGrid/ko.resultGrid.js

@@ -434,7 +434,7 @@ class ResultGrid extends DisposableComponent {
     if (this.notebookMode()) {
       $dataTablesWrapper.on(
         'mousewheel.resultGrid DOMMouseScroll.resultGrid wheel.resultGrid',
-        function(event) {
+        function (event) {
           if ($resultTable.closest('.results').css('overflow') === 'hidden') {
             return;
           }
@@ -632,7 +632,7 @@ class ResultGrid extends DisposableComponent {
   scrollToResultColumn(linkElement) {
     const $resultTable = this.getResultTableElement();
     const searchText = $.trim($(linkElement).text());
-    const foundColumn = $resultTable.find('th').filter(function() {
+    const foundColumn = $resultTable.find('th').filter(function () {
       return $.trim($(this).text()) === searchText;
     });
     $resultTable.find('.columnSelected').removeClass('columnSelected');

+ 1 - 3
desktop/core/src/desktop/js/apps/notebook2/editorViewModel.js

@@ -99,9 +99,7 @@ class EditorViewModel {
       () =>
         this.selectedNotebook() &&
         this.selectedNotebook().snippets().length === 1 &&
-        this.selectedNotebook()
-          .snippets()[0]
-          .isSqlDialect()
+        this.selectedNotebook().snippets()[0].isSqlDialect()
     );
     this.isResultFullScreenMode = ko.observable(false);
     this.isPresentationMode = ko.pureComputed(

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

@@ -364,9 +364,7 @@ export default class Notebook {
 
           if (
             this.snippets()[0].downloadResultViewModel &&
-            this.snippets()[0]
-              .downloadResultViewModel()
-              .saveTarget() === 'dashboard'
+            this.snippets()[0].downloadResultViewModel().saveTarget() === 'dashboard'
           ) {
             huePubSub.publish(
               'open.link',

+ 8 - 2
desktop/core/src/desktop/js/apps/notebook2/notebook.test.js

@@ -49,7 +49,10 @@ describe('notebook.js', () => {
   });
 
   it('should serialize a notebook to JSON', async () => {
-    const connectors = [{ id: 'hive', dialect: 'hive' }, { id: 'impala', dialect: 'impala' }];
+    const connectors = [
+      { id: 'hive', dialect: 'hive' },
+      { id: 'impala', dialect: 'impala' }
+    ];
     const spy = jest
       .spyOn(hueConfig, 'findEditorConnector')
       .mockImplementation(connectors.find.bind(connectors));
@@ -73,7 +76,10 @@ describe('notebook.js', () => {
 
   it('should serialize a notebook context to JSON', async () => {
     const notebook = new Notebook(viewModel, {});
-    const connectors = [{ id: 'hive', dialect: 'hive' }, { id: 'impala', dialect: 'impala' }];
+    const connectors = [
+      { id: 'hive', dialect: 'hive' },
+      { id: 'impala', dialect: 'impala' }
+    ];
     jest
       .spyOn(hueConfig, 'findEditorConnector')
       .mockImplementation(connectors.find.bind(connectors));

+ 3 - 6
desktop/core/src/desktop/js/apps/notebook2/snippet.js

@@ -495,11 +495,7 @@ export default class Snippet {
             option.text = option.text && option.text.trim();
             option.value =
               option.value &&
-              option.value
-                .trim()
-                .replace(',', ',')
-                .replace('(', '(')
-                .replace(')', ')');
+              option.value.trim().replace(',', ',').replace('(', '(').replace(')', ')');
 
             if (value.placeholder || matchList[2]) {
               if (!value.options) {
@@ -825,7 +821,8 @@ export default class Snippet {
               -1 &&
               this.statement() !== '') ||
             ([DIALECT.jar, DIALECT.java].indexOf(this.dialect()) !== -1 &&
-              (this.properties().app_jar() !== '' && this.properties().class() !== '')) ||
+              this.properties().app_jar() !== '' &&
+              this.properties().class() !== '') ||
             (DIALECT.spark2 === this.dialect() && this.properties().jars().length > 0) ||
             (DIALECT.shell === this.dialect() && this.properties().command_path().length > 0) ||
             (DIALECT.mapreduce === this.dialect() && this.properties().app_jar().length > 0) ||

+ 1 - 3
desktop/core/src/desktop/js/apps/tableBrowser/app.js

@@ -91,9 +91,7 @@ huePubSub.subscribe('app.dom.loaded', app => {
                 sZeroRecords: I18n('No matching records')
               },
               fnDrawCallback: () => {
-                $(selector)
-                  .parents('.dataTables_wrapper')
-                  .css('overflow-x', 'hidden');
+                $(selector).parents('.dataTables_wrapper').css('overflow-x', 'hidden');
                 $(selector).jHueTableExtender2({
                   fixedHeader: true,
                   fixedFirstColumn: true,

+ 6 - 22
desktop/core/src/desktop/js/apps/tableBrowser/metastoreSource.js

@@ -90,14 +90,8 @@ class MetastoreSource {
         result.namespaceId = this.namespace().id;
         if (this.namespace().database()) {
           result.database = this.namespace().database().catalogEntry.name;
-          if (
-            this.namespace()
-              .database()
-              .table()
-          ) {
-            result.table = this.namespace()
-              .database()
-              .table().catalogEntry.name;
+          if (this.namespace().database().table()) {
+            result.table = this.namespace().database().table().catalogEntry.name;
           }
         }
       }
@@ -110,9 +104,7 @@ class MetastoreSource {
           if (state.database) {
             this.namespace().setDatabaseByName(state.database, () => {
               if (this.namespace().database() && state.table) {
-                this.namespace()
-                  .database()
-                  .setTableByName(state.table);
+                this.namespace().database().setTableByName(state.table);
               }
             });
           }
@@ -122,16 +114,8 @@ class MetastoreSource {
 
     const completeRefresh = previousState => {
       this.reloading(true);
-      if (
-        this.namespace() &&
-        this.namespace().database() &&
-        this.namespace()
-          .database()
-          .table()
-      ) {
-        this.namespace()
-          .database()
-          .table(null);
+      if (this.namespace() && this.namespace().database() && this.namespace().database().table()) {
+        this.namespace().database().table(null);
       }
       if (this.namespace() && this.namespace().database()) {
         this.namespace().database(null);
@@ -170,7 +154,7 @@ class MetastoreSource {
       } else if (refreshedEntry.isDatabase() && this.namespace()) {
         this.namespace()
           .databases()
-          .some(function(database) {
+          .some(function (database) {
             if (database.catalogEntry === refreshedEntry) {
               database.load(
                 () => {

+ 18 - 77
desktop/core/src/desktop/js/apps/tableBrowser/metastoreViewModel.js

@@ -142,15 +142,8 @@ class MetastoreViewModel {
           return;
         }
       }
-      if (
-        this.source()
-          .namespace()
-          .database()
-      ) {
-        this.source()
-          .namespace()
-          .database()
-          .table(null);
+      if (this.source().namespace().database()) {
+        this.source().namespace().database().table(null);
       }
       this.source()
         .namespace()
@@ -174,36 +167,16 @@ class MetastoreViewModel {
         if (window.HAS_MULTI_CLUSTER) {
           params.namespace = this.source().namespace().id;
         }
-        if (
-          this.source()
-            .namespace()
-            .database() &&
-          this.source()
-            .namespace()
-            .database()
-            .table()
-        ) {
+        if (this.source().namespace().database() && this.source().namespace().database().table()) {
           hueUtils.changeURL(
             prefix +
               'table/' +
-              this.source()
-                .namespace()
-                .database()
-                .table()
-                .catalogEntry.path.join('/'),
+              this.source().namespace().database().table().catalogEntry.path.join('/'),
             params
           );
-        } else if (
-          this.source()
-            .namespace()
-            .database()
-        ) {
+        } else if (this.source().namespace().database()) {
           hueUtils.changeURL(
-            prefix +
-              'tables/' +
-              this.source()
-                .namespace()
-                .database().catalogEntry.name,
+            prefix + 'tables/' + this.source().namespace().database().catalogEntry.name,
             params
           );
         } else {
@@ -219,27 +192,15 @@ class MetastoreViewModel {
     };
 
     this.databasesBreadcrumb = () => {
-      if (
-        this.source()
-          .namespace()
-          .database()
-      ) {
-        this.source()
-          .namespace()
-          .database()
-          .table(null);
+      if (this.source().namespace().database()) {
+        this.source().namespace().database().table(null);
       }
-      this.source()
-        .namespace()
-        .database(null);
+      this.source().namespace().database(null);
       huePubSub.publish('metastore.url.change');
     };
 
     this.tablesBreadcrumb = () => {
-      this.source()
-        .namespace()
-        .database()
-        .table(null);
+      this.source().namespace().database().table(null);
       huePubSub.publish('metastore.url.change');
     };
 
@@ -252,7 +213,7 @@ class MetastoreViewModel {
           el => el.parent().hasClass('dataTables_wrapper'),
           () => {
             const sampleTable = $('#sampleTable');
-            const sampleCol = sampleTable.find('th').filter(function() {
+            const sampleCol = sampleTable.find('th').filter(function () {
               return $.trim($(this).text()).indexOf(col.catalogEntry.name) > -1;
             });
             sampleTable.find('.columnSelected').removeClass('columnSelected');
@@ -260,7 +221,7 @@ class MetastoreViewModel {
               .find('tr td:nth-child(' + (sampleCol.index() + 1) + ')')
               .addClass('columnSelected');
             let scrollLeft = 0;
-            sampleTable.find('th:lt(' + sampleCol.index() + ')').each(function() {
+            sampleTable.find('th:lt(' + sampleCol.index() + ')').each(function () {
               scrollLeft += $(this).outerWidth();
             });
             scrollLeft = Math.max(0, scrollLeft - 40);
@@ -301,20 +262,10 @@ class MetastoreViewModel {
     this.source()
       .namespace()
       .setDatabaseByName(entry.path[0], () => {
-        if (
-          this.source()
-            .namespace()
-            .database()
-        ) {
+        if (this.source().namespace().database()) {
           if (
-            this.source()
-              .namespace()
-              .database()
-              .table() &&
-            this.source()
-              .namespace()
-              .database()
-              .table().catalogEntry.name === entry.name
+            this.source().namespace().database().table() &&
+            this.source().namespace().database().table().catalogEntry.name === entry.name
           ) {
             if (callback) {
               callback();
@@ -329,14 +280,9 @@ class MetastoreViewModel {
               .tables()
               .filter(table => table.catalogEntry.name === entry.name);
             if (foundTables.length === 1) {
-              this.source()
-                .namespace()
-                .database()
-                .setTable(foundTables[0], callback);
+              this.source().namespace().database().setTable(foundTables[0], callback);
             } else if (clearDbCacheOnMissing) {
-              const dbEntry = this.source()
-                .namespace()
-                .database().catalogEntry;
+              const dbEntry = this.source().namespace().database().catalogEntry;
               dbEntry
                 .getChildren({ refreshCache: true, silenceErrors: true })
                 .then(childEntries => {
@@ -367,12 +313,7 @@ class MetastoreViewModel {
             }
           };
 
-          if (
-            !this.source()
-              .namespace()
-              .database()
-              .loaded()
-          ) {
+          if (!this.source().namespace().database().loaded()) {
             const doOnce = this.source()
               .namespace()
               .database()

+ 30 - 62
desktop/core/src/desktop/js/catalog/dataCatalog.js

@@ -39,7 +39,7 @@ let cacheEnabled = true;
  * @param {string[][]} [options.paths]
  * @return {string}
  */
-const generateEntryCacheId = function(options) {
+const generateEntryCacheId = function (options) {
   let id = options.namespace.id;
   if (options.path) {
     if (typeof options.path === 'string') {
@@ -65,8 +65,8 @@ const generateEntryCacheId = function(options) {
  * @param {DataCatalogEntry} dataCatalogEntry - The entry to fill
  * @param {Object} storeEntry - The cached version
  */
-const mergeEntry = function(dataCatalogEntry, storeEntry) {
-  const mergeAttribute = function(attributeName, ttl, promiseName) {
+const mergeEntry = function (dataCatalogEntry, storeEntry) {
+  const mergeAttribute = function (attributeName, ttl, promiseName) {
     if (
       storeEntry.version === DATA_CATALOG_VERSION &&
       storeEntry[attributeName] &&
@@ -100,11 +100,11 @@ const mergeEntry = function(dataCatalogEntry, storeEntry) {
  * @param {MultiTableEntry} multiTableCatalogEntry - The entry to fill
  * @param {Object} storeEntry - The cached version
  */
-const mergeMultiTableEntry = function(multiTableCatalogEntry, storeEntry) {
+const mergeMultiTableEntry = function (multiTableCatalogEntry, storeEntry) {
   if (multiTableCatalogEntry.getConnector().optimizer === LOCAL_STRATEGY) {
     return;
   }
-  const mergeAttribute = function(attributeName, ttl, promiseName) {
+  const mergeAttribute = function (attributeName, ttl, promiseName) {
     if (
       storeEntry.version === DATA_CATALOG_VERSION &&
       storeEntry[attributeName] &&
@@ -195,10 +195,7 @@ export class DataCatalog {
     if (!namespace || !compute) {
       if (rootPath.length === 0) {
         self.entries = {};
-        self.store
-          .clear()
-          .then(deferred.resolve)
-          .catch(deferred.reject);
+        self.store.clear().then(deferred.resolve).catch(deferred.reject);
         return deferred.promise();
       }
       return deferred.reject().promise();
@@ -221,10 +218,7 @@ export class DataCatalog {
           if (key.indexOf(keyPrefix) === 0) {
             const deleteDeferred = $.Deferred();
             deletePromises.push(deleteDeferred.promise());
-            self.store
-              .removeItem(key)
-              .then(deleteDeferred.resolve)
-              .catch(deleteDeferred.reject);
+            self.store.removeItem(key).then(deleteDeferred.resolve).catch(deleteDeferred.reject);
           }
         });
         keysDeferred.resolve();
@@ -243,9 +237,7 @@ export class DataCatalog {
   persistCatalogEntry(dataCatalogEntry) {
     const self = this;
     if (!cacheEnabled || CACHEABLE_TTL.default <= 0) {
-      return $.Deferred()
-        .resolve()
-        .promise();
+      return $.Deferred().resolve().promise();
     }
     const deferred = $.Deferred();
 
@@ -341,7 +333,7 @@ export class DataCatalog {
             .done(data => {
               const perTable = {};
 
-              const splitOptimizerValuesPerTable = function(listName) {
+              const splitOptimizerValuesPerTable = function (listName) {
                 if (data.values[listName]) {
                   data.values[listName].forEach(column => {
                     let tableMeta = perTable[column.dbName + '.' + column.tableName];
@@ -455,22 +447,16 @@ export class DataCatalog {
 
     const identifiersToClean = [];
 
-    const addEntryMeta = function(entry, sourceMeta) {
+    const addEntryMeta = function (entry, sourceMeta) {
       entry.sourceMeta = sourceMeta || entry.definition;
-      entry.sourceMetaPromise = $.Deferred()
-        .resolve(entry.sourceMeta)
-        .promise();
+      entry.sourceMetaPromise = $.Deferred().resolve(entry.sourceMeta).promise();
       entry.navigatorMeta = { comment: '' };
-      entry.navigatorMetaPromise = $.Deferred()
-        .resolve(entry.navigatorMeta)
-        .promise();
+      entry.navigatorMetaPromise = $.Deferred().resolve(entry.navigatorMeta).promise();
       entry.analysis = { is_view: false };
-      entry.analysisPromise = $.Deferred()
-        .resolve(entry.analysis)
-        .promise();
+      entry.analysisPromise = $.Deferred().resolve(entry.analysis).promise();
     };
 
-    let removeTable = function() {}; // noop until actually added
+    let removeTable = function () {}; // noop until actually added
 
     const sourceIdentifier = generateEntryCacheId({
       namespace: options.namespace,
@@ -494,9 +480,7 @@ export class DataCatalog {
       });
       addEntryMeta(sourceEntry);
       identifiersToClean.push(sourceIdentifier);
-      sourceEntry.childrenPromise = $.Deferred()
-        .resolve([])
-        .promise();
+      sourceEntry.childrenPromise = $.Deferred().resolve([]).promise();
       sourceDeferred.resolve(sourceEntry);
     }
 
@@ -524,9 +508,7 @@ export class DataCatalog {
           });
           addEntryMeta(databaseEntry);
           identifiersToClean.push(databaseIdentifier);
-          databaseEntry.childrenPromise = $.Deferred()
-            .resolve([])
-            .promise();
+          databaseEntry.childrenPromise = $.Deferred().resolve([]).promise();
           databaseDeferred.resolve(databaseEntry);
           existingTemporaryDatabases.push(databaseEntry);
         }
@@ -556,7 +538,7 @@ export class DataCatalog {
             });
             existingTemporaryTables.push(tableEntry);
             const indexToDelete = existingTemporaryTables.length - 1;
-            removeTable = function() {
+            removeTable = function () {
               existingTemporaryTables.splice(indexToDelete, 1);
             };
 
@@ -578,9 +560,7 @@ export class DataCatalog {
                 data: options.sample || [],
                 meta: tableEntry.sourceMeta.extended_columns
               };
-              tableEntry.samplePromise = $.Deferred()
-                .resolve(tableEntry.sample)
-                .promise();
+              tableEntry.samplePromise = $.Deferred().resolve(tableEntry.sample).promise();
 
               let index = 0;
               options.columns.forEach(column => {
@@ -618,9 +598,7 @@ export class DataCatalog {
                     columnEntry.sample.data.push([sampleRow[index - 1]]);
                   });
                 }
-                columnEntry.samplePromise = $.Deferred()
-                  .resolve(columnEntry.sample)
-                  .promise();
+                columnEntry.samplePromise = $.Deferred().resolve(columnEntry.sample).promise();
 
                 tableEntry.sourceMeta.columns.push(column.name);
                 tableEntry.sourceMeta.extended_columns.push(columnEntry.definition);
@@ -647,7 +625,7 @@ export class DataCatalog {
     });
 
     return {
-      delete: function() {
+      delete: function () {
         removeTable();
         while (identifiersToClean.length) {
           delete self.entries[identifiersToClean.pop()];
@@ -671,12 +649,7 @@ export class DataCatalog {
     const self = this;
     const identifier = generateEntryCacheId(options);
     if (options.temporaryOnly) {
-      return (
-        self.temporaryEntries[identifier] ||
-        $.Deferred()
-          .reject()
-          .promise()
-      );
+      return self.temporaryEntries[identifier] || $.Deferred().reject().promise();
     }
     if (self.entries[identifier]) {
       return self.entries[identifier];
@@ -808,9 +781,7 @@ export class DataCatalog {
       CACHEABLE_TTL.optimizer <= 0 ||
       multiTableEntry.getConnector().optimizer === LOCAL_STRATEGY
     ) {
-      return $.Deferred()
-        .resolve()
-        .promise();
+      return $.Deferred().resolve().promise();
     }
     const deferred = $.Deferred();
     self.multiTableStore
@@ -837,7 +808,7 @@ const sourceBoundCatalogs = {};
  *
  * @return {DataCatalog}
  */
-const getCatalog = function(connector) {
+const getCatalog = function (connector) {
   if (!connector || !connector.id) {
     throw new Error('getCatalog called without connector with id');
   }
@@ -867,7 +838,7 @@ export default {
    *
    * @return {Object}
    */
-  addTemporaryTable: function(options) {
+  addTemporaryTable: function (options) {
     return getCatalog(options.connector).addTemporaryTable(options);
   },
 
@@ -882,7 +853,7 @@ export default {
    *
    * @return {Promise}
    */
-  getEntry: function(options) {
+  getEntry: function (options) {
     return getCatalog(options.connector).getEntry(options);
   },
 
@@ -895,7 +866,7 @@ export default {
    *
    * @return {Promise}
    */
-  getMultiTableEntry: function(options) {
+  getMultiTableEntry: function (options) {
     return getCatalog(options.connector).getMultiTableEntry(options);
   },
 
@@ -916,17 +887,14 @@ export default {
    *
    * @return {CancellablePromise}
    */
-  getChildren: function(options) {
+  getChildren: function (options) {
     const deferred = $.Deferred();
     const cancellablePromises = [];
     getCatalog(options.connector)
       .getEntry(options)
       .done(entry => {
         cancellablePromises.push(
-          entry
-            .getChildren(options)
-            .done(deferred.resolve)
-            .fail(deferred.reject)
+          entry.getChildren(options).done(deferred.resolve).fail(deferred.reject)
         );
       })
       .fail(deferred.reject);
@@ -955,11 +923,11 @@ export default {
    */
   updateAllNavigatorTags: generalDataCatalog.updateAllNavigatorTags.bind(generalDataCatalog),
 
-  enableCache: function() {
+  enableCache: function () {
     cacheEnabled = true;
   },
 
-  disableCache: function() {
+  disableCache: function () {
     cacheEnabled = false;
   },
 

+ 29 - 65
desktop/core/src/desktop/js/catalog/dataCatalogEntry.js

@@ -34,7 +34,7 @@ import { DataCatalog } from './dataCatalog';
  *
  * @return {CancellablePromise}
  */
-const reloadSourceMeta = function(dataCatalogEntry, options) {
+const reloadSourceMeta = function (dataCatalogEntry, options) {
   if (dataCatalogEntry.dataCatalog.invalidatePromise) {
     const deferred = $.Deferred();
     const cancellablePromises = [];
@@ -67,7 +67,7 @@ const reloadSourceMeta = function(dataCatalogEntry, options) {
  *
  * @return {CancellablePromise}
  */
-const reloadNavigatorMeta = function(dataCatalogEntry, apiOptions) {
+const reloadNavigatorMeta = function (dataCatalogEntry, apiOptions) {
   if (dataCatalogEntry.canHaveNavigatorMetadata()) {
     return dataCatalogEntry
       .trackedPromise(
@@ -99,7 +99,7 @@ const reloadNavigatorMeta = function(dataCatalogEntry, apiOptions) {
  *
  * @return {CancellablePromise}
  */
-const reloadAnalysis = function(dataCatalogEntry, apiOptions) {
+const reloadAnalysis = function (dataCatalogEntry, apiOptions) {
   return dataCatalogEntry.trackedPromise(
     'analysisPromise',
     catalogUtils.fetchAndSave(
@@ -120,7 +120,7 @@ const reloadAnalysis = function(dataCatalogEntry, apiOptions) {
  *
  * @return {CancellablePromise}
  */
-const reloadPartitions = function(dataCatalogEntry, apiOptions) {
+const reloadPartitions = function (dataCatalogEntry, apiOptions) {
   return dataCatalogEntry.trackedPromise(
     'partitionsPromise',
     catalogUtils.fetchAndSave('fetchPartitions', 'partitions', dataCatalogEntry, apiOptions)
@@ -136,7 +136,7 @@ const reloadPartitions = function(dataCatalogEntry, apiOptions) {
  *
  * @return {CancellablePromise}
  */
-const reloadSample = function(dataCatalogEntry, apiOptions) {
+const reloadSample = function (dataCatalogEntry, apiOptions) {
   return dataCatalogEntry.trackedPromise(
     'samplePromise',
     catalogUtils.fetchAndSave('fetchSample', 'sample', dataCatalogEntry, apiOptions)
@@ -152,7 +152,7 @@ const reloadSample = function(dataCatalogEntry, apiOptions) {
  *
  * @return {CancellablePromise}
  */
-const reloadOptimizerMeta = function(dataCatalogEntry, apiOptions) {
+const reloadOptimizerMeta = function (dataCatalogEntry, apiOptions) {
   if (dataCatalogEntry.dataCatalog.canHaveOptimizerMeta()) {
     const optimizer = getOptimizer(dataCatalogEntry.dataCatalog.connector);
     return dataCatalogEntry.trackedPromise(
@@ -181,7 +181,7 @@ const reloadOptimizerMeta = function(dataCatalogEntry, apiOptions) {
  * @param {string} functionName - The function to call, i.e. 'getTopAggs' etc.
  * @return {CancellablePromise}
  */
-const getFromMultiTableCatalog = function(catalogEntry, options, functionName) {
+const getFromMultiTableCatalog = function (catalogEntry, options, functionName) {
   const deferred = $.Deferred();
   if (!catalogEntry.isTableOrView()) {
     return deferred.reject();
@@ -195,9 +195,7 @@ const getFromMultiTableCatalog = function(catalogEntry, options, functionName) {
     })
     .done(multiTableEntry => {
       cancellablePromises.push(
-        multiTableEntry[functionName](options)
-          .done(deferred.resolve)
-          .fail(deferred.reject)
+        multiTableEntry[functionName](options).done(deferred.resolve).fail(deferred.reject)
       );
     })
     .fail(deferred.reject);
@@ -373,9 +371,7 @@ class DataCatalogEntry {
    */
   getParent() {
     if (!this.path.length) {
-      return $.Deferred()
-        .reject()
-        .promise();
+      return $.Deferred().reject().promise();
     }
 
     return this.dataCatalog.getEntry({
@@ -518,7 +514,7 @@ class DataCatalogEntry {
             }
           });
         }
-        $.when.apply($, promises).done(function() {
+        $.when.apply($, promises).done(function () {
           deferred.resolve(Array.prototype.slice.call(arguments));
         });
       })
@@ -549,9 +545,7 @@ class DataCatalogEntry {
     options = catalogUtils.setSilencedErrors(options);
 
     if (!self.canHaveNavigatorMetadata() || self.isField()) {
-      return $.Deferred()
-        .reject()
-        .promise();
+      return $.Deferred().reject().promise();
     }
 
     if (
@@ -594,9 +588,7 @@ class DataCatalogEntry {
             children.forEach(childEntry => {
               if (!childEntry.navigatorMeta) {
                 childEntry.navigatorMeta = {};
-                childEntry.navigatorMetaPromise = $.Deferred()
-                  .reject()
-                  .promise();
+                childEntry.navigatorMetaPromise = $.Deferred().reject().promise();
               }
             });
           };
@@ -692,7 +684,7 @@ class DataCatalogEntry {
             }
           });
         } else if (self.isTableOrView() && response.values) {
-          const addOptimizerPopularity = function(columns, type) {
+          const addOptimizerPopularity = function (columns, type) {
             if (columns) {
               columns.forEach(column => {
                 const matchingChild = entriesByName[column.columnName.toLowerCase()];
@@ -741,9 +733,7 @@ class DataCatalogEntry {
     options = catalogUtils.setSilencedErrors(options);
 
     if (!self.dataCatalog.canHaveOptimizerMeta()) {
-      return $.Deferred()
-        .reject()
-        .promise();
+      return $.Deferred().reject().promise();
     }
     if (
       self.optimizerPopularityForChildrenPromise &&
@@ -875,7 +865,7 @@ class DataCatalogEntry {
     const deferred = $.Deferred();
     const cancellablePromises = [];
 
-    const resolveWithSourceMeta = function() {
+    const resolveWithSourceMeta = function () {
       if (self.sourceMeta) {
         deferred.resolve(self.sourceMeta.comment || '');
       } else if (self.definition && typeof self.definition.comment !== 'undefined') {
@@ -968,9 +958,7 @@ class DataCatalogEntry {
               .done(entity => {
                 if (entity) {
                   self.navigatorMeta = entity;
-                  self.navigatorMetaPromise = $.Deferred()
-                    .resolve(self.navigatorMeta)
-                    .promise();
+                  self.navigatorMetaPromise = $.Deferred().resolve(self.navigatorMeta).promise();
                   self.saveLater();
                   deferred.resolve(self.navigatorMeta);
                 } else {
@@ -1026,9 +1014,7 @@ class DataCatalogEntry {
               .done(entity => {
                 if (entity) {
                   self.navigatorMeta = entity;
-                  self.navigatorMetaPromise = $.Deferred()
-                    .resolve(self.navigatorMeta)
-                    .promise();
+                  self.navigatorMetaPromise = $.Deferred().resolve(self.navigatorMeta).promise();
                   self.saveLater();
                 }
                 self.getComment(apiOptions).done(comment => {
@@ -1085,9 +1071,7 @@ class DataCatalogEntry {
               .done(entity => {
                 if (entity) {
                   self.navigatorMeta = entity;
-                  self.navigatorMetaPromise = $.Deferred()
-                    .resolve(self.navigatorMeta)
-                    .promise();
+                  self.navigatorMetaPromise = $.Deferred().resolve(self.navigatorMeta).promise();
                   self.saveLater();
                 } else {
                   deferred.reject();
@@ -1126,9 +1110,7 @@ class DataCatalogEntry {
               .done(entity => {
                 if (entity) {
                   self.navigatorMeta = entity;
-                  self.navigatorMetaPromise = $.Deferred()
-                    .resolve(self.navigatorMeta)
-                    .promise();
+                  self.navigatorMetaPromise = $.Deferred().resolve(self.navigatorMeta).promise();
                   self.saveLater();
                 } else {
                   deferred.reject();
@@ -1488,9 +1470,7 @@ class DataCatalogEntry {
     if (options && options.cachedOnly) {
       return (
         catalogUtils.applyCancellable(self.sourceMetaPromise, options) ||
-        $.Deferred()
-          .reject(false)
-          .promise()
+        $.Deferred().reject(false).promise()
       );
     }
     if (options && options.refreshCache) {
@@ -1519,9 +1499,7 @@ class DataCatalogEntry {
     if (options && options.cachedOnly) {
       return (
         catalogUtils.applyCancellable(self.analysisPromise, options) ||
-        $.Deferred()
-          .reject(false)
-          .promise()
+        $.Deferred().reject(false).promise()
       );
     }
     if (options && (options.refreshCache || options.refreshAnalysis)) {
@@ -1547,16 +1525,12 @@ class DataCatalogEntry {
   getPartitions(options) {
     const self = this;
     if (!self.isTableOrView()) {
-      return $.Deferred()
-        .reject(false)
-        .promise();
+      return $.Deferred().reject(false).promise();
     }
     if (options && options.cachedOnly) {
       return (
         catalogUtils.applyCancellable(self.partitionsPromise, options) ||
-        $.Deferred()
-          .reject(false)
-          .promise()
+        $.Deferred().reject(false).promise()
       );
     }
     if (options && options.refreshCache) {
@@ -1585,16 +1559,12 @@ class DataCatalogEntry {
     options = catalogUtils.setSilencedErrors(options);
 
     if (!self.canHaveNavigatorMetadata()) {
-      return $.Deferred()
-        .reject()
-        .promise();
+      return $.Deferred().reject().promise();
     }
     if (options && options.cachedOnly) {
       return (
         catalogUtils.applyCancellable(self.navigatorMetaPromise, options) ||
-        $.Deferred()
-          .reject(false)
-          .promise()
+        $.Deferred().reject(false).promise()
       );
     }
     if (options && options.refreshCache) {
@@ -1623,16 +1593,12 @@ class DataCatalogEntry {
     options = catalogUtils.setSilencedErrors(options);
 
     if (!self.dataCatalog.canHaveOptimizerMeta() || !self.isTableOrView()) {
-      return $.Deferred()
-        .reject()
-        .promise();
+      return $.Deferred().reject().promise();
     }
     if (options && options.cachedOnly) {
       return (
         catalogUtils.applyCancellable(self.optimizerMetaPromise, options) ||
-        $.Deferred()
-          .reject(false)
-          .promise()
+        $.Deferred().reject(false).promise()
       );
     }
     if (options && options.refreshCache) {
@@ -1679,7 +1645,7 @@ class DataCatalogEntry {
       const deferred = $.Deferred();
       const cancellablePromises = [];
 
-      const revertToSpecific = function() {
+      const revertToSpecific = function () {
         if (options && options.cachedOnly) {
           deferred.reject();
         } else {
@@ -1751,9 +1717,7 @@ class DataCatalogEntry {
     if (options && options.cachedOnly) {
       return (
         catalogUtils.applyCancellable(self.samplePromise, options) ||
-        $.Deferred()
-          .reject(false)
-          .promise()
+        $.Deferred().reject(false).promise()
       );
     }
     if (options && options.refreshCache) {

+ 3 - 5
desktop/core/src/desktop/js/catalog/multiTableEntry.js

@@ -31,7 +31,7 @@ import { DataCatalog } from './dataCatalog';
  * @param {Function} apiHelperFunction
  * @return {CancellablePromise}
  */
-const genericOptimizerReload = function(
+const genericOptimizerReload = function (
   multiTableEntry,
   options,
   promiseAttribute,
@@ -62,7 +62,7 @@ const genericOptimizerReload = function(
  * @param {Function} apiHelperFunction
  * @return {CancellablePromise}
  */
-const genericOptimizerGet = function(
+const genericOptimizerGet = function (
   multiTableEntry,
   options,
   promiseAttribute,
@@ -72,9 +72,7 @@ const genericOptimizerGet = function(
   if (DataCatalog.cacheEnabled() && options && options.cachedOnly) {
     return (
       catalogUtils.applyCancellable(multiTableEntry[promiseAttribute], options) ||
-      $.Deferred()
-        .reject(false)
-        .promise()
+      $.Deferred().reject(false).promise()
     );
   }
   if (!DataCatalog.cacheEnabled() || (options && options.refreshCache)) {

+ 8 - 20
desktop/core/src/desktop/js/doc/hueFileEntry.js

@@ -99,16 +99,10 @@ class HueFileEntry {
           return (
             (typeFilter === 'all' || entryType === typeFilter || entryType === 'directory') &&
             (!filter ||
-              entry
-                .definition()
-                .name.toLowerCase()
-                .indexOf(filter) !== -1 ||
+              entry.definition().name.toLowerCase().indexOf(filter) !== -1 ||
               (DOCUMENT_TYPE_I18n[entryType] &&
                 DOCUMENT_TYPE_I18n[entryType].toLowerCase().indexOf(filter) !== -1) ||
-              entry
-                .definition()
-                .description.toLowerCase()
-                .indexOf(filter) !== -1)
+              entry.definition().description.toLowerCase().indexOf(filter) !== -1)
           );
         });
       }
@@ -389,10 +383,7 @@ class HueFileEntry {
     }
     const copyNext = () => {
       if (self.selectedEntries().length > 0) {
-        const nextUuid = self
-          .selectedEntries()
-          .shift()
-          .definition().uuid;
+        const nextUuid = self.selectedEntries().shift().definition().uuid;
         apiHelper.copyDocument({
           uuid: nextUuid,
           successCallback: () => {
@@ -507,7 +498,7 @@ class HueFileEntry {
       uuid: owner.uuid,
       query: query,
       type: self.serverTypeFilter().type,
-      successCallback: function(data) {
+      successCallback: function (data) {
         resultEntry.hasErrors(false);
         const newEntries = [];
 
@@ -629,7 +620,7 @@ class HueFileEntry {
   emptyTrash() {
     if (this.trashEntry()) {
       if (!this.trashEntry().loaded()) {
-        this.trashEntry().load(function() {
+        this.trashEntry().load(function () {
           this.entriesToDelete(this.trashEntry().entries());
           $('#deleteEntriesModal').modal('show');
         });
@@ -668,10 +659,7 @@ class HueFileEntry {
 
     const deleteNext = () => {
       if (self.entriesToDelete().length > 0) {
-        const nextUuid = self
-          .entriesToDelete()
-          .shift()
-          .definition().uuid;
+        const nextUuid = self.entriesToDelete().shift().definition().uuid;
         apiHelper.deleteDocument({
           uuid: nextUuid,
           skipTrash: deleteForever,
@@ -829,7 +817,7 @@ class HueFileEntry {
     const self = this;
     if (name && self.app === 'documents') {
       apiHelper.createDocumentsFolder({
-        successCallback: function() {
+        successCallback: function () {
           huePubSub.publish('assist.document.refresh');
           self.load();
         },
@@ -844,7 +832,7 @@ class HueFileEntry {
     const self = this;
     if (name && self.app === 'documents') {
       apiHelper.updateDocument({
-        successCallback: function() {
+        successCallback: function () {
           huePubSub.publish('assist.document.refresh');
           self.load();
         },

+ 1 - 1
desktop/core/src/desktop/js/jest/jest.init.js

@@ -103,7 +103,7 @@ Object.keys(globalVars).forEach(key => {
 });
 
 $.ajaxSetup({
-  beforeSend: function() {
+  beforeSend: function () {
     console.warn('actual jQuery ajax called');
     console.trace();
   }

+ 2 - 2
desktop/core/src/desktop/js/jest/sqlTestUtils.js

@@ -15,7 +15,7 @@
 // limitations under the License.
 
 // Needed to compare by val without taking attr order into account
-const resultEquals = function(a, b) {
+const resultEquals = function (a, b) {
   if (typeof a !== typeof b) {
     return false;
   }
@@ -37,7 +37,7 @@ const resultEquals = function(a, b) {
   return a == b;
 };
 
-const jsonStringToJsString = function(jsonString) {
+const jsonStringToJsString = function (jsonString) {
   return jsonString
     .replace(/'([a-zA-Z]+)':/g, (all, group) => {
       return group + ':';

+ 4 - 4
desktop/core/src/desktop/js/jquery/jquery.migration.js

@@ -20,7 +20,7 @@
 
 import jQuery from 'jquery';
 
-jQuery.uaMatch = function(ua) {
+jQuery.uaMatch = function (ua) {
   ua = ua.toLowerCase();
 
   const match =
@@ -61,7 +61,7 @@ if (!jQuery.browser) {
 if (!jQuery.clean) {
   const rscriptType = /\/(java|ecma)script/i;
 
-  jQuery.clean = function(elems, context, fragment, scripts) {
+  jQuery.clean = function (elems, context, fragment, scripts) {
     // Set context per 1.8 logic
     context = context || document;
     context = (!context.nodeType && context[0]) || context;
@@ -76,7 +76,7 @@ if (!jQuery.clean) {
     // Complex logic lifted directly from jQuery 1.8
     if (fragment) {
       // Special handling of each script element
-      handleScript = function(elem) {
+      handleScript = function (elem) {
         // Check if we consider it executable
         if (!elem.type || rscriptType.test(elem.type)) {
           // Detach the script and store it in the scripts array (if provided) or the fragment
@@ -113,6 +113,6 @@ if (!jQuery.clean) {
 
 const oldSelf = jQuery.fn.andSelf || jQuery.fn.addBack;
 
-jQuery.fn.andSelf = function() {
+jQuery.fn.andSelf = function () {
   return oldSelf.apply(this, arguments);
 };

+ 1 - 1
desktop/core/src/desktop/js/jquery/plugins/jquery.datatables.sorting.js

@@ -16,7 +16,7 @@
 
 import $ from 'jquery';
 
-$.fn.dataTableExt.afnSortData['dom-sort-value'] = function(oSettings, iColumn) {
+$.fn.dataTableExt.afnSortData['dom-sort-value'] = function (oSettings, iColumn) {
   const aData = [];
   oSettings.oApi._fnGetTrNodes(oSettings).forEach(nRow => {
     const oElem = $('td:eq(' + iColumn + ')', nRow);

+ 4 - 4
desktop/core/src/desktop/js/jquery/plugins/jquery.delayedinput.js

@@ -37,11 +37,11 @@ function Plugin(element, options) {
   this.init();
 }
 
-Plugin.prototype.setOptions = function(options) {
+Plugin.prototype.setOptions = function (options) {
   this.options = $.extend({}, defaults, options);
 };
 
-Plugin.prototype.init = function() {
+Plugin.prototype.init = function () {
   const _this = this;
   let _timeout = -1;
   if (_this.options.fn != null) {
@@ -56,13 +56,13 @@ Plugin.prototype.init = function() {
   }
 };
 
-$.fn[pluginName] = function(fn, timeout, skipOnEnterAndKeys) {
+$.fn[pluginName] = function (fn, timeout, skipOnEnterAndKeys) {
   const _options = {
     fn: fn,
     timeout: timeout,
     skipOnEnterAndKeys: typeof skipOnEnterAndKeys !== 'undefined' && skipOnEnterAndKeys
   };
-  return this.each(function() {
+  return this.each(function () {
     if (!$.data(this, 'plugin_' + pluginName)) {
       $.data(this, 'plugin_' + pluginName, new Plugin(this, _options));
     } else {

+ 63 - 118
desktop/core/src/desktop/js/jquery/plugins/jquery.filechooser.js

@@ -127,11 +127,11 @@ const pluginName = 'jHueFileChooser',
     },
     fsSelected: 'hdfs',
     user: '',
-    onNavigate: function() {},
-    onFileChoose: function() {},
-    onFolderChoose: function() {},
-    onFolderChange: function() {},
-    onError: function() {}
+    onNavigate: function () {},
+    onFileChoose: function () {},
+    onFolderChoose: function () {},
+    onFolderChange: function () {},
+    onError: function () {}
   },
   STORAGE_PREFIX = 'hueFileBrowserLastPathForUser_';
 
@@ -158,7 +158,7 @@ function Plugin(element, options) {
   this.init();
 }
 
-Plugin.prototype.setOptions = function(options) {
+Plugin.prototype.setOptions = function (options) {
   const self = this;
   self.options = $.extend({}, defaults, { user: window.LOGGED_USERNAME }, options);
   self.options.labels = $.extend({}, defaults.labels, DEFAULT_I18n, options ? options.labels : {});
@@ -168,9 +168,7 @@ Plugin.prototype.setOptions = function(options) {
     self.options.fsSelected = scheme;
   }
 
-  $(self.element)
-    .find('.filechooser-services li')
-    .removeClass('active');
+  $(self.element).find('.filechooser-services li').removeClass('active');
   $(self.element)
     .find('.filechooser-services li[data-fs="' + self.options.fsSelected + '"]')
     .addClass('active');
@@ -209,7 +207,7 @@ function getFs(scheme) {
   }
 }
 
-Plugin.prototype.setFileSystems = function(filesystems) {
+Plugin.prototype.setFileSystems = function (filesystems) {
   const self = this;
   let filters, filesystemsFiltered;
   self.options.filesystems = [];
@@ -233,9 +231,7 @@ Plugin.prototype.setFileSystems = function(filesystems) {
 
   $(self.element).data('fs', filesystemsFiltered);
   if (filesystemsFiltered.length > 1) {
-    const $ul = $('<ul>')
-      .addClass('nav nav-list')
-      .css('border', 'none');
+    const $ul = $('<ul>').addClass('nav nav-list').css('border', 'none');
     filesystemsFiltered.forEach(fs => {
       const filesysteminfo = self.options.filesysteminfo;
       const $li = $('<li>')
@@ -246,10 +242,8 @@ Plugin.prototype.setFileSystems = function(filesystems) {
             (filesysteminfo[fs] ? filesysteminfo[fs].label.name : fs.toUpperCase()) +
             '</a>'
         );
-      $li.on('click', function() {
-        $(this)
-          .siblings()
-          .removeClass('active');
+      $li.on('click', function () {
+        $(this).siblings().removeClass('active');
         $(this).addClass('active');
         self.options.fsSelected = fs;
         const storedPath = $.totalStorage(
@@ -267,10 +261,7 @@ Plugin.prototype.setFileSystems = function(filesystems) {
       });
       $li.appendTo($ul);
     });
-    $(self.element)
-      .find('.filechooser-services')
-      .empty()
-      .width(80);
+    $(self.element).find('.filechooser-services').empty().width(80);
     $(self.element)
       .find('.filechooser-tree')
       .width(480)
@@ -283,7 +274,7 @@ Plugin.prototype.setFileSystems = function(filesystems) {
 };
 
 //TODO: refactor this method to template
-Plugin.prototype.navigateTo = function(path) {
+Plugin.prototype.navigateTo = function (path) {
   const _parent = this;
   $(_parent.element)
     .find('.filechooser-tree')
@@ -295,25 +286,19 @@ Plugin.prototype.navigateTo = function(path) {
     path = path.substring(0, index);
   }
   $.getJSON('/filebrowser/view=' + encodeURIComponent(path) + pageSize, data => {
-    $(_parent.element)
-      .find('.filechooser-tree')
-      .empty();
+    $(_parent.element).find('.filechooser-tree').empty();
 
     path = data.current_dir_path || path; // use real path.
-    const _flist = $('<ul>')
-      .addClass('unstyled')
-      .css({
-        height: '260px',
-        'overflow-y': 'auto'
-      });
-    const $homeBreadcrumb = $('<ul>')
-      .addClass('hue-breadcrumbs')
-      .css({
-        padding: '0',
-        marginLeft: '0',
-        float: 'left',
-        'white-space': 'nowrap'
-      });
+    const _flist = $('<ul>').addClass('unstyled').css({
+      height: '260px',
+      'overflow-y': 'auto'
+    });
+    const $homeBreadcrumb = $('<ul>').addClass('hue-breadcrumbs').css({
+      padding: '0',
+      marginLeft: '0',
+      float: 'left',
+      'white-space': 'nowrap'
+    });
     const _home = $('<li>');
     //var filesysteminfo = self.options.filesysteminfo;
     const fs = _parent.options.filesysteminfo[_parent.options.fsSelected || 'hdfs'];
@@ -331,10 +316,7 @@ Plugin.prototype.navigateTo = function(path) {
     _homelink.appendTo(_home);
     _home.appendTo($homeBreadcrumb);
 
-    $('<span>')
-      .addClass('divider')
-      .css('margin-right', '20px')
-      .appendTo(_home);
+    $('<span>').addClass('divider').css('margin-right', '20px').appendTo(_home);
 
     if (data.error || (data.title != null && data.title == 'Error')) {
       $homeBreadcrumb.appendTo($(_parent.element).find('.filechooser-tree'));
@@ -406,15 +388,15 @@ Plugin.prototype.navigateTo = function(path) {
       const tog = v => (v ? 'addClass' : 'removeClass');
       $searchInput.addClass('clearable');
       $searchInput
-        .on('input', function() {
+        .on('input', function () {
           $searchInput[tog(this.value)]('x');
         })
-        .on('mousemove', function(e) {
+        .on('mousemove', function (e) {
           $searchInput[tog(this.offsetWidth - 18 < e.clientX - this.getBoundingClientRect().left)](
             'onX'
           );
         })
-        .on('click', function(e) {
+        .on('click', function (e) {
           if (this.offsetWidth - 18 < e.clientX - this.getBoundingClientRect().left) {
             $searchInput.removeClass('x onX').val('');
           }
@@ -450,19 +432,17 @@ Plugin.prototype.navigateTo = function(path) {
 
       $search.appendTo($(_parent.element).find('.filechooser-tree'));
 
-      const $scrollingBreadcrumbs = $('<ul>')
-        .addClass('hue-breadcrumbs editable-breadcrumbs')
-        .css({
-          padding: '0',
-          marginLeft: '10px',
-          marginBottom: '0',
-          paddingRight: '10px',
-          float: 'left',
-          width: '300px',
-          'overflow-x': 'scroll',
-          'overflow-y': 'hidden',
-          'white-space': 'nowrap'
-        });
+      const $scrollingBreadcrumbs = $('<ul>').addClass('hue-breadcrumbs editable-breadcrumbs').css({
+        padding: '0',
+        marginLeft: '10px',
+        marginBottom: '0',
+        paddingRight: '10px',
+        float: 'left',
+        width: '300px',
+        'overflow-x': 'scroll',
+        'overflow-y': 'hidden',
+        'white-space': 'nowrap'
+      });
 
       if (ko && ko.bindingHandlers.delayedOverflow) {
         ko.bindingHandlers.delayedOverflow.init($scrollingBreadcrumbs[0]);
@@ -483,10 +463,7 @@ Plugin.prototype.navigateTo = function(path) {
             _parent.navigateTo(_parent.options.extraHomeProperties.path);
           });
         _extraHomelink.appendTo(_extraHome);
-        $('<span>')
-          .addClass('divider')
-          .css('margin-right', '20px')
-          .appendTo(_extraHome);
+        $('<span>').addClass('divider').css('margin-right', '20px').appendTo(_extraHome);
         _extraHome.appendTo($scrollingBreadcrumbs);
       }
 
@@ -495,7 +472,7 @@ Plugin.prototype.navigateTo = function(path) {
         .val(path)
         .hide();
 
-      $scrollingBreadcrumbs.click(function(e) {
+      $scrollingBreadcrumbs.click(function (e) {
         if ($(e.target).is('ul') || $(e.target).hasClass('spacer')) {
           $(this).hide();
           $hdfsAutocomplete.show().focus();
@@ -512,20 +489,12 @@ Plugin.prototype.navigateTo = function(path) {
           const _crumb = $('<li>');
           const _crumbLink = $('<a>');
           const _crumbLabel = crumb.label != null && crumb.label != '' ? crumb.label : '/';
-          _crumbLink
-            .attr('href', 'javascript:void(0)')
-            .text(_crumbLabel)
-            .appendTo(_crumb);
+          _crumbLink.attr('href', 'javascript:void(0)').text(_crumbLabel).appendTo(_crumb);
           if (cnt < _bLength - 1) {
             if (cnt > 0) {
-              $('<span>')
-                .addClass('divider')
-                .text('/')
-                .appendTo(_crumb);
+              $('<span>').addClass('divider').text('/').appendTo(_crumb);
             } else {
-              $('<span>')
-                .html('&nbsp;')
-                .appendTo(_crumb);
+              $('<span>').html('&nbsp;').appendTo(_crumb);
             }
           }
           _crumb.click(() => {
@@ -544,32 +513,26 @@ Plugin.prototype.navigateTo = function(path) {
         home: '/user/' + _parent.options.user + '/',
         skipEnter: true,
         skipKeydownEvents: true,
-        onEnter: function(el) {
+        onEnter: function (el) {
           const _url = el.val();
           _parent.options.onFolderChange(_url);
           _parent.navigateTo(_url);
           $('#jHueHdfsAutocomplete').hide();
         },
-        onBlur: function() {
+        onBlur: function () {
           $hdfsAutocomplete.hide();
           $scrollingBreadcrumbs.show();
         },
         smartTooltip: _parent.options.labels.SMART_TOOLTIP
       });
 
-      $('<div>')
-        .addClass('clearfix')
-        .appendTo($(_parent.element).find('.filechooser-tree'));
+      $('<div>').addClass('clearfix').appendTo($(_parent.element).find('.filechooser-tree'));
 
       const resizeBreadcrumbs = window.setInterval(() => {
         if ($homeBreadcrumb.is(':visible') && $homeBreadcrumb.width() > 0) {
           window.clearInterval(resizeBreadcrumbs);
           $scrollingBreadcrumbs.width(
-            $(_parent.element)
-              .find('.filechooser-tree')
-              .width() -
-              $homeBreadcrumb.width() -
-              65
+            $(_parent.element).find('.filechooser-tree').width() - $homeBreadcrumb.width() - 65
           );
         }
       }, 100);
@@ -591,10 +554,7 @@ Plugin.prototype.navigateTo = function(path) {
         let _addFile = file.name !== '.';
         if (_parent.options.filterExtensions != '' && file.type == 'file') {
           const _allowedExtensions = _parent.options.filterExtensions.split(',');
-          const _fileExtension = file.name
-            .split('.')
-            .pop()
-            .toLowerCase();
+          const _fileExtension = file.name.split('.').pop().toLowerCase();
           _addFile = _allowedExtensions.indexOf(_fileExtension) > -1;
         }
         if (_addFile) {
@@ -648,18 +608,11 @@ Plugin.prototype.navigateTo = function(path) {
       $searchInput.jHueDelayedInput(() => {
         const filter = $searchInput.val().toLowerCase();
         let results = 0;
-        $(_parent.element)
-          .find('.filechooser-tree .no-results')
-          .hide();
+        $(_parent.element).find('.filechooser-tree .no-results').hide();
         $(_parent.element)
           .find('.filechooser-tree .file-list-item')
-          .each(function() {
-            if (
-              $(this)
-                .text()
-                .toLowerCase()
-                .indexOf(filter) > -1
-            ) {
+          .each(function () {
+            if ($(this).text().toLowerCase().indexOf(filter) > -1) {
               $(this).show();
               results++;
             } else {
@@ -667,9 +620,7 @@ Plugin.prototype.navigateTo = function(path) {
             }
           });
         if (results == 0) {
-          $(_parent.element)
-            .find('.filechooser-tree .no-results')
-            .show();
+          $(_parent.element).find('.filechooser-tree .no-results').show();
         }
       }, 300);
 
@@ -687,9 +638,7 @@ Plugin.prototype.navigateTo = function(path) {
         initUploader(path, _parent, _uploadFileBtn, _parent.options.labels);
       }
       if (_parent.options.selectFolder) {
-        _selectFolderBtn = $('<a>')
-          .addClass('btn')
-          .text(_parent.options.labels.SELECT_FOLDER);
+        _selectFolderBtn = $('<a>').addClass('btn').text(_parent.options.labels.SELECT_FOLDER);
         if (_parent.options.uploadFile) {
           _selectFolderBtn.css('margin-top', '10px');
         }
@@ -701,9 +650,7 @@ Plugin.prototype.navigateTo = function(path) {
       }
       $('<span> </span>').appendTo(_actions);
       if (_parent.options.createFolder) {
-        _createFolderBtn = $('<a>')
-          .addClass('btn')
-          .text(_parent.options.labels.CREATE_FOLDER);
+        _createFolderBtn = $('<a>').addClass('btn').text(_parent.options.labels.CREATE_FOLDER);
         if (_parent.options.uploadFile) {
           _createFolderBtn.css('margin-top', '10px');
         }
@@ -745,7 +692,7 @@ Plugin.prototype.navigateTo = function(path) {
                 name: _folderName.val(),
                 path: path
               },
-              success: function(xhr, status) {
+              success: function (xhr, status) {
                 if (status == 'success') {
                   _parent.navigateTo(path);
                   if (_uploadFileBtn) {
@@ -755,7 +702,7 @@ Plugin.prototype.navigateTo = function(path) {
                   _createFolderDetails.slideUp();
                 }
               },
-              error: function(xhr) {
+              error: function (xhr) {
                 $(document).trigger('error', xhr.responseText);
               }
             });
@@ -777,9 +724,7 @@ Plugin.prototype.navigateTo = function(path) {
       }
 
       window.setTimeout(() => {
-        $(_parent.element)
-          .parent()
-          .scrollTop(0);
+        $(_parent.element).parent().scrollTop(0);
         $scrollingBreadcrumbs.animate({
           scrollLeft: $scrollingBreadcrumbs.width()
         });
@@ -812,7 +757,7 @@ function initUploader(path, _parent, el, labels) {
       dest: path,
       fileFieldLabel: 'hdfs_file'
     },
-    onComplete: function(id, fileName, responseJSON) {
+    onComplete: function (id, fileName, responseJSON) {
       num_of_pending_uploads--;
       if (responseJSON.status == -1) {
         $(document).trigger('error', responseJSON.data);
@@ -821,7 +766,7 @@ function initUploader(path, _parent, el, labels) {
         huePubSub.publish('assist.' + getFs(getScheme(path)) + '.refresh');
       }
     },
-    onSubmit: function(id, fileName) {
+    onSubmit: function (id, fileName) {
       num_of_pending_uploads++;
     },
     template:
@@ -848,7 +793,7 @@ function initUploader(path, _parent, el, labels) {
   });
 }
 
-Plugin.prototype.init = function() {
+Plugin.prototype.init = function () {
   const self = this;
   $(self.element)
     .empty()
@@ -876,8 +821,8 @@ Plugin.prototype.init = function() {
   });
 };
 
-$.fn[pluginName] = function(options) {
-  return this.each(function() {
+$.fn[pluginName] = function (options) {
+  return this.each(function () {
     if (!$.data(this, 'plugin_' + pluginName)) {
       $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
     } else {

+ 24 - 63
desktop/core/src/desktop/js/jquery/plugins/jquery.hdfs.autocomplete.js

@@ -26,9 +26,9 @@ import hueUtils from 'utils/hueUtils';
 const pluginName = 'jHueHdfsAutocomplete',
   defaults = {
     home: '/',
-    onEnter: function() {},
-    onBlur: function() {},
-    onPathChange: function() {},
+    onEnter: function () {},
+    onBlur: function () {},
+    onPathChange: function () {},
     smartTooltip: '',
     smartTooltipThreshold: 10, // needs 10 up/down or click actions and no tab to activate the smart tooltip
     showOnFocus: false,
@@ -48,7 +48,7 @@ function Plugin(element, options) {
   this.init();
 }
 
-Plugin.prototype.init = function() {
+Plugin.prototype.init = function () {
   const _this = this;
   const _el = $(_this.element);
   _el.addClass('jHueAutocompleteElement');
@@ -158,7 +158,7 @@ Plugin.prototype.init = function() {
 
   let _hdfsAutocompleteSelectedIndex = -1;
   let _filterTimeout = -1;
-  _el.keyup(function(e) {
+  _el.keyup(function (e) {
     window.clearTimeout(_filterTimeout);
     if ($.inArray(e.keyCode, [38, 40, 13, 32, 191]) == -1) {
       _hdfsAutocompleteSelectedIndex = -1;
@@ -168,13 +168,8 @@ Plugin.prototype.init = function() {
           path = path.substr(path.lastIndexOf('/') + 1);
         }
         $('#jHueHdfsAutocomplete ul li').show();
-        $('#jHueHdfsAutocomplete ul li').each(function() {
-          if (
-            $(this)
-              .text()
-              .trim()
-              .indexOf(path) != 0
-          ) {
+        $('#jHueHdfsAutocomplete ul li').each(function () {
+          if ($(this).text().trim().indexOf(path) != 0) {
             $(this).hide();
           }
         });
@@ -201,12 +196,9 @@ Plugin.prototype.init = function() {
         .eq(_hdfsAutocompleteSelectedIndex)
         .addClass('active');
       $('#jHueHdfsAutocomplete .popover-content').scrollTop(
-        $('#jHueHdfsAutocomplete ul li:visible')
-          .eq(_hdfsAutocompleteSelectedIndex)
-          .prevAll().length *
-          $('#jHueHdfsAutocomplete ul li:visible')
-            .eq(_hdfsAutocompleteSelectedIndex)
-            .outerHeight()
+        $('#jHueHdfsAutocomplete ul li:visible').eq(_hdfsAutocompleteSelectedIndex).prevAll()
+          .length *
+          $('#jHueHdfsAutocomplete ul li:visible').eq(_hdfsAutocompleteSelectedIndex).outerHeight()
       );
     }
     if ((e.keyCode == 32 && e.ctrlKey) || e.keyCode == 191) {
@@ -215,9 +207,7 @@ Plugin.prototype.init = function() {
     }
     if (e.keyCode == 13) {
       if (_hdfsAutocompleteSelectedIndex > -1) {
-        $('#jHueHdfsAutocomplete ul li:visible')
-          .eq(_hdfsAutocompleteSelectedIndex)
-          .click();
+        $('#jHueHdfsAutocomplete ul li:visible').eq(_hdfsAutocompleteSelectedIndex).click();
       } else {
         _this.options.onEnter($(this));
       }
@@ -279,18 +269,13 @@ Plugin.prototype.init = function() {
             .css('top', _el.offset().top + _el.outerHeight() - 1)
             .css('left', _el.offset().left)
             .width(_el.outerWidth() - 4);
-          $('#jHueHdfsAutocomplete')
-            .find('ul')
-            .empty()
-            .html(_currentFiles.join(''));
+          $('#jHueHdfsAutocomplete').find('ul').empty().html(_currentFiles.join(''));
           $('#jHueHdfsAutocomplete')
             .find('li')
-            .on('click', function(e) {
+            .on('click', function (e) {
               smartTooltipMaker();
               e.preventDefault();
-              const item = $(this)
-                .text()
-                .trim();
+              const item = $(this).text().trim();
               if (item == '..') {
                 // one folder up
                 path = path.substring(0, path.lastIndexOf('/'));
@@ -298,11 +283,7 @@ Plugin.prototype.init = function() {
                 path = path + (path.charAt(path.length - 1) == '/' ? '' : '/') + item;
               }
               _el.val(base + path);
-              if (
-                $(this)
-                  .html()
-                  .indexOf('folder') > -1
-              ) {
+              if ($(this).html().indexOf('folder') > -1) {
                 _el.val(_el.val() + '/');
                 _this.options.onPathChange(_el.val());
                 showHdfsAutocomplete();
@@ -332,31 +313,15 @@ Plugin.prototype.init = function() {
     const possibleMatches = [];
     for (let i = 0; i < _currentFiles.length; i++) {
       if (
-        ($(_currentFiles[i])
-          .text()
-          .trim()
-          .indexOf(lastChars) == 0 ||
-          lastChars == '') &&
-        $(_currentFiles[i])
-          .text()
-          .trim() != '..'
+        ($(_currentFiles[i]).text().trim().indexOf(lastChars) == 0 || lastChars == '') &&
+        $(_currentFiles[i]).text().trim() != '..'
       ) {
         possibleMatches.push(_currentFiles[i]);
       }
     }
     if (possibleMatches.length == 1) {
-      _el.val(
-        _el.val() +
-          $(possibleMatches[0])
-            .text()
-            .trim()
-            .substr(lastChars.length)
-      );
-      if (
-        $(possibleMatches[0])
-          .html()
-          .indexOf('folder') > -1
-      ) {
+      _el.val(_el.val() + $(possibleMatches[0]).text().trim().substr(lastChars.length));
+      if ($(possibleMatches[0]).html().indexOf('folder') > -1) {
         _el.val(_el.val() + '/');
         showHdfsAutocomplete();
       }
@@ -364,11 +329,7 @@ Plugin.prototype.init = function() {
       // finds the longest common prefix
       const possibleMatchesPlain = [];
       for (let z = 0; z < possibleMatches.length; z++) {
-        possibleMatchesPlain.push(
-          $(possibleMatches[z])
-            .text()
-            .trim()
-        );
+        possibleMatchesPlain.push($(possibleMatches[z]).text().trim());
       }
       const arr = possibleMatchesPlain.slice(0).sort();
       const word1 = arr[0];
@@ -384,12 +345,12 @@ Plugin.prototype.init = function() {
   }
 };
 
-Plugin.prototype.setOptions = function(options) {
+Plugin.prototype.setOptions = function (options) {
   this.options = $.extend({}, defaults, options);
 };
 
-$.fn[pluginName] = function(options) {
-  return this.each(function() {
+$.fn[pluginName] = function (options) {
+  return this.each(function () {
     if (!$.data(this, 'plugin_' + pluginName)) {
       $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
     } else {
@@ -398,7 +359,7 @@ $.fn[pluginName] = function(options) {
   });
 };
 
-$[pluginName] = function(options) {
+$[pluginName] = function (options) {
   if (typeof console != 'undefined') {
     console.warn('$(elem).jHueHdfsAutocomplete() is a preferred call method.');
   }

+ 8 - 8
desktop/core/src/desktop/js/jquery/plugins/jquery.hdfstree.js

@@ -42,7 +42,7 @@ const pluginName = 'jHueHdfsTree',
     initialPath: '/',
     isS3: false,
     withTopPadding: true,
-    onPathChange: function() {},
+    onPathChange: function () {},
     createFolder: true,
     labels: {
       CREATE_FOLDER: 'Create folder',
@@ -74,7 +74,7 @@ function Plugin(element, options) {
   this.init();
 }
 
-Plugin.prototype.init = function(optionalPath) {
+Plugin.prototype.init = function (optionalPath) {
   const _this = this;
 
   if (typeof optionalPath != 'undefined') {
@@ -296,10 +296,10 @@ Plugin.prototype.init = function(optionalPath) {
                 name: _folderName.val(),
                 path: currentPath
               },
-              beforeSend: function(xhr) {
+              beforeSend: function (xhr) {
                 xhr.setRequestHeader('X-Requested-With', 'Hue'); // need to override the default one because otherwise Django returns HTTP 500
               },
-              success: function(xhr, status) {
+              success: function (xhr, status) {
                 if (status == 'success') {
                   _createFolderDetails.slideUp();
                   const _newFolder = currentPath + '/' + _folderName.val();
@@ -353,19 +353,19 @@ Plugin.prototype.init = function(optionalPath) {
   });
 };
 
-Plugin.prototype.setOptions = function(options) {
+Plugin.prototype.setOptions = function (options) {
   this.options = $.extend({}, defaults, options);
 };
 
-$.fn[pluginName] = function(options) {
-  return this.each(function() {
+$.fn[pluginName] = function (options) {
+  return this.each(function () {
     if (!$.data(this, 'plugin_' + pluginName)) {
       $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
     }
   });
 };
 
-$[pluginName] = function(options) {
+$[pluginName] = function (options) {
   if (typeof console != 'undefined') {
     console.warn('$(elem).jHueHdfsTree() is a preferred call method.');
   }

+ 37 - 105
desktop/core/src/desktop/js/jquery/plugins/jquery.hiveautocomplete.js

@@ -30,9 +30,9 @@ const pluginName = 'jHueGenericAutocomplete',
     home: '/',
     skipColumns: false,
     skipTables: false,
-    onEnter: function() {},
-    onBlur: function() {},
-    onPathChange: function() {},
+    onEnter: function () {},
+    onBlur: function () {},
+    onPathChange: function () {},
     pathChangeLevel: '',
     smartTooltip: '',
     smartTooltipThreshold: 10, // needs 10 up/down or click actions and no tab to activate the smart tooltip
@@ -83,7 +83,7 @@ function Plugin(element, options) {
   this.init();
 }
 
-Plugin.prototype.init = function() {
+Plugin.prototype.init = function () {
   const self = this;
   const $el = $(self.element);
 
@@ -179,12 +179,12 @@ Plugin.prototype.init = function() {
   });
 
   let validateTimeout = -1;
-  const onPathChange = function(path) {
+  const onPathChange = function (path) {
     window.clearTimeout(validateTimeout);
     self.options.onPathChange(path);
   };
 
-  const validateAndSet = function() {
+  const validateAndSet = function () {
     const path = $el.val().split('.');
     if (path.length > 1) {
       window.clearTimeout(validateTimeout);
@@ -215,7 +215,7 @@ Plugin.prototype.init = function() {
 
   let _hiveAutocompleteSelectedIndex = -1;
   let _filterTimeout = -1;
-  $el.keyup(function(e) {
+  $el.keyup(function (e) {
     window.clearTimeout(_filterTimeout);
     validateAndSet();
     if ($.inArray(e.keyCode, [17, 38, 40, 13, 32, 191]) === -1) {
@@ -230,23 +230,12 @@ Plugin.prototype.init = function() {
         const $jHueGenericAutocompleteLi = $('#jHueGenericAutocomplete ul li');
         $jHueGenericAutocompleteLi.show();
         if (path !== '') {
-          $jHueGenericAutocompleteLi.each(function() {
+          $jHueGenericAutocompleteLi.each(function () {
             if (self.options.searchEverywhere) {
-              if (
-                $(this)
-                  .text()
-                  .trim()
-                  .toLowerCase()
-                  .indexOf(path.toLowerCase()) === -1
-              ) {
+              if ($(this).text().trim().toLowerCase().indexOf(path.toLowerCase()) === -1) {
                 $(this).hide();
               }
-            } else if (
-              $(this)
-                .text()
-                .trim()
-                .indexOf(path) !== 0
-            ) {
+            } else if ($(this).text().trim().indexOf(path) !== 0) {
               $(this).hide();
             }
           });
@@ -321,7 +310,7 @@ Plugin.prototype.init = function() {
   }
   let _currentFiles = [];
 
-  self.getDatabases = function(callback) {
+  self.getDatabases = function (callback) {
     const self = this;
     $.when(self.namespaceDeferred, self.computeDeferred).done((namespace, compute) => {
       dataCatalog
@@ -341,7 +330,7 @@ Plugin.prototype.init = function() {
     });
   };
 
-  self.getTables = function(database, callback) {
+  self.getTables = function (database, callback) {
     const self = this;
     $.when(self.namespaceDeferred, self.computeDeferred).done((namespace, compute) => {
       dataCatalog
@@ -357,7 +346,7 @@ Plugin.prototype.init = function() {
     });
   };
 
-  self.getColumns = function(database, table, callback) {
+  self.getColumns = function (database, table, callback) {
     const self = this;
     $.when(self.namespaceDeferred, self.computeDeferred).done((namespace, compute) => {
       dataCatalog
@@ -463,44 +452,25 @@ Plugin.prototype.init = function() {
           .css('top', $el.offset().top + $el.outerHeight() - 1)
           .css('left', $el.offset().left)
           .width($el.outerWidth() - 4);
-        $jHueGenericAutocomplete
-          .find('ul')
-          .empty()
-          .html(_currentFiles.join(''));
-        $jHueGenericAutocomplete.find('li').on('click', function(e) {
+        $jHueGenericAutocomplete.find('ul').empty().html(_currentFiles.join(''));
+        $jHueGenericAutocomplete.find('li').on('click', function (e) {
           smartTooltipMaker();
           e.preventDefault();
-          const item = $(this)
-            .text()
-            .trim();
+          const item = $(this).text().trim();
 
           if (
-            $(this)
-              .html()
-              .indexOf('search') > -1 ||
-            $(this)
-              .html()
-              .indexOf('cog') > -1 ||
-            $(this)
-              .html()
-              .indexOf('database') > -1
+            $(this).html().indexOf('search') > -1 ||
+            $(this).html().indexOf('cog') > -1 ||
+            $(this).html().indexOf('database') > -1
           ) {
             if (
-              $(this)
-                .html()
-                .indexOf('search') > -1 &&
-              $(this)
-                .html()
-                .indexOf('search-plus') === -1
+              $(this).html().indexOf('search') > -1 &&
+              $(this).html().indexOf('search-plus') === -1
             ) {
               $el.val('collections.' + item);
             } else if (
-              $(this)
-                .html()
-                .indexOf('cog') > -1 &&
-              $(this)
-                .html()
-                .indexOf('cogs') === -1
+              $(this).html().indexOf('cog') > -1 &&
+              $(this).html().indexOf('cogs') === -1
             ) {
               $el.val('configs.' + item);
             } else {
@@ -517,11 +487,7 @@ Plugin.prototype.init = function() {
             self.options.onEnter($el);
           }
 
-          if (
-            $(this)
-              .html()
-              .indexOf('database') > -1
-          ) {
+          if ($(this).html().indexOf('database') > -1) {
             if (self.options.skipTables) {
               $el.val(item);
               $('#jHueGenericAutocomplete').hide();
@@ -539,11 +505,7 @@ Plugin.prototype.init = function() {
             }
           }
 
-          if (
-            $(this)
-              .html()
-              .indexOf('table') > -1
-          ) {
+          if ($(this).html().indexOf('table') > -1) {
             if ($el.val().indexOf('.') > -1) {
               if ($el.val().match(/\./gi).length === 1) {
                 $el.val($el.val().substring(0, $el.val().lastIndexOf('.') + 1) + item);
@@ -570,11 +532,7 @@ Plugin.prototype.init = function() {
             }
           }
 
-          if (
-            $(this)
-              .html()
-              .indexOf('columns') > -1
-          ) {
+          if ($(this).html().indexOf('columns') > -1) {
             if ($el.val().match(/\./gi).length > 1) {
               $el.val($el.val().substring(0, $el.val().lastIndexOf('.') + 1) + item);
             } else {
@@ -591,17 +549,11 @@ Plugin.prototype.init = function() {
         }, 100);
       }
     }
-    $el
-      .parent()
-      .find('.fa-spinner')
-      .hide();
+    $el.parent().find('.fa-spinner').hide();
   }
 
   function showAutocomplete() {
-    $el
-      .parent()
-      .find('.fa-spinner')
-      .show();
+    $el.parent().find('.fa-spinner').show();
     let path = $el.val();
     if (self.options.startingPath !== '') {
       path = self.options.startingPath + path;
@@ -669,31 +621,15 @@ Plugin.prototype.init = function() {
     const possibleMatches = [];
     for (let i = 0; i < _currentFiles.length; i++) {
       if (
-        ($(_currentFiles[i])
-          .text()
-          .trim()
-          .indexOf(lastChars) === 0 ||
-          lastChars === '') &&
-        $(_currentFiles[i])
-          .text()
-          .trim() !== '..'
+        ($(_currentFiles[i]).text().trim().indexOf(lastChars) === 0 || lastChars === '') &&
+        $(_currentFiles[i]).text().trim() !== '..'
       ) {
         possibleMatches.push(_currentFiles[i]);
       }
     }
     if (possibleMatches.length === 1) {
-      $el.val(
-        $el.val() +
-          $(possibleMatches[0])
-            .text()
-            .trim()
-            .substr(lastChars.length)
-      );
-      if (
-        $(possibleMatches[0])
-          .html()
-          .indexOf('folder') > -1
-      ) {
+      $el.val($el.val() + $(possibleMatches[0]).text().trim().substr(lastChars.length));
+      if ($(possibleMatches[0]).html().indexOf('folder') > -1) {
         $el.val($el.val() + '/');
         showAutocomplete();
       }
@@ -701,11 +637,7 @@ Plugin.prototype.init = function() {
       // finds the longest common prefix
       const possibleMatchesPlain = [];
       for (let z = 0; z < possibleMatches.length; z++) {
-        possibleMatchesPlain.push(
-          $(possibleMatches[z])
-            .text()
-            .trim()
-        );
+        possibleMatchesPlain.push($(possibleMatches[z]).text().trim());
       }
       const arr = possibleMatchesPlain.slice(0).sort();
       const word1 = arr[0];
@@ -720,12 +652,12 @@ Plugin.prototype.init = function() {
   }
 };
 
-Plugin.prototype.setOptions = function(options) {
+Plugin.prototype.setOptions = function (options) {
   this.options = $.extend({}, defaults, options);
 };
 
-$.fn[pluginName] = function(options) {
-  return this.each(function() {
+$.fn[pluginName] = function (options) {
+  return this.each(function () {
     if (!$.data(this, 'plugin_' + pluginName)) {
       $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
     } else {
@@ -734,7 +666,7 @@ $.fn[pluginName] = function(options) {
   });
 };
 
-$[pluginName] = function(options) {
+$[pluginName] = function (options) {
   if (typeof console !== 'undefined') {
     console.warn('$(elem).jHueGenericAutocomplete() is a preferred call method.');
   }

+ 8 - 14
desktop/core/src/desktop/js/jquery/plugins/jquery.horizontalscrollbar.js

@@ -38,9 +38,7 @@ function initWhenReady(el) {
     return;
   }
 
-  const colWidth = $(el)
-    .find('thead tr th')
-    .outerWidth();
+  const colWidth = $(el).find('thead tr th').outerWidth();
 
   let wrapperWidth = $wrapper.width();
   let wrapperScrollWidth = $wrapper[0].scrollWidth;
@@ -61,7 +59,7 @@ function initWhenReady(el) {
     $scrollbar.draggable({
       axis: 'x',
       containment: 'parent',
-      start: function() {
+      start: function () {
         $wrapper = $(el).parents('.dataTables_wrapper');
         wrapperScrollWidth = $wrapper[0].scrollWidth;
         wrapperWidth = $wrapper.width();
@@ -83,7 +81,7 @@ function initWhenReady(el) {
       }
     });
 
-    $wrapper.bind('mousewheel', function(e) {
+    $wrapper.bind('mousewheel', function (e) {
       const _deltaX = e.deltaX * e.deltaFactor,
         _deltaY = e.deltaY;
 
@@ -144,15 +142,11 @@ function initWhenReady(el) {
   }
 }
 
-Plugin.prototype.init = function() {
+Plugin.prototype.init = function () {
   const el = this.element;
 
-  const checkWidth = function() {
-    if (
-      $(el)
-        .parents('.dataTables_wrapper')
-        .width() > 0
-    ) {
+  const checkWidth = function () {
+    if ($(el).parents('.dataTables_wrapper').width() > 0) {
       initWhenReady(el);
     } else {
       window.setTimeout(checkWidth, 100);
@@ -162,8 +156,8 @@ Plugin.prototype.init = function() {
   checkWidth();
 };
 
-$.fn[pluginName] = function(options) {
-  return this.each(function() {
+$.fn[pluginName] = function (options) {
+  return this.each(function () {
     $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
   });
 };

+ 27 - 51
desktop/core/src/desktop/js/jquery/plugins/jquery.huedatatable.js

@@ -24,11 +24,11 @@ import hueUtils from 'utils/hueUtils';
  *
  */
 
-$.fn.hueDataTable = function(oInit) {
+$.fn.hueDataTable = function (oInit) {
   const self = this;
   self.$table = null;
 
-  self.fnSetColumnVis = function(index, visible) {
+  self.fnSetColumnVis = function (index, visible) {
     const aoColumns = self.$table.data('aoColumns');
     const change = aoColumns[index].bVisible !== visible;
     aoColumns[index].bVisible = visible;
@@ -53,7 +53,7 @@ $.fn.hueDataTable = function(oInit) {
     }
   };
 
-  self.fnToggleAllCols = function(visible) {
+  self.fnToggleAllCols = function (visible) {
     const aoColumns = self.$table.data('aoColumns');
     aoColumns.forEach((col, idx) => {
       if (idx > 0) {
@@ -62,10 +62,7 @@ $.fn.hueDataTable = function(oInit) {
     });
     if (!visible) {
       self.$table.find('th, td').hide();
-      self.$table
-        .find('tr')
-        .find('td:eq(0),th:eq(0)')
-        .show();
+      self.$table.find('tr').find('td:eq(0),th:eq(0)').show();
     } else {
       self.$table.find('th, td').show();
     }
@@ -76,7 +73,7 @@ $.fn.hueDataTable = function(oInit) {
     }
   };
 
-  self.fnSortColumn = function(obj, way) {
+  self.fnSortColumn = function (obj, way) {
     const data = self.$table.data('data');
 
     let idx = obj.originalIndex;
@@ -191,7 +188,7 @@ $.fn.hueDataTable = function(oInit) {
     self.fnDraw(true);
   };
 
-  self.fnShowSearch = function() {
+  self.fnShowSearch = function () {
     if ($('.hue-datatable-search').length == 0) {
       const search = $('<div>')
         .css({
@@ -255,9 +252,7 @@ $.fn.hueDataTable = function(oInit) {
       });
     } else {
       $('.hue-datatable-search').show();
-      $('.hue-datatable-search')
-        .find('input')
-        .focus();
+      $('.hue-datatable-search').find('input').focus();
     }
     let right = -30;
     const adjustRight =
@@ -265,11 +260,8 @@ $.fn.hueDataTable = function(oInit) {
     if (adjustRight > 0) {
       right = adjustRight;
     }
-    $('.hueAnchorScroller:visible').each(function() {
-      const visibleRight =
-        $(this)
-          .css('right')
-          .replace(/px/gi, '') * 1;
+    $('.hueAnchorScroller:visible').each(function () {
+      const visibleRight = $(this).css('right').replace(/px/gi, '') * 1;
       if (!isNaN(visibleRight) && visibleRight > right) {
         right = visibleRight;
       }
@@ -277,7 +269,7 @@ $.fn.hueDataTable = function(oInit) {
     $('.hue-datatable-search').css('right', right + 50 + 'px');
   };
 
-  self.fnSearch = function(what, avoidScroll) {
+  self.fnSearch = function (what, avoidScroll) {
     const $t = self.$table;
     if ($t) {
       if (typeof avoidScroll === 'undefined' || !avoidScroll) {
@@ -287,9 +279,7 @@ $.fn.hueDataTable = function(oInit) {
       }
 
       if (what !== '') {
-        $('.hue-datatable-search')
-          .find('span')
-          .text('');
+        $('.hue-datatable-search').find('span').text('');
         $('.hue-datatable-search')
           .find('.fa-chevron-down')
           .addClass('muted')
@@ -319,11 +309,7 @@ $.fn.hueDataTable = function(oInit) {
         });
         $t.data('searchCoords', coords);
         if (coords.length > 0) {
-          if (
-            $('.hue-datatable-search')
-              .find('input')
-              .val() !== ''
-          ) {
+          if ($('.hue-datatable-search').find('input').val() !== '') {
             $('.hue-datatable-search')
               .find('.fa-chevron-down')
               .removeClass('muted')
@@ -348,15 +334,13 @@ $.fn.hueDataTable = function(oInit) {
               );
           }
         } else {
-          $('.hue-datatable-search')
-            .find('span')
-            .text($t.data('oInit')['i18n'].NO_RESULTS);
+          $('.hue-datatable-search').find('span').text($t.data('oInit')['i18n'].NO_RESULTS);
         }
       }
     }
   };
 
-  self.fnScrollToPreviousResult = function() {
+  self.fnScrollToPreviousResult = function () {
     const $t = self.$table;
     if ($t && $t.data('searchCoords') && $t.data('searchCoords').length > 0) {
       let high = $t.data('searchCoordHighlighted');
@@ -366,7 +350,7 @@ $.fn.hueDataTable = function(oInit) {
     }
   };
 
-  self.fnScrollToNextResult = function() {
+  self.fnScrollToNextResult = function () {
     const $t = self.$table;
     if ($t && $t.data('searchCoords') && $t.data('searchCoords').length > 0) {
       let high = $t.data('searchCoordHighlighted');
@@ -377,7 +361,7 @@ $.fn.hueDataTable = function(oInit) {
   };
 
   self.isScrolling = false;
-  self.fnScrollTo = function(row, col) {
+  self.fnScrollTo = function (row, col) {
     const $t = self.$table;
     if ($t) {
       self.isScrolling = true;
@@ -408,7 +392,7 @@ $.fn.hueDataTable = function(oInit) {
             $t
               .find('tbody tr')
               .find('td:eq(0)')
-              .filter(function() {
+              .filter(function () {
                 return $(this).text() - 1 == row;
               })
               .position().top + 73
@@ -428,7 +412,7 @@ $.fn.hueDataTable = function(oInit) {
 
   this.lowerCaseFilter = '';
 
-  self.fnDraw = function(force) {
+  self.fnDraw = function (force) {
     const aoColumns = self.$table.data('aoColumns');
     if (!self.isDrawing && aoColumns) {
       const $t = self.$table;
@@ -438,7 +422,7 @@ $.fn.hueDataTable = function(oInit) {
         const appendable = $t.children('tbody').length > 0 ? $t.children('tbody') : $t;
         let startCol = -1;
         let endCol = -1;
-        $t.find('thead>tr th').each(function(i) {
+        $t.find('thead>tr th').each(function (i) {
           if ($(this).position().left > 0 && startCol == -1) {
             startCol = i;
           }
@@ -552,10 +536,7 @@ $.fn.hueDataTable = function(oInit) {
                 (aoColumns.length - 1) +
                 '" class="stripe"></td>';
             }
-            appendable
-              .children()
-              .eq(i)
-              .html(html);
+            appendable.children().eq(i).html(html);
           }
 
           if (force) {
@@ -670,7 +651,7 @@ $.fn.hueDataTable = function(oInit) {
     this.fnDraw(true);
   };
 
-  self.fnAddData = function(mData, bRedraw, streaming, streamRecordLimit) {
+  self.fnAddData = function (mData, bRedraw, streaming, streamRecordLimit) {
     const $t = self.$table;
 
     if ($t) {
@@ -699,24 +680,19 @@ $.fn.hueDataTable = function(oInit) {
       self.fnDraw(true);
 
       if ($('.hue-datatable-search').is(':visible')) {
-        self.fnSearch(
-          $('.hue-datatable-search')
-            .find('input')
-            .val(),
-          true
-        );
+        self.fnSearch($('.hue-datatable-search').find('input').val(), true);
       }
     }
   };
 
-  self.fnSettings = function() {
+  self.fnSettings = function () {
     const aoColumns = self.$table.data('aoColumns');
     return {
       aoColumns: aoColumns
     };
   };
 
-  self.fnClearTable = function(bRedraw) {
+  self.fnClearTable = function (bRedraw) {
     const $t = self.$table;
     if ($t) {
       if ($t.children('tbody').length > 0) {
@@ -732,7 +708,7 @@ $.fn.hueDataTable = function(oInit) {
     }
   };
 
-  self.fnDestroy = function() {
+  self.fnDestroy = function () {
     self.fnClearTable();
     self.$table.unwrap();
     self.$table.data('isScrollAttached', null);
@@ -747,7 +723,7 @@ $.fn.hueDataTable = function(oInit) {
     }
   };
 
-  return self.each(function() {
+  return self.each(function () {
     self.$table = $(this);
     const parent = self.$table.parent();
     if (parent.hasClass('dataTables_wrapper')) {
@@ -791,7 +767,7 @@ $.fn.hueDataTable = function(oInit) {
       let drawTimeout = -1;
       if (self.$table.data('oInit')['scrollable'] && !self.$table.data('isScrollAttached')) {
         self.$table.data('isScrollAttached', true);
-        const scrollFn = function() {
+        const scrollFn = function () {
           window.clearTimeout(drawTimeout);
           drawTimeout = window.setTimeout(
             self.fnDraw,

+ 11 - 23
desktop/core/src/desktop/js/jquery/plugins/jquery.notify.js

@@ -41,11 +41,11 @@ function Plugin(options) {
   this.show();
 }
 
-Plugin.prototype.setOptions = function(options) {
+Plugin.prototype.setOptions = function (options) {
   this.options = $.extend({}, defaults, options);
 };
 
-Plugin.prototype.show = function() {
+Plugin.prototype.show = function () {
   const _this = this;
   const MARGIN = 4;
 
@@ -53,9 +53,7 @@ Plugin.prototype.show = function() {
 
   if (
     _this.options.message !== '' &&
-    $('.jHueNotify .message')
-      .last()
-      .text() !== _this.options.message
+    $('.jHueNotify .message').last().text() !== _this.options.message
   ) {
     const el = $('#jHueNotify').clone();
     el.removeAttr('id');
@@ -65,20 +63,10 @@ Plugin.prototype.show = function() {
     el.attr('class', 'alert jHueNotify');
     el.find('.close').hide();
 
-    if (
-      $('.jHueNotify')
-        .last()
-        .position() != null
-    ) {
+    if ($('.jHueNotify').last().position() != null) {
       el.css(
         'top',
-        $('.jHueNotify')
-          .last()
-          .position().top +
-          $('.jHueNotify')
-            .last()
-            .outerHeight() +
-          MARGIN
+        $('.jHueNotify').last().position().top + $('.jHueNotify').last().outerHeight() + MARGIN
       );
     }
 
@@ -122,7 +110,7 @@ Plugin.prototype.show = function() {
         );
         el.remove();
       }, 3000);
-      el.click(function() {
+      el.click(function () {
         window.clearTimeout(t);
         $(this).stop(true);
         $(this).fadeOut();
@@ -141,20 +129,20 @@ Plugin.prototype.show = function() {
   }
 };
 
-$[pluginName] = function() {};
+$[pluginName] = function () {};
 
-$[pluginName].info = function(message) {
+$[pluginName].info = function (message) {
   new Plugin({ level: TYPES.INFO, message: message });
 };
 
-$[pluginName].warn = function(message) {
+$[pluginName].warn = function (message) {
   new Plugin({ level: TYPES.GENERAL, message: message, sticky: true });
 };
 
-$[pluginName].error = function(message) {
+$[pluginName].error = function (message) {
   new Plugin({ level: TYPES.ERROR, message: message, sticky: true });
 };
 
-$[pluginName].notify = function(options) {
+$[pluginName].notify = function (options) {
   new Plugin(options);
 };

+ 5 - 7
desktop/core/src/desktop/js/jquery/plugins/jquery.rowselector.js

@@ -34,20 +34,18 @@ function Plugin(element, options) {
   this.init();
 }
 
-Plugin.prototype.setOptions = function(options) {
+Plugin.prototype.setOptions = function (options) {
   this.options = $.extend({}, defaults, options);
 };
 
-Plugin.prototype.init = function() {
+Plugin.prototype.init = function () {
   const _this = this;
   $(_this.element)
     .closest('tr')
     .click(e => {
       if (
         $(e.target).data('row-selector-exclude') ||
-        $(e.target)
-          .closest('td')
-          .hasClass('row-selector-exclude')
+        $(e.target).closest('td').hasClass('row-selector-exclude')
       ) {
         return;
       }
@@ -63,8 +61,8 @@ Plugin.prototype.init = function() {
     .css('cursor', 'pointer');
 };
 
-$.fn[pluginName] = function(options) {
-  return this.each(function() {
+$.fn[pluginName] = function (options) {
+  return this.each(function () {
     if (!$.data(this, 'plugin_' + pluginName)) {
       $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
     } else {

+ 7 - 12
desktop/core/src/desktop/js/jquery/plugins/jquery.scrollleft.js

@@ -44,11 +44,11 @@ function Plugin(element, options) {
   }
 }
 
-Plugin.prototype.setOptions = function(options) {
+Plugin.prototype.setOptions = function (options) {
   this.options = $.extend({}, defaults, options);
 };
 
-Plugin.prototype.setupScrollLeft = function() {
+Plugin.prototype.setupScrollLeft = function () {
   const _this = this;
   let link = null,
     isActive = true;
@@ -75,10 +75,7 @@ Plugin.prototype.setupScrollLeft = function() {
   }
 
   function positionOtherAnchors() {
-    const upPosition =
-      $('#jHueScrollUpAnchor')
-        .css('right')
-        .replace(/px/gi, '') * 1;
+    const upPosition = $('#jHueScrollUpAnchor').css('right').replace(/px/gi, '') * 1;
     let right = upPosition - 30;
     if ($('#jHueScrollUpAnchor').is(':visible')) {
       right = upPosition;
@@ -142,9 +139,7 @@ Plugin.prototype.setupScrollLeft = function() {
       $('#jHueScrollLeftAnchor')
         .data('caller')
         .animate({ scrollLeft: 0 }, 300, () => {
-          $(document)
-            .find("[jHueLeftScrollified='true']")
-            .trigger('scroll_update');
+          $(document).find("[jHueLeftScrollified='true']").trigger('scroll_update');
           if (
             $(document)
               .find("[jHueLeftScrollified='true']")
@@ -173,12 +168,12 @@ Plugin.prototype.setupScrollLeft = function() {
   });
 };
 
-$.fn[pluginName] = function(options) {
-  return this.each(function() {
+$.fn[pluginName] = function (options) {
+  return this.each(function () {
     $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
   });
 };
 
-$[pluginName] = function(options) {
+$[pluginName] = function (options) {
   new Plugin($('body'), options);
 };

+ 6 - 9
desktop/core/src/desktop/js/jquery/plugins/jquery.scrollup.js

@@ -48,11 +48,11 @@ function Plugin(element, options) {
   }
 }
 
-Plugin.prototype.setOptions = function(options) {
+Plugin.prototype.setOptions = function (options) {
   this.options = $.extend({}, defaults, options);
 };
 
-Plugin.prototype.setupScrollUp = function() {
+Plugin.prototype.setupScrollUp = function () {
   const _this = this;
   let link = null;
 
@@ -78,10 +78,7 @@ Plugin.prototype.setupScrollUp = function() {
   }
 
   function positionOtherAnchors() {
-    const upPosition =
-      $('#jHueScrollUpAnchor')
-        .css('right')
-        .replace(/px/gi, '') * 1;
+    const upPosition = $('#jHueScrollUpAnchor').css('right').replace(/px/gi, '') * 1;
     let right = upPosition - 30;
     if ($('#jHueScrollUpAnchor').is(':visible')) {
       right = upPosition;
@@ -175,12 +172,12 @@ Plugin.prototype.setupScrollUp = function() {
   });
 };
 
-$.fn[pluginName] = function(options) {
-  return this.each(function() {
+$.fn[pluginName] = function (options) {
+  return this.each(function () {
     $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
   });
 };
 
-$[pluginName] = function(options) {
+$[pluginName] = function (options) {
   new Plugin($('body'), options);
 };

+ 21 - 52
desktop/core/src/desktop/js/jquery/plugins/jquery.selector.js

@@ -29,7 +29,7 @@ const pluginName = 'jHueSelector',
     noChoicesFound: 'No choices found for this element',
     width: 300,
     height: 200,
-    onChange: function() {}
+    onChange: function () {}
   };
 
 function Plugin(element, options) {
@@ -40,11 +40,11 @@ function Plugin(element, options) {
   this.init();
 }
 
-Plugin.prototype.setOptions = function(options) {
+Plugin.prototype.setOptions = function (options) {
   this.options = $.extend({}, defaults, options);
 };
 
-Plugin.prototype.init = function() {
+Plugin.prototype.init = function () {
   const _this = this;
   const addressBook = [];
   const selectorContainer = $('<div>');
@@ -55,10 +55,7 @@ Plugin.prototype.init = function() {
   $(_this.element)
     .find('option')
     .each((cnt, opt) => {
-      const initial = $(opt)
-        .text()
-        .substr(0, 1)
-        .toLowerCase();
+      const initial = $(opt).text().substr(0, 1).toLowerCase();
       if (addressBook[initial] == null) {
         addressBook[initial] = [];
       }
@@ -97,15 +94,11 @@ Plugin.prototype.init = function() {
         const chk = $('<input>')
           .attr('type', 'checkbox')
           .addClass('selector')
-          .change(function() {
+          .change(function () {
             if ($(this).is(':checked')) {
-              $(this)
-                .data('opt')
-                .attr('selected', 'selected');
+              $(this).data('opt').attr('selected', 'selected');
             } else {
-              $(this)
-                .data('opt')
-                .removeAttr('selected');
+              $(this).data('opt').removeAttr('selected');
             }
             _this.options.onChange();
           })
@@ -129,19 +122,15 @@ Plugin.prototype.init = function() {
       selectAll.text(this.options.selectAllLabel);
       $('<input>')
         .attr('type', 'checkbox')
-        .change(function() {
+        .change(function () {
           const isChecked = $(this).is(':checked');
-          selectorContainer.find('input.selector:visible').each(function() {
+          selectorContainer.find('input.selector:visible').each(function () {
             if (isChecked) {
               $(this).prop('checked', true);
-              $(this)
-                .data('opt')
-                .attr('selected', 'selected');
+              $(this).data('opt').attr('selected', 'selected');
             } else {
               $(this).prop('checked', false);
-              $(this)
-                .data('opt')
-                .removeAttr('selected');
+              $(this).data('opt').removeAttr('selected');
             }
           });
           if (searchBox.val() != '') {
@@ -157,43 +146,23 @@ Plugin.prototype.init = function() {
     const searchBox = $('<input>')
       .attr('type', 'text')
       .attr('placeholder', this.options.searchPlaceholder)
-      .keyup(function() {
-        body
-          .find('ul')
-          .attr('show', true)
-          .show();
+      .keyup(function () {
+        body.find('ul').attr('show', true).show();
         const q = $.trim($(this).val());
         if (q != '') {
           body.find('li.selectorDivider').hide();
-          body.find('label').each(function() {
-            if (
-              $(this)
-                .text()
-                .toLowerCase()
-                .indexOf(q.toLowerCase()) > -1
-            ) {
-              $(this)
-                .parent()
-                .show();
+          body.find('label').each(function () {
+            if ($(this).text().toLowerCase().indexOf(q.toLowerCase()) > -1) {
+              $(this).parent().show();
             } else {
-              $(this)
-                .parent()
-                .hide();
+              $(this).parent().hide();
             }
           });
           body.find('ul').attr('show', false);
-          body
-            .find('ul > *:visible')
-            .parent()
-            .attr('show', true)
-            .find('li.selectorDivider')
-            .show();
+          body.find('ul > *:visible').parent().attr('show', true).find('li.selectorDivider').show();
         } else {
           body.find('li.selectorDivider').show();
-          body
-            .find('label')
-            .parent()
-            .show();
+          body.find('label').parent().show();
         }
         body.find('ul[show=false]').hide();
         body.find('ul[show=true]').show();
@@ -209,8 +178,8 @@ Plugin.prototype.init = function() {
   }
 };
 
-$.fn[pluginName] = function(options) {
-  return this.each(function() {
+$.fn[pluginName] = function (options) {
+  return this.each(function () {
     if (!$.data(this, 'plugin_' + pluginName)) {
       $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
     } else {

+ 41 - 75
desktop/core/src/desktop/js/jquery/plugins/jquery.tableextender.js

@@ -53,7 +53,7 @@ function Plugin(element, options) {
   this.init();
 }
 
-Plugin.prototype.setOptions = function(options) {
+Plugin.prototype.setOptions = function (options) {
   this.options = $.extend({}, defaults, options);
   this.options.labels = $.extend(
     {},
@@ -77,31 +77,29 @@ Plugin.prototype.setOptions = function(options) {
   }
 };
 
-Plugin.prototype.resetSource = function() {
+Plugin.prototype.resetSource = function () {
   const _this = this;
   if (_this.options.includeNavigator) {
     const source = [];
     $(this.element)
       .find('th')
-      .each(function() {
+      .each(function () {
         source.push($(this).text());
       });
 
-    $('#jHueTableExtenderNavigator')
-      .find('input')
-      .data('typeahead').source = source;
+    $('#jHueTableExtenderNavigator').find('input').data('typeahead').source = source;
   }
 };
 
-Plugin.prototype.drawHeader = function(skipCreation) {
+Plugin.prototype.drawHeader = function (skipCreation) {
   drawHeader(this, skipCreation);
 };
 
-Plugin.prototype.drawFirstColumn = function() {
+Plugin.prototype.drawFirstColumn = function () {
   drawFirstColumn(this);
 };
 
-Plugin.prototype.drawLockedRows = function(force) {
+Plugin.prototype.drawLockedRows = function (force) {
   const _this = this;
   const $pluginElement = $(_this.element);
   if ($pluginElement.data('lockedRows')) {
@@ -112,8 +110,8 @@ Plugin.prototype.drawLockedRows = function(force) {
   }
 };
 
-Plugin.prototype.init = function() {
-  $.expr[':'].econtains = function(obj, index, meta, stack) {
+Plugin.prototype.init = function () {
+  $.expr[':'].econtains = function (obj, index, meta, stack) {
     return (
       (obj.textContent || obj.innerText || $(obj).text() || '').toLowerCase() ==
       meta[3].toLowerCase()
@@ -127,11 +125,9 @@ Plugin.prototype.init = function() {
       .attr('href', '#')
       .addClass('pull-right')
       .html('&times;')
-      .click(function(e) {
+      .click(function (e) {
         e.preventDefault();
-        $(this)
-          .parent()
-          .hide();
+        $(this).parent().hide();
       })
       .appendTo(jHueTableExtenderNavigator);
     $('<label>')
@@ -154,9 +150,7 @@ Plugin.prototype.init = function() {
             $('.columnSelected').removeClass('columnSelected');
             $('.cellSelected').removeClass('cellSelected');
             $(event.target.parentNode).addClass('rowSelected');
-            $(event.target.parentNode)
-              .find('td')
-              .addClass('rowSelected');
+            $(event.target.parentNode).find('td').addClass('rowSelected');
             jHueTableExtenderNavigator
               .css(
                 'left',
@@ -174,13 +168,13 @@ Plugin.prototype.init = function() {
     const source = [];
     $(_this.element)
       .find('th')
-      .each(function() {
+      .each(function () {
         source.push($(this).text());
       });
 
     jHueTableExtenderNavigator.find('input').typeahead({
       source: source,
-      updater: function(item) {
+      updater: function (item) {
         jHueTableExtenderNavigator.hide();
         $(_this.element)
           .find(
@@ -202,17 +196,10 @@ Plugin.prototype.init = function() {
                   1) +
                 ')'
             )
-            .each(function() {
+            .each(function () {
               $(this)
                 .attr('rel', 'tooltip')
-                .attr(
-                  'title',
-                  '#' +
-                    $(this)
-                      .parent()
-                      .find('td:first-child')
-                      .text()
-                )
+                .attr('title', '#' + $(this).parent().find('td:first-child').text())
                 .tooltip({
                   placement: 'left'
                 });
@@ -226,12 +213,8 @@ Plugin.prototype.init = function() {
                 $(_this.element)
                   .find('th:econtains(' + item + ')')
                   .position().left +
-                $(_this.element)
-                  .parent()
-                  .scrollLeft() -
-                $(_this.element)
-                  .parent()
-                  .offset().left -
+                $(_this.element).parent().scrollLeft() -
+                $(_this.element).parent().offset().left -
                 30
             },
             300
@@ -290,7 +273,7 @@ Plugin.prototype.init = function() {
     drawFirstColumn(_this);
   }
 
-  $(document).on('click dblclick', '.dataTables_wrapper > table tbody tr', function() {
+  $(document).on('click dblclick', '.dataTables_wrapper > table tbody tr', function () {
     $(
       '.dataTables_wrapper > .jHueTableExtenderClonedContainerColumn table tbody tr.selected'
     ).removeClass('selected');
@@ -306,7 +289,7 @@ Plugin.prototype.init = function() {
       ).addClass('selected');
     }
   });
-  $(document).on('dblclick', '.dataTables_wrapper > table tbody tr', function() {
+  $(document).on('dblclick', '.dataTables_wrapper > table tbody tr', function () {
     if (huePubSub) {
       huePubSub.publish('table.row.show.details', {
         idx: $(this).index(),
@@ -329,7 +312,7 @@ function drawLockedRow(plugin, rowNo, force) {
   function unlock($el) {
     $header
       .find('tr td:first-child')
-      .filter(function() {
+      .filter(function () {
         return $(this).text() === rowNo + '';
       })
       .closest('tr')
@@ -372,7 +355,7 @@ function drawLockedRow(plugin, rowNo, force) {
           '</td>'
       )
       .appendTo($headerCounter.find('tbody'));
-    $newTr.find('td').on('click', function() {
+    $newTr.find('td').on('click', function () {
       unlock($(this));
     });
     lockedRows['r' + rowNo] = {
@@ -382,7 +365,7 @@ function drawLockedRow(plugin, rowNo, force) {
   } else {
     lockedRows['r' + rowNo].row.appendTo($header.find('tbody'));
     lockedRows['r' + rowNo].cell.appendTo($headerCounter.find('tbody'));
-    lockedRows['r' + rowNo].cell.find('td').on('click', function() {
+    lockedRows['r' + rowNo].cell.find('td').on('click', function () {
       unlock($(this));
     });
   }
@@ -442,31 +425,24 @@ function drawFirstColumn(plugin) {
     .html('<thead></thead><tbody></tbody>');
   clonedTable.removeClass(plugin.options.classToRemove);
   clonedTable.css('margin-bottom', '0').css('table-layout', 'fixed');
-  $(plugin.element)
-    .find('thead>tr th:eq(0)')
-    .clone()
-    .appendTo(clonedTable.find('thead'));
+  $(plugin.element).find('thead>tr th:eq(0)').clone().appendTo(clonedTable.find('thead'));
   const clonedTBody = clonedTable.find('tbody');
-  const clones = $(plugin.element)
-    .find('tbody>tr td:nth-child(1)')
-    .clone();
+  const clones = $(plugin.element).find('tbody>tr td:nth-child(1)').clone();
   let h = '';
-  clones.each(function() {
+  clones.each(function () {
     h += '<tr><td>' + $(this).html() + '</td></tr>';
   });
   clonedTBody.html(h);
   if (plugin.options.lockSelectedRow) {
-    clonedTBody.find('td').each(function() {
+    clonedTBody.find('td').each(function () {
       const cell = $(this);
       cell
         .attr('title', plugin.options.labels.LOCK)
         .addClass('lockable pointer')
-        .on('click', function() {
+        .on('click', function () {
           drawLockedRow(plugin, $(this).text() * 1);
         });
-      $('<i>')
-        .addClass('fa fa-lock muted')
-        .prependTo(cell);
+      $('<i>').addClass('fa fa-lock muted').prependTo(cell);
     });
   }
   clonedTable
@@ -572,14 +548,14 @@ function drawHeader(plugin, skipCreation) {
 
     clonedTable.find('thead>tr th').wrapInner('<span></span>');
 
-    $pluginElement.find('thead>tr th').each(function(i) {
+    $pluginElement.find('thead>tr th').each(function (i) {
       const originalTh = $(this);
       originalTh.removeAttr('data-bind');
       clonedTable
         .find('thead>tr th:eq(' + i + ')')
         .width(originalTh.width())
         .css('background-color', '#FFFFFF')
-        .click(function() {
+        .click(function () {
           originalTh.click();
           if (plugin.options.headerSorting) {
             clonedTable.find('thead>tr th').attr('class', 'sorting');
@@ -610,31 +586,21 @@ function drawHeader(plugin, skipCreation) {
 
     const throttledHeaderPadding = () => {
       const firstCellWidth = clonedTable.find('thead>tr th:eq(0)').outerWidth();
-      clonedTable.find('thead>tr th').each(function() {
+      clonedTable.find('thead>tr th').each(function () {
         const leftPosition = $(this).position().left - firstCellWidth;
         if (leftPosition + $(this).outerWidth() > 0 && leftPosition < 0) {
-          if (
-            $(this)
-              .find('span')
-              .width() +
-              -leftPosition <
-            $(this).outerWidth() - 20
-          ) {
+          if ($(this).find('span').width() + -leftPosition < $(this).outerWidth() - 20) {
             // 20 is the sorting css width
-            $(this)
-              .find('span')
-              .css('paddingLeft', -leftPosition);
+            $(this).find('span').css('paddingLeft', -leftPosition);
           }
         } else {
-          $(this)
-            .find('span')
-            .css('paddingLeft', 0);
+          $(this).find('span').css('paddingLeft', 0);
         }
       });
     };
 
     let scrollTimeout = -1;
-    $pluginElement.parent().scroll(function() {
+    $pluginElement.parent().scroll(function () {
       const scrollLeft = $(this).scrollLeft();
       clonedTableVisibleContainer.scrollLeft(scrollLeft);
       window.clearTimeout(scrollTimeout);
@@ -655,7 +621,7 @@ function drawHeader(plugin, skipCreation) {
         if ($pluginElement.parent().width() != $pluginElement.parent().data('w')) {
           clonedTableVisibleContainer.width($pluginElement.parent().width());
           $pluginElement.parent().data('w', clonedTableVisibleContainer.width());
-          $pluginElement.find('thead>tr th').each(function(i) {
+          $pluginElement.find('thead>tr th').each(function (i) {
             clonedTable
               .find('thead>tr th:eq(' + i + ')')
               .width($(this).width())
@@ -668,7 +634,7 @@ function drawHeader(plugin, skipCreation) {
     );
     $pluginElement.data('header_interval', headerInt);
 
-    $pluginElement.parent().resize(function() {
+    $pluginElement.parent().resize(function () {
       clonedTableVisibleContainer.width($(this).width());
     });
 
@@ -697,7 +663,7 @@ function drawHeader(plugin, skipCreation) {
     $('#' + $pluginElement.attr('id') + 'jHueTableExtenderClonedContainer')
       .children('div')
       .width($pluginElement.outerWidth());
-    $pluginElement.find('thead>tr th').each(function(i) {
+    $pluginElement.find('thead>tr th').each(function (i) {
       const originalTh = $(this);
       $('#' + $pluginElement.attr('id') + 'jHueTableExtenderClonedContainer')
         .find('thead>tr th:eq(' + i + ')')
@@ -719,8 +685,8 @@ function getSelection() {
   return t.toString();
 }
 
-$.fn[pluginName] = function(options) {
-  return this.each(function() {
+$.fn[pluginName] = function (options) {
+  return this.each(function () {
     if (!$.data(this, 'plugin_' + pluginName)) {
       $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
     } else {

+ 26 - 33
desktop/core/src/desktop/js/jquery/plugins/jquery.tableextender2.js

@@ -64,7 +64,7 @@ function Plugin(element, options) {
   const sortAdjustment = self.options.noSort ? 10 : 20; // 20 is the sorting css width
 
   let firstCellWidth, leftPosition, th, thi, leftPadding;
-  const throttledHeaderPadding = function() {
+  const throttledHeaderPadding = function () {
     firstCellWidth = self.options.fixedFirstColumn ? self.firstColumnTopCell.outerWidth() : 0;
     for (thi = 0; thi < self.thMapping.length; thi++) {
       th = self.thMapping[thi];
@@ -86,7 +86,7 @@ function Plugin(element, options) {
   };
 
   let scrollTimeout = -1;
-  const headerScroll = function() {
+  const headerScroll = function () {
     self.headerRowContainer.scrollLeft(self.$parent.scrollLeft());
     if (manyColumns) {
       window.clearTimeout(scrollTimeout);
@@ -129,7 +129,7 @@ function Plugin(element, options) {
     hideSubscription.remove();
   });
 
-  const adjustSizes = function() {
+  const adjustSizes = function () {
     if (self.lastHeaderWidth !== self.$parent.width()) {
       self.lastHeaderWidth = self.$parent.width();
       self.headerRowContainer.width(self.lastHeaderWidth);
@@ -156,7 +156,7 @@ function Plugin(element, options) {
     window.clearInterval(sizeInterval);
   });
 
-  const clickHandler = function() {
+  const clickHandler = function () {
     if ($(this).hasClass('selected')) {
       self.$parent.find('.selected').removeClass('selected');
     } else {
@@ -168,13 +168,13 @@ function Plugin(element, options) {
     }
   };
 
-  const overHandler = function() {
+  const overHandler = function () {
     self.$parent
       .find('.fixed-first-column table tbody tr:eq(' + $(this).index() + ') td')
       .addClass('fixed-first-col-hover');
   };
 
-  const outHandler = function() {
+  const outHandler = function () {
     self.$parent.find('.fixed-first-column table tbody tr td').removeClass('fixed-first-col-hover');
   };
 
@@ -197,7 +197,7 @@ function Plugin(element, options) {
   }
 }
 
-Plugin.prototype.redraw = function() {
+Plugin.prototype.redraw = function () {
   const self = this;
   self.drawHeader();
   self.drawFirstColumn();
@@ -209,7 +209,7 @@ Plugin.prototype.redraw = function() {
   }, 300);
 };
 
-Plugin.prototype.destroy = function() {
+Plugin.prototype.destroy = function () {
   const self = this;
   self.disposeFunctions.forEach(disposeFunction => {
     disposeFunction();
@@ -229,7 +229,7 @@ Plugin.prototype.destroy = function() {
   self.$element.data('plugin_' + PLUGIN_NAME, null);
 };
 
-Plugin.prototype.setOptions = function(options) {
+Plugin.prototype.setOptions = function (options) {
   this.options = $.extend({}, DEFAULT_OPTIONS, options);
   this.options.labels = $.extend(
     {},
@@ -245,7 +245,7 @@ Plugin.prototype.setOptions = function(options) {
   );
 };
 
-Plugin.prototype.repositionHeader = function() {
+Plugin.prototype.repositionHeader = function () {
   const self = this;
   if (self.options.disableTopPosition) {
     return;
@@ -298,7 +298,7 @@ Plugin.prototype.repositionHeader = function() {
   }
 };
 
-Plugin.prototype.drawHeader = function() {
+Plugin.prototype.drawHeader = function () {
   const self = this;
   if (!self.$element.attr('id') && self.options.parentId) {
     self.$element.attr('id', 'eT' + self.options.parentId);
@@ -323,11 +323,11 @@ Plugin.prototype.drawHeader = function() {
 
   self.thMapping = [];
   let totalThWidth = 0;
-  self.$element.find('thead>tr th').each(function(i) {
+  self.$element.find('thead>tr th').each(function (i) {
     const originalTh = $(this);
     originalTh.removeAttr('data-bind');
     const clonedTh = $(clonedThs[i]).css('background-color', '#FFFFFF');
-    clonedTh.click(function() {
+    clonedTh.click(function () {
       originalTh.click();
       if (self.options.headerSorting) {
         clonedThs.attr('class', 'sorting');
@@ -373,7 +373,7 @@ Plugin.prototype.drawHeader = function() {
   self.$mainScrollable.trigger('scroll');
 };
 
-Plugin.prototype.drawFirstColumn = function(repositionHeader) {
+Plugin.prototype.drawFirstColumn = function (repositionHeader) {
   const self = this;
   if (!self.options.fixedFirstColumn) {
     self.firstColumnInner = $();
@@ -432,15 +432,12 @@ Plugin.prototype.drawFirstColumn = function(repositionHeader) {
     .html('<thead><tr></tr></thead><tbody></tbody>');
   clonedTable.removeClass(self.options.classToRemove);
   clonedTable.css('margin-bottom', '0').css('table-layout', 'fixed');
-  self.$element
-    .find('thead>tr th:eq(0)')
-    .clone()
-    .appendTo(clonedTable.find('thead tr'));
+  self.$element.find('thead>tr th:eq(0)').clone().appendTo(clonedTable.find('thead tr'));
   const clonedTBody = clonedTable.find('tbody');
   const clones = self.$element.find('tbody>tr td:nth-child(1)').clone();
   let h = '';
   let foundEmptyTh = false;
-  clones.each(function() {
+  clones.each(function () {
     if ($(this).html() === '') {
       foundEmptyTh = true;
     }
@@ -456,18 +453,14 @@ Plugin.prototype.drawFirstColumn = function(repositionHeader) {
   }
   clonedTBody.html(h);
   if (self.options.lockSelectedRow) {
-    clonedTBody.find('td').each(function(idx) {
+    clonedTBody.find('td').each(function (idx) {
       const cell = $(this);
       cell.addClass('lockable');
       $('<i>')
         .addClass('fa fa-lock pointer muted')
         .prependTo(cell)
-        .on('click', function() {
-          self.drawLockedRow(
-            $(this)
-              .parent()
-              .text() * 1
-          );
+        .on('click', function () {
+          self.drawLockedRow($(this).parent().text() * 1);
         })
         .attr('title', self.options.labels.LOCK);
       $('<i>')
@@ -513,7 +506,7 @@ Plugin.prototype.drawFirstColumn = function(repositionHeader) {
   }
 };
 
-Plugin.prototype.drawLockedRows = function(force) {
+Plugin.prototype.drawLockedRows = function (force) {
   const self = this;
   if (Object.keys(self.lockedRows).length === 0) {
     self.headerRowContainer.find('tbody').empty();
@@ -528,13 +521,13 @@ Plugin.prototype.drawLockedRows = function(force) {
   }
 };
 
-Plugin.prototype.drawLockedRow = function(rowNo, force) {
+Plugin.prototype.drawLockedRow = function (rowNo, force) {
   const self = this;
 
   function unlock($el) {
     self.headerRowContainer
       .find('tr td:first-child')
-      .filter(function() {
+      .filter(function () {
         return $(this).text() === rowNo + '';
       })
       .closest('tr')
@@ -575,7 +568,7 @@ Plugin.prototype.drawLockedRow = function(rowNo, force) {
           '</td>'
       )
       .appendTo(self.firstColumnTopCell.find('tbody'));
-    $newTr.find('td').on('click', function() {
+    $newTr.find('td').on('click', function () {
       unlock($(this));
     });
     self.lockedRows['r' + rowNo] = {
@@ -585,14 +578,14 @@ Plugin.prototype.drawLockedRow = function(rowNo, force) {
   } else {
     self.lockedRows['r' + rowNo].row.appendTo(self.headerRowContainer.find('tbody'));
     self.lockedRows['r' + rowNo].cell.appendTo(self.firstColumnTopCell.find('tbody'));
-    self.lockedRows['r' + rowNo].cell.find('td').on('click', function() {
+    self.lockedRows['r' + rowNo].cell.find('td').on('click', function () {
       unlock($(this));
     });
   }
 };
 
-$.fn[PLUGIN_NAME] = function(options) {
-  return this.each(function() {
+$.fn[PLUGIN_NAME] = function (options) {
+  return this.each(function () {
     if ($.data(this, 'plugin_' + PLUGIN_NAME)) {
       $.data(this, 'plugin_' + PLUGIN_NAME).destroy();
     }

+ 15 - 34
desktop/core/src/desktop/js/jquery/plugins/jquery.tablescroller.js

@@ -43,20 +43,17 @@ function Plugin(element, options) {
   this.init();
 }
 
-Plugin.prototype.setOptions = function(options) {
+Plugin.prototype.setOptions = function (options) {
   this.options = $.extend({}, defaults, options);
   resizeScrollingTable(this);
 };
 
-Plugin.prototype.init = function() {
+Plugin.prototype.init = function () {
   const _this = this;
 
   $(_this.element).data('original-height', $(_this.element).height());
 
-  const disableScrollingTable = $(_this.element)
-    .find('table')
-    .eq(0)
-    .data('tablescroller-disable');
+  const disableScrollingTable = $(_this.element).find('table').eq(0).data('tablescroller-disable');
   if (disableScrollingTable == null || disableScrollingTable !== true) {
     resizeScrollingTable(_this);
     let resizeTimeout = -1;
@@ -74,7 +71,7 @@ Plugin.prototype.init = function() {
   }
 };
 
-Plugin.prototype.destroy = function() {
+Plugin.prototype.destroy = function () {
   const $element = $(this.element);
   this.disposeFunctions.forEach(disposeFunction => {
     disposeFunction();
@@ -84,37 +81,27 @@ Plugin.prototype.destroy = function() {
 
 function resizeScrollingTable(_this) {
   const el = _this.element;
-  $(el)
-    .css('overflow-y', '')
-    .css('height', '');
+  $(el).css('overflow-y', '').css('height', '');
   $(el).css('overflow-x', 'auto');
   let heightAfter = _this.options.heightAfterCorrection;
   $(el)
     .nextAll(':visible')
-    .each(function() {
+    .each(function () {
       heightAfter += $(this).outerHeight(true);
     });
 
   let heightCondition = $(el).height() > $(window).height() - $(el).offset().top - heightAfter;
-  const enforceHeight = $(_this.element)
-    .find('table')
-    .eq(0)
-    .data('tablescroller-enforce-height');
+  const enforceHeight = $(_this.element).find('table').eq(0).data('tablescroller-enforce-height');
   if (enforceHeight !== undefined && enforceHeight == true) {
     heightCondition = true;
   }
 
   const fixedHeight =
-    $(_this.element)
-      .find('table')
-      .eq(0)
-      .data('tablescroller-fixed-height') || _this.options.maxHeight;
+    $(_this.element).find('table').eq(0).data('tablescroller-fixed-height') ||
+    _this.options.maxHeight;
 
   if (heightCondition) {
-    const specificMinHeight = $(el)
-      .find('table')
-      .eq(0)
-      .data('tablescroller-min-height');
+    const specificMinHeight = $(el).find('table').eq(0).data('tablescroller-min-height');
     let minHeightVal = _this.options.minHeight;
     if (!isNaN(parseFloat(specificMinHeight)) && isFinite(specificMinHeight)) {
       minHeightVal = parseFloat(specificMinHeight);
@@ -139,25 +126,19 @@ function resizeScrollingTable(_this) {
         );
     } else {
       if ($(el).data('original-height') > minHeightVal) {
-        $(el)
-          .css('overflow-y', 'auto')
-          .height(minHeightVal);
+        $(el).css('overflow-y', 'auto').height(minHeightVal);
       }
       if (fixedHeight > -1) {
-        $(el)
-          .css('overflow-y', 'auto')
-          .css('maxHeight', fixedHeight);
+        $(el).css('overflow-y', 'auto').css('maxHeight', fixedHeight);
       }
     }
   } else if (fixedHeight > -1) {
-    $(el)
-      .css('overflow-y', 'auto')
-      .css('maxHeight', fixedHeight);
+    $(el).css('overflow-y', 'auto').css('maxHeight', fixedHeight);
   }
 }
 
-$.fn[PLUGIN_NAME] = function(options) {
-  return this.each(function() {
+$.fn[PLUGIN_NAME] = function (options) {
+  return this.each(function () {
     if (!$.data(this, 'plugin_' + PLUGIN_NAME)) {
       $.data(this, 'plugin_' + PLUGIN_NAME, new Plugin(this, options));
     } else {

+ 5 - 5
desktop/core/src/desktop/js/jquery/plugins/jquery.titleupdater.js

@@ -34,11 +34,11 @@ function Plugin(options) {
   this.updateStatusBar();
 }
 
-Plugin.prototype.setOptions = function(options) {
+Plugin.prototype.setOptions = function (options) {
   this.options = $.extend({}, defaults, options);
 };
 
-Plugin.prototype.updateStatusBar = function() {
+Plugin.prototype.updateStatusBar = function () {
   const _this = this;
   if (_this.options.reset && $(document).data('jHueTitleUpdaterOriginal') != null) {
     document.title = $(document).data('jHueTitleUpdaterOriginal');
@@ -51,12 +51,12 @@ Plugin.prototype.updateStatusBar = function() {
   }
 };
 
-$[pluginName] = function() {};
+$[pluginName] = function () {};
 
-$[pluginName].reset = function() {
+$[pluginName].reset = function () {
   new Plugin({ reset: true });
 };
 
-$[pluginName].set = function(message) {
+$[pluginName].set = function (message) {
   new Plugin({ message: message });
 };

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

@@ -66,7 +66,7 @@ class AceLocationHandler {
 
     self.verifyThrottle = -1;
 
-    const updateDatabaseIndex = function(databaseList) {
+    const updateDatabaseIndex = function (databaseList) {
       self.databaseIndex = {};
       databaseList.forEach(database => {
         self.databaseIndex[database.toLowerCase()] = true;
@@ -95,19 +95,19 @@ class AceLocationHandler {
     const activeMarkers = [];
     let keepLastMarker = false;
 
-    const hideContextTooltip = function() {
+    const hideContextTooltip = function () {
       clearTimeout(tooltipTimeout);
       contextTooltip.hide();
     };
 
-    const clearActiveMarkers = function() {
+    const clearActiveMarkers = function () {
       hideContextTooltip();
       while (activeMarkers.length > keepLastMarker ? 1 : 0) {
         self.editor.session.removeMarker(activeMarkers.shift());
       }
     };
 
-    const markLocation = function(parseLocation) {
+    const markLocation = function (parseLocation) {
       let range;
       if (parseLocation.type === 'function') {
         // Todo: Figure out why functions need an extra char at the end
@@ -317,7 +317,7 @@ class AceLocationHandler {
       self.editor.off('input', inputListener);
     });
 
-    const mouseoutListener = function() {
+    const mouseoutListener = function () {
       clearActiveMarkers();
       clearTimeout(tooltipTimeout);
       contextTooltip.hide();
@@ -330,7 +330,7 @@ class AceLocationHandler {
       self.editor.container.removeEventListener('mouseout', mouseoutListener);
     });
 
-    const onContextMenu = function(e) {
+    const onContextMenu = function (e) {
       const selectionRange = self.editor.selection.getRange();
       huePubSub.publish('context.popover.hide');
       huePubSub.publish('sql.syntax.dropdown.hide');
@@ -451,7 +451,7 @@ class AceLocationHandler {
     let lastKnownStatements = [];
     let activeStatement;
 
-    const isPointInside = function(parseLocation, editorPosition) {
+    const isPointInside = function (parseLocation, editorPosition) {
       const row = editorPosition.row + 1; // ace positioning has 0 based rows while the parser has 1
       const column = editorPosition.column;
       return (
@@ -486,7 +486,7 @@ class AceLocationHandler {
     };
 
     let lastExecutingStatement = null;
-    const updateActiveStatement = function(cursorChange) {
+    const updateActiveStatement = function (cursorChange) {
       if (!self.snippet.isSqlDialect()) {
         return;
       }
@@ -597,7 +597,7 @@ class AceLocationHandler {
       }
     };
 
-    const parseForStatements = function() {
+    const parseForStatements = function () {
       if (self.snippet.isSqlDialect()) {
         try {
           const lastChangeTime = self.editor.lastChangeTime;
@@ -746,7 +746,7 @@ class AceLocationHandler {
     const markerId = self.editor.getSession().addMarker(range, clazz);
     const marker = self.editor.getSession().$backMarkers[markerId];
     marker.token = token;
-    marker.dispose = function() {
+    marker.dispose = function () {
       range.start.detach();
       range.end.detach();
       delete marker.token.syntaxError;
@@ -888,7 +888,7 @@ class AceLocationHandler {
       });
       $.when
         .apply($, tablePromises)
-        .done(function() {
+        .done(function () {
           let joined = [];
           for (let i = 0; i < arguments.length; i++) {
             joined = joined.concat(arguments[i]);
@@ -965,14 +965,14 @@ class AceLocationHandler {
       }
     });
 
-    const resolvePathFromTables = function(location) {
+    const resolvePathFromTables = function (location) {
       const promise = $.Deferred();
       if (
         location.type === 'column' &&
         typeof location.tables !== 'undefined' &&
         location.identifierChain.length === 1
       ) {
-        const findIdentifierChainInTable = function(tablesToGo) {
+        const findIdentifierChainInTable = function (tablesToGo) {
           const nextTable = tablesToGo.shift();
           if (typeof nextTable.subQuery === 'undefined') {
             dataCatalog
@@ -1026,7 +1026,7 @@ class AceLocationHandler {
       return promise;
     };
 
-    const verify = function() {
+    const verify = function () {
       if (tokensToVerify.length === 0) {
         return;
       }

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

@@ -29,7 +29,7 @@ export const NAME = 'aceEditor';
 export const INSERT_AT_CURSOR_EVENT = 'editor.insert.at.cursor';
 
 registerBinding(NAME, {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     const $el = $(element);
     const options = ko.unwrap(valueAccessor());
     const snippet = options.snippet;
@@ -37,7 +37,7 @@ registerBinding(NAME, {
 
     const disposeFunctions = [];
 
-    const dispose = function() {
+    const dispose = function () {
       disposeFunctions.forEach(dispose => {
         dispose();
       });
@@ -50,7 +50,7 @@ registerBinding(NAME, {
     const editor = ace.edit(snippet.id());
     const AceRange = ace.require('ace/range').Range;
 
-    const resizeAce = function() {
+    const resizeAce = function () {
       window.setTimeout(() => {
         try {
           editor.resize(true);
@@ -163,15 +163,15 @@ registerBinding(NAME, {
     };
 
     editor.customMenuOptions = {
-      setEnableDarkTheme: function(enabled) {
+      setEnableDarkTheme: function (enabled) {
         darkThemeEnabled = enabled;
         apiHelper.setInTotalStorage('ace', 'dark.theme.enabled', darkThemeEnabled);
         editor.setTheme(darkThemeEnabled ? 'ace/theme/hue_dark' : 'ace/theme/hue');
       },
-      getEnableDarkTheme: function() {
+      getEnableDarkTheme: function () {
         return darkThemeEnabled;
       },
-      setEnableAutocompleter: function(enabled) {
+      setEnableAutocompleter: function (enabled) {
         editor.setOption('enableBasicAutocompletion', enabled);
         apiHelper.setInTotalStorage('hue.ace', 'enableBasicAutocompletion', enabled);
         const $enableLiveAutocompletionChecked = $('#setEnableLiveAutocompletion:checked');
@@ -182,27 +182,27 @@ registerBinding(NAME, {
           $setEnableLiveAutocompletion.trigger('click');
         }
       },
-      getEnableAutocompleter: function() {
+      getEnableAutocompleter: function () {
         return editor.getOption('enableBasicAutocompletion');
       },
-      setEnableLiveAutocompletion: function(enabled) {
+      setEnableLiveAutocompletion: function (enabled) {
         editor.setOption('enableLiveAutocompletion', enabled);
         apiHelper.setInTotalStorage('hue.ace', 'enableLiveAutocompletion', enabled);
         if (enabled && $('#setEnableAutocompleter:checked').length === 0) {
           $('#setEnableAutocompleter').trigger('click');
         }
       },
-      getEnableLiveAutocompletion: function() {
+      getEnableLiveAutocompletion: function () {
         return editor.getOption('enableLiveAutocompletion');
       },
-      setFontSize: function(size) {
+      setFontSize: function (size) {
         if (size.toLowerCase().indexOf('px') === -1 && size.toLowerCase().indexOf('em') === -1) {
           size += 'px';
         }
         editor.setOption('fontSize', size);
         apiHelper.setInTotalStorage('hue.ace', 'fontSize', size);
       },
-      getFontSize: function() {
+      getFontSize: function () {
         let size = editor.getOption('fontSize');
         if (size.toLowerCase().indexOf('px') === -1 && size.toLowerCase().indexOf('em') === -1) {
           size += 'px';
@@ -222,7 +222,7 @@ registerBinding(NAME, {
         aceLocationHandler.attachSqlSyntaxWorker();
       }
 
-      editor.customMenuOptions.setErrorHighlighting = function(enabled) {
+      editor.customMenuOptions.setErrorHighlighting = function (enabled) {
         errorHighlightingEnabled = enabled;
         apiHelper.setInTotalStorage('hue.ace', 'errorHighlightingEnabled', enabled);
         if (enabled) {
@@ -231,16 +231,16 @@ registerBinding(NAME, {
           aceLocationHandler.detachSqlSyntaxWorker();
         }
       };
-      editor.customMenuOptions.getErrorHighlighting = function() {
+      editor.customMenuOptions.getErrorHighlighting = function () {
         return errorHighlightingEnabled;
       };
-      editor.customMenuOptions.setClearIgnoredSyntaxChecks = function() {
+      editor.customMenuOptions.setClearIgnoredSyntaxChecks = function () {
         apiHelper.setInTotalStorage('hue.syntax.checker', 'suppressedRules', {});
         $('#setClearIgnoredSyntaxChecks')
           .hide()
           .before('<div style="margin-top:5px;float:right;">done</div>');
       };
-      editor.customMenuOptions.getClearIgnoredSyntaxChecks = function() {
+      editor.customMenuOptions.getClearIgnoredSyntaxChecks = function () {
         return false;
       };
     }
@@ -271,7 +271,7 @@ registerBinding(NAME, {
     }
     editor.completer.exactMatch = !snippet.isSqlDialect();
 
-    const initAutocompleters = function() {
+    const initAutocompleters = function () {
       if (editor.completers) {
         editor.completers.length = 0;
         if (snippet.isSqlDialect()) {
@@ -292,7 +292,7 @@ registerBinding(NAME, {
 
     const UNICODES_TO_REMOVE = /[\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u200B\u202F\u205F\u3000\uFEFF]/gi; //taken from https://www.cs.tut.fi/~jkorpela/chars/spaces.html
 
-    const removeUnicodes = function(value) {
+    const removeUnicodes = function (value) {
       return value.replace(UNICODES_TO_REMOVE, ' ');
     };
 
@@ -423,10 +423,7 @@ registerBinding(NAME, {
         data.location.last_line - 1,
         data.location.last_column - 1
       );
-      editor
-        .getSession()
-        .getDocument()
-        .replace(range, data.text);
+      editor.getSession().getDocument().replace(range, data.text);
     });
 
     disposeFunctions.push(() => {
@@ -483,7 +480,7 @@ registerBinding(NAME, {
     editor.commands.addCommand({
       name: 'execute',
       bindKey: { win: 'Ctrl-Enter', mac: 'Command-Enter|Ctrl-Enter' },
-      exec: function() {
+      exec: function () {
         snippet.statement_raw(removeUnicodes(editor.getValue()));
         snippet.execute();
       }
@@ -492,7 +489,7 @@ registerBinding(NAME, {
     editor.commands.addCommand({
       name: 'switchTheme',
       bindKey: { win: 'Ctrl-Alt-t', mac: 'Command-Alt-t' },
-      exec: function() {
+      exec: function () {
         darkThemeEnabled = !darkThemeEnabled;
         apiHelper.setInTotalStorage('ace', 'dark.theme.enabled', darkThemeEnabled);
         editor.setTheme(darkThemeEnabled ? 'ace/theme/hue_dark' : 'ace/theme/hue');
@@ -502,7 +499,7 @@ registerBinding(NAME, {
     editor.commands.addCommand({
       name: 'new',
       bindKey: { win: 'Ctrl-e', mac: 'Command-e' },
-      exec: function() {
+      exec: function () {
         huePubSub.publish('editor.create.new');
       }
     });
@@ -510,7 +507,7 @@ registerBinding(NAME, {
     editor.commands.addCommand({
       name: 'save',
       bindKey: { win: 'Ctrl-s', mac: 'Command-s|Ctrl-s' },
-      exec: function() {
+      exec: function () {
         huePubSub.publish('editor.save');
       }
     });
@@ -518,7 +515,7 @@ registerBinding(NAME, {
     editor.commands.addCommand({
       name: 'esc',
       bindKey: { win: 'Ctrl-Shift-p', mac: 'Ctrl-Shift-p|Command-Shift-p' },
-      exec: function() {
+      exec: function () {
         huePubSub.publish('editor.presentation.toggle');
       }
     });
@@ -531,7 +528,7 @@ registerBinding(NAME, {
         win: 'Ctrl-i|Ctrl-Shift-f|Ctrl-Alt-l',
         mac: 'Command-i|Ctrl-i|Ctrl-Shift-f|Command-Shift-f|Ctrl-Shift-l|Cmd-Shift-l'
       },
-      exec: function() {
+      exec: function () {
         if (
           [
             'ace/mode/hive',
@@ -573,11 +570,11 @@ registerBinding(NAME, {
       exec: editor.commands.commands['gotoline'].exec
     });
 
-    const isNewStatement = function() {
+    const isNewStatement = function () {
       return /^\s*$/.test(editor.getValue()) || /^.*;\s*$/.test(editor.getTextBeforeCursor());
     };
 
-    const insertSqlAtCursor = function(text, cursorEndAdjust, menu) {
+    const insertSqlAtCursor = function (text, cursorEndAdjust, menu) {
       const before = editor.getTextBeforeCursor();
       if (/\S+$/.test(before)) {
         text = ' ' + text;
@@ -763,7 +760,7 @@ registerBinding(NAME, {
                 $aceFileChooseContent.html($aceFileChooseContent.data('spinner'));
               }
               $aceFileChooseContent.jHueFileChooser({
-                onFileChoose: function(filePath) {
+                onFileChoose: function (filePath) {
                   editor.session.insert(editor.getCursorPosition(), filePath + "'");
                   editor.hideFileButton();
                   if (autocompleteTemporarilyDisabled) {
@@ -811,7 +808,7 @@ registerBinding(NAME, {
     snippet.ace(editor);
   },
 
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     const options = ko.unwrap(valueAccessor());
     const snippet = options.snippet;
     const AceRange = ace.require('ace/range').Range;

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

@@ -20,7 +20,7 @@ import * as ko from 'knockout';
 import huePubSub from 'utils/huePubSub';
 
 ko.bindingHandlers.aceResizer = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     const options = ko.unwrap(valueAccessor());
     const ace = options.snippet.ace.bind(options.snippet);
     const $target = $(options.target);
@@ -82,8 +82,8 @@ ko.bindingHandlers.aceResizer = {
 
     $resizer.draggable({
       axis: 'y',
-      start: options.onStart ? options.onStart : function() {},
-      drag: function(event, ui) {
+      start: options.onStart ? options.onStart : function () {},
+      drag: function (event, ui) {
         draggedOnce = true;
         const currentHeight =
           ui.offset.top +
@@ -94,7 +94,7 @@ ko.bindingHandlers.aceResizer = {
         ui.offset.top = 0;
         ui.position.top = 0;
       },
-      stop: function(event, ui) {
+      stop: function (event, ui) {
         ui.offset.top = 0;
         ui.position.top = 0;
         $.totalStorage('hue.editor.editor.size', $target.height());

+ 43 - 123
desktop/core/src/desktop/js/ko/bindings/charts/chartUtils.js

@@ -55,16 +55,12 @@ const barChartBuilder = (element, options, isTimeline) => {
   const _isPivot = options.isPivot != null ? options.isPivot : false;
 
   if ($(element).find('svg').length > 0 && (_datum.length === 0 || _datum[0].values.length === 0)) {
-    $(element)
-      .find('svg')
-      .remove();
+    $(element).find('svg').remove();
   }
 
   if (_datum.length > 0 && _datum[0].values.length > 0 && isNaN(_datum[0].values[0].y)) {
     _datum = [];
-    $(element)
-      .find('svg')
-      .remove();
+    $(element).find('svg').remove();
   }
 
   nv.addGraph(() => {
@@ -72,9 +68,7 @@ const barChartBuilder = (element, options, isTimeline) => {
       $(element).find('svg').length > 0 &&
       $(element).find('.nv-discreteBarWithAxes').length > 0
     ) {
-      $(element)
-        .find('svg')
-        .empty();
+      $(element).find('svg').empty();
     }
     const _chart = nv.models.multiBarWithBrushChart();
     _chart.noData(_datum.message || I18n('No Data Available.'));
@@ -105,16 +99,14 @@ const barChartBuilder = (element, options, isTimeline) => {
     _chart.multibar.hideable(true);
     _chart.multibar.stacked(typeof options.stacked != 'undefined' ? options.stacked : false);
     if (isTimeline) {
-      _chart.convert = function(d) {
+      _chart.convert = function (d) {
         return isTimeline ? new Date(moment(d[0].obj.from).valueOf()) : parseFloat(d);
       };
       _chart.staggerLabels(false);
       _chart.tooltipContent(values => {
         return values.map(value => {
           value = JSON.parse(JSON.stringify(value));
-          value.x = moment(value.x)
-            .utc()
-            .format('YYYY-MM-DD HH:mm:ss');
+          value.x = moment(value.x).utc().format('YYYY-MM-DD HH:mm:ss');
           value.y = _chart.yAxis.tickFormat()(value.y);
           return value;
         });
@@ -122,7 +114,7 @@ const barChartBuilder = (element, options, isTimeline) => {
       _chart.xAxis.tickFormat(multi(_chart.xAxis));
       _chart.multibar.stacked(typeof options.stacked != 'undefined' ? options.stacked : false);
       _chart.onChartUpdate(() => {
-        _d3.selectAll('g.nv-x.nv-axis g text').each(function(d) {
+        _d3.selectAll('g.nv-x.nv-axis g text').each(function (d) {
           insertLinebreaks(_chart, d, this);
         });
       });
@@ -158,7 +150,7 @@ const barChartBuilder = (element, options, isTimeline) => {
           options.onComplete();
         }
         if (isTimeline) {
-          _d3.selectAll('g.nv-x.nv-axis g text').each(function(d) {
+          _d3.selectAll('g.nv-x.nv-axis g text').each(function (d) {
             insertLinebreaks(_chart, d, this);
           });
         }
@@ -324,9 +316,7 @@ const lineChartBuilder = (element, options, isTimeline) => {
   let _datum = options.transformer(options.datum);
   $(element).height(300);
   if ($(element).find('svg').length > 0 && (_datum.length === 0 || _datum[0].values.length === 0)) {
-    $(element)
-      .find('svg')
-      .empty();
+    $(element).find('svg').empty();
   }
   if (
     _datum.length > 0 &&
@@ -334,9 +324,7 @@ const lineChartBuilder = (element, options, isTimeline) => {
     (isNaN(_datum[0].values[0].x) || isNaN(_datum[0].values[0].y))
   ) {
     _datum = [];
-    $(element)
-      .find('svg')
-      .empty();
+    $(element).find('svg').empty();
   }
 
   if ($(element).is(':visible')) {
@@ -345,7 +333,7 @@ const lineChartBuilder = (element, options, isTimeline) => {
       _chart.noData(_datum.message || I18n('No Data Available.'));
       $(element).data('chart', _chart);
       _chart.transitionDuration(0);
-      _chart.convert = function(d) {
+      _chart.convert = function (d) {
         return isTimeline ? new Date(moment(d[0].obj.from).valueOf()) : parseFloat(d);
       };
       if (options.showControls != null) {
@@ -374,16 +362,14 @@ const lineChartBuilder = (element, options, isTimeline) => {
         _chart.tooltipContent(values => {
           return values.map(value => {
             value = JSON.parse(JSON.stringify(value));
-            value.x = moment(value.x)
-              .utc()
-              .format('YYYY-MM-DD HH:mm:ss');
+            value.x = moment(value.x).utc().format('YYYY-MM-DD HH:mm:ss');
             value.y = _chart.yAxis.tickFormat()(value.y);
             return value;
           });
         });
         _chart.xAxis.tickFormat(multi(_chart.xAxis, _chart));
         _chart.onChartUpdate(() => {
-          _d3.selectAll('g.nv-x.nv-axis g text').each(function(d) {
+          _d3.selectAll('g.nv-x.nv-axis g text').each(function (d) {
             insertLinebreaks(_chart, d, this);
           });
         });
@@ -407,7 +393,7 @@ const lineChartBuilder = (element, options, isTimeline) => {
             options.onComplete();
           }
           if (isTimeline) {
-            _d3.selectAll('g.nv-x.nv-axis g text').each(function(d) {
+            _d3.selectAll('g.nv-x.nv-axis g text').each(function (d) {
               insertLinebreaks(_chart, d, this);
             });
           }
@@ -442,13 +428,9 @@ const multi = xAxis => {
   return d3v3.time.format.utc.multi([
     [
       '%H:%M:%S %Y-%m-%d',
-      function(d) {
+      function (d) {
         const domain = xAxis.domain();
-        const result =
-          (previous > d || d === domain[0]) &&
-          moment(d)
-            .utc()
-            .seconds();
+        const result = (previous > d || d === domain[0]) && moment(d).utc().seconds();
         if (result) {
           previous = d;
         }
@@ -457,7 +439,7 @@ const multi = xAxis => {
     ],
     [
       '%H:%M %Y-%m-%d',
-      function(d) {
+      function (d) {
         const domain = xAxis.domain();
         const result = previous > d || d === domain[0];
         if (result) {
@@ -468,15 +450,11 @@ const multi = xAxis => {
     ],
     [
       '%S %H:%M',
-      function(d) {
+      function (d) {
         const previousDiff = Math.abs(d - previous);
         const result =
-          moment(previous)
-            .utc()
-            .minutes() !==
-            moment(d)
-              .utc()
-              .minutes() && previousDiff < MINUTE_MS;
+          moment(previous).utc().minutes() !== moment(d).utc().minutes() &&
+          previousDiff < MINUTE_MS;
         if (result) {
           previous = d;
         }
@@ -485,15 +463,11 @@ const multi = xAxis => {
     ],
     [
       '%S',
-      function(d) {
+      function (d) {
         const previousDiff = Math.abs(d - previous);
         const result =
-          moment(previous)
-            .utc()
-            .seconds() !==
-            moment(d)
-              .utc()
-              .seconds() && previousDiff < MINUTE_MS;
+          moment(previous).utc().seconds() !== moment(d).utc().seconds() &&
+          previousDiff < MINUTE_MS;
         if (result) {
           previous = d;
         }
@@ -502,19 +476,12 @@ const multi = xAxis => {
     ],
     [
       '%H:%M:%S %Y-%m-%d',
-      function(d) {
+      function (d) {
         const previousDiff = Math.abs(d - previous);
         const result =
-          moment(previous)
-            .utc()
-            .date() !==
-            moment(d)
-              .utc()
-              .date() &&
+          moment(previous).utc().date() !== moment(d).utc().date() &&
           previousDiff < WEEK_MS &&
-          moment(d)
-            .utc()
-            .seconds();
+          moment(d).utc().seconds();
         if (result) {
           previous = d;
         }
@@ -523,15 +490,10 @@ const multi = xAxis => {
     ],
     [
       '%H:%M %Y-%m-%d',
-      function(d) {
+      function (d) {
         const previousDiff = Math.abs(d - previous);
         const result =
-          moment(previous)
-            .utc()
-            .date() !==
-            moment(d)
-              .utc()
-              .date() && previousDiff < WEEK_MS;
+          moment(previous).utc().date() !== moment(d).utc().date() && previousDiff < WEEK_MS;
         if (result) {
           previous = d;
         }
@@ -540,25 +502,13 @@ const multi = xAxis => {
     ],
     [
       '%H:%M:%S',
-      function(d) {
+      function (d) {
         const previousDiff = Math.abs(d - previous);
         const result =
-          (moment(previous)
-            .utc()
-            .hours() !==
-            moment(d)
-              .utc()
-              .hours() ||
-            moment(previous)
-              .utc()
-              .minutes() !==
-              moment(d)
-                .utc()
-                .minutes()) &&
+          (moment(previous).utc().hours() !== moment(d).utc().hours() ||
+            moment(previous).utc().minutes() !== moment(d).utc().minutes()) &&
           previousDiff < WEEK_MS &&
-          moment(d)
-            .utc()
-            .seconds();
+          moment(d).utc().seconds();
         if (result) {
           previous = d;
         }
@@ -567,21 +517,11 @@ const multi = xAxis => {
     ],
     [
       '%H:%M',
-      function(d) {
+      function (d) {
         const previousDiff = Math.abs(d - previous);
         const result =
-          (moment(previous)
-            .utc()
-            .hours() !==
-            moment(d)
-              .utc()
-              .hours() ||
-            moment(previous)
-              .utc()
-              .minutes() !==
-              moment(d)
-                .utc()
-                .minutes()) &&
+          (moment(previous).utc().hours() !== moment(d).utc().hours() ||
+            moment(previous).utc().minutes() !== moment(d).utc().minutes()) &&
           previousDiff < WEEK_MS;
         if (result) {
           previous = d;
@@ -591,15 +531,10 @@ const multi = xAxis => {
     ],
     [
       '%d %Y-%m',
-      function(d) {
+      function (d) {
         const previousDiff = Math.abs(d - previous);
         const result =
-          moment(previous)
-            .utc()
-            .months() !==
-            moment(d)
-              .utc()
-              .months() && previousDiff < MONTH_MS;
+          moment(previous).utc().months() !== moment(d).utc().months() && previousDiff < MONTH_MS;
         if (result) {
           previous = d;
         }
@@ -608,15 +543,10 @@ const multi = xAxis => {
     ],
     [
       '%d',
-      function(d) {
+      function (d) {
         const previousDiff = Math.abs(d - previous);
         const result =
-          moment(previous)
-            .utc()
-            .date() !==
-            moment(d)
-              .utc()
-              .date() && previousDiff < MONTH_MS;
+          moment(previous).utc().date() !== moment(d).utc().date() && previousDiff < MONTH_MS;
         if (result) {
           previous = d;
         }
@@ -625,15 +555,10 @@ const multi = xAxis => {
     ],
     [
       '%m %Y',
-      function(d) {
+      function (d) {
         const previousDiff = Math.abs(d - previous);
         const result =
-          moment(previous)
-            .utc()
-            .years() !==
-            moment(d)
-              .utc()
-              .years() && previousDiff < YEAR_MS;
+          moment(previous).utc().years() !== moment(d).utc().years() && previousDiff < YEAR_MS;
         if (result) {
           previous = d;
         }
@@ -642,15 +567,10 @@ const multi = xAxis => {
     ],
     [
       '%m',
-      function(d) {
+      function (d) {
         const previousDiff = Math.abs(d - previous);
         const result =
-          moment(previous)
-            .utc()
-            .months() !==
-            moment(d)
-              .utc()
-              .months() && previousDiff < YEAR_MS;
+          moment(previous).utc().months() !== moment(d).utc().months() && previousDiff < YEAR_MS;
         if (result) {
           previous = d;
         }
@@ -659,7 +579,7 @@ const multi = xAxis => {
     ],
     [
       '%Y',
-      function(d) {
+      function (d) {
         previous = d;
         return true;
       }

+ 3 - 5
desktop/core/src/desktop/js/ko/bindings/charts/ko.barChart.js

@@ -30,7 +30,7 @@ import {
 import huePubSub from 'utils/huePubSub';
 
 ko.bindingHandlers.barChart = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     const _options = ko.unwrap(valueAccessor());
     if (_options.type && _options.type() === 'line') {
       window.setTimeout(() => {
@@ -44,13 +44,11 @@ ko.bindingHandlers.barChart = {
       $(element).data('type', 'bar');
     }
   },
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     const _options = ko.unwrap(valueAccessor());
     if (_options.type && _options.type() !== $(element).data('type')) {
       if ($(element).find('svg').length > 0) {
-        $(element)
-          .find('svg')
-          .remove();
+        $(element).find('svg').remove();
       }
       if (_options.type() === 'line') {
         window.setTimeout(() => {

+ 18 - 57
desktop/core/src/desktop/js/ko/bindings/charts/ko.leafletMapChart.js

@@ -24,7 +24,7 @@ import 'ext/leaflet/leaflet.zoombox';
 import huePubSub from 'utils/huePubSub';
 
 ko.bindingHandlers.leafletMapChart = {
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     const L = window.L;
     const _options = valueAccessor();
     const _data = _options.transformer(valueAccessor().datum);
@@ -37,18 +37,14 @@ ko.bindingHandlers.leafletMapChart = {
           typeof _options == 'undefined')
       ) {
         $(element).show();
-        $(element)
-          .siblings('.leaflet-nodata')
-          .remove();
+        $(element).siblings('.leaflet-nodata').remove();
       } else {
         $(element).hide();
         if (
           (_data.message || (_options.visible != null && _options.visible)) &&
           !_options.isLoading
         ) {
-          $(element)
-            .siblings('.leaflet-nodata')
-            .remove();
+          $(element).siblings('.leaflet-nodata').remove();
           $(element).before(
             $('<div>')
               .addClass('leaflet-nodata')
@@ -82,11 +78,7 @@ ko.bindingHandlers.leafletMapChart = {
       if (_options.height != null) {
         $(element).height(_options.height * 1);
       } else if ($(element).parents('.tab-pane').length > 0) {
-        $(element).height(
-          $(element)
-            .parents('.tab-pane')
-            .height() - 100
-        );
+        $(element).height($(element).parents('.tab-pane').height() - 100);
       } else {
         $(element).height(300);
       }
@@ -148,16 +140,14 @@ ko.bindingHandlers.leafletMapChart = {
                 position: $(element).width() > 300 ? 'topright' : 'bottomleft'
               });
 
-              _command.onAdd = function(map) {
+              _command.onAdd = function (map) {
                 const div = L.DomUtil.create(
                   'div',
                   'leaflet-search-command leaflet-bar leaflet-move-label'
                 );
                 div.innerHTML =
                   '<button id="command' +
-                  $(element)
-                    .parents('.card-widget')
-                    .attr('id') +
+                  $(element).parents('.card-widget').attr('id') +
                   '" type="button" class="btn btn-mini disable-feedback"><i class="fa fa-fw fa-square-o"></i> ' +
                   (_options.moveCheckboxLabel
                     ? _options.moveCheckboxLabel
@@ -169,37 +159,27 @@ ko.bindingHandlers.leafletMapChart = {
               _command.addTo(_map);
 
               if (_options.onRegionChange == null) {
-                _options.onRegionChange = function() {};
+                _options.onRegionChange = function () {};
               }
 
-              let _onRegionChange = function() {};
+              let _onRegionChange = function () {};
 
-              $(
-                '#command' +
-                  $(element)
-                    .parents('.card-widget')
-                    .attr('id')
-              ).on('click', function(e) {
+              $('#command' + $(element).parents('.card-widget').attr('id')).on('click', function (
+                e
+              ) {
                 $(this).toggleClass('btn-primary');
-                $(this)
-                  .find('.fa-fw')
-                  .toggleClass('fa-check-square');
+                $(this).find('.fa-fw').toggleClass('fa-check-square');
                 if ($(this).hasClass('btn-primary')) {
                   if (_options.onRegionChange != null) {
                     _onRegionChange = _options.onRegionChange;
                   }
                 } else {
-                  _onRegionChange = function() {};
+                  _onRegionChange = function () {};
                 }
               });
 
               ko.utils.domNodeDisposal.addDisposeCallback(element, () => {
-                $(
-                  '#command' +
-                    $(element)
-                      .parents('.card-widget')
-                      .attr('id')
-                ).off('click');
+                $('#command' + $(element).parents('.card-widget').attr('id')).off('click');
               });
 
               _map.on('boxzoomend', e => {
@@ -285,21 +265,10 @@ ko.bindingHandlers.leafletMapChart = {
           }
 
           window.setTimeout(() => {
-            if (
-              !$(
-                '#command' +
-                  $(element)
-                    .parents('.card-widget')
-                    .attr('id')
-              ).is(':checked')
-            ) {
+            if (!$('#command' + $(element).parents('.card-widget').attr('id')).is(':checked')) {
               _map.fitBounds(_clusterGroup.getBounds());
             }
-            if (
-              $(element)
-                .find('.leaflet-tile-pane')
-                .children().length > 0
-            ) {
+            if ($(element).find('.leaflet-tile-pane').children().length > 0) {
               if (heatData.length == 0) {
                 _map.addLayer(_clusterGroup);
                 $('.leaflet-heatmap-layer').remove();
@@ -317,18 +286,10 @@ ko.bindingHandlers.leafletMapChart = {
 
           const resizeSubscription = huePubSub.subscribe('resize.leaflet.map', () => {
             if ($(element).data('_map')) {
-              $(element)
-                .data('_map')
-                .invalidateSize();
+              $(element).data('_map').invalidateSize();
               if ($(element).data('_markerLayer')) {
                 try {
-                  $(element)
-                    .data('_map')
-                    .fitBounds(
-                      $(element)
-                        .data('_markerLayer')
-                        .getBounds()
-                    );
+                  $(element).data('_map').fitBounds($(element).data('_markerLayer').getBounds());
                 } catch (e) {}
               }
             }

+ 3 - 3
desktop/core/src/desktop/js/ko/bindings/charts/ko.lineChart.js

@@ -24,12 +24,12 @@ import { insertLinebreaks, lineChartBuilder } from 'ko/bindings/charts/chartUtil
 import huePubSub from 'utils/huePubSub';
 
 ko.bindingHandlers.lineChart = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     window.setTimeout(() => {
       lineChartBuilder(element, valueAccessor(), false);
     }, 0);
   },
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     const _options = valueAccessor();
     const _datum = _options.transformer(_options.datum);
     const _chart = $(element).data('chart');
@@ -46,7 +46,7 @@ ko.bindingHandlers.lineChart = {
             return d3v3.time.format('%Y-%m-%d %H:%M:%S')(new Date(d));
           });
           _chart.onChartUpdate(() => {
-            _d3.selectAll('g.nv-x.nv-axis g text').each(function(d) {
+            _d3.selectAll('g.nv-x.nv-axis g text').each(function (d) {
               insertLinebreaks(_chart, d, this);
             });
           });

+ 8 - 16
desktop/core/src/desktop/js/ko/bindings/charts/ko.partitionChart.js

@@ -22,7 +22,7 @@ import HueColors from 'utils/hueColors';
 import huePubSub from 'utils/huePubSub';
 
 ko.bindingHandlers.partitionChart = {
-  render: function(element, valueAccessor) {
+  render: function (element, valueAccessor) {
     huePubSub.publish('charts.state');
     const MIN_HEIGHT_FOR_TOOLTIP = 24;
 
@@ -35,9 +35,7 @@ ko.bindingHandlers.partitionChart = {
       _y = d3v3.scale.linear().range([0, _h]);
 
     if ($(element).find('svg').length > 0) {
-      $(element)
-        .find('svg')
-        .empty();
+      $(element).find('svg').empty();
     }
 
     const _tip = d3v3
@@ -84,7 +82,7 @@ ko.bindingHandlers.partitionChart = {
       .attr('transform', d => {
         return 'translate(' + _x(d.y) + ',' + _y(d.x) + ')';
       })
-      .on('mouseover', function(d, i) {
+      .on('mouseover', function (d, i) {
         if (
           element.querySelectorAll('rect')[i].getBBox().height < MIN_HEIGHT_FOR_TOOLTIP ||
           d.depth === 0
@@ -95,12 +93,9 @@ ko.bindingHandlers.partitionChart = {
         if (typeof this.__data__.parent === 'undefined') {
           return;
         }
-        d3v3
-          .select(this)
-          .select('rect')
-          .classed('mouseover', true);
+        d3v3.select(this).select('rect').classed('mouseover', true);
       })
-      .on('mouseout', function(d, i) {
+      .on('mouseout', function (d, i) {
         if (
           element.querySelectorAll('rect')[i].getBBox().height < MIN_HEIGHT_FOR_TOOLTIP ||
           d.depth === 0
@@ -108,10 +103,7 @@ ko.bindingHandlers.partitionChart = {
           _tip.attr('class', 'd3-tip').show(d);
           _tip.hide();
         }
-        d3v3
-          .select(this)
-          .select('rect')
-          .classed('mouseover', false);
+        d3v3.select(this).select('rect').classed('mouseover', false);
       });
 
     if (typeof _options.zoomable == 'undefined' || _options.zoomable) {
@@ -220,10 +212,10 @@ ko.bindingHandlers.partitionChart = {
       _options.onComplete();
     }
   },
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     ko.bindingHandlers.partitionChart.render(element, valueAccessor);
   },
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     ko.bindingHandlers.partitionChart.render(element, valueAccessor);
   }
 };

+ 6 - 24
desktop/core/src/desktop/js/ko/bindings/charts/ko.pieChart.js

@@ -24,7 +24,7 @@ import hueUtils from 'utils/hueUtils';
 import I18n from 'utils/i18n';
 
 ko.bindingHandlers.pieChart = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     window.setTimeout(() => {
       const _options = valueAccessor();
       let _data = _options.transformer(_options.data);
@@ -32,27 +32,16 @@ ko.bindingHandlers.pieChart = {
       $(element).css('marginRight', 'auto');
       if (typeof _options.maxWidth != 'undefined') {
         const _max = _options.maxWidth * 1;
-        $(element).width(
-          Math.min(
-            $(element)
-              .parent()
-              .width(),
-            _max
-          )
-        );
+        $(element).width(Math.min($(element).parent().width(), _max));
       }
 
       if ($(element).find('svg').length > 0 && _data.length === 0) {
-        $(element)
-          .find('svg')
-          .empty();
+        $(element).find('svg').empty();
       }
 
       if (_data.length > 0 && isNaN(_data[0].value)) {
         _data = [];
-        $(element)
-          .find('svg')
-          .empty();
+        $(element).find('svg').empty();
       }
 
       if ($(element).is(':visible')) {
@@ -121,14 +110,7 @@ ko.bindingHandlers.pieChart = {
               .on('resize', () => {
                 if (typeof _options.maxWidth != 'undefined') {
                   const _max = _options.maxWidth * 1;
-                  $(element).width(
-                    Math.min(
-                      $(element)
-                        .parent()
-                        .width(),
-                      _max
-                    )
-                  );
+                  $(element).width(Math.min($(element).parent().width(), _max));
                 }
                 $(element).height($(element).width());
                 _chart.update();
@@ -152,7 +134,7 @@ ko.bindingHandlers.pieChart = {
       }
     }, 0);
   },
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     const _options = valueAccessor();
     const _data = _options.transformer(_options.data);
     const _chart = $(element).data('chart');

+ 3 - 7
desktop/core/src/desktop/js/ko/bindings/charts/ko.scatterChart.js

@@ -20,7 +20,7 @@ import * as ko from 'knockout';
 import nv from 'ext/nv.d3.1.1.15b.custom';
 
 ko.bindingHandlers.scatterChart = {
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     const options = valueAccessor();
     let _datum = options.transformer(options.datum);
     window.setTimeout(() => {
@@ -29,9 +29,7 @@ ko.bindingHandlers.scatterChart = {
         $(element).find('svg').length > 0 &&
         (_datum.length === 0 || _datum[0].values.length === 0)
       ) {
-        $(element)
-          .find('svg')
-          .empty();
+        $(element).find('svg').empty();
       }
       if (
         _datum.length > 0 &&
@@ -39,9 +37,7 @@ ko.bindingHandlers.scatterChart = {
         (isNaN(_datum[0].values[0].x) || isNaN(_datum[0].values[0].y))
       ) {
         _datum = [];
-        $(element)
-          .find('svg')
-          .empty();
+        $(element).find('svg').empty();
       }
 
       if ($(element).is(':visible')) {

+ 4 - 6
desktop/core/src/desktop/js/ko/bindings/charts/ko.timelineChart.js

@@ -29,7 +29,7 @@ import {
 import huePubSub from 'utils/huePubSub';
 
 ko.bindingHandlers.timelineChart = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     if (valueAccessor().type && valueAccessor().type() === 'line') {
       window.setTimeout(() => {
         lineChartBuilder(element, valueAccessor(), true);
@@ -42,13 +42,11 @@ ko.bindingHandlers.timelineChart = {
       $(element).data('type', 'bar');
     }
   },
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     const _options = valueAccessor();
     if (valueAccessor().type && valueAccessor().type() !== $(element).data('type')) {
       if ($(element).find('svg').length > 0) {
-        $(element)
-          .find('svg')
-          .remove();
+        $(element).find('svg').remove();
       }
       if (valueAccessor().type() === 'line') {
         window.setTimeout(() => {
@@ -83,7 +81,7 @@ ko.bindingHandlers.timelineChart = {
             }
           })
           .call(_chart);
-        _d3.selectAll('g.nv-x.nv-axis g text').each(function(d) {
+        _d3.selectAll('g.nv-x.nv-axis g text').each(function (d) {
           insertLinebreaks(_chart, d, this);
         });
         huePubSub.publish('charts.state');

+ 23 - 37
desktop/core/src/desktop/js/ko/bindings/charts/mapchart/datamap.js

@@ -27,8 +27,8 @@ const defaultOptions = {
   setProjection: setProjection,
   projection: 'equirectangular',
   dataType: 'json',
-  onClick: function() {},
-  done: function() {},
+  onClick: function () {},
+  done: function () {},
   legendData: [],
   fills: {
     defaultFill: '#ABDDA4'
@@ -38,7 +38,7 @@ const defaultOptions = {
     hideAntarctica: true,
     borderWidth: 1,
     borderColor: '#FDFDFD',
-    popupTemplate: function(geography, data) {
+    popupTemplate: function (geography, data) {
       return '<div class="hoverinfo"><strong>' + geography.properties.name + '</strong></div>';
     },
     popupOnHover: true,
@@ -53,7 +53,7 @@ const defaultOptions = {
     borderWidth: 2,
     borderColor: '#FFFFFF',
     popupOnHover: true,
-    popupTemplate: function(geography, data) {
+    popupTemplate: function (geography, data) {
       return '<div class="hoverinfo"><strong>' + data.name + '</strong></div>';
     },
     fillOpacity: 0.75,
@@ -264,7 +264,7 @@ function handleGeographyConfig() {
   if (options.highlightOnHover || options.popupOnHover) {
     svg
       .selectAll('.datamaps-subunit')
-      .on('mouseover', function(d) {
+      .on('mouseover', function (d) {
         const $this = d3.select(this);
 
         if (options.highlightOnHover) {
@@ -292,7 +292,7 @@ function handleGeographyConfig() {
           self.updatePopup($this, d, options, svg);
         }
       })
-      .on('mouseout', function() {
+      .on('mouseout', function () {
         const $this = d3.select(this);
 
         if (options.highlightOnHover) {
@@ -339,10 +339,7 @@ function addLegend(layer, data, options) {
 
   html += '</dl>';
 
-  d3.select(this.options.element)
-    .append('div')
-    .attr('class', 'datamaps-legend')
-    .html(html);
+  d3.select(this.options.element).append('div').attr('class', 'datamaps-legend').html(html);
 }
 
 function handleArcs(layer, data, options) {
@@ -397,7 +394,7 @@ function handleArcs(layer, data, options) {
     })
     .transition()
     .delay(100)
-    .style('fill', function() {
+    .style('fill', function () {
       /*
          Thank you Jake Archibald, this is awesome.
          Source: http://jakearchibald.com/2013/animated-line-drawing-svg/
@@ -413,11 +410,7 @@ function handleArcs(layer, data, options) {
       return 'none';
     });
 
-  arcs
-    .exit()
-    .transition()
-    .style('opacity', 0)
-    .remove();
+  arcs.exit().transition().style('opacity', 0).remove();
 }
 
 function handleLabels(layer, options) {
@@ -522,7 +515,7 @@ function handleBubbles(layer, data, options) {
       const fillColor = fillData[datum.fillKey];
       return fillColor || fillData.defaultFill;
     })
-    .on('mouseover', function(datum) {
+    .on('mouseover', function (datum) {
       const $this = d3.select(this);
 
       if (options.highlightOnHover) {
@@ -546,7 +539,7 @@ function handleBubbles(layer, data, options) {
         self.updatePopup($this, datum, options, svg);
       }
     })
-    .on('mouseout', function(datum) {
+    .on('mouseout', function (datum) {
       const $this = d3.select(this);
 
       if (options.highlightOnHover) {
@@ -565,12 +558,7 @@ function handleBubbles(layer, data, options) {
       return datum.radius;
     });
 
-  bubbles
-    .exit()
-    .transition()
-    .delay(options.exitDelay)
-    .attr('r', 0)
-    .remove();
+  bubbles.exit().transition().delay(options.exitDelay).attr('r', 0).remove();
 
   function datumHasCoords(datum) {
     return (
@@ -632,7 +620,7 @@ function Datamap(options) {
 }
 
 // actually draw the features(states & countries)
-Datamap.prototype.draw = function() {
+Datamap.prototype.draw = function () {
   //save off in a closure
   const self = this;
   const options = self.options;
@@ -666,7 +654,7 @@ Datamap.prototype.draw = function() {
       //allow for csv or json data types
       d3[self.options.dataType](self.options.dataUrl, data => {
         //in the case of csv, transform data to object
-        if (self.options.dataType === 'csv' && (data && data.slice)) {
+        if (self.options.dataType === 'csv' && data && data.slice) {
           const tmpData = {};
           for (let i = 0; i < data.length; i++) {
             tmpData[data[i].id] = data[i];
@@ -697,12 +685,12 @@ Datamap.prototype.draw = function() {
  ***************************************/
 
 //convert lat/lng coords to X / Y coords
-Datamap.prototype.latLngToXY = function(lat, lng) {
+Datamap.prototype.latLngToXY = function (lat, lng) {
   return this.projection([lng, lat]);
 };
 
 //add <g> layer to root SVG
-Datamap.prototype.addLayer = function(className, id, first) {
+Datamap.prototype.addLayer = function (className, id, first) {
   let layer;
   if (first) {
     layer = this.svg.insert('g', ':first-child');
@@ -712,7 +700,7 @@ Datamap.prototype.addLayer = function(className, id, first) {
   return layer.attr('id', id || '').attr('class', className || '');
 };
 
-Datamap.prototype.updateChoropleth = function(data) {
+Datamap.prototype.updateChoropleth = function (data) {
   const svg = this.svg;
   for (const subunit in data) {
     if (data.hasOwnProperty(subunit)) {
@@ -742,10 +730,10 @@ Datamap.prototype.updateChoropleth = function(data) {
   }
 };
 
-Datamap.prototype.updatePopup = function(element, d, options) {
+Datamap.prototype.updatePopup = function (element, d, options) {
   const self = this;
   element.on('mousemove', null);
-  element.on('mousemove', function() {
+  element.on('mousemove', function () {
     const position = d3.mouse(this);
     const svgHeight = d3.select(self.svg[0][0].parentNode)[0][0].offsetHeight || -1;
     d3.select(self.svg[0][0].parentNode)
@@ -766,14 +754,12 @@ Datamap.prototype.updatePopup = function(element, d, options) {
     }
   });
 
-  d3.select(self.svg[0][0].parentNode)
-    .select('.datamaps-hoverover')
-    .style('display', 'block');
+  d3.select(self.svg[0][0].parentNode).select('.datamaps-hoverover').style('display', 'block');
 };
 
-Datamap.prototype.addPlugin = function(name, pluginFn) {
+Datamap.prototype.addPlugin = function (name, pluginFn) {
   if (typeof Datamap.prototype[name] === 'undefined') {
-    Datamap.prototype[name] = function(data, options, callback, createNewLayer) {
+    Datamap.prototype[name] = function (data, options, callback, createNewLayer) {
       let layer;
       if (typeof createNewLayer === 'undefined') {
         createNewLayer = false;
@@ -803,7 +789,7 @@ Datamap.prototype.addPlugin = function(name, pluginFn) {
   }
 };
 
-jQuery.fn.datamaps = function(options, callback) {
+jQuery.fn.datamaps = function (options, callback) {
   options = options || {};
   options.element = this[0];
   const datamap = new Datamap(options);

+ 7 - 7
desktop/core/src/desktop/js/ko/bindings/charts/mapchart/ko.mapChart.js

@@ -24,7 +24,7 @@ import HueColors from 'utils/hueColors';
 import HueGeo from 'utils/hueGeo';
 
 ko.bindingHandlers.mapChart = {
-  render: function(element, valueAccessor) {
+  render: function (element, valueAccessor) {
     const _options = valueAccessor();
 
     const $element = $(element);
@@ -224,13 +224,13 @@ ko.bindingHandlers.mapChart = {
           scope: _scope,
           data: mapData,
           legendData: _legend,
-          onClick: function(data) {
+          onClick: function (data) {
             if (typeof options.onClick != 'undefined') {
               huePubSub.publish('charts.state', { updating: true });
               options.onClick(data);
             }
           },
-          done: function() {
+          done: function () {
             const _bubbles = [];
             if (options.enableGeocoding) {
               $(nonCountries).each((cnt, item) => {
@@ -244,7 +244,7 @@ ko.bindingHandlers.mapChart = {
                     longitude: lng
                   });
                   _map.bubbles(_bubbles, {
-                    popupTemplate: function(geo, data) {
+                    popupTemplate: function (geo, data) {
                       return (
                         '<div class="hoverinfo" style="text-align: center"><strong>' +
                         data.label +
@@ -267,7 +267,7 @@ ko.bindingHandlers.mapChart = {
             highlightBorderColor: HueColors.BLUE,
             selectedFillColor: HueColors.DARKER_BLUE,
             selectedBorderColor: HueColors.DARKER_BLUE,
-            popupTemplate: function(geography, data) {
+            popupTemplate: function (geography, data) {
               let _hover = '';
               if (data != null) {
                 _hover = '<br/>';
@@ -326,10 +326,10 @@ ko.bindingHandlers.mapChart = {
 
     $element.data('drawThrottle', timeout);
   },
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     ko.bindingHandlers.mapChart.render(element, valueAccessor);
   },
-  update: function(element, valueAccessor, allBindingsAccessor) {
+  update: function (element, valueAccessor, allBindingsAccessor) {
     if (typeof allBindingsAccessor().mapChart.visible != 'undefined') {
       if (
         (typeof allBindingsAccessor().mapChart.visible == 'boolean' &&

+ 16 - 16
desktop/core/src/desktop/js/ko/bindings/charts/plotly/ko.plotly.js

@@ -50,7 +50,7 @@ const PLOTLY_COMMON_OPTIONS = {
 };
 
 function resizeHandlers(element) {
-  const resizeEvent = function() {
+  const resizeEvent = function () {
     try {
       if ($(element).is(':visible')) {
         Plotly.Plots.resize(element);
@@ -73,10 +73,10 @@ function eventEmitterSetup(element) {
 }
 
 ko.bindingHandlers.pieChart = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     resizeHandlers(element);
   },
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     const options = valueAccessor();
     window.clearTimeout(element.plotterTimeout);
     element.plotterTimeout = window.setTimeout(() => {
@@ -121,61 +121,61 @@ function basicChartBuilder(element, valueAccessor, chartType) {
 }
 
 ko.bindingHandlers.basicChart = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     resizeHandlers(element);
   },
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     basicChartBuilder(element, valueAccessor);
   }
 };
 
 ko.bindingHandlers.barChart = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     resizeHandlers(element);
   },
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     basicChartBuilder(element, valueAccessor, 'bar');
   }
 };
 
 ko.bindingHandlers.timelineChart = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     resizeHandlers(element);
   },
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     basicChartBuilder(element, valueAccessor, 'scatter');
   }
 };
 
 ko.bindingHandlers.lineChart = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     resizeHandlers(element);
   },
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     basicChartBuilder(element, valueAccessor, 'scatter');
   }
 };
 
 ko.bindingHandlers.mapChart = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     $(element).html('To-do.');
   },
-  update: function(element, valueAccessor, allBindingsAccessor) {
+  update: function (element, valueAccessor, allBindingsAccessor) {
     $(element).html('To-do.');
   }
 };
 
 ko.bindingHandlers.scatterChart = {
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     $(element).html('To-do.');
   }
 };
 
 ko.bindingHandlers.partitionChart = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     $(element).html('To-do.');
   },
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     $(element).html('To-do.');
   }
 };

+ 1 - 1
desktop/core/src/desktop/js/ko/bindings/ko.appAwareTemplateContextMenu.js

@@ -19,7 +19,7 @@ import * as ko from 'knockout';
 import huePubSub from 'utils/huePubSub';
 
 ko.bindingHandlers.appAwareTemplateContextMenu = {
-  init: function(element, valueAccessor, allBindings, viewModel, bindingContext) {
+  init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
     viewModel.$currentApp = ko.observable('');
     huePubSub.publish('get.current.app.name', viewModel.$currentApp);
     huePubSub.subscribe('set.current.app.name', viewModel.$currentApp);

+ 2 - 4
desktop/core/src/desktop/js/ko/bindings/ko.assistFileDraggable.js

@@ -20,7 +20,7 @@ import * as ko from 'knockout';
 import huePubSub from 'utils/huePubSub';
 
 ko.bindingHandlers.assistFileDraggable = {
-  init: function(element, valueAccessor, allBindings, boundEntry) {
+  init: function (element, valueAccessor, allBindings, boundEntry) {
     const $element = $(element);
 
     let dragStartY = -1;
@@ -45,9 +45,7 @@ ko.bindingHandlers.assistFileDraggable = {
           );
         }
 
-        const $helper = $('.assist-file-entry-drag')
-          .clone()
-          .appendTo($container);
+        const $helper = $('.assist-file-entry-drag').clone().appendTo($container);
         $helper.find('.drag-text').text(boundEntry.definition().name);
         $helper
           .find('i')

+ 1 - 1
desktop/core/src/desktop/js/ko/bindings/ko.assistFileDroppable.js

@@ -20,7 +20,7 @@ import * as ko from 'knockout';
 import huePubSub from 'utils/huePubSub';
 
 ko.bindingHandlers.assistFileDroppable = {
-  init: function(element, valueAccessor, allBindings, boundEntry) {
+  init: function (element, valueAccessor, allBindings, boundEntry) {
     const $element = $(element);
 
     let dragData;

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

@@ -21,12 +21,12 @@ import apiHelper from 'api/apiHelper';
 import huePubSub from 'utils/huePubSub';
 
 ko.bindingHandlers.assistVerticalResizer = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     const $container = $(element);
     const options = ko.unwrap(valueAccessor());
     const panelDefinitions = options.panels;
 
-    const checkForElements = function() {
+    const checkForElements = function () {
       const $allPanels = $container.children('.assist-inner-panel');
       const $allExtras = $container.children('.assist-fixed-height');
       if (
@@ -47,7 +47,7 @@ ko.bindingHandlers.assistVerticalResizer = {
     });
   },
 
-  updateWhenRendered: function(element, valueAccessor) {
+  updateWhenRendered: function (element, valueAccessor) {
     const options = ko.unwrap(valueAccessor());
     const panelDefinitions = options.panels;
 
@@ -68,7 +68,7 @@ ko.bindingHandlers.assistVerticalResizer = {
       return;
     }
     if (panelDefinitions().length === 1) {
-      const adjustHeightSingle = function() {
+      const adjustHeightSingle = function () {
         $allPanels.height($container.innerHeight() - allExtrasHeight);
       };
 
@@ -109,7 +109,7 @@ ko.bindingHandlers.assistVerticalResizer = {
     let containerTop = $container.offset().top;
 
     // Resizes all containers according to the set ratios
-    const resizeByRatio = function() {
+    const resizeByRatio = function () {
       if (totalHeight === $container.innerHeight()) {
         return;
       }
@@ -166,7 +166,7 @@ ko.bindingHandlers.assistVerticalResizer = {
     $allExtras.show();
     $allPanels.show();
 
-    const fitPanelHeights = function($panelsToResize, desiredTotalHeight) {
+    const fitPanelHeights = function ($panelsToResize, desiredTotalHeight) {
       let currentHeightOfPanels = 0;
 
       let noMoreSpace = true;
@@ -225,7 +225,7 @@ ko.bindingHandlers.assistVerticalResizer = {
 
       $resizer.draggable({
         axis: 'y',
-        drag: function(event, ui) {
+        drag: function (event, ui) {
           const limitAfter = totalHeight - requiredSpaceAfter;
           const position = ui.offset.top - containerTop;
           if (position > limitBefore && position < limitAfter) {
@@ -242,7 +242,7 @@ ko.bindingHandlers.assistVerticalResizer = {
           ui.offset.top = 0;
           ui.position.top = 0;
         },
-        stop: function(event, ui) {
+        stop: function (event, ui) {
           ui.offset.top = 0;
           ui.position.top = 0;
           let totalHeightForPanels = 0;

+ 1 - 1
desktop/core/src/desktop/js/ko/bindings/ko.attachViewModelToElementData.js

@@ -18,7 +18,7 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 
 ko.bindingHandlers.attachViewModelToElementData = {
-  init: function(el, valueAccessor, allBindingsAccessor, viewModel) {
+  init: function (el, valueAccessor, allBindingsAccessor, viewModel) {
     $(el).data('__ko_vm', viewModel);
   }
 };

+ 3 - 3
desktop/core/src/desktop/js/ko/bindings/ko.augmentHtml.js

@@ -20,7 +20,7 @@ import * as ko from 'knockout';
 // TODO: less from bootstrap?
 
 ko.bindingHandlers.augmentHtml = {
-  render: function(element, valueAccessor) {
+  render: function (element, valueAccessor) {
     const _val = ko.unwrap(valueAccessor());
     const _enc = $('<span>').html(_val);
     if (_enc.find('style').length > 0) {
@@ -38,10 +38,10 @@ ko.bindingHandlers.augmentHtml = {
       $(element).html(_val);
     }
   },
-  init: function(element, valueAccessor, allBindingsAccessor, viewModel) {
+  init: function (element, valueAccessor, allBindingsAccessor, viewModel) {
     ko.bindingHandlers.augmentHtml.render(element, valueAccessor, allBindingsAccessor, viewModel);
   },
-  update: function(element, valueAccessor, allBindingsAccessor, viewModel) {
+  update: function (element, valueAccessor, allBindingsAccessor, viewModel) {
     ko.bindingHandlers.augmentHtml.render(element, valueAccessor, allBindingsAccessor, viewModel);
   }
 };

+ 11 - 11
desktop/core/src/desktop/js/ko/bindings/ko.autocomplete.js

@@ -20,7 +20,7 @@ import * as ko from 'knockout';
 import huePubSub from 'utils/huePubSub';
 
 ko.bindingHandlers.autocomplete = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     let options = valueAccessor();
     const $element = $(element);
     const getMenuElement = () => {
@@ -32,14 +32,14 @@ ko.bindingHandlers.autocomplete = {
 
     const delay = 400;
 
-    const showSpinner = function() {
+    const showSpinner = function () {
       if (options.showSpinner) {
         $element.addClass('input-spinner');
       }
     };
 
     let spinThrottle = -1;
-    const hideSpinner = function() {
+    const hideSpinner = function () {
       window.clearTimeout(spinThrottle);
       $element.removeClass('input-spinner');
     };
@@ -55,16 +55,16 @@ ko.bindingHandlers.autocomplete = {
         limitWidthToInput: false,
         minWidth: 200,
         delay: delay,
-        search: function() {
+        search: function () {
           window.clearTimeout(spinThrottle);
           if (!$element.hueAutocomplete('option', 'disabled')) {
             spinThrottle = window.setTimeout(showSpinner, 50);
           }
         },
-        open: function() {
+        open: function () {
           hideSpinner();
         },
-        close: function() {
+        close: function () {
           hideSpinner();
         }
       },
@@ -73,7 +73,7 @@ ko.bindingHandlers.autocomplete = {
 
     if (options.addCount) {
       const oldSource = options.source;
-      options.source = function(request, callback) {
+      options.source = function (request, callback) {
         oldSource(request, values => {
           callback(values);
           const $menu = $($element.data('custom-hueAutocomplete').menu.element);
@@ -95,7 +95,7 @@ ko.bindingHandlers.autocomplete = {
 
     if (typeof $().hueAutocomplete === 'undefined') {
       $.widget('custom.hueAutocomplete', $.ui.autocomplete, {
-        _renderItemData: function(ul, item) {
+        _renderItemData: function (ul, item) {
           if (item.error && this.options.errorTemplate) {
             const $li = $(
               '<li data-bind="template: { name: \'' + this.options.errorTemplate + '\' }">'
@@ -128,13 +128,13 @@ ko.bindingHandlers.autocomplete = {
             ko.applyBindings(item.data, $li[0]);
           }
         },
-        _resizeMenu: function() {
+        _resizeMenu: function () {
           // This overrides the default behaviour of using dropdown width of the same size as input autocomplete box
           if (options.limitWidthToInput) {
             this.menu.element.outerWidth(options.minWidth);
           }
         },
-        _renderMenu: function(ul, items) {
+        _renderMenu: function (ul, items) {
           const self = this;
           hideSpinner();
           if (options.limitWidthToInput) {
@@ -221,7 +221,7 @@ ko.bindingHandlers.autocomplete = {
 
     if (options.reopenPattern || options.valueObservable || options.onSelect) {
       const oldSelect = options.select;
-      options.select = function(event, ui) {
+      options.select = function (event, ui) {
         if (options.reopenPattern && options.reopenPattern.test(ui.item.value)) {
           window.setTimeout(() => {
             $element.hueAutocomplete('search', $element.val());

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

@@ -18,7 +18,7 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 
 ko.bindingHandlers.autogrowInput = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     const o = $.extend(
       {
         minWidth: 0,
@@ -43,7 +43,7 @@ ko.bindingHandlers.autogrowInput = {
     });
     let val = '';
 
-    const check = function() {
+    const check = function () {
       if (val === (val = input.val())) {
         return;
       }

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

@@ -18,7 +18,7 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 
 ko.bindingHandlers.blurHide = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     const $el = $(element);
     const prop = valueAccessor();
     $el.on('blur', () => {
@@ -29,7 +29,7 @@ ko.bindingHandlers.blurHide = {
       }
     });
   },
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     const $el = $(element);
     const prop = valueAccessor();
     if (ko.isObservable(prop) && prop()) {

+ 6 - 6
desktop/core/src/desktop/js/ko/bindings/ko.bytesize.js

@@ -18,25 +18,25 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 import sprintf from 'sprintf-js';
 
-ko.bindingHandlers.bytesize = (function() {
+ko.bindingHandlers.bytesize = (function () {
   let that;
   return (that = {
     units: ['B', 'KB', 'MB', 'GB', 'TB', 'PB'],
-    init: function(element, valueAccessor) {
+    init: function (element, valueAccessor) {
       that.format(element, valueAccessor);
     },
-    update: function(element, valueAccessor) {
+    update: function (element, valueAccessor) {
       that.format(element, valueAccessor);
     },
-    format: function(element, valueAccessor) {
+    format: function (element, valueAccessor) {
       const value = valueAccessor();
       const formatted = that.humanSize(ko.unwrap(value));
       $(element).text(formatted);
     },
-    getBaseLog: function(x, y) {
+    getBaseLog: function (x, y) {
       return Math.log(x) / Math.log(y);
     },
-    humanSize: function(bytes) {
+    humanSize: function (bytes) {
       const isNumber = !isNaN(parseFloat(bytes)) && isFinite(bytes);
       if (!isNumber) {
         return '';

+ 1 - 1
desktop/core/src/desktop/js/ko/bindings/ko.chosen.js

@@ -18,7 +18,7 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 
 ko.bindingHandlers.chosen = {
-  init: function(element, valueAccessor, allBindings) {
+  init: function (element, valueAccessor, allBindings) {
     const $element = $(element);
     const options = ko.unwrap(valueAccessor());
 

+ 5 - 5
desktop/core/src/desktop/js/ko/bindings/ko.clearable.js

@@ -19,7 +19,7 @@ import * as ko from 'knockout';
 
 ko.bindingHandlers.clearable = {
   after: ['textInput', 'value', 'valueUpdate'],
-  init: function(element, valueAccessor, allBindingsAccessor) {
+  init: function (element, valueAccessor, allBindingsAccessor) {
     const $element = $(element);
 
     const params = valueAccessor();
@@ -33,13 +33,13 @@ ko.bindingHandlers.clearable = {
     $element[tog(valueObservable())]('x');
 
     $element
-      .on('input', function() {
+      .on('input', function () {
         $element[tog(this.value)]('x');
       })
-      .on('mousemove', function(e) {
+      .on('mousemove', function (e) {
         $element[tog(this.offsetWidth - 18 < e.clientX - this.getBoundingClientRect().left)]('onX');
       })
-      .on('click', function(e) {
+      .on('click', function (e) {
         if (this.offsetWidth - 18 < e.clientX - this.getBoundingClientRect().left) {
           $element.removeClass('x onX').val('');
           valueObservable('');
@@ -80,7 +80,7 @@ ko.bindingHandlers.clearable = {
       }
     }
   },
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     const $element = $(element);
     const params = valueAccessor();
     const valueObservable = ko.isObservable(params) ? params : params.value;

+ 1 - 1
desktop/core/src/desktop/js/ko/bindings/ko.clickForAceFocus.js

@@ -18,7 +18,7 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 
 ko.bindingHandlers.clickForAceFocus = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     const editor = valueAccessor();
     $(element).on('click', e => {
       if (e.target === element) {

+ 1 - 1
desktop/core/src/desktop/js/ko/bindings/ko.clickToCopy.js

@@ -18,7 +18,7 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 
 ko.bindingHandlers.clickToCopy = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     $(element).click(() => {
       const $input = $('<textarea>')
         .css({ opacity: 0 })

+ 3 - 7
desktop/core/src/desktop/js/ko/bindings/ko.codemirror.js

@@ -20,7 +20,7 @@ import * as ko from 'knockout';
 import hueUtils from 'utils/hueUtils';
 
 ko.bindingHandlers.codemirror = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     const options = $.extend(valueAccessor(), {});
     const editor = CodeMirror.fromTextArea(element, options);
     element.editor = editor;
@@ -63,11 +63,7 @@ ko.bindingHandlers.codemirror = {
           _value = _value.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
         }
         valueAccessor().data(_value);
-        if (
-          $('.widget-html-pill')
-            .parent()
-            .hasClass('active')
-        ) {
+        if ($('.widget-html-pill').parent().hasClass('active')) {
           $('[contenteditable=true]').html(hueUtils.stripHtmlFromFunctions(valueAccessor().data()));
         }
       }, 100);
@@ -77,7 +73,7 @@ ko.bindingHandlers.codemirror = {
       wrapperElement.remove();
     });
   },
-  update: function(element) {
+  update: function (element) {
     const editor = element.editor;
     editor.refresh();
   }

+ 5 - 5
desktop/core/src/desktop/js/ko/bindings/ko.contextMenu.js

@@ -35,7 +35,7 @@ import huePubSub from 'utils/huePubSub';
  *
  */
 ko.bindingHandlers.contextMenu = {
-  initContextMenu: function($menu, $scrollContainer, onShow, onHide) {
+  initContextMenu: function ($menu, $scrollContainer, onShow, onHide) {
     let active = false;
 
     let currentLeft = 0;
@@ -43,13 +43,13 @@ ko.bindingHandlers.contextMenu = {
     let openScrollTop = 0;
     let openScrollLeft = 0;
 
-    const adjustForScroll = function() {
+    const adjustForScroll = function () {
       $menu.css('top', currentTop - $scrollContainer.scrollTop() + openScrollTop);
       $menu.css('left', currentLeft - $scrollContainer.scrollLeft() + openScrollLeft);
     };
 
     return {
-      show: function(event) {
+      show: function (event) {
         $menu.css('top', 0);
         $menu.css('left', 0);
         $menu.css('opacity', 0);
@@ -78,7 +78,7 @@ ko.bindingHandlers.contextMenu = {
           onShow();
         }
       },
-      hide: function() {
+      hide: function () {
         if (active) {
           $scrollContainer.off('scroll', adjustForScroll);
           $menu.css('opacity', 0);
@@ -93,7 +93,7 @@ ko.bindingHandlers.contextMenu = {
       }
     };
   },
-  init: function(element, valueAccessor, allBindings, viewModel, bindingContext) {
+  init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
     const $element = $(element);
     const options = valueAccessor();
     const $menu = $element.find(options.menuSelector);

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

@@ -20,7 +20,7 @@ import * as ko from 'knockout';
 import huePubSub from 'utils/huePubSub';
 
 ko.bindingHandlers.contextSubMenu = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     const menuSelector = valueAccessor();
     const $element = $(element);
 
@@ -28,7 +28,7 @@ ko.bindingHandlers.contextSubMenu = {
     const $parentMenu = $element.parent('.hue-context-menu');
     let open = false;
 
-    const closeSubMenu = function() {
+    const closeSubMenu = function () {
       open = false;
       $menu.hide();
       $element.removeClass('active');

+ 4 - 4
desktop/core/src/desktop/js/ko/bindings/ko.datalist.js

@@ -18,7 +18,7 @@ import * as ko from 'knockout';
 
 // https://stackoverflow.com/questions/19865364/knockoutjs-linking-value-from-a-input-to-a-datalist-value
 
-ko.bindingHandlers.datalist = (function() {
+ko.bindingHandlers.datalist = (function () {
   function getVal(rawItem, prop) {
     const item = ko.unwrap(rawItem);
     return item && prop ? ko.unwrap(item[prop]) : item;
@@ -31,7 +31,7 @@ ko.bindingHandlers.datalist = (function() {
   }
 
   return {
-    init: function(element, valueAccessor, allBindingsAccessor) {
+    init: function (element, valueAccessor, allBindingsAccessor) {
       const setup = valueAccessor(),
         textProperty = ko.unwrap(setup.optionsText),
         valueProperty = ko.unwrap(setup.optionsValue),
@@ -65,7 +65,7 @@ ko.bindingHandlers.datalist = (function() {
         });
       } else {
         const event = allBindingsAccessor().valueUpdate === 'afterkeydown' ? 'input' : 'change';
-        ko.utils.registerEventHandler(element, event, function() {
+        ko.utils.registerEventHandler(element, event, function () {
           onNewValue(this.value);
         });
       }
@@ -79,7 +79,7 @@ ko.bindingHandlers.datalist = (function() {
         onNewValue(koValue());
       }
     },
-    update: function(element, valueAccessor) {
+    update: function (element, valueAccessor) {
       const setup = valueAccessor(),
         datalist = element.list,
         dataItems = ko.unwrap(setup.options),

+ 6 - 25
desktop/core/src/desktop/js/ko/bindings/ko.dateRangePicker.js

@@ -94,7 +94,7 @@ ko.bindingHandlers.dateRangePicker = {
   ],
   EXTRA_INTERVAL_OPTIONS: [],
 
-  init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
+  init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
     const DATE_FORMAT = 'YYYY-MM-DD';
     const TIME_FORMAT = 'HH:mm:ss';
     const DATETIME_FORMAT = DATE_FORMAT + ' ' + TIME_FORMAT;
@@ -336,31 +336,15 @@ ko.bindingHandlers.dateRangePicker = {
 
     _tmpl.find('.start-date-custom').on('change', () => {
       _options.min(_tmpl.find('.start-date-custom').val());
-      _tmpl.find('.start-date').val(
-        moment(_options.min())
-          .utc()
-          .format(DATE_FORMAT)
-      );
-      _tmpl.find('.start-time').val(
-        moment(_options.min())
-          .utc()
-          .format(TIME_FORMAT)
-      );
+      _tmpl.find('.start-date').val(moment(_options.min()).utc().format(DATE_FORMAT));
+      _tmpl.find('.start-time').val(moment(_options.min()).utc().format(TIME_FORMAT));
       _options.start(_options.min());
     });
 
     _tmpl.find('.end-date-custom').on('change', () => {
       _options.max(_tmpl.find('.end-date-custom').val());
-      _tmpl.find('.end-date').val(
-        moment(_options.max())
-          .utc()
-          .format(DATE_FORMAT)
-      );
-      _tmpl.find('.end-time').val(
-        moment(_options.max())
-          .utc()
-          .format(TIME_FORMAT)
-      );
+      _tmpl.find('.end-date').val(moment(_options.max()).utc().format(DATE_FORMAT));
+      _tmpl.find('.end-time').val(moment(_options.max()).utc().format(TIME_FORMAT));
       _options.end(_options.max());
     });
 
@@ -437,10 +421,7 @@ ko.bindingHandlers.dateRangePicker = {
         } else {
           if (_tmpl.find('.end-date').val() === _tmpl.find('.start-date').val()) {
             _tmpl.find('.end-time').val(startDate.utc().format(TIME_FORMAT));
-            _tmpl
-              .find('.end-time')
-              .data('timepicker')
-              .setValues(startDate.format(TIME_FORMAT));
+            _tmpl.find('.end-time').data('timepicker').setValues(startDate.format(TIME_FORMAT));
           } else {
             _tmpl.find('.end-date').val(_tmpl.find('.end-date').data('original-val'));
             _tmpl

+ 1 - 1
desktop/core/src/desktop/js/ko/bindings/ko.datepicker.js

@@ -18,7 +18,7 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 
 ko.bindingHandlers.datepicker = {
-  init: function(element, valueAccessor, allBindings) {
+  init: function (element, valueAccessor, allBindings) {
     const _el = $(element);
     const _options = ko.unwrap(valueAccessor());
     _el

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

@@ -18,9 +18,9 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 
 ko.bindingHandlers.dblclick = {
-  init: function(element, valueAccessor, allBindingsAccessor, viewModel) {
+  init: function (element, valueAccessor, allBindingsAccessor, viewModel) {
     const fn = valueAccessor();
-    $(element).dblclick(function() {
+    $(element).dblclick(function () {
       const data = ko.dataFor(this);
       fn.call(viewModel, data);
     });

+ 1 - 1
desktop/core/src/desktop/js/ko/bindings/ko.delayedOverflow.js

@@ -18,7 +18,7 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 
 ko.bindingHandlers.delayedOverflow = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     const $element = $(element);
 
     $element.css('overflow', 'hidden');

+ 1 - 1
desktop/core/src/desktop/js/ko/bindings/ko.dockable.js

@@ -21,7 +21,7 @@ import huePubSub from 'utils/huePubSub';
 import hueUtils from 'utils/hueUtils';
 
 ko.bindingHandlers.dockable = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     const options = valueAccessor() || {};
     const scrollable = options.scrollable ? options.scrollable : window;
     const triggerAdjust = options.triggerAdjust || 0;

+ 7 - 7
desktop/core/src/desktop/js/ko/bindings/ko.documentChooser.js

@@ -41,7 +41,7 @@ const TYPE_MAP = {
 };
 
 ko.bindingHandlers.documentChooser = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     const options = valueAccessor();
     let type = 'query-hive';
 
@@ -63,7 +63,7 @@ ko.bindingHandlers.documentChooser = {
       preload: true,
       dropdownParent: 'body',
       render: {
-        option: function(item, escape) {
+        option: function (item, escape) {
           return (
             '<div>' +
             '<strong>' +
@@ -76,7 +76,7 @@ ko.bindingHandlers.documentChooser = {
           );
         }
       },
-      load: function(query, callback) {
+      load: function (query, callback) {
         if (query === '' && options.value && !firstLoad) {
           firstLoad = true;
         }
@@ -85,12 +85,12 @@ ko.bindingHandlers.documentChooser = {
           text: query,
           include_trashed: false,
           limit: 100,
-          successCallback: function(data) {
+          successCallback: function (data) {
             callback(data.documents);
           }
         });
       },
-      onChange: function(val) {
+      onChange: function (val) {
         if (options.value) {
           options.value(val);
         }
@@ -101,7 +101,7 @@ ko.bindingHandlers.documentChooser = {
           options.mappedDocument(ko.mapping.fromJS(this.options[val]));
         }
       },
-      onLoad: function() {
+      onLoad: function () {
         if (options.value) {
           this.setValue(options.value());
         }
@@ -112,7 +112,7 @@ ko.bindingHandlers.documentChooser = {
     });
   },
 
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     const options = valueAccessor();
     if (options.value) {
       element.selectize.setValue(options.value());

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

@@ -39,11 +39,11 @@ import huePubSub from 'utils/huePubSub';
  * @type {{init: ko.bindingHandlers.documentContextPopover.init}}
  */
 ko.bindingHandlers.documentContextPopover = {
-  init: function(element, valueAccessor, allBindings, viewModel, bindingContext) {
+  init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
     ko.bindingHandlers.click.init(
       element,
       () => {
-        return function() {
+        return function () {
           const options = valueAccessor();
 
           apiHelper

+ 5 - 5
desktop/core/src/desktop/js/ko/bindings/ko.draggableText.js

@@ -24,7 +24,7 @@ export const DRAGGABLE_TEXT_META_EVENT = 'draggable.text.meta';
 export const NAME = 'draggableText';
 
 registerBinding(NAME, {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     const $element = $(element);
     const options = valueAccessor();
     if ((ko.isObservable(options.text) && !options.text()) || !options.text) {
@@ -39,17 +39,17 @@ registerBinding(NAME, {
     let dragStartY = -1;
     let notifiedOnDragStarted = false;
     $element.draggable({
-      helper: function() {
+      helper: function () {
         return $helper;
       },
       appendTo: 'body',
-      start: function(event) {
+      start: function (event) {
         dragStartX = event.clientX;
         dragStartY = event.clientY;
         huePubSub.publish(DRAGGABLE_TEXT_META_EVENT, options.meta);
         notifiedOnDragStarted = false;
       },
-      drag: function(event) {
+      drag: function (event) {
         huePubSub.publish('draggable.text.drag', {
           event: event,
           meta: options.meta
@@ -65,7 +65,7 @@ registerBinding(NAME, {
           notifiedOnDragStarted = true;
         }
       },
-      stop: function(event) {
+      stop: function (event) {
         if (
           Math.sqrt(
             (dragStartX - event.clientX) * (dragStartX - event.clientX) +

+ 1 - 1
desktop/core/src/desktop/js/ko/bindings/ko.dropdown.js

@@ -18,7 +18,7 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 
 ko.bindingHandlers.dropdown = {
-  init: function(element) {
+  init: function (element) {
     $(element).dropdown();
   }
 };

+ 9 - 15
desktop/core/src/desktop/js/ko/bindings/ko.dropzone.js

@@ -23,7 +23,7 @@ import I18n from 'utils/i18n';
 // TODO: Depends on Dropzone
 
 ko.bindingHandlers.dropzone = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     const value = ko.unwrap(valueAccessor());
     if (value.disabled) {
       return;
@@ -44,14 +44,14 @@ ko.bindingHandlers.dropzone = {
         '</div>' +
         '<div class="progress-row-bar" data-dz-uploadprogress></div>' +
         '</div>',
-      sending: function() {
+      sending: function () {
         $('.hoverMsg').addClass('hide');
         $('#progressStatus').removeClass('hide');
         $('#progressStatusBar').removeClass('hide');
         $('#progressStatus .progress-row').remove();
         $('#progressStatusBar div').css('width', '0');
       },
-      uploadprogress: function(file, progress) {
+      uploadprogress: function (file, progress) {
         $('[data-dz-name]').each((cnt, item) => {
           if ($(item).text() === file.name) {
             $(item)
@@ -59,25 +59,19 @@ ko.bindingHandlers.dropzone = {
               .find('[data-dz-uploadprogress]')
               .width(progress.toFixed() + '%');
             if (progress.toFixed() === '100') {
-              $(item)
-                .parents('.progress-row')
-                .find('[data-dz-remove]')
-                .hide();
-              $(item)
-                .parents('.progress-row')
-                .find('[data-dz-uploaded]')
-                .show();
+              $(item).parents('.progress-row').find('[data-dz-remove]').hide();
+              $(item).parents('.progress-row').find('[data-dz-uploaded]').show();
             }
           }
         });
       },
-      totaluploadprogress: function(progress) {
+      totaluploadprogress: function (progress) {
         $('#progressStatusBar div').width(progress.toFixed() + '%');
       },
-      canceled: function() {
+      canceled: function () {
         $.jHueNotify.info(I18n('The upload has been canceled'));
       },
-      complete: function(file) {
+      complete: function (file) {
         if (file.xhr.response !== '') {
           const response = JSON.parse(file.xhr.response);
           if (response && response.status != null) {
@@ -95,7 +89,7 @@ ko.bindingHandlers.dropzone = {
           }
         }
       },
-      queuecomplete: function() {
+      queuecomplete: function () {
         window.setTimeout(() => {
           $('#progressStatus').addClass('hide');
           $('#progressStatusBar').addClass('hide');

+ 5 - 5
desktop/core/src/desktop/js/ko/bindings/ko.duration.js

@@ -18,21 +18,21 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 import sprintf from 'sprintf-js';
 
-ko.bindingHandlers.duration = (function() {
+ko.bindingHandlers.duration = (function () {
   let that;
   return (that = {
-    init: function(element, valueAccessor) {
+    init: function (element, valueAccessor) {
       that.format(element, valueAccessor);
     },
-    update: function(element, valueAccessor) {
+    update: function (element, valueAccessor) {
       that.format(element, valueAccessor);
     },
-    format: function(element, valueAccessor) {
+    format: function (element, valueAccessor) {
       const value = valueAccessor();
       const formatted = that.humanTime(ko.unwrap(value));
       $(element).text(formatted);
     },
-    humanTime: function(value) {
+    humanTime: function (value) {
       value = value * 1;
       if (value < Math.pow(10, 3)) {
         return sprintf.sprintf('%i ns', value);

+ 1 - 1
desktop/core/src/desktop/js/ko/bindings/ko.ellipsis.js

@@ -18,7 +18,7 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 
 ko.bindingHandlers.ellipsis = {
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     const value = ko.unwrap(valueAccessor());
     const $element = $(element);
     const chopLength = value.length ? value.length : 30;

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

@@ -18,12 +18,12 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 
 ko.bindingHandlers.fadeVisible = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     const value = valueAccessor();
     const toggleValue = typeof value.value === 'undefined' ? value : value.value;
     $(element).toggle(ko.unwrap(toggleValue));
   },
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     const value = valueAccessor();
     const toggleValue = typeof value.value === 'undefined' ? value : value.value;
     const speed = typeof value.speed === 'undefined' ? 'normal' : value.speed;

+ 1 - 1
desktop/core/src/desktop/js/ko/bindings/ko.fetchMore.js

@@ -18,7 +18,7 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 
 ko.bindingHandlers.fetchMore = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     const options = valueAccessor();
     const $element = $(element);
 

+ 1 - 1
desktop/core/src/desktop/js/ko/bindings/ko.fileChooser.js

@@ -20,7 +20,7 @@ import * as ko from 'knockout';
 import hueUtils from 'utils/hueUtils';
 
 ko.bindingHandlers.filechooser = {
-  init: function(element, valueAccessor, allBindingsAccessor) {
+  init: function (element, valueAccessor, allBindingsAccessor) {
     const $element = $(element);
     const options = ko.unwrap(allBindingsAccessor());
     $element.attr('autocomplete', 'off');

+ 16 - 19
desktop/core/src/desktop/js/ko/bindings/ko.foreachVisible.js

@@ -60,7 +60,7 @@ import huePubSub from 'utils/huePubSub';
  *
  */
 ko.bindingHandlers.foreachVisible = {
-  init: function(element, valueAccessor, allBindings, viewModel, bindingContext) {
+  init: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
     return ko.bindingHandlers.template.init(
       element,
       () => {
@@ -75,7 +75,7 @@ ko.bindingHandlers.foreachVisible = {
     );
   },
 
-  update: function(element, valueAccessor, allBindings, viewModel, bindingContext) {
+  update: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
     const options = valueAccessor();
     let $element = $(element);
     let isTable = false;
@@ -124,7 +124,7 @@ ko.bindingHandlers.foreachVisible = {
     let incrementLimit = 0; // The diff required to re-render, set to visibleCount below
     let elementIncrement = 0; // Elements to add on either side of the visible elements, set to 3x visibleCount
     let endIndex = 0;
-    const updateVisibleEntryCount = function() {
+    const updateVisibleEntryCount = function () {
       // TODO: Drop the window innerHeight limitation.
       // Sometimes after resizeWrapper() is called the reported innerHeight of the $container is the same as
       // the wrapper causing the binding to render all the items. This limits the visibleEntryCount to the
@@ -155,7 +155,7 @@ ko.bindingHandlers.foreachVisible = {
 
     const huePubSubs = [];
 
-    const scrollToIndex = function(idx, offset, instant, callback) {
+    const scrollToIndex = function (idx, offset, instant, callback) {
       const lastKnownHeights = $parentFVOwnerElement.data('lastKnownHeights');
       if (!lastKnownHeights || lastKnownHeights.length <= idx) {
         return;
@@ -205,7 +205,7 @@ ko.bindingHandlers.foreachVisible = {
 
     if (ko.isObservable(viewModel.foreachVisible)) {
       viewModel.foreachVisible({
-        scrollToIndex: function(index) {
+        scrollToIndex: function (index) {
           const offset = depth > 0 ? $parentFVOwnerElement.position().top : 0;
           scrollToIndex(index, offset, true);
         }
@@ -220,7 +220,7 @@ ko.bindingHandlers.foreachVisible = {
           $parentForeachVisible: $element,
           $parentForeachVisibleId: id,
           $depth: depth + 1,
-          $indexOffset: function() {
+          $indexOffset: function () {
             return startIndex;
           }
         });
@@ -264,7 +264,7 @@ ko.bindingHandlers.foreachVisible = {
       $parentFVOwnerElement.data('lastKnownHeights', lastKnownHeights);
     }
 
-    const resizeWrapper = function() {
+    const resizeWrapper = function () {
       let totalHeight = 0;
       const lastKnownHeights = $parentFVOwnerElement.data('lastKnownHeights');
       if (!lastKnownHeights) {
@@ -277,7 +277,7 @@ ko.bindingHandlers.foreachVisible = {
     };
     resizeWrapper();
 
-    const updateLastKnownHeights = function() {
+    const updateLastKnownHeights = function () {
       if ($container.data('busyRendering')) {
         return;
       }
@@ -329,7 +329,7 @@ ko.bindingHandlers.foreachVisible = {
 
     updateLastKnownHeights();
 
-    const positionList = function() {
+    const positionList = function () {
       const lastKnownHeights = $parentFVOwnerElement.data('lastKnownHeights');
       if (!lastKnownHeights) {
         return;
@@ -341,7 +341,7 @@ ko.bindingHandlers.foreachVisible = {
       $element.css('top', top + 'px');
     };
 
-    const afterRender = function() {
+    const afterRender = function () {
       renderedElements = isTable ? $element.children('tbody').children() : $element.children();
       $container.data('busyRendering', false);
       if (typeof options.fetchMore !== 'undefined' && endIndex === allEntries.length - 1) {
@@ -350,7 +350,7 @@ ko.bindingHandlers.foreachVisible = {
       huePubSub.publish('foreach.visible.update.heights', id);
     };
 
-    const render = function() {
+    const render = function () {
       if ((endIndex === 0 && allEntries.length > 1) || endIndex < 0) {
         ko.bindingHandlers.template.update(
           element,
@@ -358,7 +358,7 @@ ko.bindingHandlers.foreachVisible = {
             return {
               foreach: [],
               templateEngine: ko.nativeTemplateEngine.instance,
-              afterRender: function() {
+              afterRender: function () {
                 // This is called once for each added element (not when elements are removed)
                 clearTimeout(throttle);
                 throttle = setTimeout(afterRender, 0);
@@ -387,7 +387,7 @@ ko.bindingHandlers.foreachVisible = {
           return {
             foreach: allEntries.slice(startIndex, endIndex + 1),
             templateEngine: ko.nativeTemplateEngine.instance,
-            afterRender: function() {
+            afterRender: function () {
               // This is called once for each added element (not when elements are removed)
               clearTimeout(throttle);
               throttle = setTimeout(afterRender, 0);
@@ -400,7 +400,7 @@ ko.bindingHandlers.foreachVisible = {
       );
     };
 
-    const setStartAndEndFromScrollTop = function() {
+    const setStartAndEndFromScrollTop = function () {
       const lastKnownHeights = $parentFVOwnerElement.data('lastKnownHeights');
       if (!lastKnownHeights) {
         return;
@@ -413,10 +413,7 @@ ko.bindingHandlers.foreachVisible = {
 
       while ($lastParent) {
         // Include the header, parent() is .foreach-wrapper, parent().parent() is the container (ul or div)
-        const lastRefOffset = $lastRef
-          .parent()
-          .parent()
-          .offset().top;
+        const lastRefOffset = $lastRef.parent().parent().offset().top;
         let lastAddedSpace = 0;
         $lastParent.children().each((idx, child) => {
           const $child = $(child);
@@ -448,7 +445,7 @@ ko.bindingHandlers.foreachVisible = {
     let renderThrottle = -1;
     let preloadGhostThrottle = -1;
     let lastScrollTop = -1;
-    const onScroll = function() {
+    const onScroll = function () {
       if (
         startIndex > incrementLimit &&
         Math.abs(lastScrollTop - $container.scrollTop()) < incrementLimit * options.minHeight

+ 2 - 5
desktop/core/src/desktop/js/ko/bindings/ko.fresherEditor.js

@@ -20,7 +20,7 @@ import * as ko from 'knockout';
 import hueUtils from 'utils/hueUtils';
 
 ko.bindingHandlers.fresherEditor = {
-  init: function(element, valueAccessor) {
+  init: function (element, valueAccessor) {
     const _el = $(element);
     const options = $.extend(valueAccessor(), {});
     _el.html(options.data());
@@ -121,10 +121,7 @@ ko.bindingHandlers.fresherEditor = {
       } else if (document.selection && document.selection.type !== 'Control') {
         // IE < 9
         if (_el.data('selection')) {
-          _el
-            .data('selection')
-            .createRange()
-            .pasteHTML(html);
+          _el.data('selection').createRange().pasteHTML(html);
         } else {
           document.selection.createRange().pasteHTML(html);
         }

+ 1 - 1
desktop/core/src/desktop/js/ko/bindings/ko.hdfsAutocomplete.js

@@ -18,7 +18,7 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 
 ko.bindingHandlers.hdfsAutocomplete = {
-  init: function(element) {
+  init: function (element) {
     const $element = $(element);
     $element.attr('autocomplete', 'off');
     $element.jHueHdfsAutocomplete({

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

@@ -18,7 +18,7 @@ import $ from 'jquery';
 import * as ko from 'knockout';
 
 ko.bindingHandlers.hdfsTree = {
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     const options = ko.unwrap(valueAccessor());
     const $element = $(element);
 
@@ -30,7 +30,7 @@ ko.bindingHandlers.hdfsTree = {
       root: options.root,
       initialPath: options.path,
       withTopPadding: false,
-      onPathChange: function(path) {
+      onPathChange: function (path) {
         options.selectedPath(path);
       }
     });

+ 4 - 6
desktop/core/src/desktop/js/ko/bindings/ko.highlight.js

@@ -20,10 +20,10 @@ import * as ko from 'knockout';
 // TODO: Depends on Ace
 
 ko.bindingHandlers.highlight = {
-  init: function(element) {
+  init: function (element) {
     $(element).addClass('ace-highlight');
   },
-  update: function(element, valueAccessor) {
+  update: function (element, valueAccessor) {
     const options = $.extend(
       {
         dialect: 'hive',
@@ -65,7 +65,7 @@ ko.bindingHandlers.highlight = {
           const tok = new Tokenizer(new Rules().getRules());
           const lines = value.split('\n');
 
-          const renderSimpleLine = function(txt, stringBuilder, tokens) {
+          const renderSimpleLine = function (txt, stringBuilder, tokens) {
             let screenColumn = 0;
             let token = tokens[0];
             let value = token.value;
@@ -136,9 +136,7 @@ ko.bindingHandlers.highlight = {
           if (options.enableOverflow) {
             $(element).css({ overflow: 'auto' });
           }
-          $(element)
-            .find('.ace_invisible_space')
-            .remove();
+          $(element).find('.ace_invisible_space').remove();
         }
       );
     }

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików