瀏覽代碼

HUE-8687 [frontend] Introduce an I18n global js function

Johan Ahlen 6 年之前
父節點
當前提交
dbaf300
共有 41 個文件被更改,包括 405 次插入2398 次删除
  1. 3 3
      apps/filebrowser/src/filebrowser/templates/listdir_components.mako
  2. 26 11
      apps/jobbrowser/src/jobbrowser/static/jobbrowser/js/impala_dagre.js
  3. 1 1
      apps/metastore/src/metastore/static/metastore/js/metastore.model.js
  4. 5 4
      desktop/core/src/desktop/js/apps/notebook/app.js
  5. 51 0
      desktop/core/src/desktop/js/doc/docSupport.js
  6. 3 1
      desktop/core/src/desktop/js/ext/ko.selectize.custom.js
  7. 5 0
      desktop/core/src/desktop/js/hue.js
  8. 14 12
      desktop/core/src/desktop/js/jquery/plugins/jquery.filechooser.js
  9. 8 1
      desktop/core/src/desktop/js/jquery/plugins/jquery.hdfstree.js
  10. 8 1
      desktop/core/src/desktop/js/jquery/plugins/jquery.tableextender.js
  11. 8 1
      desktop/core/src/desktop/js/jquery/plugins/jquery.tableextender2.js
  12. 4 2
      desktop/core/src/desktop/js/ko/bindings/charts/chartUtils.js
  13. 3 1
      desktop/core/src/desktop/js/ko/bindings/charts/ko.barChart.js
  14. 3 1
      desktop/core/src/desktop/js/ko/bindings/charts/ko.lineChart.js
  15. 4 3
      desktop/core/src/desktop/js/ko/bindings/charts/ko.pieChart.js
  16. 3 1
      desktop/core/src/desktop/js/ko/bindings/charts/ko.timelineChart.js
  17. 5 6
      desktop/core/src/desktop/js/ko/bindings/ko.dropzone.js
  18. 4 2
      desktop/core/src/desktop/js/ko/bindings/ko.tagEditor.js
  19. 9 3
      desktop/core/src/desktop/js/onePageViewModel.js
  20. 5 4
      desktop/core/src/desktop/js/sideBarViewModel.js
  21. 1 38
      desktop/core/src/desktop/js/spec/globalJsConstants.js
  22. 5 10
      desktop/core/src/desktop/js/sql/aceLocationHandler.js
  23. 64 43
      desktop/core/src/desktop/js/sql/autocompleteResults.js
  24. 3 2
      desktop/core/src/desktop/js/sql/spec/autocompleteResultsSpec.js
  25. 3 1
      desktop/core/src/desktop/js/topNavViewModel.js
  26. 19 0
      desktop/core/src/desktop/js/utils/i18n.js
  27. 1 1
      desktop/core/src/desktop/static/desktop/js/document/hueFileEntry.js
  28. 0 680
      desktop/core/src/desktop/static/desktop/js/jquery.filechooser.js
  29. 0 539
      desktop/core/src/desktop/static/desktop/js/jquery.tableextender.js
  30. 0 518
      desktop/core/src/desktop/static/desktop/js/jquery.tableextender2.js
  31. 0 275
      desktop/core/src/desktop/static/desktop/js/jquery.tableextender3.js
  32. 1 1
      desktop/core/src/desktop/static/desktop/js/ko.charts.leaflet.js
  33. 2 2
      desktop/core/src/desktop/static/desktop/js/queryBuilder.js
  34. 0 53
      desktop/core/src/desktop/templates/common_header_m.mako
  35. 2 2
      desktop/core/src/desktop/templates/common_notebook_ko_components.mako
  36. 1 1
      desktop/core/src/desktop/templates/document_browser.mako
  37. 107 154
      desktop/core/src/desktop/templates/global_js_constants.mako
  38. 1 1
      desktop/core/src/desktop/templates/ko_components/ko_context_popover.mako
  39. 13 9
      desktop/core/src/desktop/templates/ko_components/ko_simple_ace_editor.mako
  40. 1 1
      desktop/core/src/desktop/templates/sql_syntax_dropdown.mako
  41. 9 9
      desktop/libs/dashboard/src/dashboard/templates/common_search.mako

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

@@ -2083,7 +2083,7 @@ from filebrowser.conf import ENABLE_EXTRACT_UPLOADED_ARCHIVE
                 '<span class="break-word" data-dz-name></span>' +
                 '<div class="pull-right">' +
                 '<span class="muted" data-dz-size></span>&nbsp;&nbsp;' +
-                '<span data-dz-remove><a href="javascript:undefined;" title="' + HUE_I18n.dropzone.cancelUpload + '"><i class="fa fa-fw fa-times"></i></a></span>' +
+                '<span data-dz-remove><a href="javascript:undefined;" title="' + I18n('Cancel upload') + '"><i class="fa fa-fw fa-times"></i></a></span>' +
                 '<span style="display: none" data-dz-uploaded><i class="fa fa-fw fa-check muted"></i></span>' +
                 '</div>' +
                 '<div class="progress-row-bar" data-dz-uploadprogress></div>' +
