Pārlūkot izejas kodu

HUE-8687 [frontend] Upgrade jQuery to 3.3.1

Johan Ahlen 6 gadi atpakaļ
vecāks
revīzija
0ef3c51
23 mainītis faili ar 61 papildinājumiem un 86 dzēšanām
  1. 2 2
      apps/beeswax/src/beeswax/static/beeswax/js/beeswax.vm.js
  2. 10 10
      apps/hbase/src/hbase/templates/app.mako
  3. 1 1
      apps/jobbrowser/src/jobbrowser/templates/jobs.mako
  4. 2 2
      apps/jobsub/src/jobsub/static/jobsub/js/jobsub.ko.js
  5. 2 2
      apps/oozie/src/oozie/static/oozie/js/workflow.js
  6. 4 4
      apps/oozie/src/oozie/static/oozie/js/workflow.models.js
  7. 2 2
      apps/oozie/src/oozie/templates/editor/edit_workflow.mako
  8. 1 1
      apps/oozie/src/oozie/templates/utils.inc.mako
  9. 1 1
      apps/rdbms/src/rdbms/static/rdbms/js/rdbms.vm.js
  10. 1 1
      desktop/core/src/desktop/static/desktop/js/apiHelper.js
  11. 0 0
      desktop/core/src/desktop/static/desktop/js/hue-bundle-9f109ed3929449756ec4.js.map
  12. 13 13
      desktop/core/src/desktop/static/desktop/js/hue-bundle-f0a99703362a3fc33475.js
  13. 0 0
      desktop/core/src/desktop/static/desktop/js/hue-bundle-f0a99703362a3fc33475.js.map
  14. 0 32
      desktop/core/src/desktop/static/desktop/js/hue-bundle.js
  15. 0 0
      desktop/core/src/desktop/static/desktop/js/hue-bundle.js.map
  16. 1 1
      desktop/core/src/desktop/static/desktop/js/jquery.filechooser.js
  17. 1 1
      desktop/core/src/desktop/templates/common_header_footer_components.mako
  18. 13 6
      desktop/core/src/desktop/templates/hue.mako
  19. 1 1
      desktop/libs/dashboard/src/dashboard/static/dashboard/js/create-collections.ko.js
  20. 1 1
      desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js
  21. 3 3
      package-lock.json
  22. 1 1
      package.json
  23. 1 1
      webpack-stats.json

+ 2 - 2
apps/beeswax/src/beeswax/static/beeswax/js/beeswax.vm.js