@@ -2122,7 +2122,7 @@ from filebrowser.conf import ENABLE_EXTRACT_UPLOADED_ARCHIVE
               $('#progressStatusBar div').width(progress.toFixed() + "%");
             },
             canceled: function () {
-              $.jHueNotify.info(HUE_I18n.dropzone.uploadCanceled);
+              $.jHueNotify.info(I18n('The upload has been canceled'));
             },
             complete: function (data) {
               if (data.xhr.response != '') {
@@ -2131,7 +2131,7 @@ from filebrowser.conf import ENABLE_EXTRACT_UPLOADED_ARCHIVE
                   if (response.status != 0) {
                     $(document).trigger('error', response.data);
                   } else {
-                    $(document).trigger('info', response.path + ' ' + HUE_I18n.dropzone.uploadSucceeded);
+                    $(document).trigger('info', response.path + ' ' + I18n('uploaded successfully'));
                     viewModel.filesToHighlight.push(response.path);
                   }
                 }

+ 26 - 11
apps/jobbrowser/src/jobbrowser/static/jobbrowser/js/impala_dagre.js

@@ -7,6 +7,21 @@ data_stream_target attribute.
 Copied from https://github.com/apache/incubator-impala/blob/master/www/query_plan.tmpl
 */
 function impalaDagre(id) {
+
+  var PROFILE_I18n = {
+    timeline: window.I18n('Timeline'),
+    metrics: window.I18n('Metrics'),
+    cpu: window.I18n('CPU'),
+    io: window.I18n('IO'),
+    execution: window.I18n('Execution'),
+    codegen: window.I18n('CodeGen'),
+    overview: window.I18n('Overview'),
+    topnodes: window.I18n('Top Nodes'),
+    compilation: window.I18n('Compilation'),
+    planning: window.I18n('Planning'),
+    risks: window.I18n('Risks')
+  }
+
   var d3 = window.d3v3;
   var dagreD3 = window.dagreD3;
   var g = new dagreD3.graphlib.Graph().setGraph({rankDir: "BT"});
@@ -362,7 +377,7 @@ function impalaDagre(id) {
   function _timelineAfter(start_time, timeline) {
     var total = 0;
     return timeline.map(function (event, index) {
-      return $.extend({}, event, { start_time: start_time + total, duration: event.value, value: start_time + (total += event.value), name: window.HUE_I18n.profile[event.clazz]});
+      return $.extend({}, event, { start_time: start_time + total, duration: event.value, value: start_time + (total += event.value), name: PROFILE_I18n[event.clazz]});
     });
   }
 
@@ -375,7 +390,7 @@ function impalaDagre(id) {
     if (!initTime) {
       return timeline;
     }
-    return [$.extend({}, initTime, { start_time: 0, duration: initTime.value, name: window.HUE_I18n.profile.codegen, color: colors[2] })].concat(timeline);
+    return [$.extend({}, initTime, { start_time: 0, duration: initTime.value, name: window.I18n('CodeGen'), color: colors[2] })].concat(timeline);
   }
 
   function getHealthData(key, startTime) {
@@ -471,7 +486,7 @@ function impalaDagre(id) {
   function showDetailGlobal() {
     var details = d3.select('#' + id + '.query-plan .details');
     var key = getKey(id);
-    details.html('<header class="metric-title">' + getIcon({ svg: 'hi-sitemap' }) + '<h4>' + window.HUE_I18n.profile.overview + '</h4></div>')
+    details.html('<header class="metric-title">' + getIcon({ svg: 'hi-sitemap' }) + '<h4>' + window.I18n('Overview') + '</h4></div>')
     var detailsContent = details.append('div').classed('details-content', true);
     var topNodes = getTopNodes();
     if (topNodes && topNodes.length) {
@@ -479,7 +494,7 @@ function impalaDagre(id) {
       var cpuTimelineTitle = cpuTimelineSection.append('header');
       cpuTimelineTitle.append('svg').classed('hi', true).append('use').attr('xlink:href', '#hi-filter');
       var metricsMax = getMetricsMax() ? ' (' + ko.bindingHandlers.numberFormat.human(getMetricsMax(), 5) + ')' : '';
-      cpuTimelineTitle.append('h5').text(window.HUE_I18n.profile.topnodes + metricsMax);
+      cpuTimelineTitle.append('h5').text(window.I18n('Top Nodes') + metricsMax);
       var cpuTimelineSectionTable = cpuTimelineSection.append('table').classed('clickable', true);
       var cpuTimelineSectionTableRows = cpuTimelineSectionTable.selectAll('tr').data(topNodes).enter().append('tr').on('click', function (node) {
         select(getId(node.key));
@@ -489,8 +504,8 @@ function impalaDagre(id) {
       cpuTimelineSectionTableRows.append('td').text(function (datum) { return ko.bindingHandlers.numberFormat.human(datum.duration, datum.unit); });
     }
 
-    appendTimelineAndLegend(detailsContent, getTimelineData('summary', 'Query Compilation'), window.HUE_I18n.profile.planning, '#hi-access-time');
-    appendTimelineAndLegend(detailsContent, getTimelineData('summary', 'Query Timeline'), window.HUE_I18n.profile.execution, '#hi-access-time');
+    appendTimelineAndLegend(detailsContent, getTimelineData('summary', 'Query Compilation'), window.I18n('Planning'), '#hi-access-time');
+    appendTimelineAndLegend(detailsContent, getTimelineData('summary', 'Query Timeline'), window.I18n('Execution' ), '#hi-access-time');
 
     d3.select('#' + id + '.query-plan .details .metric-title').on('click', function () {
       toggleDetails();
@@ -524,12 +539,12 @@ function impalaDagre(id) {
     d3.select('#' + id + '.query-plan').classed('open', true);
     var details = d3.select('#' + id + '.query-plan .details');
     var key = getKey(key);
-    details.html('<header class="metric-title">' + getIcon(states_by_name[key].icon) + '<h4>' + states_by_name[key].label+ '</h4></div>')
+    details.html('<header class="metric-title">' + getIcon(states_by_name[key].icon) + '<h4>' + states_by_name[key].label+ '</h4></div>');
     var detailsContent = details.append('div').classed('details-content', true);
 
     var cpuTimelineData = getCPUTimelineData(key);
-    appendTimelineAndLegend(detailsContent, getExecutionTimelineData(key), window.HUE_I18n.profile.execution, '#hi-microchip', getMetricsMax());
-    appendTimelineAndLegend(detailsContent, getHealthData(key, cpuTimelineData[0] && cpuTimelineData[0].start_time), window.HUE_I18n.profile.risks, '#hi-heart', getMetricsMax());
+    appendTimelineAndLegend(detailsContent, getExecutionTimelineData(key), window.I18n('Execution'), '#hi-microchip', getMetricsMax());
+    appendTimelineAndLegend(detailsContent, getHealthData(key, cpuTimelineData[0] && cpuTimelineData[0].start_time), window.I18n('Risks'), '#hi-heart', getMetricsMax());
 
     var timelineData = getTimelineData(key);
     var timeline = renderTimeline(timelineData, getMetricsMax());
@@ -538,7 +553,7 @@ function impalaDagre(id) {
       var timelineSection = detailsContent.append('div').classed('details-section', true);
       var timelineTitle = timelineSection.append('header');
       timelineTitle.append('svg').classed('hi', true).append('use').attr('xlink:href', '#hi-access-time');
-      timelineTitle.append('h5').text(window.HUE_I18n.profile.timeline + ' (' + ko.bindingHandlers.numberFormat.human(timelineSum, 5) + ')');
+      timelineTitle.append('h5').text(window.I18n('Timeline') + ' (' + ko.bindingHandlers.numberFormat.human(timelineSum, 5) + ')');
       timelineSection.node().appendChild($.parseXML(timeline).children[0]);
 
       var timelineSectionTable = timelineSection.append('table').classed('column', true);
@@ -556,7 +571,7 @@ function impalaDagre(id) {
 
     var metricsTitle = metricsSection.append('header');
     metricsTitle.append('svg').classed('hi', true).append('use').attr('xlink:href', '#hi-bar-chart');
-    metricsTitle.append('h5').text(window.HUE_I18n.profile.metrics);
+    metricsTitle.append('h5').text(window.I18n('Metrics'));
 
     var metricsContent = metricsSection.append('table').classed('column metrics', true);
     var metricsHosts = Object.keys(data.properties.hosts).sort().map(function (key) { return data.properties.hosts[key]; });

+ 1 - 1
apps/metastore/src/metastore/static/metastore/js/metastore.model.js

@@ -773,7 +773,7 @@ var MetastoreTable = (function () {
         self.fetchDetails();
       }).fail(function () {
         self.refreshingTableStats(false);
-        $.jHueNotify.error(HUE_I18n.metastore.errorRefreshingTableStats);
+        $.jHueNotify.error(window.I18n('An error occurred refreshing the table stats. Please try again.'));
         console.error('apiHelper.refreshTableStats error');
         console.error(data);
       });

+ 5 - 4
desktop/core/src/desktop/js/apps/notebook/app.js

@@ -23,6 +23,7 @@ import 'jquery/plugins/jquery.hdfstree';
 
 import huePubSub from 'utils/huePubSub';
 import hueUtils from 'utils/hueUtils';
+import I18n from 'utils/i18n';
 
 window.Clipboard = Clipboard;
 
@@ -69,11 +70,11 @@ const hideHoverMsg = vm => {
   if (vm.editorMode()) {
     $(window.EDITOR_BINDABLE_ELEMENT)
       .find('.hoverText')
-      .html(window.HUE_I18n.notebook.dropEditorHoverText);
+      .html(I18n('Drop a SQL file here'));
   } else {
     $(window.EDITOR_BINDABLE_ELEMENT)
       .find('.hoverText')
-      .html(window.HUE_I18n.notebook.dropNotebookHoverText);
+      .html(I18n('Drop iPython/Zeppelin notebooks here'));
   }
   $(window.EDITOR_BINDABLE_ELEMENT)
     .find('.hoverMsg')
@@ -89,8 +90,8 @@ const createHueDatatable = (el, snippet, vm) => {
   }
   const _dt = $(el).hueDataTable({
     i18n: {
-      NO_RESULTS: window.HUE_I18n.notebook.noResults,
-      OF: window.HUE_I18n.notebook.of
+      NO_RESULTS: I18n('No results found.'),
+      OF: I18n('of')
     },
     fnDrawCallback: function(oSettings) {
       if (vm.editorMode()) {

+ 51 - 0
desktop/core/src/desktop/js/doc/docSupport.js

@@ -0,0 +1,51 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+import I18n from 'utils/i18n';
+
+const DOCUMENT_TYPE_I18n = {
+  all: I18n('All'),
+  directory: I18n('Directory'),
+  'link-pigscript': I18n('Pig Design'),
+  'link-workflow': I18n('Job Design'),
+  notebook: I18n('Notebook'),
+  'oozie-bundle2': I18n('Oozie Bundle'),
+  'oozie-coordinator2': I18n('Oozie Schedule'),
+  'oozie-workflow2': I18n('Oozie Workflow'),
+  'query-hive': I18n('Hive Query'),
+  'query-impala': I18n('Impala Query'),
+  'search-dashboard': I18n('Search Dashboard'),
+  'query-mapreduce': I18n('MapReduce Job'),
+  'query-sqoop1': I18n('Import Job'),
+  'query-spark2': I18n('Spark Job'),
+  'query-java': I18n('Java Job'),
+  'query-pig': I18n('Pig Script'),
+  'query-shell': I18n('Shell Script'),
+  'query-distcp': I18n('DistCp Job')
+};
+
+const DOCUMENT_TYPES = [];
+
+Object.keys(DOCUMENT_TYPE_I18n).forEach(key => {
+  if (key !== 'all') {
+    DOCUMENT_TYPES.push({ type: key, label: DOCUMENT_TYPE_I18n[key] });
+  }
+});
+
+DOCUMENT_TYPES.sort((a, b) => a.label.localeCompare(b.label));
+DOCUMENT_TYPES.unshift({ type: 'all', label: DOCUMENT_TYPE_I18n['all'] });
+
+export { DOCUMENT_TYPE_I18n, DOCUMENT_TYPES };

+ 3 - 1
desktop/core/src/desktop/js/ext/ko.selectize.custom.js

@@ -19,6 +19,8 @@
 import $ from 'jquery';
 import ko from 'knockout';
 
+import I18n from 'utils/i18n';
+
 var inject_binding = function (allBindings, key, value) {
   //https://github.com/knockout/knockout/pull/932#issuecomment-26547528
   return {
@@ -47,7 +49,7 @@ ko.bindingHandlers.browserAwareSelectize = {
 ko.bindingHandlers.selectize = {
   init: function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
     if (typeof allBindingsAccessor.get('optionsCaption') == 'undefined')
-      allBindingsAccessor = inject_binding(allBindingsAccessor, 'optionsCaption', window.HUE_I18n.selectize.choose);
+      allBindingsAccessor = inject_binding(allBindingsAccessor, 'optionsCaption', I18n('Choose...'));
 
     ko.bindingHandlers.options.update(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext);
 

+ 5 - 0
desktop/core/src/desktop/js/hue.js

@@ -36,6 +36,7 @@ import 'utils/customIntervals';
 import 'utils/json.bigDataParse';
 import apiHelper from 'api/apiHelper';
 import CancellablePromise from 'api/cancellablePromise';
+import { DOCUMENT_TYPE_I18n, DOCUMENT_TYPES } from 'doc/docSupport';
 import contextCatalog from 'catalog/contextCatalog';
 import dataCatalog from 'catalog/dataCatalog';
 import hueAnalytics from 'utils/hueAnalytics';
@@ -44,6 +45,7 @@ import hueDebug from 'utils/hueDebug';
 import hueDrop from 'utils/hueDrop';
 import huePubSub from 'utils/huePubSub';
 import hueUtils from 'utils/hueUtils';
+import I18n from 'utils/i18n';
 import MultiLineEllipsisHandler from 'utils/multiLineEllipsisHandler';
 
 import AceLocationHandler from 'sql/aceLocationHandler';
@@ -78,6 +80,8 @@ window.dataCatalog = dataCatalog;
 window.d3 = d3;
 window.d3v3 = d3v3;
 window.Dropzone = Dropzone;
+window.DOCUMENT_TYPE_I18n = DOCUMENT_TYPE_I18n;
+window.DOCUMENT_TYPES = DOCUMENT_TYPES;
 window.EditorViewModel = EditorViewModel;
 window.filesize = filesize;
 window.globalSearchParser = globalSearchParser;
@@ -88,6 +92,7 @@ window.hueDebug = hueDebug;
 window.hueDrop = hueDrop;
 window.huePubSub = huePubSub;
 window.hueUtils = hueUtils;
+window.I18n = I18n;
 window.localforage = localforage;
 window.MultiLineEllipsisHandler = MultiLineEllipsisHandler;
 window.page = page;

+ 14 - 12
desktop/core/src/desktop/js/jquery/plugins/jquery.filechooser.js

@@ -18,6 +18,7 @@ import $ from 'jquery';
 import qq from 'ext/fileuploader.custom';
 
 import huePubSub from '../../utils/huePubSub';
+import I18n from 'utils/i18n';
 
 /*
  * jHue fileChooser plugin
@@ -116,17 +117,23 @@ const pluginName = 'jHueFileChooser',
   },
   STORAGE_PREFIX = 'hueFileBrowserLastPathForUser_';
 
+const DEFAULT_I18n = {
+  BACK: I18n('Back'),
+  SELECT_FOLDER: I18n('Select this folder'),
+  CREATE_FOLDER: I18n('Create folder'),
+  FOLDER_NAME: I18n('Folder name'),
+  CANCEL: I18n('Cancel'),
+  FILE_NOT_FOUND: I18n('The file has not been found'),
+  UPLOAD_FILE: I18n('Upload a file'),
+  FAILED: I18n('Failed')
+};
+
 function Plugin(element, options) {
   this.element = element;
   $(element).data('jHueFileChooser', this);
 
   this.options = $.extend({}, defaults, { user: window.LOGGED_USERNAME }, options);
-  this.options.labels = $.extend(
-    {},
-    defaults.labels,
-    window.HUE_I18n.jHueFileChooser,
-    options ? options.labels : {}
-  );
+  this.options.labels = $.extend({}, defaults.labels, DEFAULT_I18n, options ? options.labels : {});
   this._defaults = defaults;
   this._name = pluginName;
   this.previousPath = '';
@@ -136,12 +143,7 @@ function Plugin(element, options) {
 Plugin.prototype.setOptions = function(options) {
   const self = this;
   self.options = $.extend({}, defaults, { user: window.LOGGED_USERNAME }, options);
-  self.options.labels = $.extend(
-    {},
-    defaults.labels,
-    window.HUE_I18n.jHueFileChooser,
-    options ? options.labels : {}
-  );
+  self.options.labels = $.extend({}, defaults.labels, DEFAULT_I18n, options ? options.labels : {});
   const initialPath = $.trim(self.options.initialPath);
   const scheme = initialPath && initialPath.substring(0, initialPath.indexOf(':'));
   if (scheme && scheme.length) {

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

@@ -17,6 +17,7 @@
 import jQuery from 'jquery';
 
 import hueUtils from '../../utils/hueUtils';
+import I18n from 'utils/i18n';
 
 // TODO: don't create multiple jquery instances from chunks
 const $ = window.$ || jQuery;
@@ -57,7 +58,13 @@ function Plugin(element, options) {
   this.options.labels = $.extend(
     {},
     defaults.labels,
-    window.HUE_I18n.jHueHdfsTree,
+    {
+      GO_TO_COLUMN: I18n('Go to column:'),
+      PLACEHOLDER: I18n('column name...'),
+      LOCK: I18n('Lock this row'),
+      UNLOCK: I18n('Unlock this row'),
+      ROW_DETAILS: I18n('Show row details')
+    },
     options ? options.labels : {}
   );
   this._defaults = defaults;

+ 8 - 1
desktop/core/src/desktop/js/jquery/plugins/jquery.tableextender.js

@@ -17,6 +17,7 @@
 import $ from 'jquery';
 
 import huePubSub from 'utils/huePubSub';
+import I18n from 'utils/i18n';
 
 /*
  * jHue table extender plugin
@@ -57,7 +58,13 @@ Plugin.prototype.setOptions = function(options) {
   this.options.labels = $.extend(
     {},
     defaults.labels,
-    window.HUE_I18n.jHueTableExtender,
+    {
+      GO_TO_COLUMN: I18n('Go to column:'),
+      PLACEHOLDER: I18n('column name...'),
+      LOCK: I18n('Lock this row'),
+      UNLOCK: I18n('Unlock this row'),
+      ROW_DETAILS: I18n('Show row details')
+    },
     options ? options.labels : {}
   );
   this._defaults = defaults;

+ 8 - 1
desktop/core/src/desktop/js/jquery/plugins/jquery.tableextender2.js

@@ -18,6 +18,7 @@ import $ from 'jquery';
 
 import huePubSub from 'utils/huePubSub';
 import hueUtils from 'utils/hueUtils';
+import I18n from 'utils/i18n';
 
 const PLUGIN_NAME = 'jHueTableExtender2';
 
@@ -220,7 +221,13 @@ Plugin.prototype.setOptions = function(options) {
   this.options.labels = $.extend(
     {},
     DEFAULT_OPTIONS.labels,
-    window.HUE_I18n.jHueTableExtender,
+    {
+      GO_TO_COLUMN: I18n('Go to column:'),
+      PLACEHOLDER: I18n('column name...'),
+      LOCK: I18n('Lock this row'),
+      UNLOCK: I18n('Unlock this row'),
+      ROW_DETAILS: I18n('Show row details')
+    },
     options ? options.labels : {}
   );
 };

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

@@ -16,7 +16,9 @@
 
 import $ from 'jquery';
 import d3v3 from 'd3v3';
+
 import huePubSub from 'utils/huePubSub';
+import I18n from 'utils/i18n';
 
 const MS = 1;
 const SECOND_MS = 1000 * MS;
@@ -74,7 +76,7 @@ const barChartBuilder = (element, options, isTimeline) => {
         .empty();
     }
     const _chart = nv.models.multiBarWithBrushChart();
-    _chart.noData(_datum.message || window.HUE_I18n.chart.noData);
+    _chart.noData(_datum.message || I18n('No Data Available.'));
     if (_datum.length > 0) {
       $(element).data('chart_type', 'multibar_brush');
     }
@@ -339,7 +341,7 @@ const lineChartBuilder = (element, options, isTimeline) => {
   if ($(element).is(':visible')) {
     nv.addGraph(() => {
       const _chart = nv.models.lineWithBrushChart();
-      _chart.noData(_datum.message || window.HUE_I18n.chart.noData);
+      _chart.noData(_datum.message || I18n('No Data Available.'));
       $(element).data('chart', _chart);
       _chart.transitionDuration(0);
       _chart.convert = function(d) {

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

@@ -18,6 +18,8 @@ import $ from 'jquery';
 import d3v3 from 'd3v3';
 import ko from 'knockout';
 
+import I18n from 'utils/i18n';
+
 import {
   barChartBuilder,
   handleSelection,
@@ -65,7 +67,7 @@ ko.bindingHandlers.barChart = {
     const _isPivot = _options.isPivot != null ? _options.isPivot : false;
 
     if (_chart) {
-      _chart.noData(_datum.message || window.HUE_I18n.chart.noData);
+      _chart.noData(_datum.message || I18n('No Data Available.'));
       if (_chart.multibar) {
         _chart.multibar.stacked(typeof _options.stacked != 'undefined' ? _options.stacked : false);
       }

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

@@ -18,6 +18,8 @@ import $ from 'jquery';
 import d3v3 from 'd3v3';
 import ko from 'knockout';
 
+import I18n from 'utils/i18n';
+
 import { insertLinebreaks, lineChartBuilder } from 'ko/bindings/charts/chartUtils';
 import huePubSub from 'utils/huePubSub';
 
@@ -33,7 +35,7 @@ ko.bindingHandlers.lineChart = {
     const _chart = $(element).data('chart');
     if (_chart) {
       window.setTimeout(() => {
-        _chart.noData(_datum.message || window.HUE_I18n.chart.noData);
+        _chart.noData(_datum.message || I18n('No Data Available.'));
         const _d3 = d3v3.select($(element).find('svg')[0]);
         if (
           _datum.length > 0 &&

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

@@ -20,6 +20,7 @@ import ko from 'knockout';
 
 import huePubSub from 'utils/huePubSub';
 import hueUtils from 'utils/hueUtils';
+import I18n from 'utils/i18n';
 
 ko.bindingHandlers.pieChart = {
   init: function(element, valueAccessor) {
@@ -70,7 +71,7 @@ ko.bindingHandlers.pieChart = {
               .tooltipContent((key, y) => {
                 return '<h3>' + hueUtils.htmlEncode(key) + '</h3><p>' + y + '</p>';
               });
-            _chart.noData(_data.message || window.HUE_I18n.chart.noData);
+            _chart.noData(_data.message || I18n('No Data Available.'));
             const _d3 =
               $(element).find('svg').length > 0
                 ? d3v3.select($(element).find('svg')[0])
@@ -139,7 +140,7 @@ ko.bindingHandlers.pieChart = {
               $(element).find('svg').length > 0
                 ? d3v3.select($(element).find('svg')[0])
                 : d3v3.select($(element)[0]).append('svg');
-            _d3.selectAll('.nv-slice').on('click', (d) => {
+            _d3.selectAll('.nv-slice').on('click', d => {
               if (typeof _options.onClick != 'undefined') {
                 huePubSub.publish('charts.state', { updating: true });
                 _options.onClick(d);
@@ -155,7 +156,7 @@ ko.bindingHandlers.pieChart = {
     const _data = _options.transformer(_options.data);
     const _chart = $(element).data('chart');
     if (_chart) {
-      _chart.noData(_data.message || window.HUE_I18n.chart.noData);
+      _chart.noData(_data.message || I18n('No Data Available.'));
       const _d3 = d3v3.select($(element).find('svg')[0]);
       _d3
         .datum(_data)

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

@@ -18,6 +18,8 @@ import $ from 'jquery';
 import d3v3 from 'd3v3';
 import ko from 'knockout';
 
+import I18n from 'utils/i18n';
+
 import {
   barChartBuilder,
   handleSelection,
@@ -63,7 +65,7 @@ ko.bindingHandlers.timelineChart = {
     const _chart = $(element).data('chart');
     if (_chart) {
       window.setTimeout(() => {
-        _chart.noData(_datum.message || window.HUE_I18n.chart.noData);
+        _chart.noData(_datum.message || I18n('No Data Available.'));
         if (_chart.multibar) {
           _chart.multibar.stacked(
             typeof _options.stacked != 'undefined' ? _options.stacked : false

+ 5 - 6
desktop/core/src/desktop/js/ko/bindings/ko.dropzone.js

@@ -18,6 +18,8 @@ import Dropzone from 'dropzone';
 import $ from 'jquery';
 import ko from 'knockout';
 
+import I18n from 'utils/i18n';
+
 // TODO: Depends on Dropzone
 
 ko.bindingHandlers.dropzone = {
@@ -36,7 +38,7 @@ ko.bindingHandlers.dropzone = {
         '<div class="pull-right">' +
         '<span class="muted" data-dz-size></span>&nbsp;&nbsp;' +
         '<span data-dz-remove><a href="javascript:undefined;" title="' +
-        window.HUE_I18n.dropzone.cancelUpload +
+        I18n('Cancel upload') +
         '"><i class="fa fa-fw fa-times"></i></a></span>' +
         '<span style="display: none" data-dz-uploaded><i class="fa fa-fw fa-check muted"></i></span>' +
         '</div>' +
@@ -73,7 +75,7 @@ ko.bindingHandlers.dropzone = {
         $('#progressStatusBar div').width(progress.toFixed() + '%');
       },
       canceled: function() {
-        $.jHueNotify.info(window.HUE_I18n.dropzone.uploadCanceled);
+        $.jHueNotify.info(I18n('The upload has been canceled'));
       },
       complete: function(file) {
         if (file.xhr.response !== '') {
@@ -85,10 +87,7 @@ ko.bindingHandlers.dropzone = {
                 value.onError(file.name);
               }
             } else {
-              $(document).trigger(
-                'info',
-                response.path + ' ' + window.HUE_I18n.dropzone.uploadSucceeded
-              );
+              $(document).trigger('info', response.path + ' ' + I18n('uploaded successfully'));
               if (value.onComplete) {
                 value.onComplete(response.path);
               }

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

@@ -17,6 +17,8 @@
 import $ from 'jquery';
 import ko from 'knockout';
 
+import I18n from 'utils/i18n';
+
 ko.bindingHandlers.tagEditor = {
   init: function(element, valueAccessor) {
     let options = valueAccessor();
@@ -168,7 +170,7 @@ ko.bindingHandlers.tagEditor = {
       if (!options.readOnly && !options.hasErrors()) {
         $('<i>')
           .addClass('fa fa-pencil selectize-edit pointer')
-          .attr('title', window.HUE_I18n.selectize.editTags)
+          .attr('title', I18n('Edit tags'))
           .appendTo($readOnlyInner);
         $readOnlyInner.click(() => {
           showEdit();
@@ -243,7 +245,7 @@ ko.bindingHandlers.tagEditor = {
         if (!options.readOnly && !options.hasErrors()) {
           $('<i>')
             .addClass('fa fa-pencil selectize-edit pointer')
-            .attr('title', window.HUE_I18n.selectize.editTags)
+            .attr('title', I18n('Edit tags'))
             .appendTo($readOnlyInner);
           $readOnlyInner.click(() => {
             showEdit();

+ 9 - 3
desktop/core/src/desktop/js/onePageViewModel.js

@@ -14,10 +14,12 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+import _ from 'lodash';
+import page from 'page';
+
 import hueUtils from 'utils/hueUtils';
 import huePubSub from 'utils/huePubSub';
-import page from 'page';
-import _ from 'lodash';
+import I18n from 'utils/i18n';
 
 class OnePageViewModel {
   constructor() {
@@ -395,7 +397,11 @@ class OnePageViewModel {
             } else if (app !== '500') {
               self.loadApp('500');
             } else {
-              $.jHueNotify.error(window.HUE_I18n.general.offlineOrError);
+              $.jHueNotify.error(
+                I18n(
+                  'It looks like you are offline or an unknown error happened. Please refresh the page.'
+                )
+              );
             }
           }
         });

+ 5 - 4
desktop/core/src/desktop/js/sideBarViewModel.js

@@ -15,6 +15,7 @@
 // limitations under the License.
 
 import huePubSub from 'utils/huePubSub';
+import I18n from 'utils/i18n';
 
 class SideBarViewModel {
   constructor(onePageViewModel, topNavViewModel) {
@@ -57,7 +58,7 @@ class SideBarViewModel {
 
           if (editor) {
             appsItems.push({
-              displayName: window.HUE_I18n.nav.editor,
+              displayName: I18n('Editor'),
               url: editor['page'],
               icon: 'editor'
             });
@@ -81,14 +82,14 @@ class SideBarViewModel {
         if (appsItems.length > 0) {
           items.push({
             isCategory: true,
-            displayName: window.HUE_I18n.nav.apps,
+            displayName: I18n('Apps'),
             children: appsItems
           });
         }
 
         const browserItems = [];
         browserItems.push({
-          displayName: window.HUE_I18n.nav.documents,
+          displayName: I18n('Documents'),
           url: '/home/',
           icon: 'documents'
         });
@@ -104,7 +105,7 @@ class SideBarViewModel {
         if (browserItems.length > 0) {
           items.push({
             isCategory: true,
-            displayName: window.HUE_I18n.nav.browsers,
+            displayName: I18n('Browsers'),
             children: browserItems
           });
         }

+ 1 - 38
desktop/core/src/desktop/js/spec/globalJsConstants.js

@@ -18,44 +18,7 @@ const globalVars = {
   LOGGED_USERNAME: 'foo',
   CACHEABLE_TTL: 1,
   HAS_OPTIMIZER: false,
-  AUTOCOMPLETE_TIMEOUT: 1,
-  HUE_I18n: {
-    autocomplete: {
-      category: {
-        all: 'all',
-        column: 'columns',
-        cte: 'cte',
-        database: 'database',
-        field: 'field',
-        function: 'function',
-        identifier: 'identifier',
-        keyword: 'keyword',
-        popular: 'popular',
-        sample: 'sample',
-        table: 'table',
-        udf: 'udf',
-        option: 'option',
-        variable: 'variable'
-      },
-      meta: {
-        aggregateFunction: 'aggregateFunction',
-        alias: 'alias',
-        commonTableExpression: 'commonTableExpression',
-        database: 'database',
-        filter: 'filter',
-        groupBy: 'groupBy',
-        join: 'join',
-        joinCondition: 'joinCondition',
-        keyword: 'keyword',
-        orderBy: 'orderBy',
-        table: 'table',
-        sample: 'sample',
-        variable: 'variable',
-        view: 'view',
-        virtual: 'virtual'
-      }
-    }
-  }
+  AUTOCOMPLETE_TIMEOUT: 1
 };
 
 Object.keys(globalVars).forEach(key => {

+ 5 - 10
desktop/core/src/desktop/js/sql/aceLocationHandler.js

@@ -20,6 +20,7 @@ import AssistStorageEntry from 'assist/assistStorageEntry';
 import dataCatalog from 'catalog/dataCatalog';
 import hueDebug from 'utils/hueDebug';
 import huePubSub from 'utils/huePubSub';
+import I18n from 'utils/i18n';
 import SqlParseSupport from 'parse/sqlParseSupport';
 import sqlUtils from 'sql/sqlUtils';
 
@@ -224,13 +225,10 @@ class AceLocationHandler {
                 let tooltipText;
                 if (token.syntaxError.expected.length > 0) {
                   tooltipText =
-                    window.HUE_I18n.syntaxChecker.didYouMean +
-                    ' "' +
-                    token.syntaxError.expected[0].text +
-                    '"?';
+                    I18n('Did you mean') + ' "' + token.syntaxError.expected[0].text + '"?';
                 } else {
                   tooltipText =
-                    window.HUE_I18n.syntaxChecker.couldNotFind +
+                    I18n('Could not find') +
                     ' "' +
                     (token.qualifiedIdentifier || token.value) +
                     '"';
@@ -252,12 +250,9 @@ class AceLocationHandler {
                 let tooltipText;
                 if (token.syntaxError.expected.length > 0) {
                   tooltipText =
-                    window.HUE_I18n.syntaxChecker.didYouMean +
-                    ' "' +
-                    token.syntaxError.expected[0].text +
-                    '"?';
+                    I18n('Did you mean') + ' "' + token.syntaxError.expected[0].text + '"?';
                 } else if (token.syntaxError.expectedStatementEnd) {
-                  tooltipText = window.HUE_I18n.syntaxChecker.expectedStatementEnd;
+                  tooltipText = I18n('Expected end of statement');
                 }
                 if (tooltipText) {
                   const endCoordinates = self.editor.renderer.textToScreenCoordinates(

+ 64 - 43
desktop/core/src/desktop/js/sql/autocompleteResults.js

@@ -22,6 +22,7 @@ import dataCatalog from 'catalog/dataCatalog';
 import HueColors from 'utils/hueColors';
 import hueUtils from 'utils/hueUtils';
 import huePubSub from 'utils/huePubSub';
+import I18n from 'utils/i18n';
 import sqlUtils from 'sql/sqlUtils';
 import { SqlSetOptions, SqlFunctions } from 'sql/sqlFunctions';
 
@@ -39,151 +40,174 @@ const COLORS = {
   HDFS: normalizedColors['red'][2]
 };
 
+const META_I18n = {
+  aggregateFunction: I18n('aggregate'),
+  alias: I18n('alias'),
+  commonTableExpression: I18n('cte'),
+  database: I18n('database'),
+  dir: I18n('dir'),
+  filter: I18n('filter'),
+  groupBy: I18n('group by'),
+  join: I18n('join'),
+  joinCondition: I18n('condition'),
+  keyword: I18n('keyword'),
+  orderBy: I18n('order by'),
+  sample: I18n('sample'),
+  table: I18n('table'),
+  variable: I18n('variable'),
+  view: I18n('view'),
+  virtual: I18n('virtual')
+};
+
 const CATEGORIES = {
-  ALL: { id: 'all', color: HueColors.BLUE, label: window.HUE_I18n.autocomplete.category.all },
+  ALL: {
+    id: 'all',
+    color: HueColors.BLUE,
+    label: I18n('All')
+  },
   POPULAR: {
     id: 'popular',
     color: COLORS.POPULAR,
-    label: window.HUE_I18n.autocomplete.category.popular
+    label: I18n('Popular')
   },
   POPULAR_AGGREGATE: {
     id: 'popularAggregate',
     weight: 1500,
     color: COLORS.POPULAR,
-    label: window.HUE_I18n.autocomplete.category.popular,
+    label: I18n('Popular'),
     detailsTemplate: 'agg-udf'
   },
   POPULAR_GROUP_BY: {
     id: 'popularGroupBy',
     weight: 1300,
     color: COLORS.POPULAR,
-    label: window.HUE_I18n.autocomplete.category.popular,
+    label: I18n('Popular'),
     detailsTemplate: 'group-by'
   },
   POPULAR_ORDER_BY: {
     id: 'popularOrderBy',
     weight: 1200,
     color: COLORS.POPULAR,
-    label: window.HUE_I18n.autocomplete.category.popular,
+    label: I18n('Popular'),
     detailsTemplate: 'order-by'
   },
   POPULAR_FILTER: {
     id: 'popularFilter',
     weight: 1400,
     color: COLORS.POPULAR,
-    label: window.HUE_I18n.autocomplete.category.popular,
+    label: I18n('Popular'),
     detailsTemplate: 'filter'
   },
   POPULAR_ACTIVE_JOIN: {
     id: 'popularActiveJoin',
     weight: 1500,
     color: COLORS.POPULAR,
-    label: window.HUE_I18n.autocomplete.category.popular,
+    label: I18n('Popular'),
     detailsTemplate: 'join'
   },
   POPULAR_JOIN_CONDITION: {
     id: 'popularJoinCondition',
     weight: 1500,
     color: COLORS.POPULAR,
-    label: window.HUE_I18n.autocomplete.category.popular,
+    label: I18n('Popular'),
     detailsTemplate: 'join-condition'
   },
   COLUMN: {
     id: 'column',
     weight: 1000,
     color: COLORS.COLUMN,
-    label: window.HUE_I18n.autocomplete.category.column,
+    label: I18n('Columns'),
     detailsTemplate: 'column'
   },
   SAMPLE: {
     id: 'sample',
     weight: 900,
     color: COLORS.SAMPLE,
-    label: window.HUE_I18n.autocomplete.category.sample,
+    label: I18n('Samples'),
     detailsTemplate: 'value'
   },
   IDENTIFIER: {
     id: 'identifier',
     weight: 800,
     color: COLORS.IDENT_CTE_VAR,
-    label: window.HUE_I18n.autocomplete.category.identifier,
+    label: I18n('Identifiers'),
     detailsTemplate: 'identifier'
   },
   CTE: {
     id: 'cte',
     weight: 700,
     color: COLORS.IDENT_CTE_VAR,
-    label: window.HUE_I18n.autocomplete.category.cte,
+    label: I18n('CTEs'),
     detailsTemplate: 'cte'
   },
   TABLE: {
     id: 'table',
     weight: 600,
     color: COLORS.TABLE,
-    label: window.HUE_I18n.autocomplete.category.table,
+    label: I18n('Tables'),
     detailsTemplate: 'table'
   },
   DATABASE: {
     id: 'database',
     weight: 500,
     color: COLORS.DATABASE,
-    label: window.HUE_I18n.autocomplete.category.database,
+    label: I18n('Databases'),
     detailsTemplate: 'database'
   },
   UDF: {
     id: 'udf',
     weight: 400,
     color: COLORS.UDF,
-    label: window.HUE_I18n.autocomplete.category.udf,
+    label: I18n('UDFs'),
     detailsTemplate: 'udf'
   },
   OPTION: {
     id: 'option',
     weight: 400,
     color: COLORS.UDF,
-    label: window.HUE_I18n.autocomplete.category.option,
+    label: I18n('Options'),
     detailsTemplate: 'option'
   },
   HDFS: {
     id: 'hdfs',
     weight: 300,
     color: COLORS.HDFS,
-    label: window.HUE_I18n.autocomplete.category.hdfs,
+    label: I18n('Files'),
     detailsTemplate: 'hdfs'
   },
   VIRTUAL_COLUMN: {
     id: 'virtualColumn',
     weight: 200,
     color: COLORS.COLUMN,
-    label: window.HUE_I18n.autocomplete.category.column,
+    label: I18n('Columns'),
     detailsTemplate: 'column'
   },
   COLREF_KEYWORD: {
     id: 'colrefKeyword',
     weight: 100,
     color: COLORS.KEYWORD,
-    label: window.HUE_I18n.autocomplete.category.keyword,
+    label: I18n('Keywords'),
     detailsTemplate: 'keyword'
   },
   VARIABLE: {
     id: 'variable',
     weight: 50,
     color: COLORS.IDENT_CTE_VAR,
-    label: window.HUE_I18n.autocomplete.category.variable,
+    label: I18n('Variables'),
     detailsTemplate: 'variable'
   },
   KEYWORD: {
     id: 'keyword',
     weight: 0,
     color: COLORS.KEYWORD,
-    label: window.HUE_I18n.autocomplete.category.keyword,
+    label: I18n('Keywords'),
     detailsTemplate: 'keyword'
   },
   POPULAR_JOIN: {
     id: 'popularJoin',
     weight: 1500,
     color: COLORS.POPULAR,
-    label: window.HUE_I18n.autocomplete.category.popular,
+    label: I18n('Popular'),
     detailsTemplate: 'join'
   }
 };
@@ -547,7 +571,7 @@ class AutocompleteResults {
       const keywordSuggestions = $.map(self.parseResult.suggestKeywords, keyword => {
         return {
           value: self.parseResult.lowerCase ? keyword.value.toLowerCase() : keyword.value,
-          meta: window.HUE_I18n.autocomplete.meta.keyword,
+          meta: META_I18n.keyword,
           category: CATEGORIES.KEYWORD,
           weightAdjust: keyword.weight,
           popular: ko.observable(false),
@@ -573,7 +597,7 @@ class AutocompleteResults {
             self.parseResult.suggestColRefKeywords[typeForKeywords].forEach(keyword => {
               colRefKeywordSuggestions.push({
                 value: self.parseResult.lowerCase ? keyword.toLowerCase() : keyword,
-                meta: window.HUE_I18n.autocomplete.meta.keyword,
+                meta: META_I18n.keyword,
                 category: CATEGORIES.COLREF_KEYWORD,
                 popular: ko.observable(false),
                 details: {
@@ -615,7 +639,7 @@ class AutocompleteResults {
         if (type === 'COLREF') {
           columnAliasSuggestions.push({
             value: columnAlias.name,
-            meta: window.HUE_I18n.autocomplete.meta.alias,
+            meta: META_I18n.alias,
             category: CATEGORIES.COLUMN,
             popular: ko.observable(false),
             details: columnAlias
@@ -646,7 +670,7 @@ class AutocompleteResults {
         commonTableExpressionSuggestions.push({
           value: prefix + expression.name,
           filterValue: expression.name,
-          meta: window.HUE_I18n.autocomplete.meta.commonTableExpression,
+          meta: META_I18n.commonTableExpression,
           category: CATEGORIES.CTE,
           popular: ko.observable(false),
           details: null
@@ -752,7 +776,7 @@ class AutocompleteResults {
               sqlUtils.backTickIfNeeded(self.snippet.type(), dbEntry.name) +
               (suggestDatabases.appendDot ? '.' : ''),
             filterValue: dbEntry.name,
-            meta: window.HUE_I18n.autocomplete.meta.database,
+            meta: META_I18n.database,
             category: CATEGORIES.DATABASE,
             popular: ko.observable(false),
             hasCatalogEntry: true,
@@ -811,7 +835,7 @@ class AutocompleteResults {
                         prefix + sqlUtils.backTickIfNeeded(self.snippet.type(), tableEntry.name),
                       filterValue: tableEntry.name,
                       tableName: tableEntry.name,
-                      meta: window.HUE_I18n.autocomplete.meta[tableEntry.getType().toLowerCase()],
+                      meta: META_I18n[tableEntry.getType().toLowerCase()],
                       category: CATEGORIES.TABLE,
                       popular: ko.observable(false),
                       hasCatalogEntry: true,
@@ -889,14 +913,14 @@ class AutocompleteResults {
             ) {
               columnSuggestions.push({
                 value: 'BLOCK__OFFSET__INSIDE__FILE',
-                meta: window.HUE_I18n.autocomplete.meta.virtual,
+                meta: META_I18n.virtual,
                 category: CATEGORIES.VIRTUAL_COLUMN,
                 popular: ko.observable(false),
                 details: { name: 'BLOCK__OFFSET__INSIDE__FILE' }
               });
               columnSuggestions.push({
                 value: 'INPUT__FILE__NAME',
-                meta: window.HUE_I18n.autocomplete.meta.virtual,
+                meta: META_I18n.virtual,
                 category: CATEGORIES.VIRTUAL_COLUMN,
                 popular: ko.observable(false),
                 details: { name: 'INPUT__FILE__NAME' }
@@ -1218,7 +1242,7 @@ class AutocompleteResults {
               self.parseResult.colRef.identifierChain.length - 1
             ].name +
             '}',
-          meta: window.HUE_I18n.autocomplete.meta.variable,
+          meta: META_I18n.variable,
           category: CATEGORIES.VARIABLE,
           popular: ko.observable(false),
           details: null
@@ -1236,7 +1260,7 @@ class AutocompleteResults {
           colRef.sample.forEach(sample => {
             valueSuggestions.push({
               value: isString ? startQuote + sample + endQuote : new String(sample),
-              meta: window.HUE_I18n.autocomplete.meta.sample,
+              meta: META_I18n.sample,
               category: CATEGORIES.SAMPLE,
               popular: ko.observable(false),
               details: null
@@ -1262,7 +1286,7 @@ class AutocompleteResults {
         self.appendEntries([
           {
             value: 'adl://',
-            meta: window.HUE_I18n.autocomplete.meta.keyword,
+            meta: META_I18n.keyword,
             category: CATEGORIES.KEYWORD,
             weightAdjust: 0,
             popular: ko.observable(false),
@@ -1270,7 +1294,7 @@ class AutocompleteResults {
           },
           {
             value: 's3a://',
-            meta: window.HUE_I18n.autocomplete.meta.keyword,
+            meta: META_I18n.keyword,
             category: CATEGORIES.KEYWORD,
             weightAdjust: 0,
             popular: ko.observable(false),
@@ -1278,7 +1302,7 @@ class AutocompleteResults {
           },
           {
             value: 'hdfs://',
-            meta: window.HUE_I18n.autocomplete.meta.keyword,
+            meta: META_I18n.keyword,
             category: CATEGORIES.KEYWORD,
             weightAdjust: 0,
             popular: ko.observable(false),
@@ -1286,7 +1310,7 @@ class AutocompleteResults {
           },
           {
             value: '/',
-            meta: 'dir',
+            meta: META_I18n.dir,
             category: CATEGORIES.HDFS,
             popular: ko.observable(false),
             details: null
@@ -1453,7 +1477,7 @@ class AutocompleteResults {
                         totalCount += value.totalQueryCount;
                         joinSuggestions.push({
                           value: suggestionString,
-                          meta: window.HUE_I18n.autocomplete.meta.join,
+                          meta: META_I18n.join,
                           category: suggestJoins.prependJoin
                             ? CATEGORIES.POPULAR_JOIN
                             : CATEGORIES.POPULAR_ACTIVE_JOIN,
@@ -1537,7 +1561,7 @@ class AutocompleteResults {
                         totalCount += value.totalQueryCount;
                         joinConditionSuggestions.push({
                           value: suggestionString,
-                          meta: window.HUE_I18n.autocomplete.meta.joinCondition,
+                          meta: META_I18n.joinCondition,
                           category: CATEGORIES.POPULAR_JOIN_CONDITION,
                           popular: ko.observable(true),
                           details: value
@@ -1736,10 +1760,7 @@ class AutocompleteResults {
               suggestions.push({
                 value: prefix + filterValue,
                 filterValue: filterValue,
-                meta:
-                  navOptAttribute === 'groupByColumn'
-                    ? window.HUE_I18n.autocomplete.meta.groupBy
-                    : window.HUE_I18n.autocomplete.meta.orderBy,
+                meta: navOptAttribute === 'groupByColumn' ? META_I18n.groupBy : META_I18n.orderBy,
                 category:
                   navOptAttribute === 'groupByColumn'
                     ? CATEGORIES.POPULAR_GROUP_BY
@@ -1858,7 +1879,7 @@ class AutocompleteResults {
                               totalCount += popularValue.count;
                               filterSuggestions.push({
                                 value: compVal,
-                                meta: window.HUE_I18n.autocomplete.meta.filter,
+                                meta: META_I18n.filter,
                                 category: CATEGORIES.POPULAR_FILTER,
                                 popular: ko.observable(true),
                                 details: popularValue

+ 3 - 2
desktop/core/src/desktop/js/sql/spec/autocompleteResultsSpec.js

@@ -20,6 +20,7 @@ import 'jasmine-ajax';
 import AutocompleteResults from '../autocompleteResults';
 import dataCatalog from 'catalog/dataCatalog';
 import huePubSub from 'utils/huePubSub';
+import I18n from 'utils/i18n';
 import LOTS_OF_PARSE_RESULTS from './lotsOfParseResults';
 
 describe('AutocompleteResults.js', () => {
@@ -345,9 +346,9 @@ describe('AutocompleteResults.js', () => {
     });
     expect(subject.filtered().length).toBe(2);
     // Sorted by weight, case adjusted
-    expect(subject.filtered()[0].meta).toBe(window.HUE_I18n.autocomplete.meta.keyword);
+    expect(subject.filtered()[0].meta).toBe(I18n('keyword'));
     expect(subject.filtered()[0].value).toBe('foo');
-    expect(subject.filtered()[1].meta).toBe(window.HUE_I18n.autocomplete.meta.keyword);
+    expect(subject.filtered()[1].meta).toBe(I18n('keyword'));
     expect(subject.filtered()[1].value).toBe('bar');
   });
 

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

@@ -15,9 +15,11 @@
 // limitations under the License.
 
 import $ from 'jquery';
+
 import apiHelper from 'api/apiHelper';
 import hueAnalytics from 'utils/hueAnalytics';
 import huePubSub from 'utils/huePubSub';
+import I18n from 'utils/i18n';
 
 class TopNavViewModel {
   constructor(onePageViewModel) {
@@ -98,7 +100,7 @@ class TopNavViewModel {
 
           if (window.SHOW_ADD_MORE_EDITORS && app.name === 'editor') {
             interpreters.push({
-              displayName: window.HUE_I18n.general.addMore,
+              displayName: I18n('Add more...'),
               dividerAbove: true,
               href: 'http://gethue.com/sql-editor/'
             });

+ 19 - 0
desktop/core/src/desktop/js/utils/i18n.js

@@ -0,0 +1,19 @@
+// Licensed to Cloudera, Inc. under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  Cloudera, Inc. licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+const I18n = identifier => HUE_I18n[identifier] || identifier;
+
+export default I18n;

+ 1 - 1
desktop/core/src/desktop/static/desktop/js/document/hueFileEntry.js

@@ -116,7 +116,7 @@ var HueFileEntry = (function () {
           var entryType = entry.definition().type;
           return (typeFilter === 'all' || entryType === typeFilter || entryType === 'directory')
             && (!filter || entry.definition().name.toLowerCase().indexOf(filter) !== -1 ||
-            (HUE_I18n.documentType[entryType] && HUE_I18n.documentType[entryType].toLowerCase().indexOf(filter) !== -1) ||
+            (window.DOCUMENT_TYPE_I18n[entryType] && window.DOCUMENT_TYPE_I18n[entryType].toLowerCase().indexOf(filter) !== -1) ||
             entry.definition().description.toLowerCase().indexOf(filter) !== -1);
         })
       }

+ 0 - 680
desktop/core/src/desktop/static/desktop/js/jquery.filechooser.js

@@ -1,680 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
- * jHue fileChooser plugin
- */
-;
-(function ($, window, document, undefined) {
-
-  var pluginName = "jHueFileChooser",
-    defaults = {
-      initialPath: "",
-      forceRefresh: false,
-      errorRedirectPath: "",
-      createFolder: true,
-      uploadFile: true,
-      selectFolder: false,
-      suppressErrors: false,
-      displayOnlyFolders: false,
-      showExtraHome: false,
-      extraHomeProperties: {},
-      filterExtensions: "",
-      labels: {
-        BACK: "Back",
-        SELECT_FOLDER: "Select this folder",
-        CREATE_FOLDER: "Create folder",
-        FOLDER_NAME: "Folder name",
-        CANCEL: "Cancel",
-        FILE_NOT_FOUND: "The file has not been found",
-        UPLOAD_FILE: "Upload a file",
-        FAILED: "Failed",
-        HOME: "Home"
-      },
-      filesystems: ['hdfs'],
-      filesysteminfo: {
-        "": {
-          scheme: "",
-          root: "/",
-          home: "/?default_to_home",
-          icon: {
-            brand: "fa-files-o",
-            home: "fa-home",
-          },
-          label : {
-            home: "home",
-            name: "HDFS",
-          }
-        },
-        hdfs: {
-          scheme: "",
-          root: "/",
-          home: "/?default_to_home",
-          icon: {
-            brand: "fa-files-o",
-            home: "fa-home",
-          },
-          label : {
-            home: "home",
-            name: "HDFS",
-          }
-        },
-        s3a: {
-          scheme: "s3a",
-          root: "s3a://",
-          home: "s3a://",
-          icon: {
-            brand: "fa-cubes",
-            home: "fa-cubes",
-          },
-          label : {
-            home: "",
-            name: "S3"
-          }
-        },
-        adl: {
-          scheme: "adl",
-          root: "adl:/",
-          home: "adl:/",
-          icon: {
-            svg:{
-              brand: "#hi-adls",
-              home: "#hi-adls"
-            },
-            brand: "fa-windows",
-            home: "fa-windows"
-          },
-          label : {
-            home: "",
-            name: "ADLS"
-          }
-        }
-      },
-      fsSelected: 'hdfs',
-      user: "",
-      onNavigate: function () {
-      },
-      onFileChoose: function () {
-      },
-      onFolderChoose: function () {
-      },
-      onFolderChange: function () {
-      },
-      onError: function () {
-      }
-    },
-    STORAGE_PREFIX = "hueFileBrowserLastPathForUser_";
-
-  function Plugin(element, options) {
-    this.element = element;
-    $(element).data('jHueFileChooser', this);
-
-    this.options = $.extend({}, defaults, { user: LOGGED_USERNAME }, options);
-    this.options.labels = $.extend({}, defaults.labels, HUE_I18n.jHueFileChooser, options ? options.labels : {});
-    this._defaults = defaults;
-    this._name = pluginName;
-    this.previousPath = "";
-    this.init();
-  }
-
-  Plugin.prototype.setOptions = function (options) {
-    var self = this;
-    self.options = $.extend({}, defaults, { user: LOGGED_USERNAME }, options);
-    self.options.labels = $.extend({}, defaults.labels, HUE_I18n.jHueFileChooser, options ? options.labels : {});
-    var initialPath = $.trim(self.options.initialPath);
-    var scheme = initialPath && initialPath.substring(0,initialPath.indexOf(":"));
-    if (scheme && scheme.length) {
-      self.options.fsSelected = scheme;
-    }
-
-    $(self.element).find('.filechooser-services li').removeClass('active');
-    $(self.element).find('.filechooser-services li[data-fs="' + self.options.fsSelected + '"]').addClass('active');
-
-    if (self.options.forceRefresh) {
-      if (initialPath != "") {
-        self.navigateTo(self.options.initialPath);
-      } else if ($.totalStorage(STORAGE_PREFIX + self.options.user + self.options.fsSelected) != null) {
-        self.navigateTo($.totalStorage(STORAGE_PREFIX + self.options.user + self.options.fsSelected));
-      } else {
-        self.navigateTo("/?default_to_home");
-      }
-    } else {
-      if (initialPath != "") {
-        self.navigateTo(self.options.initialPath);
-      } else if ($.totalStorage(STORAGE_PREFIX + self.options.user + self.options.fsSelected) != null) {
-        self.navigateTo($.totalStorage(STORAGE_PREFIX + self.options.user + self.options.fsSelected));
-      }
-    }
-  };
-
-  function getScheme (path) {
-    var index = path.indexOf("://");
-    return index >= 0 ? path.substring(0, index) : "hdfs";
-  }
-
-  function getFs (scheme) {
-    if (scheme === 'adl') {
-      return 'adls';
-    } else if (scheme === 's3a' ){
-      return 's3';
-    } else if (!scheme || scheme === 'hdfs') {
-      return 'hdfs';
-    } else {
-      return scheme;
-    }
-  }
-
-  Plugin.prototype.setFileSystems = function (filesystems) {
-    var self = this, filters, filesystemsFiltered;
-    self.options.filesystems = [];
-    Object.keys(filesystems).forEach(function (k) {
-      if (filesystems[k]) {
-        self.options.filesystems.push(k);
-      }
-    });
-    self.options.filesystems.sort();
-    if (self.options.filesystemsFilter) {
-      filters = self.options.filesystemsFilter.reduce(function(filters, fs) {
-      filters[fs] = true;
-      return filters;
-    }, {});
-      filesystemsFiltered = self.options.filesystems.filter(function(fs) {
-        return filters[fs];
-      });
-    } else {
-      filesystemsFiltered = self.options.filesystems;
-    }
-
-    $(self.element).data('fs', filesystemsFiltered);
-    if (filesystemsFiltered.length > 1) {
-      var $ul = $('<ul>').addClass('nav nav-list').css('border', 'none');
-      filesystemsFiltered.forEach(function (fs) {
-        var filesysteminfo = self.options.filesysteminfo;
-        var $li = $('<li>').attr('data-fs', fs).addClass(self.options.fsSelected === fs ? 'active' : '').html('<a class="pointer" style="padding-left: 6px">' + (filesysteminfo[fs] ? filesysteminfo[fs].label.name : fs.toUpperCase()) + '</a>');
-        $li.on('click', function () {
-          $(this).siblings().removeClass('active');
-          $(this).addClass('active');
-          self.options.fsSelected = fs;
-          var storedPath = $.totalStorage(STORAGE_PREFIX + self.options.user + self.options.fsSelected);
-          if (storedPath !== null) {
-            if (filesysteminfo[fs] && storedPath.toLowerCase().indexOf(fs) === -1) {
-              self.navigateTo(filesysteminfo[fs].home);
-            } else {
-              self.navigateTo(storedPath);
-            }
-          } else {
-            self.navigateTo(filesysteminfo[fs] ? filesysteminfo[fs].home : '/?default_to_home');
-          }
-        });
-        $li.appendTo($ul);
-      });
-      $(self.element).find('.filechooser-services').empty().width(80);
-      $(self.element).find('.filechooser-tree').width(480).css('paddingLeft', '6px').css('borderLeft', '1px solid #EEE').css('marginLeft', '80px').css('min-height', '330px');
-      $ul.appendTo($(self.element).find('.filechooser-services'));
-    }
-  };
-
-  //TODO: refactor this method to template
-  Plugin.prototype.navigateTo = function (path) {
-    var _parent = this;
-    $(_parent.element).find('.filechooser-tree').html("<i style=\"font-size: 24px; color: #DDD\" class=\"fa fa-spinner fa-spin\"></i>");
-    var pageSize = '?pagesize=1000';
-    if (path.indexOf('?') > -1) {
-      pageSize = pageSize.replace(/\?/, '&');
-    }
-    $.getJSON("/filebrowser/view=" + path + pageSize, function (data) {
-      $(_parent.element).find('.filechooser-tree').empty();
-
-      path = data.current_dir_path || path; // use real path.
-      var _flist = $("<ul>").addClass("unstyled").css({
-        'height': '260px',
-        'overflow-y': 'auto'
-      });
-      var $homeBreadcrumb = $("<ul>").addClass("hue-breadcrumbs").css({
-        'padding': '0',
-        'marginLeft': '0',
-        'float': 'left',
-        'white-space': 'nowrap'
-      });
-      var _home = $("<li>");
-      //var filesysteminfo = self.options.filesysteminfo;
-      var fs = _parent.options.filesysteminfo[_parent.options.fsSelected || "hdfs"];
-      var el = fs.icon.svg ? '<svg class="hi"><use xlink:href="'+fs.icon.svg.home+'"></use></svg>' : '<i class="fa '+fs.icon.home+'"></i> ' + fs.label.home;
-      var _homelink = $("<a>").addClass("nounderline").html(el).css("cursor", "pointer").click(function () {
-        _parent.navigateTo(fs.home);
-      });
-
-      _homelink.appendTo(_home);
-      _home.appendTo($homeBreadcrumb);
-
-      $("<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'));
-        $("<div class='clearfix'>").appendTo($(_parent.element).find('.filechooser-tree'));
-        var _errorMsg = $("<div>").addClass("alert").addClass("alert-error").text(data.message ? data.message : data.error);
-        _errorMsg.appendTo($(_parent.element).find('.filechooser-tree'));
-        //TODO: allow user to user breadcrums when there is an error
-        var _previousLink = $("<a>").addClass("btn").text(_parent.options.labels.BACK).click(function () {
-          function getParentPath (path) {
-            if (!path) return path;
-            var indexFirst = path.indexOf("/");
-            var indexLast = path.lastIndexOf("/");
-            return indexLast - indexFirst > 1 && indexLast > 0 ? path.substring(0, indexLast + 1) : path;
-          }
-          var next = path !== _parent.previousPath && getScheme(path) === getScheme(_parent.previousPath) ? _parent.previousPath : getParentPath(path);
-          _parent.options.onFolderChange(next);
-          _parent.navigateTo(next);
-        });
-        _previousLink.appendTo($(_parent.element).find('.filechooser-tree'));
-      } else {
-        if (data.type == "file") {
-          _parent.navigateTo(data.view.dirname);
-          return;
-        }
-        $.totalStorage(STORAGE_PREFIX + _parent.options.user + _parent.options.fsSelected, path);
-        _parent.previousPath = path;
-        _parent.options.onNavigate(_parent.previousPath);
-
-        var $search = $('<div>').html('<i class="fa fa-refresh inactive-action pointer" style="position: absolute; top: 3px; margin-left: -16px"></i> <i class="fa fa-search inactive-action pointer" style="position: absolute; top: 3px"></i><input type="text" class="small-search" style="display: none; width: 0; padding: 2px; padding-left: 20px">').css({
-          'position': 'absolute',
-          'right': '20px',
-          'background-color': '#FFF'
-        });
-
-        function slideOutInput() {
-          $search.find('input').animate({
-            'width': '0'
-          }, 100, function(){
-            $search.find('input').hide();
-            $search.find('.fa-refresh').show();
-          });
-        }
-
-        var $searchInput = $search.find('input');
-        function tog(v) {
-          return v ? "addClass" : "removeClass";
-        }
-        $searchInput.addClass("clearable");
-        $searchInput.on("input", function () {
-          $searchInput[tog(this.value)]("x");
-        })
-        .on("mousemove", function (e) {
-          $searchInput[tog(this.offsetWidth - 18 < e.clientX - this.getBoundingClientRect().left)]("onX");
-        })
-        .on("click", function (e) {
-          if (this.offsetWidth - 18 < e.clientX - this.getBoundingClientRect().left) {
-            $searchInput.removeClass("x onX").val("");
-          }
-        });
-        if (!isIE11) {
-          $searchInput.on("blur", function (e) {
-            if ($searchInput.val() === ''){
-              slideOutInput();
-            }
-          });
-        }
-
-        $search.find('.fa-search').on('click', function(){
-          if ($searchInput.is(':visible')){
-            slideOutInput();
-          } else {
-            $search.find('.fa-refresh').hide();
-            $searchInput.show().animate({
-              'width': '100px'
-            }, 100, function(){
-              $searchInput.focus();
-            });
-          }
-        });
-
-        $search.find('.fa-refresh').on('click', function(){
-          _parent.navigateTo(path);
-        });
-
-        $search.appendTo($(_parent.element).find('.filechooser-tree'));
-
-        var $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]);
-        }
-
-        if (_parent.options.showExtraHome) {
-          var _extraHome = $("<li>");
-          var _extraHomelink = $("<a>").addClass("nounderline").html('<i class="fa ' + _parent.options.extraHomeProperties.icon + '"></i> ' + _parent.options.extraHomeProperties.label).css("cursor", "pointer").click(function () {
-            _parent.navigateTo(_parent.options.extraHomeProperties.path);
-          });
-          _extraHomelink.appendTo(_extraHome);
-          $("<span>").addClass("divider").css("margin-right", "20px").appendTo(_extraHome);
-          _extraHome.appendTo($scrollingBreadcrumbs);
-        }
-
-        var $hdfsAutocomplete = $('<input type="text">').addClass('editable-breadcrumb-input').val(path).hide();
-
-        $scrollingBreadcrumbs.click(function (e) {
-          if ($(e.target).is('ul') || $(e.target).hasClass('spacer')) {
-            $(this).hide();
-            $hdfsAutocomplete.show().focus();
-          }
-        });
-
-        var $editBreadcrumbs = $("<li>").css('marginRight', '2px');
-        var $crumbLink = $("<span>").addClass('spacer');
-        $crumbLink.html('&nbsp;').appendTo($editBreadcrumbs);
-        $editBreadcrumbs.appendTo($scrollingBreadcrumbs);
-        if (typeof data.breadcrumbs != "undefined" && data.breadcrumbs != null) {
-          var _bLength = data.breadcrumbs.length;
-          $(data.breadcrumbs).each(function (cnt, crumb) {
-            var _crumb = $("<li>");
-            var _crumbLink = $("<a>");
-            var _crumbLabel = (crumb.label != null && crumb.label != "") ? crumb.label : "/";
-            _crumbLink.attr("href", "javascript:void(0)").text(_crumbLabel).appendTo(_crumb);
-            if (cnt < _bLength - 1) {
-              if (cnt > 0) {
-                $("<span>").addClass("divider").text("/").appendTo(_crumb);
-              } else {
-                $("<span>").html("&nbsp;").appendTo(_crumb);
-              }
-            }
-            _crumb.click(function () {
-              var _url = (crumb.url != null && crumb.url != "") ? crumb.url : "/";
-              _parent.options.onFolderChange(_url);
-              _parent.navigateTo(_url);
-            });
-            _crumb.appendTo($scrollingBreadcrumbs);
-          });
-        }
-        $homeBreadcrumb.appendTo($(_parent.element).find('.filechooser-tree'));
-        $scrollingBreadcrumbs.appendTo($(_parent.element).find('.filechooser-tree'));
-        $hdfsAutocomplete.appendTo($(_parent.element).find('.filechooser-tree'));
-
-        $hdfsAutocomplete.jHueHdfsAutocomplete({
-          home: "/user/" + _parent.options.user + "/",
-          skipEnter: true,
-          skipKeydownEvents: true,
-          onEnter: function (el) {
-            var _url = el.val();
-            _parent.options.onFolderChange(_url);
-            _parent.navigateTo(_url);
-            $("#jHueHdfsAutocomplete").hide();
-          },
-          onBlur: function () {
-            $hdfsAutocomplete.hide();
-            $scrollingBreadcrumbs.show();
-          },
-          smartTooltip: _parent.options.labels.SMART_TOOLTIP
-        });
-
-        $('<div>').addClass('clearfix').appendTo($(_parent.element).find('.filechooser-tree'));
-
-        var resizeBreadcrumbs = window.setInterval(function(){
-          if ($homeBreadcrumb.is(':visible') && $homeBreadcrumb.width() > 0){
-            window.clearInterval(resizeBreadcrumbs);
-            $scrollingBreadcrumbs.width($(_parent.element).find('.filechooser-tree').width() - $homeBreadcrumb.width() - 65);
-          }
-        }, 100);
-
-        $(data.files).each(function (cnt, file) {
-          var _addFile = file.name !== '.';
-          if (_parent.options.filterExtensions != "" && file.type == "file") {
-            var _allowedExtensions = _parent.options.filterExtensions.split(",");
-            var _fileExtension = file.name.split(".").pop().toLowerCase();
-            _addFile = _allowedExtensions.indexOf(_fileExtension) > -1;
-          }
-          if (_addFile) {
-            var _f = $("<li>");
-            var _flink = $("<a>");
-
-            if (file.type == "dir") {
-              _flink.attr("href", "javascript:void(0)");
-              if (file.path.toLowerCase().indexOf('s3a://') == 0 && (file.path.substr(6).indexOf('/') > -1 || file.path.substr(6) == '')) {
-                _flink.text(" " + (cnt > 0 ? file.name : ".."))
-              } else {
-                _flink.text(" " + (file.name != "" ? file.name : ".."));
-              }
-              if (_flink.text() !== ' ..') {
-                _f.addClass('file-list-item');
-              }
-              _flink.appendTo(_f);
-              if (file.path.toLowerCase().indexOf('s3a://') == 0 && file.path.substr(5).indexOf('/') == -1) {
-                $("<i class='fa fa-cloud'></i>").prependTo(_flink);
-              } else {
-                $("<i class='fa fa-folder'></i>").prependTo(_flink);
-              }
-              _flink.click(function () {
-                _parent.options.onFolderChange(file.path);
-                _parent.navigateTo(file.path);
-              });
-            }
-            if (file.type == "file" && !_parent.options.displayOnlyFolders) {
-              _f.addClass('file-list-item');
-              _flink.attr("href", "javascript:void(0)").text(" " + (file.name != "" ? file.name : "..")).appendTo(_f);
-              $("<i class='fa fa-file-o'></i>").prependTo(_flink);
-              _flink.click(function () {
-                _parent.options.onFileChoose(file.path);
-              });
-            }
-            _f.appendTo(_flist);
-          }
-        });
-
-        _flist.appendTo($(_parent.element).find('.filechooser-tree'));
-
-        $searchInput.jHueDelayedInput(function () {
-          var filter = $searchInput.val().toLowerCase();
-          var results = 0;
-          $(_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) {
-              $(this).show();
-              results++;
-            } else {
-              $(this).hide();
-            }
-          });
-          if (results == 0){
-            $(_parent.element).find('.filechooser-tree .no-results').show();
-          }
-        }, 300);
-
-        var _actions = $("<div>").addClass("jHueFilechooserActions");
-        var _showActions = false;
-        var _uploadFileBtn;
-        var _createFolderBtn;
-        var _selectFolderBtn;
-        if (_parent.options.uploadFile) {
-          _uploadFileBtn = $("<div>").attr("id", "file-uploader").addClass('fileChooserActionUploader');
-          _uploadFileBtn.appendTo(_actions);
-          _showActions = true;
-          initUploader(path, _parent, _uploadFileBtn, _parent.options.labels);
-        }
-        if (_parent.options.selectFolder) {
-          _selectFolderBtn = $("<a>").addClass("btn").text(_parent.options.labels.SELECT_FOLDER);
-          if (_parent.options.uploadFile) {
-            _selectFolderBtn.css("margin-top", "10px");
-          }
-          _selectFolderBtn.appendTo(_actions);
-          _showActions = true;
-          _selectFolderBtn.click(function () {
-            _parent.options.onFolderChoose(path);
-          });
-        }
-        $("<span> </span>").appendTo(_actions);
-        if (_parent.options.createFolder) {
-          _createFolderBtn = $("<a>").addClass("btn").text(_parent.options.labels.CREATE_FOLDER);
-          if (_parent.options.uploadFile) {
-            _createFolderBtn.css("margin-top", "10px");
-          }
-          _createFolderBtn.appendTo(_actions);
-          _showActions = true;
-          var _createFolderDetails = $("<form>").css({"margin-top": "10px", "position": "fixed"}).addClass("form-inline");
-          _createFolderDetails.hide();
-          var _folderName = $("<input>").attr("type", "text").attr("placeholder", _parent.options.labels.FOLDER_NAME).appendTo(_createFolderDetails);
-          $("<span> </span>").appendTo(_createFolderDetails);
-          var _folderBtn = $("<input>").attr("type", "button").attr("value", _parent.options.labels.CREATE_FOLDER).addClass("btn primary").appendTo(_createFolderDetails);
-          $("<span> </span>").appendTo(_createFolderDetails);
-          var _folderCancel = $("<input>").attr("type", "button").attr("value", _parent.options.labels.CANCEL).addClass("btn").appendTo(_createFolderDetails);
-          _folderCancel.click(function () {
-            if (_uploadFileBtn) {
-              _uploadFileBtn.removeClass("disabled");
-            }
-            _createFolderBtn.removeClass("disabled");
-            _createFolderDetails.slideUp();
-          });
-          _folderBtn.click(function () {
-            if (_folderName.val().length > 0) {
-              $.ajax({
-                type: "POST",
-                url: "/filebrowser/mkdir",
-                data: {
-                  name: _folderName.val(),
-                  path: path
-                },
-                success: function (xhr, status) {
-                  if (status == "success") {
-                    _parent.navigateTo(path);
-                    if (_uploadFileBtn) {
-                      _uploadFileBtn.removeClass("disabled");
-                    }
-                    _createFolderBtn.removeClass("disabled");
-                    _createFolderDetails.slideUp();
-                  }
-                },
-                error: function (xhr) {
-                  $(document).trigger("error", xhr.responseText);
-                }
-              });
-            }
-          });
-
-          _createFolderDetails.appendTo(_actions);
-
-          _createFolderBtn.click(function () {
-            if (_uploadFileBtn) {
-              _uploadFileBtn.addClass("disabled");
-            }
-            _createFolderBtn.addClass("disabled");
-            _createFolderDetails.slideDown();
-          });
-        }
-        if (_showActions) {
-          _actions.appendTo($(_parent.element).find('.filechooser-tree'));
-        }
-
-        window.setTimeout(function () {
-          $(_parent.element).parent().scrollTop(0);
-          $scrollingBreadcrumbs.animate({
-            'scrollLeft': $scrollingBreadcrumbs.width()
-          });
-        }, 0);
-      }
-    }).fail(function (e) {
-      if (!_parent.options.suppressErrors) {
-        $(document).trigger("info", _parent.options.labels.FILE_NOT_FOUND);
-        _parent.options.onError();
-      }
-      if (e.status === 404 || e.status === 500) {
-        var fs = _parent.options.filesysteminfo[_parent.options.fsSelected || "hdfs"];
-        _parent.navigateTo(_parent.options.errorRedirectPath !== "" ? _parent.options.errorRedirectPath : fs.home);
-      } else {
-        console.error(e);
-        $(document).trigger("error", e.statusText);
-      }
-    });
-  };
-
-  var num_of_pending_uploads = 0;
-
-  function initUploader(path, _parent, el, labels) {
-    var uploader = new qq.FileUploader({
-      element: el[0],
-      action: '/filebrowser/upload/file',
-      params: {
-        dest: path,
-        fileFieldLabel: 'hdfs_file'
-      },
-      onComplete: function (id, fileName, responseJSON) {
-        num_of_pending_uploads--;
-        if (responseJSON.status == -1) {
-          $(document).trigger("error", responseJSON.data);
-        } else if (!num_of_pending_uploads) {
-          _parent.navigateTo(path);
-          window.huePubSub.publish('assist.' + getFs(getScheme(path)) + '.refresh');
-        }
-      },
-      onSubmit: function (id, fileName) {
-        num_of_pending_uploads++;
-      },
-      template: '<div class="qq-uploader">' +
-      '<div class="qq-upload-drop-area"><span></span></div>' +
-      '<div class="qq-upload-button">' + labels.UPLOAD_FILE + '</div><br>' +
-      '<ul class="qq-upload-list"></ul>' +
-      '</div>',
-      fileTemplate: '<li>' +
-      '<span class="qq-upload-file"></span>' +
-      '<span class="qq-upload-spinner"></span>' +
-      '<span class="qq-upload-size"></span>' +
-      '<a class="qq-upload-cancel" href="#">' + labels.CANCEL + '</a>' +
-      '<span class="qq-upload-failed-text">' + labels.FAILED + '</span>' +
-      '</li>',
-      debug: false
-    });
-  }
-
-  Plugin.prototype.init = function () {
-    var self = this;
-    $(self.element).empty().html('<div class="filechooser-container" style="position: relative"><div class="filechooser-services" style="position: absolute"></div><div class="filechooser-tree" style="width: 560px"></div></div>');
-    $.post('/filebrowser/api/get_filesystems', function (data) {
-      var initialPath = $.trim(self.options.initialPath);
-      var scheme = initialPath && initialPath.substring(0,initialPath.indexOf(":"));
-      if (data && data.status === 0) {
-        if (scheme && scheme.length && data.filesystems[scheme]) {
-          self.options.fsSelected = scheme;
-        }
-        self.setFileSystems(data.filesystems);
-      }
-      if (initialPath != "") {
-        self.navigateTo(self.options.initialPath);
-      } else if ($.totalStorage(STORAGE_PREFIX + self.options.user + self.options.fsSelected) != null) {
-        self.navigateTo($.totalStorage(STORAGE_PREFIX + self.options.user + self.options.fsSelected));
-      } else {
-        self.navigateTo("/?default_to_home");
-      }
-    });
-  };
-
-  $.fn[pluginName] = function (options) {
-    return this.each(function () {
-      if (!$.data(this, 'plugin_' + pluginName)) {
-        $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
-      }
-      else {
-        $.data(this, 'plugin_' + pluginName).setOptions(options);
-      }
-    });
-  }
-
-})(jQuery, window, document);

+ 0 - 539
desktop/core/src/desktop/static/desktop/js/jquery.tableextender.js

@@ -1,539 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-/*
- * jHue table extender plugin
- *
- */
-;
-(function ($, window, document, undefined) {
-
-  var pluginName = "jHueTableExtender",
-    defaults = {
-      fixedHeader: false,
-      fixedFirstColumn: false,
-      fixedFirstColumnTopMargin: 0,
-      headerSorting: true,
-      lockSelectedRow: false,
-      firstColumnTooltip: false,
-      classToRemove: 'resultTable',
-      hintElement: null,
-      includeNavigator: true,
-      mainScrollable: window,
-      stickToTopPosition: -1,
-      app: null,
-      labels: {
-        GO_TO_COLUMN: "Go to column:",
-        PLACEHOLDER: "column name...",
-        LOCK: "Click to lock row",
-        UNLOCK: "Click to unlock row"
-      }
-    };
-
-  function Plugin(element, options) {
-    this.element = element;
-    this.setOptions(options);
-    this._name = pluginName;
-    this.init();
-  }
-
-  Plugin.prototype.setOptions = function (options) {
-    this.options = $.extend({}, defaults, options);
-    this.options.labels = $.extend({}, defaults.labels, HUE_I18n.jHueTableExtender, options ? options.labels : {});
-    this._defaults = defaults;
-
-    if (this.options.fixedHeader) {
-      drawHeader(this);
-    }
-    if (this.options.fixedFirstColumn) {
-      drawFirstColumn(this);
-    }
-  };
-
-  Plugin.prototype.resetSource = function () {
-    var _this = this;
-    if (_this.options.includeNavigator) {
-      var source = [];
-      $(this.element).find("th").each(function () {
-        source.push($(this).text());
-      });
-
-      $("#jHueTableExtenderNavigator").find("input").data('typeahead').source = source;
-    }
-  };
-
-  Plugin.prototype.drawHeader = function (skipCreation) {
-    drawHeader(this, skipCreation);
-  }
-
-  Plugin.prototype.drawFirstColumn = function () {
-    drawFirstColumn(this);
-  }
-
-  Plugin.prototype.drawLockedRows = function (force) {
-    var _this = this;
-    var $pluginElement = $(_this.element);
-    if ($pluginElement.data('lockedRows')) {
-      var locks = $pluginElement.data('lockedRows');
-      Object.keys(locks).forEach(function (idx) {
-        drawLockedRow(_this, idx.substr(1), force);
-      });
-    }
-  }
-
-
-  Plugin.prototype.init = function () {
-
-    $.expr[":"].econtains = function (obj, index, meta, stack) {
-      return (obj.textContent || obj.innerText || $(obj).text() || "").toLowerCase() == meta[3].toLowerCase();
-    }
-
-    var _this = this;
-    if (_this.options.includeNavigator) {
-      var jHueTableExtenderNavigator = $("<div>").attr("id", "jHueTableExtenderNavigator");
-      $("<a>").attr("href", "#").addClass("pull-right").html("&times;").click(function (e) {
-        e.preventDefault();
-        $(this).parent().hide();
-      }).appendTo(jHueTableExtenderNavigator);
-      $("<label>").html(_this.options.labels.GO_TO_COLUMN + " <input type=\"text\" placeholder=\"" + _this.options.labels.PLACEHOLDER + "\" />").appendTo(jHueTableExtenderNavigator);
-
-      jHueTableExtenderNavigator.appendTo(HUE_CONTAINER);
-
-      $(_this.element).find("tbody").click(function (event) {
-        if ($.trim(getSelection()) == "") {
-          window.setTimeout(function () {
-            $(".rowSelected").removeClass("rowSelected");
-            $(".columnSelected").removeClass("columnSelected");
-            $(".cellSelected").removeClass("cellSelected");
-            $(event.target.parentNode).addClass("rowSelected");
-            $(event.target.parentNode).find("td").addClass("rowSelected");
-            jHueTableExtenderNavigator
-              .css("left", (event.pageX + jHueTableExtenderNavigator.width() > $(window).width() - 10 ? event.pageX - jHueTableExtenderNavigator.width() - 10 : event.pageX) + "px")
-              .css("top", (event.pageY + 10) + "px").show();
-            jHueTableExtenderNavigator.find("input").focus();
-          }, 100);
-        }
-      });
-
-      var source = [];
-      $(_this.element).find("th").each(function () {
-        source.push($(this).text());
-      });
-
-      jHueTableExtenderNavigator.find("input").typeahead({
-        source: source,
-        updater: function (item) {
-          jHueTableExtenderNavigator.hide();
-          $(_this.element).find("tr td:nth-child(" + ($(_this.element).find("th:econtains(" + item + ")").index() + 1) + ")").addClass("columnSelected");
-          if (_this.options.firstColumnTooltip) {
-            $(_this.element).find("tr td:nth-child(" + ($(_this.element).find("th:econtains(" + item + ")").index() + 1) + ")").each(function () {
-              $(this).attr("rel", "tooltip").attr("title", "#" + $(this).parent().find("td:first-child").text()).tooltip({
-                placement: 'left'
-              });
-            });
-          }
-          $(_this.element).parent().animate({
-            scrollLeft: $(_this.element).find("th:econtains(" + item + ")").position().left + $(_this.element).parent().scrollLeft() - $(_this.element).parent().offset().left - 30
-          }, 300);
-          $(_this.element).find("tr.rowSelected td:nth-child(" + ($(_this.element).find("th:econtains(" + item + ")").index() + 1) + ")").addClass("cellSelected");
-        }
-      });
-
-      $(_this.element).parent().bind("mouseleave", function () {
-        jHueTableExtenderNavigator.hide();
-      });
-
-      jHueTableExtenderNavigator.bind("mouseenter", function (e) {
-        jHueTableExtenderNavigator.show();
-      });
-    }
-
-    if (_this.options.hintElement != null) {
-      var showAlertTimeout = -1;
-      $(_this.element).find("tbody").mousemove(function () {
-        window.clearTimeout(showAlertTimeout);
-        if ($(_this.options.hintElement).data("show") == null || $(_this.options.hintElement).data("show")) {
-          showAlertTimeout = window.setTimeout(function () {
-            $(_this.options.hintElement).fadeIn();
-          }, 1300);
-        }
-      });
-
-      $(_this.options.hintElement).find(".close").click(function () {
-        $(_this.options.hintElement).data("show", false);
-      });
-    }
-
-    if (_this.options.fixedHeader) {
-      drawHeader(_this);
-    }
-    if (_this.options.fixedFirstColumn) {
-      drawFirstColumn(_this);
-    }
-
-    $(document).on('click dblclick', '.dataTables_wrapper > table tbody tr', function () {
-      $('.dataTables_wrapper > .jHueTableExtenderClonedContainerColumn table tbody tr.selected').removeClass('selected');
-      if ($(this).hasClass('selected')) {
-        $(this).removeClass('selected');
-      } else {
-        $('.dataTables_wrapper > table tbody tr.selected').removeClass('selected');
-        $(this).addClass('selected');
-        $('.dataTables_wrapper > .jHueTableExtenderClonedContainerColumn table tbody tr:eq('+($(this).index())+')').addClass('selected');
-      }
-    });
-    $(document).on('dblclick', '.dataTables_wrapper > table tbody tr', function () {
-      if (huePubSub){
-        huePubSub.publish('table.row.show.details', {idx: $(this).index(), table: $(this).parents('table')});
-      }
-    });
-  };
-
-  function drawLockedRow(plugin, rowNo, force) {
-    var $pluginElement = $(plugin.element);
-    var lockedRows = $pluginElement.data('lockedRows') || {};
-    var $header = $("#" + $pluginElement.attr("id") + "jHueTableExtenderClonedContainer");
-    var $headerCounter = $("#" + $pluginElement.attr("id") + "jHueTableExtenderClonedContainerCell");
-    $header.addClass('locked');
-    $headerCounter.addClass('locked');
-
-    function unlock($el) {
-      $header.find('tr td:first-child').filter(function () {
-        return $(this).text() === rowNo + '';
-      }).closest('tr').remove();
-      delete lockedRows['r' + $el.text()]
-      $el.parent().remove();
-      if ($header.find('tbody tr').length == 0) {
-        $header.removeClass('locked');
-        $headerCounter.removeClass('locked');
-      }
-    }
-
-    if (Object.keys(lockedRows).indexOf('r' + rowNo) === -1 || force) {
-      if (force) {
-        unlock(lockedRows['r' + rowNo].cell.find('td'));
-      }
-      var $clone = $('<tr>');
-      var tHtml = '';
-      var aoColumns = $pluginElement.data('aoColumns');
-      $pluginElement.data('data')[rowNo - 1].forEach(function(col, idx){
-        tHtml += '<td ' + (aoColumns && !aoColumns[idx].bVisible ? 'style="display: none"' : '') + '>' + col + '</td>';
-      });
-      $clone.html(tHtml);
-      $clone.addClass('locked');
-      $clone.appendTo($header.find('tbody'));
-      $pluginElement.data('lockedRows', lockedRows);
-      var $newTr = $('<tr>');
-      $newTr.addClass('locked').html('<td class="pointer unlockable" title="' + plugin.options.labels.UNLOCK + '"><i class="fa fa-unlock muted"></i>' + rowNo + '</td>').appendTo($headerCounter.find('tbody'));
-      $newTr.find('td').on('click', function () {
-        unlock($(this));
-      });
-      lockedRows['r' + rowNo] = {
-        row: $clone,
-        cell: $newTr
-      };
-    }
-    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 () {
-        unlock($(this));
-      });
-    }
-  }
-
-  function drawFirstColumn(plugin) {
-    var $pluginElement = $(plugin.element);
-    if (!$pluginElement.attr("id") && plugin.options.parentId) {
-      $pluginElement.attr("id", "eT" + plugin.options.parentId);
-    }
-
-    var mainScrollable = plugin.options.mainScrollable;
-    var originalTh = $(plugin.element).find("thead>tr th:eq(0)");
-    var topPosition;
-    if (plugin.options.clonedContainerPosition == 'absolute') {
-      topPosition = $pluginElement.parent().position().top - $(mainScrollable).scrollTop();
-    } else {
-      topPosition = $pluginElement.parent().offset().top - $(mainScrollable).scrollTop();
-    }
-
-    $("#" + $pluginElement.attr("id") + "jHueTableExtenderClonedContainerCell").remove();
-    var clonedCell = $('<table>').attr('class', $(plugin.element).attr('class'));
-    clonedCell.removeClass(plugin.options.classToRemove);
-    clonedCell.css("margin-bottom", "0").css("table-layout", "fixed");
-    var clonedCellTHead = $('<thead>');
-    clonedCellTHead.appendTo(clonedCell);
-    var clonedCellTH = originalTh.clone();
-    clonedCellTH.appendTo(clonedCellTHead);
-    clonedCellTH.width(originalTh.width()).css({
-      "background-color": "#FFFFFF",
-      "border-color": "transparent"
-    });
-    clonedCellTH.click(function () {
-      originalTh.click();
-    });
-    $('<tbody>').appendTo(clonedCell);
-
-    var clonedCellContainer = $("<div>").css("background-color", "#FFFFFF").width(originalTh.outerWidth());
-
-    clonedCell.appendTo(clonedCellContainer);
-
-    var clonedCellVisibleContainer = $("<div>").attr("id", $(plugin.element).attr("id") + "jHueTableExtenderClonedContainerCell").addClass("jHueTableExtenderClonedContainerCell").width(originalTh.outerWidth()).css("overflow", "hidden").css("top", topPosition + "px");
-    clonedCellVisibleContainer.css("position", plugin.options.clonedContainerPosition || "fixed");
-
-    clonedCellContainer.appendTo(clonedCellVisibleContainer);
-
-    $("#" + $pluginElement.attr("id") + "jHueTableExtenderClonedContainerColumn").remove();
-    var clonedTable = $('<table>').attr('class', $(plugin.element).attr('class')).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'));
-    var clonedTBody = clonedTable.find('tbody');
-    var clones = $(plugin.element).find("tbody>tr td:nth-child(1)").clone();
-    var h = '';
-    clones.each(function(){
-      h+= '<tr><td>' + $(this).html() +'</td></tr>';
-    });
-    clonedTBody.html(h);
-    if (plugin.options.lockSelectedRow) {
-      clonedTBody.find('td').each(function(){
-        var cell = $(this);
-        cell.attr('title', plugin.options.labels.LOCK).addClass('lockable pointer').on('click', function(){
-          drawLockedRow(plugin, $(this).text()*1);
-        });
-        $('<i>').addClass('fa fa-lock muted').prependTo(cell);
-      });
-    }
-    clonedTable.find("thead>tr th:eq(0)").width(originalTh.width()).css("background-color", "#FFFFFF");
-
-    var clonedTableContainer = $("<div>").css("background-color", "#FFFFFF").width(originalTh.outerWidth()).height($pluginElement.parent().get(0).scrollHeight);
-    clonedTable.appendTo(clonedTableContainer);
-
-    var clonedTableVisibleContainer = $("<div>").attr("id", $pluginElement.attr("id") + "jHueTableExtenderClonedContainerColumn").addClass("jHueTableExtenderClonedContainerColumn").width(originalTh.outerWidth()).height($pluginElement.parent().height()).css("overflow", "hidden").css("top", topPosition + "px");
-    clonedTableVisibleContainer.css("position", plugin.options.clonedContainerPosition || "fixed");
-
-    clonedTableContainer.appendTo(clonedTableVisibleContainer);
-    clonedTableVisibleContainer.appendTo($pluginElement.parent());
-
-    clonedCellVisibleContainer.appendTo($pluginElement.parent());
-
-    window.clearInterval($pluginElement.data('firstcol_interval'));
-    var firstColInt = window.setInterval(function () {
-      if ($pluginElement.parent().height() != $pluginElement.parent().data("h")) {
-        clonedTableContainer.height($pluginElement.parent().get(0).scrollHeight);
-        clonedTableVisibleContainer.height($pluginElement.parent().height());
-        $pluginElement.parent().data("h", clonedTableVisibleContainer.height());
-      }
-    }, 250, plugin.options.app);
-    $pluginElement.data('firstcol_interval', firstColInt);
-
-    $pluginElement.parent().resize(function () {
-      clonedTableContainer.height($pluginElement.parent().get(0).scrollHeight);
-      clonedTableVisibleContainer.height($pluginElement.parent().height());
-    });
-
-    $pluginElement.parent().scroll(function () {
-      clonedTableContainer.css("marginTop", (-$pluginElement.parent().scrollTop() + plugin.options.fixedFirstColumnTopMargin) + "px");
-    });
-
-    clonedTableContainer.css("marginTop", (-$pluginElement.parent().scrollTop() + plugin.options.fixedFirstColumnTopMargin) + "px");
-
-    function positionClones() {
-      var pos = plugin.options.stickToTopPosition;
-      if (typeof pos === 'function'){
-        pos = pos();
-      }
-      if (pos > -1) {
-        if ($pluginElement.offset().top < pos) {
-          clonedCellVisibleContainer.css("top", pos + "px");
-        }
-        else {
-          clonedCellVisibleContainer.css("top", $pluginElement.offset().top + "px");
-        }
-        clonedTableVisibleContainer.css("top", $pluginElement.offset().top + "px");
-      }
-      else {
-        if (plugin.options.clonedContainerPosition == 'absolute') {
-          clonedTableVisibleContainer.css("top", ($pluginElement.parent().position().top) + "px");
-          clonedCellVisibleContainer.css("top", ($pluginElement.parent().position().top) + "px");
-        }
-        else {
-          clonedTableVisibleContainer.css("top", ($pluginElement.parent().offset().top) + "px");
-          clonedCellVisibleContainer.css("top", ($pluginElement.parent().offset().top) + "px");
-        }
-      }
-    }
-
-    positionClones();
-
-    $(mainScrollable).on('scroll', positionClones);
-
-  }
-
-
-  function drawHeader(plugin, skipCreation) {
-    var $pluginElement = $(plugin.element);
-    if (!$pluginElement.attr("id") && plugin.options.parentId) {
-      $pluginElement.attr("id", "eT" + plugin.options.parentId);
-    }
-
-    if (typeof skipCreation === 'undefined') {
-      var mainScrollable = plugin.options.mainScrollable;
-
-      $("#" + $pluginElement.attr("id") + "jHueTableExtenderClonedContainer").remove();
-      var clonedTable = $('<table>').attr('class', $(plugin.element).attr('class'));
-      clonedTable.removeClass(plugin.options.classToRemove);
-      clonedTable.css("margin-bottom", "0").css("table-layout", "fixed");
-      var clonedTableTHead = $('<thead>');
-      clonedTableTHead.appendTo(clonedTable);
-      var clonedTableTR = $pluginElement.find('thead>tr').clone();
-      clonedTableTR.appendTo(clonedTableTHead);
-      $('<tbody>').appendTo(clonedTable)
-
-      clonedTable.find("thead>tr th").wrapInner('<span></span>');
-
-      $pluginElement.find("thead>tr th").each(function (i) {
-        var originalTh = $(this);
-        originalTh.removeAttr("data-bind");
-        clonedTable.find("thead>tr th:eq(" + i + ")").width(originalTh.width()).css("background-color", "#FFFFFF").click(function () {
-          originalTh.click();
-          if (plugin.options.headerSorting) {
-            clonedTable.find("thead>tr th").attr("class", "sorting");
-          }
-          $(this).attr("class", originalTh.attr("class"));
-        });
-      });
-
-      var clonedTableContainer = $("<div>").width($pluginElement.outerWidth());
-      clonedTable.appendTo(clonedTableContainer);
-
-      var topPosition;
-      if (plugin.options.clonedContainerPosition == 'absolute') {
-        topPosition = $pluginElement.parent().position().top - $(mainScrollable).scrollTop();
-      }
-      else {
-        topPosition = $pluginElement.parent().offset().top - $(mainScrollable).scrollTop();
-      }
-      var clonedTableVisibleContainer = $("<div>").attr("id", $pluginElement.attr("id") + "jHueTableExtenderClonedContainer").addClass("jHueTableExtenderClonedContainer").width($pluginElement.parent().width()).css("overflow-x", "hidden").css("top", topPosition + "px");
-      clonedTableVisibleContainer.css("position", plugin.options.clonedContainerPosition || "fixed");
-
-      clonedTableContainer.appendTo(clonedTableVisibleContainer);
-      clonedTableVisibleContainer.prependTo($pluginElement.parent());
-
-
-      function throttledHeaderPadding() {
-        var firstCellWidth = clonedTable.find("thead>tr th:eq(0)").outerWidth();
-        clonedTable.find("thead>tr th").each(function () {
-          var leftPosition = $(this).position().left - firstCellWidth;
-          if (leftPosition + $(this).outerWidth() > 0 && leftPosition < 0) {
-            if ($(this).find('span').width() + -leftPosition < $(this).outerWidth() - 20) { // 20 is the sorting css width
-              $(this).find('span').css('paddingLeft', -leftPosition);
-            }
-          }
-          else {
-            $(this).find('span').css('paddingLeft', 0);
-          }
-        });
-      }
-
-      var scrollTimeout = -1;
-      $pluginElement.parent().scroll(function () {
-        var scrollLeft = $(this).scrollLeft();
-        clonedTableVisibleContainer.scrollLeft(scrollLeft);
-        window.clearTimeout(scrollTimeout);
-        scrollTimeout = window.setTimeout(throttledHeaderPadding, 200);
-      });
-
-      $pluginElement.bind('headerpadding', function () {
-        scrollTimeout = window.setTimeout(throttledHeaderPadding, 200);
-      });
-
-      clonedTableVisibleContainer.scrollLeft($pluginElement.parent().scrollLeft());
-
-      $pluginElement.parent().data("w", clonedTableVisibleContainer.width());
-
-      window.clearInterval($pluginElement.data('header_interval'));
-      var headerInt = window.setInterval(function () {
-        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) {
-            clonedTable.find("thead>tr th:eq(" + i + ")").width($(this).width()).css("background-color", "#FFFFFF");
-          });
-        }
-      }, 250, plugin.options.app);
-      $pluginElement.data('header_interval', headerInt);
-
-      $pluginElement.parent().resize(function () {
-        clonedTableVisibleContainer.width($(this).width());
-      });
-
-      function positionClones() {
-        var pos = plugin.options.stickToTopPosition;
-        if (typeof pos === 'function') {
-          pos = pos();
-        }
-        if (pos > -1) {
-          if ($pluginElement.offset().top < pos) {
-            clonedTableVisibleContainer.css("top", pos + "px");
-          } else {
-            clonedTableVisibleContainer.css("top", $pluginElement.offset().top + "px");
-          }
-        } else {
-          if (plugin.options.clonedContainerPosition == 'absolute') {
-            clonedTableVisibleContainer.css("top", ($pluginElement.parent().position().top) + "px");
-          } else {
-            clonedTableVisibleContainer.css("top", ($pluginElement.parent().offset().top) + "px");
-          }
-        }
-      }
-
-      positionClones();
-
-      $(mainScrollable).on('scroll', positionClones);
-    }
-    else {
-      $("#" + $pluginElement.attr("id") + "jHueTableExtenderClonedContainer").children('div').width($pluginElement.outerWidth());
-      $pluginElement.find("thead>tr th").each(function (i) {
-        var originalTh = $(this);
-        $("#" + $pluginElement.attr("id") + "jHueTableExtenderClonedContainer").find("thead>tr th:eq(" + i + ")").width(originalTh.width()).attr('class', originalTh.attr('class'));
-      });
-    }
-  }
-
-  function getSelection() {
-    var t = '';
-    if (window.getSelection) {
-      t = window.getSelection();
-    } else if (document.getSelection) {
-      t = document.getSelection();
-    } else if (document.selection) {
-      t = document.selection.createRange().text;
-    }
-    return t.toString();
-  }
-
-  $.fn[pluginName] = function (options) {
-    return this.each(function () {
-      if (!$.data(this, 'plugin_' + pluginName)) {
-        $.data(this, 'plugin_' + pluginName, new Plugin(this, options));
-      }
-      else {
-        $.data(this, 'plugin_' + pluginName).resetSource();
-        $.data(this, 'plugin_' + pluginName).setOptions(options);
-      }
-    });
-  }
-
-})(jQuery, window, document);

+ 0 - 518
desktop/core/src/desktop/static/desktop/js/jquery.tableextender2.js

@@ -1,518 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-(function ($, window, document, undefined) {
-
-  var PLUGIN_NAME = "jHueTableExtender2";
-
-  var DEFAULT_OPTIONS = {
-    fixedHeader: true,
-    fixedFirstColumn: true,
-    fixedFirstColumnTopMargin: 0,
-    headerSorting: true,
-    lockSelectedRow: true,
-    firstColumnTooltip: false,
-    classToRemove: 'resultTable',
-    hintElement: null,
-    mainScrollable: window,
-    app: null,
-    stickToTopPosition: -1,
-    labels: {
-      GO_TO_COLUMN: "Go to column:",
-      PLACEHOLDER: "column name...",
-      LOCK: "Lock row",
-      UNLOCK: "Unlock row",
-      ROW_DETAILS: "Show row details"
-    }
-  };
-
-  function Plugin(element, options) {
-    var self = this;
-    self.disposeFunctions = [];
-
-    self.lockedRows = {};
-    self.setOptions(options); // Sets self.options
-
-    self.$element = $(element);
-    self.$parent = self.$element.parent();
-    self.$mainScrollable = $(self.options.mainScrollable);
-    self.lastHeaderWidth = 0;
-
-    self.drawHeader(); // Sets self.headerRowContainer, self.thMapping
-    self.drawFirstColumn(); // Sets self.firstColumnInner, self.firstColumnTopCell and self.firstColumn
-    self.drawLockedRows();
-
-    var manyColumns = self.thMapping.length > 20;
-
-    var sortAdjustment = self.options.noSort ? 10 : 20; // 20 is the sorting css width
-
-    var firstCellWidth, leftPosition, th, thi, leftPadding;
-    var throttledHeaderPadding = function () {
-      firstCellWidth = self.options.fixedFirstColumn ? self.firstColumnTopCell.outerWidth() : 0;
-      for (thi = 0; thi < self.thMapping.length; thi++) {
-        th = self.thMapping[thi];
-        if (!th.original.is(':visible')) {
-          continue;
-        }
-        leftPosition = th.clone.position().left - firstCellWidth;
-        if (leftPosition + th.clone.outerWidth() > 0 && leftPosition < 0) {
-          if (th.cloneSpan.width() - leftPosition < th.clone.outerWidth() - sortAdjustment) {
-            leftPadding = -leftPosition;
-          } else {
-            leftPadding = th.clone.outerWidth() - sortAdjustment - th.cloneSpan.width();
-          }
-          th.cloneSpan.css('paddingLeft', leftPadding);
-        } else {
-          th.cloneSpan.css('paddingLeft', 0);
-        }
-      }
-    };
-
-    var scrollTimeout = -1;
-    var headerScroll = function () {
-      self.headerRowContainer.scrollLeft(self.$parent.scrollLeft());
-      if (manyColumns) {
-        window.clearTimeout(scrollTimeout);
-        scrollTimeout = window.setTimeout(throttledHeaderPadding, 200);
-      } else {
-        throttledHeaderPadding();
-      }
-    };
-    self.$parent.on('scroll', headerScroll);
-    self.disposeFunctions.push(function () {
-      self.$parent.off('scroll', headerScroll);
-    });
-
-    self.$element.bind('headerpadding', function () {
-      window.clearTimeout(scrollTimeout);
-      scrollTimeout = window.setTimeout(throttledHeaderPadding, 200);
-    });
-    self.disposeFunctions.push(function () {
-      self.$element.unbind('headerpadding');
-    });
-
-    var redrawSubscription = huePubSub.subscribe('table.extender.redraw', function (parentId) {
-      if (parentId == self.options.parentId) {
-        self.redraw();
-      }
-    });
-    self.disposeFunctions.push(function () {
-      redrawSubscription.remove();
-    });
-
-    var hideSubscription = huePubSub.subscribe('table.extender.hide', function (parentId) {
-      if (parentId == self.options.parentId) {
-        self.headerRowContainer.hide();
-        self.firstColumnInner.hide();
-        self.firstColumnTopCell.hide();
-        self.firstColumn.hide();
-      }
-    });
-    self.disposeFunctions.push(function () {
-      hideSubscription.remove();
-    });
-
-    var adjustSizes = function () {
-      if (self.lastHeaderWidth !== self.$parent.width()) {
-        self.lastHeaderWidth = self.$parent.width();
-        self.headerRowContainer.width(self.lastHeaderWidth);
-      }
-      for (thi = 0; thi < self.thMapping.length; thi++) {
-        th = self.thMapping[thi];
-        if (!th.original.is(':visible')) {
-          continue;
-        }
-        if (th.clone.lastWidth !== th.original.width()) {
-          th.clone.lastWidth = th.original.width();
-          th.clone.width(th.clone.lastWidth)
-        }
-      }
-
-      if (self.headerRowContainer.scrollLeft() !== self.$parent.scrollLeft()) {
-        self.headerRowContainer.scrollLeft(self.$parent.scrollLeft());
-        throttledHeaderPadding();
-      }
-    };
-    adjustSizes();
-    var sizeInterval = window.setInterval(adjustSizes, 300, self.options.app);
-    self.disposeFunctions.push(function () {
-      window.clearInterval(sizeInterval);
-    });
-
-    var clickHandler = function () {
-      if ($(this).hasClass('selected')) {
-        self.$parent.find('.selected').removeClass('selected');
-      } else {
-        self.$parent.find('.selected').removeClass('selected');
-        $(this).addClass('selected');
-        self.$parent.find('.fixed-first-column table tbody tr:eq(' + $(this).index() + ')').addClass('selected');
-      }
-    };
-
-    var overHandler = function () {
-      self.$parent.find('.fixed-first-column table tbody tr:eq(' + $(this).index() + ') td').addClass('fixed-first-col-hover');
-    };
-
-    var outHandler = function () {
-      self.$parent.find('.fixed-first-column table tbody tr td').removeClass('fixed-first-col-hover');
-    };
-
-    self.$parent.children('table').on('click dblclick', 'tbody tr', clickHandler);
-    self.$parent.children('table').on('mouseover', 'tbody tr', overHandler);
-    self.$parent.children('table').on('mouseout', 'tbody tr', outHandler);
-    self.disposeFunctions.push(function () {
-      self.$parent.children('table').off('click dblclick', 'tbody tr', clickHandler);
-      self.$parent.children('table').on('mouseover', 'tbody tr', overHandler);
-      self.$parent.children('table').on('mouseout', 'tbody tr', outHandler);
-    });
-
-    if (!self.options.disableTopPosition) {
-      self.repositionHeader();
-      var scrollFunction = self.repositionHeader.bind(self);
-      self.$mainScrollable.on('scroll', scrollFunction);
-      self.disposeFunctions.push(function () {
-        self.$mainScrollable.off('scroll', scrollFunction);
-      });
-    }
-  }
-
-  Plugin.prototype.redraw = function () {
-    var self = this;
-    self.drawHeader();
-    self.drawFirstColumn();
-    self.drawLockedRows(true);
-    self.repositionHeader();
-    window.setTimeout(function (){
-      self.headerRowContainer.scrollLeft(self.$parent.scrollLeft());
-      self.$element.trigger('headerpadding');
-    }, 300);
-  };
-
-  Plugin.prototype.destroy = function () {
-    var self = this;
-    self.disposeFunctions.forEach(function (disposeFunction) {
-      disposeFunction();
-    })
-  };
-
-  Plugin.prototype.setOptions = function (options) {
-    this.options = $.extend({}, DEFAULT_OPTIONS, options);
-    this.options.labels = $.extend({}, DEFAULT_OPTIONS.labels, HUE_I18n.jHueTableExtender, options ? options.labels : {})
-  };
-
-  Plugin.prototype.repositionHeader = function () {
-    var self = this;
-    if (self.options.disableTopPosition) {
-      return;
-    }
-    var pos = self.options.stickToTopPosition;
-    var topPos = 0;
-    var firstColTopPos = 0;
-    if (typeof pos === 'function') {
-      pos = pos();
-    }
-    if (window.IS_EMBEDDED) {
-      pos = $('.hue-embedded-container').offset().top;
-    }
-    var isFixed = false;
-    if (pos > -1) {
-      if (self.$element.offset().top < pos) {
-        topPos = pos;
-        isFixed = true;
-      } else {
-        topPos = self.$element.offset().top;
-        isFixed = false;
-      }
-      firstColTopPos = self.$element.offset().top;
-    } else if (self.options.clonedContainerPosition == 'absolute') {
-      topPos = self.$parent.position().top;
-      firstColTopPos = topPos;
-    } else {
-      topPos = self.$parent.offset().top;
-      firstColTopPos = topPos;
-    }
-
-    if (pos > -1) {
-      var fixCSS = {
-        "top": "",
-        "left": self.$parent.position().left + "px",
-        "position": "absolute"
-      };
-      self.firstColumn.css(fixCSS);
-      if (isFixed) {
-        fixCSS = {
-          "top": topPos + "px",
-          "left": "",
-          "position": "fixed"
-        };
-      }
-      self.firstColumnTopCell.css(fixCSS);
-      self.headerRowContainer.css(fixCSS);
-    }
-    else {
-      self.firstColumn.scrollTop(self.$mainScrollable.scrollTop());
-      self.firstColumn.css("top", firstColTopPos + "px");
-      self.headerRowContainer.css("top", topPos + "px");
-      self.firstColumnTopCell.css("top", topPos + "px");
-    }
-
-  };
-
-  Plugin.prototype.drawHeader = function () {
-    var self = this;
-    if (!self.$element.attr("id") && self.options.parentId) {
-      self.$element.attr("id", "eT" + self.options.parentId);
-    }
-
-    $("#" + self.$element.attr("id") + "jHueTableExtenderClonedContainer").remove();
-    var clonedTable = $('<table>').attr('class', self.$element.attr('class'));
-    clonedTable.removeClass(self.options.classToRemove);
-    clonedTable.css("margin-bottom", "0").css("table-layout", "fixed");
-    var clonedTableTHead = $('<thead>');
-    clonedTableTHead.appendTo(clonedTable);
-    var clonedTableTR = self.$element.find('thead>tr').clone();
-    clonedTableTR.appendTo(clonedTableTHead);
-    $('<tbody>').appendTo(clonedTable);
-
-    var clonedThs = clonedTable.find("thead>tr th");
-    clonedThs.wrapInner('<span></span>');
-
-    if (typeof self.$element.data('updateThWidthsInterval') !== 'undefined') {
-      window.clearInterval(self.$element.data('updateThWidthsInterval'));
-    }
-
-    self.thMapping = [];
-    var totalThWidth = 0;
-    self.$element.find("thead>tr th").each(function (i) {
-      var originalTh = $(this);
-      originalTh.removeAttr("data-bind");
-      var clonedTh = $(clonedThs[i]).css("background-color", "#FFFFFF");
-      clonedTh.click(function () {
-        originalTh.click();
-        if (self.options.headerSorting) {
-          clonedThs.attr("class", "sorting");
-        }
-        $(this).attr("class", originalTh.attr("class"));
-      });
-      clonedTh.width(originalTh.width());
-      totalThWidth += originalTh.width();
-      self.thMapping.push({
-        original: originalTh,
-        clone: clonedTh,
-        cloneSpan: clonedTh.children().first()
-      })
-    });
-
-    var headerRowDiv = $("<div>");
-    clonedTable.appendTo(headerRowDiv);
-
-    var topPosition;
-    if (self.options.clonedContainerPosition == 'absolute') {
-      topPosition = self.$parent.position().top - self.$mainScrollable.scrollTop();
-    } else {
-      topPosition = self.$parent.offset().top - self.$mainScrollable.scrollTop();
-    }
-    var headerRowContainer = $("<div>").attr("id", self.$element.attr("id") + "jHueTableExtenderClonedContainer")
-        .addClass("fixed-header-row").width(totalThWidth).css("overflow-x", "hidden");
-    if (!self.options.disableTopPosition) {
-      headerRowContainer.css("top", topPosition + "px");
-    }
-    headerRowContainer.css("position", self.options.clonedContainerPosition || "fixed");
-    self.lastHeaderWidth = self.$parent.width();
-    headerRowContainer.width(self.lastHeaderWidth);
-
-    headerRowDiv.appendTo(headerRowContainer);
-    headerRowContainer.prependTo(self.$parent);
-
-    headerRowContainer.scrollLeft(self.$parent.scrollLeft());
-
-    self.headerRowContainer = headerRowContainer;
-    self.$mainScrollable.trigger('scroll');
-  };
-
-  Plugin.prototype.drawFirstColumn = function (repositionHeader) {
-    var self = this;
-    if (!self.options.fixedFirstColumn) {
-      self.firstColumnInner = $();
-      self.firstColumnTopCell = $();
-      self.firstColumn = $();
-      return;
-    }
-    if (!self.$element.attr("id") && self.options.parentId) {
-      self.$element.attr("id", "eT" + self.options.parentId);
-    }
-
-    var originalTh = self.$element.find("thead>tr th:eq(0)");
-    var topPosition;
-    if (self.options.clonedContainerPosition == 'absolute') {
-      topPosition = self.$parent.position().top - self.$mainScrollable.scrollTop();
-    } else {
-      topPosition = self.$parent.offset().top - self.$mainScrollable.scrollTop();
-    }
-
-    $("#" + self.$element.attr("id") + "jHueTableExtenderClonedContainerCell").remove();
-    var clonedCell = $('<table>').attr('class', self.$element.attr('class'));
-    clonedCell.removeClass(self.options.classToRemove);
-    clonedCell.css("margin-bottom", "0").css("table-layout", "fixed");
-    var clonedCellTHead = $('<thead><tr></tr></thead>');
-    clonedCellTHead.appendTo(clonedCell);
-    var clonedCellTH = originalTh.clone();
-    clonedCellTH.appendTo(clonedCellTHead.find('tr'));
-    clonedCellTH.width(originalTh.width()).css({
-      "background-color": "#FFFFFF",
-      "border-color": "transparent"
-    });
-    clonedCellTH.click(function () {
-      originalTh.click();
-    });
-    $('<tbody>').appendTo(clonedCell);
-
-    var clonedCellContainer = $("<div>").css("background-color", "#FFFFFF").width(originalTh.outerWidth());
-
-    clonedCell.appendTo(clonedCellContainer);
-
-    var firstColumnTopCell = $("<div>").attr("id", self.$element.attr("id") + "jHueTableExtenderClonedContainerCell").addClass("fixed-first-cell").width(originalTh.outerWidth()).css("overflow", "hidden").css("top", topPosition + "px");
-    firstColumnTopCell.css("position", self.options.clonedContainerPosition || "fixed");
-
-    clonedCellContainer.appendTo(firstColumnTopCell);
-
-    $("#" + self.$element.attr("id") + "jHueTableExtenderClonedContainerColumn").remove();
-    var clonedTable = $('<table>').attr('class', self.$element.attr('class')).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'));
-    var clonedTBody = clonedTable.find('tbody');
-    var clones = self.$element.find("tbody>tr td:nth-child(1)").clone();
-    var h = '';
-    var foundEmptyTh = false;
-    clones.each(function(){
-      if ($(this).html() === '') {
-        foundEmptyTh = true;
-      }
-      h+= '<tr><td>' + $(this).html() +'</td></tr>';
-    });
-    if (foundEmptyTh) {
-      // In IE it's sometimes empty so we'll redraw in a bit
-      window.setTimeout(self.drawFirstColumn.bind(self), 200);
-      self.firstColumnInner = $();
-      self.firstColumnTopCell = $();
-      self.firstColumn = $();
-      return;
-    }
-    clonedTBody.html(h);
-    if (self.options.lockSelectedRow) {
-      clonedTBody.find('td').each(function(idx){
-        var cell = $(this);
-        cell.addClass('lockable');
-        $('<i>').addClass('fa fa-lock pointer muted').prependTo(cell).on('click', function(){
-          self.drawLockedRow($(this).parent().text()*1);
-        }).attr('title', self.options.labels.LOCK);
-        $('<i>').addClass('fa fa-expand pointer muted').prependTo(cell).on('click', function(){
-          huePubSub.publish('table.row.show.details', {idx: idx, table: self.$element});
-        }).attr('title', self.options.labels.ROW_DETAILS);
-      });
-    }
-    clonedTable.find("thead>tr th:eq(0)").width(originalTh.width()).css("background-color", "#FFFFFF");
-
-    var firstColumnInner = $("<div>").css("background-color", "#FFFFFF").width(originalTh.outerWidth()).height(self.$parent.get(0).scrollHeight);
-    clonedTable.appendTo(firstColumnInner);
-
-    var firstColumn = $("<div>").attr("id", self.$element.attr("id") + "jHueTableExtenderClonedContainerColumn").addClass("fixed-first-column").width(originalTh.outerWidth()).height(self.$parent.height()).css("overflow", "hidden").css("top", topPosition + "px");
-    firstColumn.css("position", self.options.clonedContainerPosition || "fixed");
-
-    firstColumnInner.appendTo(firstColumn);
-    firstColumn.insertAfter(self.$element.prev());
-
-    firstColumnTopCell.insertAfter(firstColumn);
-
-    self.firstColumnInner = firstColumnInner;
-    self.firstColumnTopCell = firstColumnTopCell;
-    self.firstColumn = firstColumn;
-
-    if (repositionHeader) {
-      self.repositionHeader();
-    }
-  };
-
-  Plugin.prototype.drawLockedRows = function (force) {
-    var self = this;
-    if (Object.keys(self.lockedRows).length === 0) {
-      self.headerRowContainer.find('tbody').empty();
-      self.headerRowContainer.removeClass('locked');
-      self.firstColumnTopCell.removeClass('locked');
-    } else {
-      self.headerRowContainer.addClass('locked');
-      self.firstColumnTopCell.addClass('locked');
-      Object.keys(self.lockedRows).forEach(function (idx) {
-        self.drawLockedRow(idx.substr(1), force);
-      });
-    }
-  };
-
-  Plugin.prototype.drawLockedRow = function (rowNo, force) {
-    var self = this;
-
-    function unlock($el) {
-      self.headerRowContainer.find('tr td:first-child').filter(function () {
-        return $(this).text() === rowNo + '';
-      }).closest('tr').remove();
-      delete self.lockedRows['r' + $el.text()];
-      $el.parent().remove();
-      if (self.headerRowContainer.find('tbody tr').length == 0) {
-        self.headerRowContainer.removeClass('locked');
-        self.firstColumnTopCell.removeClass('locked');
-      }
-    }
-
-    if (Object.keys(self.lockedRows).indexOf('r' + rowNo) === -1 || force) {
-      if (force) {
-        unlock(self.lockedRows['r' + rowNo].cell.find('td'));
-      }
-      var $clone = $('<tr>').addClass('locked');
-      var tHtml = '';
-      var aoColumns = self.$element.data('aoColumns');
-      self.$element.data('data')[rowNo - 1].forEach(function(col, idx){
-        tHtml += '<td ' + (aoColumns && !aoColumns[idx].bVisible ? 'style="display: none"' : '') + '>' + hueUtils.deXSS(col) + '</td>';
-      });
-      $clone.html(tHtml);
-      $clone.appendTo(self.headerRowContainer.find('tbody'));
-      var $newTr = $('<tr>');
-      $newTr.addClass('locked').html('<td class="pointer unlockable" title="' + self.options.labels.UNLOCK + '"><i class="fa fa-unlock muted"></i>' + rowNo + '</td>').appendTo(self.firstColumnTopCell.find('tbody'));
-      $newTr.find('td').on('click', function () {
-        unlock($(this));
-      });
-      self.lockedRows['r' + rowNo] = {
-        row: $clone,
-        cell: $newTr
-      };
-    } 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 () {
-        unlock($(this));
-      });
-    }
-  };
-
-  $.fn[PLUGIN_NAME] = function (options) {
-    return this.each(function () {
-      if ($.data(this, 'plugin_' + PLUGIN_NAME)) {
-        $.data(this, 'plugin_' + PLUGIN_NAME).destroy();
-      }
-      $.data(this, 'plugin_' + PLUGIN_NAME, new Plugin(this, options));
-    });
-  }
-})(jQuery, window, document);

+ 0 - 275
desktop/core/src/desktop/static/desktop/js/jquery.tableextender3.js

@@ -1,275 +0,0 @@
-// Licensed to Cloudera, Inc. under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  Cloudera, Inc. licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-(function ($, window, document, undefined) {
-
-  var PLUGIN_NAME = "jHueTableExtender2";
-
-  var DEFAULT_OPTIONS = {
-    stickyHeader: true,
-    stickyFirstColumn: true,
-    headerSorting: true,
-    mainScrollable: window,
-    classToRemove: 'resultTable',
-    labels: {
-      GO_TO_COLUMN: "Go to column:",
-      PLACEHOLDER: "column name...",
-      LOCK: "Lock row",
-      UNLOCK: "Unlock row",
-      ROW_DETAILS: "Show row details"
-    }
-  };
-
-  function Plugin(sourceTable, options) {
-    var self = this;
-    self.setOptions(options);
-    self.disposeFunctions = [];
-
-    if (!self.options.stickyHeader && !self.options.stickyFirstColumn) {
-      return;
-    }
-
-    self.$sourceTable = $(sourceTable);
-    self.$parent = self.$sourceTable.parent();
-    self.$mainScrollable = self.options.mainScrollable ? $(self.options.mainScrollable) : self.$parent;
-
-    self.$firstCellTable = null;
-    self.$firstColumnTable = null;
-    self.$headerTable = null;
-    self.updateHeaderWidths = $.noop;
-
-    self.initParent();
-    self.redraw();
-
-    var widthThrottle = -1;
-
-    if (self.options.stickyFirstColumn) {
-      self.$parent.on('scroll.tableExtender', function () {
-        self.repositionLeftColumn();
-        if (self.options.stickyHeader) {
-          window.clearTimeout(widthThrottle);
-          widthThrottle = window.setTimeout(self.updateHeaderWidths.bind(self), 50);
-        }
-      });
-    }
-
-    if (self.options.stickyHeader) {
-      self.$mainScrollable.on('scroll.tableExtender', self.repositionHeader.bind(self));
-      var widthInterval = window.setInterval(self.updateHeaderWidths.bind(self), 100);
-      self.disposeFunctions.push(function () {
-        window.clearInterval(widthInterval);
-      })
-    }
-
-    self.disposeFunctions.push(huePubSub.subscribe('table.extender.redraw', function (parentId) {
-      if (parentId === self.options.parentId) {
-        self.redraw();
-      }
-    }).remove);
-  }
-
-  Plugin.prototype.destroy = function () {
-    var self = this;
-    $('.table-extender-header_' + self.options.parentId).remove();
-    $('.table-extender-first-col-' + self.options.parentId).remove();
-    $('.table-extender-first-cell-' + self.options.parentId).remove();
-    self.$parent.off('.tableExtender');
-    self.$mainScrollable.off('.tableExtender');
-    self.disposeFunctions.forEach(function (dispose) {
-      dispose();
-    });
-  };
-
-  Plugin.prototype.setOptions = function (options) {
-    var self = this;
-    self.options = $.extend({}, DEFAULT_OPTIONS, options);
-    self.options.labels = $.extend({}, DEFAULT_OPTIONS.labels, HUE_I18n.jHueTableExtender, options ? options.labels : {})
-  };
-
-  Plugin.prototype.initParent = function () {
-    var self = this;
-    var parentPosition = self.$parent.css('position');
-    self.$parent.css('position', (!parentPosition || parentPosition === 'static') ? 'relative' : parentPosition);
-  };
-
-  Plugin.prototype.createEmptyTableClone = function () {
-    var self = this;
-    var $result = $('<table>');
-    $result.attr('class', self.$sourceTable.attr('class'));
-    $result.removeClass(self.options.classToRemove);
-    $result.attr('style', self.$sourceTable.attr('style'));
-    $result.css({ 'position': 'absolute', 'top': 0, 'left': 0 });
-    return $result;
-  };
-
-  Plugin.prototype.redraw = function () {
-    var self = this;
-    if (self.options.stickyHeader) {
-      self.drawHeader();
-    }
-    if (self.options.stickyFirstColumn) {
-      self.drawFirstColumn();
-    }
-  };
-
-  Plugin.prototype.drawHeader = function () {
-    var self = this;
-    var $headerTable = self.createEmptyTableClone().css('z-index', 1);
-    $headerTable.addClass('table-extender-header_' + self.options.parentId);
-
-    // Clone the header
-    var $sourceHeaders = self.$sourceTable.find('thead>tr th');
-    var $clonedHeaders = $sourceHeaders.clone();
-    $clonedHeaders.wrapAll('<tr></tr>').parent().wrap('<thead>').parent().appendTo($headerTable);
-
-    $clonedHeaders.each(function (index, clonedTh) {
-      var $clonedTh = $(clonedTh);
-      var $sourceTh = $sourceHeaders.eq(index);
-      $clonedTh.width($sourceTh.width());
-      $clonedTh.click(function () {
-        $sourceTh.click();
-        window.setTimeout(self.drawHeader.bind(self), 0);
-      })
-    });
-    $headerTable.width(self.$sourceTable.width());
-
-    self.updateHeaderWidths = function () {
-      var sourceTableWidth = self.$sourceTable.width();
-      if (self.$headerTable && sourceTableWidth !== self.$headerTable.width()) {
-        self.$headerTable.width(sourceTableWidth);
-        $clonedHeaders.each(function (index, clonedTh) {
-          var $clonedTh = $(clonedTh);
-          var $sourceTh = $sourceHeaders.eq(index);
-          $clonedTh.width($sourceTh.width());
-        });
-      }
-    };
-
-    $('.table-extender-header_' + self.options.parentId).remove();
-
-    self.$headerTable = $headerTable;
-    self.$headerTable.appendTo(self.$parent);
-  };
-
-  Plugin.prototype.lockRow = function (index) {
-    var self = this;
-  };
-
-  Plugin.prototype.drawLockedRows = function () {
-    var self = this;
-  };
-
-  Plugin.prototype.drawFirstColumn = function () {
-    var self = this;
-
-    var $firstColumnTable = self.createEmptyTableClone().css('z-index', 2);
-    $firstColumnTable.addClass('table-extender-first-col-' + self.options.parentId);
-    // Clone the header for the first cell
-    var $sourceFirstHeader = self.$sourceTable.find('thead>tr th:eq(0)');
-    var $clonedFirstHeader = $sourceFirstHeader.clone();
-    $clonedFirstHeader.wrap('<tr></tr>').parent().wrap('<thead>').parent().appendTo($firstColumnTable);
-    $firstColumnTable.width($sourceFirstHeader.outerWidth(true));
-
-    // Create a separate table for the upper left header cell only
-    var $firstCellTable = $firstColumnTable.clone().css('z-index', 3);
-    $firstCellTable.addClass('table-extender-first-cell-' + self.options.parentId);
-
-    $firstCellTable.find('th').click(function () {
-      $sourceFirstHeader.click();
-      window.setTimeout(self.drawFirstColumn.bind(self), 0);
-    });
-
-    // Clone the cells under the header for the first column
-    var $clonedFirstCells = self.$sourceTable.find("tbody>tr td:nth-child(1)").clone();
-    $clonedFirstCells.wrapAll('<tbody>').parent().appendTo($firstColumnTable);
-    $clonedFirstCells.wrap('<tr>');
-
-    var foundEmptyCell = false;
-    $clonedFirstCells.each(function (index, cell) {
-      var $cell = $(cell);
-
-      if ($cell.html() === '') {
-        foundEmptyCell = true;
-        return false;
-      }
-      if (self.options.lockSelectedRow) {
-        $('<i>').addClass('fa fa-lock pointer muted').attr('title', self.options.labels.LOCK).on('click', function() {
-          self.drawLockedRow(index);
-        }).prependTo($cell);
-      }
-      $cell.addClass('lockable');
-      $('<i>').addClass('fa fa-expand pointer muted').attr('title', self.options.labels.ROW_DETAILS).on('click', function(){
-        huePubSub.publish('table.row.show.details', { idx: index, table: self.$sourceTable });
-      }).prependTo($cell);
-    });
-
-    if (foundEmptyCell) {
-      // In IE the cell can be empty at initial render, if so we defer the rendering
-      window.setTimeout(self.drawFirstColumn.bind(self), 100);
-      return;
-    }
-
-    // Append the table for the first columns
-    $('.table-extender-first-col-' + self.options.parentId).remove();
-    self.$firstColumnTable = $firstColumnTable;
-    self.$firstColumnTable.css('left', self.$parent.scrollLeft() + 'px');
-    self.$firstColumnTable.appendTo(self.$parent);
-
-    // Append the table for the first cell (header of first column)
-    $('.table-extender-first-cell-' + self.options.parentId).remove();
-    self.$firstCellTable = $firstCellTable;
-    self.$firstCellTable.width(self.$firstColumnTable.outerWidth(true)); // Width is only known after the first col render
-    self.$firstCellTable.css('left', self.$parent.scrollLeft() + 'px');
-    self.$firstCellTable.appendTo(self.$parent);
-  };
-
-  Plugin.prototype.repositionLeftColumn = function () {
-    var self = this;
-    if (self.$firstColumnTable) {
-      self.$firstColumnTable.css('left', self.$parent.scrollLeft() + 'px');
-      self.$firstCellTable.css('left', self.$parent.scrollLeft() + 'px');
-    }
-  };
-
-  Plugin.prototype.repositionHeader = function () {
-    var self = this;
-    if (!self.$firstCellTable || !self.$headerTable) {
-      return;
-    }
-    var diff = self.$sourceTable.offset().top - self.$mainScrollable.offset().top;
-
-    if (self.$firstCellTable && diff < 0) {
-      self.$firstCellTable.css('padding-top', -diff + 'px');
-    } else if (self.$firstCellTable && self.$firstCellTable.position().top !== 0) {
-      self.$firstCellTable.css('padding-top', '0');
-    }
-
-    if (self.$headerTable && diff < 0) {
-      self.$headerTable.css('padding-top', -diff + 'px');
-    } else if (self.$headerTable && self.$headerTable.position().top !== 0) {
-      self.$headerTable.css('padding-top', '0');
-    }
-  };
-
-  $.fn[PLUGIN_NAME] = function (options) {
-    return this.each(function () {
-      if ($.data(this, 'plugin_' + PLUGIN_NAME)) {
-        $.data(this, 'plugin_' + PLUGIN_NAME).destroy();
-      }
-      $.data(this, 'plugin_' + PLUGIN_NAME, new Plugin(this, options));
-    });
-  }
-})(jQuery, window, document);

+ 1 - 1
desktop/core/src/desktop/static/desktop/js/ko.charts.leaflet.js

@@ -30,7 +30,7 @@
           $(element).hide();
           if ((_data.message || (_options.visible != null && _options.visible)) && !_options.isLoading) {
             $(element).siblings(".leaflet-nodata").remove();
-            $(element).before($("<div>").addClass("leaflet-nodata").css({ "textAlign": "center", "fontSize": "18px", "fontWeight": 700, "marginTop": "20px"}).text(_data.message || window.HUE_I18n.chart.noData));
+            $(element).before($("<div>").addClass("leaflet-nodata").css({ "textAlign": "center", "fontSize": "18px", "fontWeight": 700, "marginTop": "20px"}).text(_data.message || window.I18n('No Data Available.')));
           }
         }
       }

+ 2 - 2
desktop/core/src/desktop/static/desktop/js/queryBuilder.js

@@ -158,7 +158,7 @@
       // Should we have an input field?
       var inputField = '';
       if (hasInput) {
-        inputField = '<input type="text" placeholder="' + HUE_I18n.queryBuilder.insertValueHere + '" required>';
+        inputField = '<input type="text" placeholder="' + window.I18n('Insert value here') + '" required>';
       }
 
       // Used to store new rule
@@ -256,7 +256,7 @@
       if (rules[PROJECT].length < 1 && rules[AGGREGATE].length < 1) {
         return {
           "status": "fail",
-          "message": HUE_I18n.queryBuilder.queryRequire
+          "message": window.I18n('Query requires a select or aggregate.')
         };
       }
 

+ 0 - 53
desktop/core/src/desktop/templates/common_header_m.mako

@@ -80,59 +80,6 @@ if USE_NEW_EDITOR.get():
 
     var AUTOCOMPLETE_TIMEOUT = ${ conf.EDITOR_AUTOCOMPLETE_TIMEOUT.get() };
 
-    window.HUE_I18n = {
-      documentType: {
-        'all': '${_('All')}',
-        'directory': '${ _('Directory') }',
-        'link-pigscript': '${_('Pig Design')}',
-        'link-workflow': '${_('Job Design')}',
-        'notebook': '${_('Notebook')}',
-        'oozie-bundle2': '${_('Oozie Bundle')}',
-        'oozie-coordinator2': '${_('Oozie Schedule')}',
-        'oozie-workflow2': '${_('Oozie Workflow')}',
-        'query-hive': '${_('Hive Query')}',
-        'query-impala': '${_('Impala Query')}',
-        'search-dashboard': '${_('Search Dashboard')}',
-        'query-mapreduce': '${_('MapReduce Job')}',
-        'query-sqoop1': '${_('Import Job')}',
-        'query-spark2': '${_('Spark Job')}',
-        'query-java': '${_('Java Job')}',
-        'query-pig': '${_('Pig Script')}',
-        'query-shell': '${_('Shell Script')}',
-        'query-distcp': '${_('DistCp Job')}'
-      },
-      jHueHdfsTree: {
-        GO_TO_COLUMN: '${_('Go to column:')}',
-        PLACEHOLDER: '${_('column name...')}',
-        LOCK: '${_('Lock this row')}',
-        UNLOCK: '${_('Unlock this row')}',
-        ROW_DETAILS: '${_('Show row details')}'
-      },
-      jHueFileChooser: {
-        BACK: '${_('Back')}',
-        SELECT_FOLDER: '${_('Select this folder')}',
-        CREATE_FOLDER: '${_('Create folder')}',
-        FOLDER_NAME: '${_('Folder name')}',
-        CANCEL: '${_('Cancel')}',
-        FILE_NOT_FOUND: '${_('The file has not been found')}',
-        UPLOAD_FILE: '${_('Upload a file')}',
-        FAILED: '${_('Failed')}'
-      },
-      jHueTableExtender: {
-        GO_TO_COLUMN: '${_('Go to column:')}',
-        PLACEHOLDER: '${_('column name...')}',
-        LOCK: '${_('Lock this row')}',
-        UNLOCK: '${_('Unlock this row')}',
-        ROW_DETAILS: '${_('Show row details')}'
-      },
-      syntaxChecker: {
-        didYouMean: '${_('Did you mean')}',
-        expectedStatementEnd: '${_('Expected end of statement')}',
-        suppressError: '${_('Ignore this type of error')}',
-        couldNotFind: '${_('Could not find')}'
-      }
-    };
-
     window.LEAFLET_DEFAULTS = {
       layer: '${ leaflet['layer'] |n,unicode }',
       attribution: '${ leaflet['attribution'] |n,unicode }'

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

@@ -413,13 +413,13 @@ except ImportError, e:
               });
               return result;
             } else {
-              return HUE_I18n.copyToClipboard.error;
+              return window.I18n('Error while copying results.');
             }
           }
         });
 
         clipboard.on('success', function (e) {
-          $.jHueNotify.info(self.snippet.result.data().length + ' ' + HUE_I18n.copyToClipboard.success);
+          $.jHueNotify.info(self.snippet.result.data().length + ' ' + window.I18n('result(s) copied to the clipboard'));
           e.clearSelection();
         });
 

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

@@ -472,7 +472,7 @@ from desktop.views import _ko
               <div class="doc-browser-attr-group">
                 <!-- ko with: definition -->
                 <div class="doc-browser-attr-col doc-browser-description" data-bind="text: description, attr: { 'title': description }"></div>
-                <div class="doc-browser-attr-col doc-browser-type" data-bind="text: HUE_I18n.documentType[type] || type"></div>
+                <div class="doc-browser-attr-col doc-browser-type" data-bind="text: window.DOCUMENT_TYPE_I18n[type] || type"></div>
                 <div class="doc-browser-attr-col doc-browser-owner" data-bind="text: owner, attr: { 'title': owner }"></div>
                 <div class="doc-browser-attr-col doc-browser-modified" data-bind="text: localeFormat(last_modified)"></div>
                 <!-- /ko -->

+ 107 - 154
desktop/core/src/desktop/templates/global_js_constants.mako

@@ -67,152 +67,113 @@
   window.JB_SINGLE_CHECK_INTERVAL_IN_MILLIS = 5000;
   window.JB_MULTI_CHECK_INTERVAL_IN_MILLIS = 20000;
 
+  // TODO: Replace with json import
   window.HUE_I18n = {
-    autocomplete: {
-      category: {
-        all: '${ _('All') }',
-        column: '${ _('Columns') }',
-        cte: '${ _('CTEs') }',
-        database: '${ _('Databases') }',
-        field: '${ _('Field') }',
-        'function': '${ _('Functions') }',
-        identifier: '${ _('Identifiers') }',
-        keyword: '${ _('Keywords') }',
-        popular: '${ _('Popular') }',
-        sample: '${ _('Samples') }',
-        table: '${ _('Tables') }',
-        udf: '${ _('UDFs') }',
-        option: '${ _('Options') }',
-        variable: '${ _('Variables') }'
-      },
-      meta: {
-        aggregateFunction: '${ _('aggregate') }',
-        alias: '${ _('alias') }',
-        commonTableExpression: '${ _('cte') }',
-        database: '${ _('database') }',
-        filter: '${ _('filter') }',
-        groupBy: '${ _('group by') }',
-        join: '${ _('join') }',
-        joinCondition: '${ _('condition') }',
-        keyword: '${ _('keyword') }',
-        orderBy: '${ _('order by') }',
-        table: '${ _('table') }',
-        sample: '${ _('sample') }',
-        variable: '${ _('variable') }',
-        view: '${ _('view') }',
-        virtual: '${ _('virtual') }'
-      }
-    },
-    copyToClipboard: {
-      error: "${ _('Error while copying results.') }",
-      success: "${ _('result(s) copied to the clipboard') }",
-    },
-    documentType: {
-      'all': '${_('All')}',
-      'directory': '${ _('Directory') }',
-      'link-pigscript': '${_('Pig Design')}',
-      'link-workflow': '${_('Job Design')}',
-      'notebook': '${_('Notebook')}',
-      'oozie-bundle2': '${_('Oozie Bundle')}',
-      'oozie-coordinator2': '${_('Oozie Schedule')}',
-      'oozie-workflow2': '${_('Oozie Workflow')}',
-      'query-hive': '${_('Hive Query')}',
-      'query-impala': '${_('Impala Query')}',
-      'search-dashboard': '${_('Search Dashboard')}',
-      'query-mapreduce': '${_('MapReduce Job')}',
-      'query-sqoop1': '${_('Import Job')}',
-      'query-spark2': '${_('Spark Job')}',
-      'query-java': '${_('Java Job')}',
-      'query-pig': '${_('Pig Script')}',
-      'query-shell': '${_('Shell Script')}',
-      'query-distcp': '${_('DistCp Job')}'
-    },
-    dropzone: {
-      cancelUpload: '${ _('Cancel upload') }',
-      uploadCanceled: '${ _('The upload has been canceled') }',
-      uploadSucceeded: '${ _('uploaded successfully') }'
-    },
-    jHueHdfsTree: {
-      GO_TO_COLUMN: '${_('Go to column:')}',
-      PLACEHOLDER: '${_('column name...')}',
-      LOCK: '${_('Lock this row')}',
-      UNLOCK: '${_('Unlock this row')}',
-      ROW_DETAILS: '${_('Show row details')}'
-    },
-    jHueFileChooser: {
-      BACK: '${_('Back')}',
-      SELECT_FOLDER: '${_('Select this folder')}',
-      CREATE_FOLDER: '${_('Create folder')}',
-      FOLDER_NAME: '${_('Folder name')}',
-      CANCEL: '${_('Cancel')}',
-      FILE_NOT_FOUND: '${_('The file has not been found')}',
-      UPLOAD_FILE: '${_('Upload a file')}',
-      FAILED: '${_('Failed')}'
-    },
-    jHueTableExtender: {
-      GO_TO_COLUMN: '${_('Go to column:')}',
-      PLACEHOLDER: '${_('column name...')}',
-      LOCK: '${_('Lock this row')}',
-      UNLOCK: '${_('Unlock this row')}',
-      ROW_DETAILS: '${_('Show row details')}'
-    },
-    metastore: {
-      errorRefreshingTableStats: '${_('An error occurred refreshing the table stats. Please try again.')}'
-    },
-    nav: {
-      apps: '${ _('Apps') }',
-      browsers: '${ _('Browsers') }',
-      documents: '${ _('Documents') }',
-      editor: '${ _('Editor') }',
-    },
-    notebook: {
-      dropEditorHoverText: '${_('Drop a SQL file here')}',
-      dropNotebookHoverText: '${_('Drop iPython/Zeppelin notebooks here')}',
-      noResults: '${_('No results found.')}',
-      of: '${_('of')}'
-    },
-    selectize: {
-      choose: "${ _('Choose...') }",
-      editTags: "${ _('Edit tags') }"
-    },
-    syntaxChecker: {
-      didYouMean: '${_('Did you mean')}',
-      expectedStatementEnd: '${_('Expected end of statement')}',
-      suppressError: '${_('Ignore this type of error')}',
-      couldNotFind: '${_('Could not find')}'
-    },
-    queryBuilder: {
-      insertValueHere: "${ _('Insert value here') }",
-      queryRequire: "${ _('Query requires a select or aggregate.') }"
-    },
-    chart: {
-      noData: "${ _('No Data Available.') }",
-      missingLegend: "${ _('Missing legend configuration.') }",
-      missingValue: "${ _('Missing value configuration.') }",
-      missingX: "${ _('Missing x axis configuration.') }",
-      missingY: "${ _('Missing y axis configuration.') }",
-      missingLatitude: "${ _('Missing latitude configuration.') }",
-      missingLongitude: "${ _('Missing longitude configuration.') }",
-      missingLabel: "${ _('Missing label configuration.') }",
-      missingRegion: "${ _('Missing region configuration.') }",
-    },
-    profile: {
-      timeline: "${ _('Timeline') }",
-      metrics: "${ _('Metrics') }",
-      cpu: "${ _('CPU') }",
-      io: "${ _('IO') }",
-      execution: "${ _('Execution') }",
-      codegen: "${ _('CodeGen') }",
-      overview: "${ _('Overview') }",
-      topnodes: "${ _('Top Nodes') }",
-      compilation: "${ _('Compilation') }",
-      planning: "${ _('Planning') }",
-      risks: "${ _('Risks') }"
-    },
-    general: {
-      addMore: '${ _('Add more...') }',
-      offlineOrError: '${ _('It looks like you are offline or an unknown error happened. Please refresh the page.') }'
-    }
+    'Add more...': '${ _('Add more...') }',
+    'aggregate': '${ _('aggregate') }',
+    'alias': '${ _('alias') }',
+    'All': '${_('All')}',
+    'An error occurred refreshing the table stats. Please try again.': '${_('An error occurred refreshing the table stats. Please try again.')}',
+    'Apps': '${ _('Apps') }',
+    'Back': '${_('Back')}',
+    'Browsers': '${ _('Browsers') }',
+    'Cancel upload': '${ _('Cancel upload') }',
+    'Cancel': '${_('Cancel')}',
+    'Choose...': '${ _('Choose...') }',
+    'CodeGen': '${ _('CodeGen') }',
+    'column name...': '${_('column name...')}',
+    'Columns': '${ _('Columns') }',
+    'Compilation': '${ _('Compilation') }',
+    'condition': '${ _('condition') }',
+    'Could not find': '${_('Could not find')}',
+    'CPU': '${ _('CPU') }',
+    'Create folder': '${_('Create folder')}',
+    'cte': '${ _('cte') }',
+    'CTEs': '${ _('CTEs') }',
+    'database': '${ _('database') }',
+    'Databases': '${ _('Databases') }',
+    'Did you mean': '${_('Did you mean')}',
+    'dir': '${ _('dir') }',
+    'Directory': '${ _('Directory') }',
+    'DistCp Job': '${_('DistCp Job')}',
+    'Documents': '${ _('Documents') }',
+    'Drop a SQL file here': '${_('Drop a SQL file here')}',
+    'Drop iPython/Zeppelin notebooks here': '${_('Drop iPython/Zeppelin notebooks here')}',
+    'Edit tags': '${ _('Edit tags') }',
+    'Editor': '${ _('Editor') }',
+    'Error while copying results.': '${ _('Error while copying results.') }',
+    'Execution': '${ _('Execution') }',
+    'Expected end of statement': '${_('Expected end of statement')}',
+    'Failed': '${_('Failed')}',
+    'Fields': '${ _('Fields') }',
+    'Files': '${ _('Files') }',
+    'filter': '${ _('filter') }',
+    'Folder name': '${_('Folder name')}',
+    'Functions': '${ _('Functions') }',
+    'Go to column:': '${_('Go to column:')}',
+    'group by': '${ _('group by') }',
+    'Hive Query': '${_('Hive Query')}',
+    'Identifiers': '${ _('Identifiers') }',
+    'Ignore this type of error': '${_('Ignore this type of error')}',
+    'Impala Query': '${_('Impala Query')}',
+    'Import Job': '${_('Import Job')}',
+    'Insert value here': '${ _('Insert value here') }',
+    'IO': '${ _('IO') }',
+    'It looks like you are offline or an unknown error happened. Please refresh the page.': '${ _('It looks like you are offline or an unknown error happened. Please refresh the page.') }',
+    'Java Job': '${_('Java Job')}',
+    'Job Design': '${_('Job Design')}',
+    'join': '${ _('join') }',
+    'keyword': '${ _('keyword') }',
+    'Keywords': '${ _('Keywords') }',
+    'Lock this row': '${_('Lock this row')}',
+    'MapReduce Job': '${_('MapReduce Job')}',
+    'Metrics': '${ _('Metrics') }',
+    'Missing label configuration.': '${ _('Missing label configuration.') }',
+    'Missing latitude configuration.': '${ _('Missing latitude configuration.') }',
+    'Missing legend configuration.': '${ _('Missing legend configuration.') }',
+    'Missing longitude configuration.': '${ _('Missing longitude configuration.') }',
+    'Missing region configuration.': '${ _('Missing region configuration.') }',
+    'Missing value configuration.': '${ _('Missing value configuration.') }',
+    'Missing x axis configuration.': '${ _('Missing x axis configuration.') }',
+    'Missing y axis configuration.': '${ _('Missing y axis configuration.') }',
+    'No Data Available.': '${ _('No Data Available.') }',
+    'No results found.': '${_('No results found.')}',
+    'Notebook': '${_('Notebook')}',
+    'of': '${_('of')}',
+    'Oozie Bundle': '${_('Oozie Bundle')}',
+    'Oozie Schedule': '${_('Oozie Schedule')}',
+    'Oozie Workflow': '${_('Oozie Workflow')}',
+    'Options': '${ _('Options') }',
+    'order by': '${ _('order by') }',
+    'Overview': '${ _('Overview') }',
+    'Pig Design': '${_('Pig Design')}',
+    'Pig Script': '${_('Pig Script')}',
+    'Planning': '${ _('Planning') }',
+    'Popular': '${ _('Popular') }',
+    'Query requires a select or aggregate.': '${ _('Query requires a select or aggregate.') }',
+    'result(s) copied to the clipboard' : '${ _('result(s) copied to the clipboard') }',
+    'Risks': '${ _('Risks') }',
+    'sample': '${ _('sample') }',
+    'Samples': '${ _('Samples') }',
+    'Search Dashboard': '${_('Search Dashboard')}',
+    'Select this folder': '${_('Select this folder')}',
+    'Shell Script': '${_('Shell Script')}',
+    'Show row details': '${_('Show row details')}',
+    'Spark Job': '${_('Spark Job')}',
+    'table': '${ _('table') }',
+    'Tables': '${ _('Tables') }',
+    'The file has not been found': '${_('The file has not been found')}',
+    'The upload has been canceled': '${ _('The upload has been canceled') }',
+    'Timeline': '${ _('Timeline') }',
+    'Top Nodes': '${ _('Top Nodes') }',
+    'UDFs': '${ _('UDFs') }',
+    'Unlock this row': '${_('Unlock this row')}',
+    'Upload a file': '${_('Upload a file')}',
+    'uploaded successfully': '${ _('uploaded successfully') }',
+    'variable': '${ _('variable') }',
+    'Variables': '${ _('Variables') }',
+    'view': '${ _('view') }',
+    'virtual': '${ _('virtual') }'
   };
 
   window.HUE_VERSION = '${ hue_version() }';
@@ -225,15 +186,7 @@
 
   window.IS_S3_ENABLED = '${ is_s3_enabled }' === 'True';
 
-  var docTypes = [];
-  Object.keys(window.HUE_I18n.documentType).forEach(function (key) {
-    if (key !== 'all') {
-      docTypes.push({ type: key, label: window.HUE_I18n.documentType[key] });
-    }
-  })
-  docTypes.sort(function (a, b) { return a.label.localeCompare(b.label); });
-  docTypes.unshift({ type: 'all', label: window.HUE_I18n.documentType['all'] });
-  window.DOCUMENT_TYPES = docTypes;
+
 
   window.LEAFLET_DEFAULTS = {
     layer: '${ leaflet['layer'] |n,unicode }',

+ 1 - 1
desktop/core/src/desktop/templates/ko_components/ko_context_popover.mako

@@ -164,7 +164,7 @@ from metadata.conf import has_navigator
       <a style="font-size: 20px;" href="javascript:void(0)" data-bind="text: name, hueLink: link, click: function () { $parents[1].close(); }"></a>
       <!-- /ko -->
       <br/>
-      <span data-bind="text: HUE_I18n.documentType[type] || type"></span>
+      <span data-bind="text: window.DOCUMENT_TYPE_I18n[type] || type"></span>
       <!-- ko if: description -->
       <div class="context-popover-doc-description" data-bind="html: description"></div>
       <!-- /ko -->

+ 13 - 9
desktop/core/src/desktop/templates/ko_components/ko_simple_ace_editor.mako

@@ -57,6 +57,10 @@ from desktop.views import _ko
 
       var DEFAULT_POPULAR = ko.observable(false);
 
+      var KEYWORD_I18n = window.I18n('keyword');
+
+      var SAMPLE_I18n = window.I18n('sample');
+
       var SolrFormulaAutocompleter = (function () {
         var SOLR_FUNCTIONS = {
           abs: {
@@ -471,9 +475,9 @@ from desktop.views import _ko
         };
 
         var CATEGORIES = {
-          ALL: { id: 'all', color: COLORS.ALL, label: HUE_I18n.autocomplete.category.all },
-          FIELD: { id: 'field', weight: 1000, color: COLORS.FIELD, label: HUE_I18n.autocomplete.category.field, detailsTemplate: 'solr-field' },
-          FUNCTION: { id: 'function', weight: 900, color: COLORS.FUNCTION, label: HUE_I18n.autocomplete.category.function, detailsTemplate: 'udf' }
+          ALL: { id: 'all', color: COLORS.ALL, label: window.I18n('All') },
+          FIELD: { id: 'field', weight: 1000, color: COLORS.FIELD, label: window.I18n('Fields'), detailsTemplate: 'solr-field' },
+          FUNCTION: { id: 'function', weight: 900, color: COLORS.FUNCTION, label: window.I18n('Functions'), detailsTemplate: 'udf' }
         };
 
         var SolrFormulaSuggestions = function (fieldAccessor) {
@@ -585,10 +589,10 @@ from desktop.views import _ko
         var SAMPLE_LIMIT = 100;
 
         var CATEGORIES = {
-          ALL: { id: 'all', color: COLORS.ALL, label: HUE_I18n.autocomplete.category.all },
-          FIELD: { id: 'field', weight: 1000, color: COLORS.FIELD, label: HUE_I18n.autocomplete.category.field, detailsTemplate: 'solr-field' },
-          KEYWORD: { id: 'keyword', weight: 0, color: COLORS.KEYWORD, label: HUE_I18n.autocomplete.category.keyword, detailsTemplate: 'keyword' },
-          SAMPLE: { id: 'sample', weight: 900, color: COLORS.SAMPLE, label: HUE_I18n.autocomplete.category.sample, detailsTemplate: 'value' }
+          ALL: { id: 'all', color: COLORS.ALL, label: window.I18n('All') },
+          FIELD: { id: 'field', weight: 1000, color: COLORS.FIELD, label: window.I18n('Fields'), detailsTemplate: 'solr-field' },
+          KEYWORD: { id: 'keyword', weight: 0, color: COLORS.KEYWORD, label: window.I18n('Keywords'), detailsTemplate: 'keyword' },
+          SAMPLE: { id: 'sample', weight: 900, color: COLORS.SAMPLE, label: window.I18n('Samples'), detailsTemplate: 'value' }
         };
 
         var SolrQuerySuggestions = function (collection, editor) {
@@ -646,7 +650,7 @@ from desktop.views import _ko
               self.lastNonSampleSuggestions.push({
                 category: CATEGORIES.KEYWORD,
                 value: keyword,
-                meta: HUE_I18n.autocomplete.meta.keyword,
+                meta: KEYWORD_I18n,
                 weightAdjust: 0,
                 popular: DEFAULT_POPULAR,
                 details: null
@@ -706,7 +710,7 @@ from desktop.views import _ko
                     }
                     sampleSuggestions.push({
                       value: value,
-                      meta: HUE_I18n.autocomplete.meta.sample,
+                      meta: SAMPLE_I18n,
                       category: CATEGORIES.SAMPLE,
                       popular: DEFAULT_POPULAR,
                       details: result.terms[i]

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

@@ -58,7 +58,7 @@ from django.utils.translation import ugettext as _
             });
           }
           expected.push({
-            label: HUE_I18n.syntaxChecker.suppressError,
+            label: window.I18n('Ignore this type of error'),
             suppressRule: params.data.ruleId.toString() + params.data.text.toLowerCase()
           });
         }

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

@@ -3425,10 +3425,10 @@ function pieChartDataTransformerGrid(data) {
     chartY = searchViewModel.collection.template.chartSettings.chartYSingle();
   } // else we just take value as is
   if (!chartX) {
-    _data.message = window.HUE_I18n.chart.missingLegend;
+    _data.message = window.I18n('Missing legend configuration.');
     return _data;
   } else if (!chartY) {
-    _data.message = window.HUE_I18n.chart.missingValue;
+    _data.message = window.I18n('Missing value configuration.');
     return _data;
   }
 
@@ -3814,10 +3814,10 @@ function gradientMapChartDataTransformerGrid(data) {
   } // else we just take value as is
   var _data = [];
   if (!chartX) {
-    _data.message = window.HUE_I18n.chart.missingRegion;
+    _data.message = window.I18n('Missing region configuration.');
     return _data;
   } else if (!chartY) {
-    _data.message = window.HUE_I18n.chart.missingY;
+    _data.message = window.I18n('Missing y axis configuration.');
     return _data;
   }
   $(data.counts).each(function (cnt, item) {
@@ -3897,13 +3897,13 @@ function leafletMapChartDataTransformerGrid(data) {
   }
 
   if (!chartX) {
-    _data.message = window.HUE_I18n.chart.missingLatitude;
+    _data.message = window.I18n('Missing latitude configuration.');
     return _data;
   } else if (!chartY) {
-    _data.message = window.HUE_I18n.chart.missingLongitude;
+    _data.message = window.I18n('Missing longitude configuration.');
     return _data;
   } else if (!chartMapLabel) {
-    _data.message = window.HUE_I18n.chart.missingLabel;
+    _data.message = window.I18n('Missing label configuration.');
     return _data;
   }
 
@@ -3988,10 +3988,10 @@ function multiSerieDataTransformerGrid(rawDatum, isTimeline) {
   } // else we just take value as is
 
   if (!chartX) {
-    _datum.message = window.HUE_I18n.chart.missingX;
+    _datum.message = window.I18n('Missing x axis configuration.');
     return _datum;
   } else if (!chartY || !chartY.length) {
-    _datum.message = window.HUE_I18n.chart.missingY;
+    _datum.message = window.I18n('Missing y axis configuration.');
     return _datum;
   }