@@ -380,7 +380,7 @@ function BeeswaxViewModel(server, apiHelper) {
   var error_fn = function(jqXHR, status, errorThrown) {
     self.design.isRunning(false);
     try {
-      $(document).trigger('server.error', $.parseJSON(jqXHR.responseText));
+      $(document).trigger('server.error', JSON.parse(jqXHR.responseText));
     } catch(e) {
       $(document).trigger('server.unmanageable_error', jqXHR.responseText);
     }
@@ -657,7 +657,7 @@ function BeeswaxViewModel(server, apiHelper) {
       error: function(jqXHR, status, errorThrown) {
         self.design.isRunning(false);
         try {
-          var data = $.parseJSON(jqXHR.responseText);
+          var data = JSON.parse(jqXHR.responseText);
           self.design.watch.errors.push(data.error);
         } catch(e) {
           $(document).trigger('server.unmanageable_error', jqXHR.responseText);

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

@@ -573,8 +573,8 @@ ${ commonheader(None, "hbase", user, request) | n,unicode }
           };
           if (call === true) {
             callback();
-          } else if (call != null && 'complete' in call) {
-            call.complete(callback);
+          } else if (call != null && 'always' in call) {
+            call.always(callback);
           } else {
             self.isLoading(false);
           }
@@ -984,7 +984,7 @@ ${ commonheader(None, "hbase", user, request) | n,unicode }
         }
         var queryObject = {url: url, method: 'POST', startTime: new Date().getTime(), status: 'running...'};
         var functionName = arguments.length > 0 ? arguments[0] : '';
-        var handler = $.post(url, $_POST).error(function (response) {
+        var handler = $.post(url, $_POST).fail(function (response) {
           if (functionName !== 'getColumnDescriptors') {
             $(document).trigger("error", JSON.parse(response.responseText).message);
           }
@@ -1298,7 +1298,7 @@ ${ commonheader(None, "hbase", user, request) | n,unicode }
           }
         }
 
-        return API.queryTable("getColumnDescriptors").done(descriptorCallback).error(function () {
+        return API.queryTable("getColumnDescriptors").done(descriptorCallback).fail(function () {
           descriptorCallback({});
         });
       };
@@ -1536,7 +1536,7 @@ ${ commonheader(None, "hbase", user, request) | n,unicode }
       self.drop = function (cont) {
         function doDrop() {
           self.isLoading(true);
-          return API.queryTable('deleteAllRow', self.row, "{}").complete(function () {
+          return API.queryTable('deleteAllRow', self.row, "{}").always(function () {
             app.views.tabledata.items.remove(self); //decouple later
             self.isLoading(false);
           });
@@ -1691,18 +1691,18 @@ ${ commonheader(None, "hbase", user, request) | n,unicode }
         var action = [i18n('enable'), i18n('disable')][self.enabled() << 0], el = $(event.currentTarget);
         confirm(i18n("Confirm") + " " + action, i18n("Are you sure you want to") + " " + action + " " + i18n("this table?"), function () {
           el.showIndicator();
-          return self[action](el).complete(function () {
+          return self[action](el).always(function () {
             el.hideIndicator();
           });
         });
       };
       self.enable = function (el) {
-        return API.queryCluster('enableTable', self.name).complete(function () {
+        return API.queryCluster('enableTable', self.name).always(function () {
           self.enabled(true);
         });
       };
       self.disable = function (callback) {
-        return API.queryCluster('disableTable', self.name).complete(function () {
+        return API.queryCluster('disableTable', self.name).always(function () {
           self.enabled(false);
           if ($.isFunction(callback)) callback();
         });
@@ -2498,11 +2498,11 @@ ${ commonheader(None, "hbase", user, request) | n,unicode }
       if (ui)
         ui.isLoading(true);
 
-      API.queryArray($(this).attr('action'), data).complete(function () {
+      API.queryArray($(this).attr('action'), data).always(function () {
         $(self).find('input[type=submit]').removeClass('disabled').hideIndicator();
         if (ui)
           ui.isLoading(false);
-      }).success(function () {
+      }).done(function () {
         $(self).modal('hide');
         if (ui)
           app.focusModel().reload();

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

@@ -146,7 +146,7 @@ ${ components.menubar(hiveserver2_impersonation_enabled) }
     $(document).ajaxError(function (event, jqxhr, settings, exception) {
       if (jqxhr.status == 500) {
         window.clearInterval(_runningInterval);
-        $(document).trigger("error", "${_('There was a problem communicating with the server: ')}" + $.parseJSON(jqxhr.responseText).message);
+        $(document).trigger("error", "${_('There was a problem communicating with the server: ')}" + JSON.parse(jqxhr.responseText).message);
       }
     });
 

+ 2 - 2
apps/jobsub/src/jobsub/static/jobsub/js/jobsub.ko.js

@@ -191,12 +191,12 @@ var Design = (function($, ko, NodeFields) {
           }
         }
       });
-      var data = normalize_model_fields($.parseJSON(JSON.stringify(model_dict)));
+      var data = normalize_model_fields(JSON.parse(JSON.stringify(model_dict)));
       var options = $.extend({
         type: 'POST',
         data: data,
         error: function(xhr) {
-          var response = $.parseJSON(xhr.responseText);
+          var response = JSON.parse(xhr.responseText);
           if (response) {
             var model = ko.mapping.toJS(self);
             $.extend(model.errors, response.data.errors);

+ 2 - 2
apps/oozie/src/oozie/static/oozie/js/workflow.js

@@ -530,7 +530,7 @@ var WorkflowModule = function($, NodeModelChooser, Node, ForkNode, DecisionNode,
                 self[key].removeAll();
                 var arr;
                 try {
-                  arr = $.parseJSON(value);
+                  arr = JSON.parse(value);
                 }
                 catch (error){
                   arr = value;
@@ -554,7 +554,7 @@ var WorkflowModule = function($, NodeModelChooser, Node, ForkNode, DecisionNode,
               case 'data':
                 var data = {};
                 try {
-                  data = $.parseJSON(value);
+                  data = JSON.parse(value);
                 } catch (error){
                   data = value;
                 }

+ 4 - 4
apps/oozie/src/oozie/static/oozie/js/workflow.models.js

@@ -50,7 +50,7 @@ function normalize_model_fields(node_model) {
 // Parse JSON if it is JSON and appropriately map.
 // Apply subscriber to each mapping.
 var map_params = function(options, subscribe) {
-  options.data = ($.type(options.data) == "string") ? $.parseJSON(options.data) : options.data;
+  options.data = ($.type(options.data) == "string") ? JSON.parse(options.data) : options.data;
   if ($.isArray(options.data)) {
     var mapping =  ko.mapping.fromJS(options.data);
     $.each(mapping(), function(index, value) {
@@ -72,7 +72,7 @@ var map_params = function(options, subscribe) {
 // Literals will notify their containing arrays when they've changed.
 var map_data = function(options) {
   var data = {};
-  options.data = ($.type(options.data) == "string") ? $.parseJSON(options.data) : options.data;
+  options.data = ($.type(options.data) == "string") ? JSON.parse(options.data) : options.data;
   $.each(options.data, function(member, value) {
     // @TODO: Should we support unstructureed data as children?
     if ($.isArray(value)) {
@@ -391,7 +391,7 @@ var ModelModule = function($) {
 function initializeWorkflowData() {
   var self = this;
 
-  self.data = ($.type(self.data) == "string") ? $.parseJSON(self.data) : self.data;
+  self.data = ($.type(self.data) == "string") ? JSON.parse(self.data) : self.data;
 
   if (! ('sla' in self.data)) {
     self.data['sla'] = DEFAULT_SLA.slice(0);
@@ -401,7 +401,7 @@ function initializeWorkflowData() {
 function initializeNodeData() {
   var self = this;
 
-  self.data = ($.type(self.data) == "string") ? $.parseJSON(self.data) : self.data;
+  self.data = ($.type(self.data) == "string") ? JSON.parse(self.data) : self.data;
 
   if (! ('sla' in self.data)) {
     self.data['sla'] = DEFAULT_SLA.slice(0);

+ 2 - 2
apps/oozie/src/oozie/templates/editor/edit_workflow.mako

@@ -1031,7 +1031,7 @@ $(document).ready(function () {
     var _url = $(this).data('clone-url');
     $.post(_url, function (data) {
       window.location = data.url;
-    }).error(function(){
+    }).fail(function(){
       $(document).trigger("error", "${ _('There was a problem copying this workflow.') }");
     });
   });
@@ -1064,7 +1064,7 @@ $(document).ready(function () {
         $('#submit-wf-modal').html(response);
         $('#submit-wf-modal').modal('show');
       }
-    ).error(function(){
+    ).fail(function(){
       $(document).trigger("error", "${ _('There was a problem submitting this workflow.') }");
     });
   }

+ 1 - 1
apps/oozie/src/oozie/templates/utils.inc.mako

@@ -364,7 +364,7 @@
           $.getJSON(checkPath, function (data) {
             pathAddition = "${ workflow.deployment_dir }/";
             callFileChooser();
-          }).error(function () {
+          }).fail(function () {
             callFileChooser();
           });
         }

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

@@ -155,7 +155,7 @@ function RdbmsViewModel() {
   var error_fn = function(jqXHR, status, errorThrown) {
     self.isExecuting(false);
     try {
-      $(document).trigger('server.error', $.parseJSON(jqXHR.responseText));
+      $(document).trigger('server.error', JSON.parse(jqXHR.responseText));
     } catch(e) {
       $(document).trigger('server.unmanageable_error', jqXHR.responseText);
     }

+ 1 - 1
desktop/core/src/desktop/static/desktop/js/apiHelper.js

@@ -1376,7 +1376,7 @@ var ApiHelper = (function () {
         cluster: ko.mapping.toJSON(options.compute ? options.compute : '""')
       },
       timeout: options.timeout
-    }).success(function (data) {
+    }).done(function (data) {
       data.notFound = data.status === 0 && data.code === 500 && data.error && (data.error.indexOf('Error 10001') !== -1 || data.error.indexOf('AnalysisException') !== -1);
       data.hueTimestamp = Date.now();
 

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/hue-bundle-9f109ed3929449756ec4.js.map


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 13 - 13
desktop/core/src/desktop/static/desktop/js/hue-bundle-f0a99703362a3fc33475.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/hue-bundle-f0a99703362a3fc33475.js.map


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 32
desktop/core/src/desktop/static/desktop/js/hue-bundle.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/hue-bundle.js.map


+ 1 - 1
desktop/core/src/desktop/static/desktop/js/jquery.filechooser.js

@@ -591,7 +591,7 @@
           });
         }, 0);
       }
-    }).error(function (e) {
+    }).fail(function (e) {
       if (!_parent.options.suppressErrors) {
         $(document).trigger("info", _parent.options.labels.FILE_NOT_FOUND);
         _parent.options.onError();

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

@@ -511,7 +511,7 @@ from metadata.conf import has_optimizer, OPTIMIZER
       resetPrimaryButtonsStatus();
     });
 
-    $(window).unload(function () {
+    $(window).on('beforeunload', function () {
       window.clearInterval(pendingRequestsInterval);
       window.clearTimeout(resetTimeout);
     });

+ 13 - 6
desktop/core/src/desktop/templates/hue.mako

@@ -789,9 +789,16 @@ ${ smart_unicode(login_modal(request).content) | n,unicode }
 
         var loadScript = function (scriptUrl) {
           var deferred = $.Deferred();
-          $.get(scriptUrl).done(function (contents) {
+          $.ajax({
+            url: scriptUrl,
+            converters: {
+              'text script': function (text) {
+                return text;
+              }
+            }
+          }).done(function (contents) {
             loadedJs.push(scriptUrl);
-            deferred.resolve(contents);
+            deferred.resolve({ url: scriptUrl, contents: contents });
           }).fail(function () {
             deferred.resolve('');
           });
@@ -857,7 +864,7 @@ ${ smart_unicode(login_modal(request).content) | n,unicode }
             })
           }
 
-          $rawHtml.unwrap('<span>');
+          $rawHtml.unwrap('span');
 
           var scriptPromises = loadScripts(scriptsToLoad);
 
@@ -865,9 +872,9 @@ ${ smart_unicode(login_modal(request).content) | n,unicode }
             if (scriptPromises.length) {
               // Evaluate the scripts in the order they were defined in the page
               var nextScriptPromise = scriptPromises.shift();
-              nextScriptPromise.done(function (contents) {
-                if (contents) {
-                  new Function(contents)();
+              nextScriptPromise.done(function (scriptDetails) {
+                if (scriptDetails.contents) {
+                  $.globalEval(scriptDetails.contents)
                 }
                 evalScriptSync();
               });

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

@@ -166,7 +166,7 @@ var CreateCollectionViewModel = function(steps) {
       return $.post("/search/admin/collections/create", {
         collection: ko.toJSON(self.collection),
       })
-      .success(function(data) {
+      .done(function(data) {
         if (data.status == 0) {
           $(document).trigger("info", data.message);
         } else {

+ 1 - 1
desktop/libs/notebook/src/notebook/static/notebook/js/notebook.ko.js

@@ -2593,7 +2593,7 @@ var EditorViewModel = (function() {
         if (xhr.status !== 502) {
           fail(xhr.responseText);
         }
-      }).complete(function(xhr, status) {
+      }).always(function() {
         self.creatingSessionLocks.remove(session.type());
       })
     };

+ 3 - 3
package-lock.json

@@ -4814,9 +4814,9 @@
       "optional": true
     },
     "jquery": {
-      "version": "2.2.4",
-      "resolved": "https://registry.npmjs.org/jquery/-/jquery-2.2.4.tgz",
-      "integrity": "sha1-LInWiJterFIqfuoywUUhVZxsvwI="
+      "version": "3.3.1",
+      "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz",
+      "integrity": "sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg=="
     },
     "js-levenshtein": {
       "version": "1.1.6",

+ 1 - 1
package.json

@@ -19,7 +19,7 @@
   },
   "dependencies": {
     "bootstrap-2.3.2": "1.0.0",
-    "jquery": "2.2.4",
+    "jquery": "3.3.1",
     "knockout": "3.4.2",
     "knockout.mapping": "2.4.3",
     "less": "3.9.0",

+ 1 - 1
webpack-stats.json

@@ -1 +1 @@
-{"status":"done","chunks":{"hue":[{"name":"hue-bundle-9f109ed3929449756ec4.js","path":"/Users/jahlen/dev/hue/desktop/core/src/desktop/static/desktop/js/hue-bundle-9f109ed3929449756ec4.js"},{"name":"hue-bundle-9f109ed3929449756ec4.js.map","path":"/Users/jahlen/dev/hue/desktop/core/src/desktop/static/desktop/js/hue-bundle-9f109ed3929449756ec4.js.map"}]}}
+{"status":"done","chunks":{"hue":[{"name":"hue-bundle-f0a99703362a3fc33475.js","path":"/Users/jahlen/dev/hue/desktop/core/src/desktop/static/desktop/js/hue-bundle-f0a99703362a3fc33475.js"},{"name":"hue-bundle-f0a99703362a3fc33475.js.map","path":"/Users/jahlen/dev/hue/desktop/core/src/desktop/static/desktop/js/hue-bundle-f0a99703362a3fc33475.js.map"}]}}

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels