diff options
author | manchandavishal <manchandavishal143@gmail.com> | 2023-04-11 23:26:46 +0530 |
---|---|---|
committer | manchandavishal <manchandavishal143@gmail.com> | 2023-04-12 22:16:53 +0530 |
commit | 6b0aa201798cb0a893d1b9a1bcc1fa465f8b340f (patch) | |
tree | 3a2a0b52a02abf95a298ba286426fc32a963eff4 | |
parent | 7d44796eca10fa61d4d98ab98358c5932746734e (diff) | |
download | horizon-6b0aa201798cb0a893d1b9a1bcc1fa465f8b340f.tar.gz |
Update jQuery click event to remove deprecation warning
The shorthand jQuery.fn.click() event has been deprecated in favor
of the on() method. This patch updates the code to use the on()
method instead to remove the deprecation warning. For more
information about the deprecation of jQuery.fn.click(),
please refer [1].
[1] https://api.jquery.com/click/
Change-Id: Ic44aaded8d0aaa70e38e46d4121dc3c825f3b831
4 files changed, 15 insertions, 15 deletions
diff --git a/horizon/static/horizon/js/horizon.messages.js b/horizon/static/horizon/js/horizon.messages.js index 94d654efe..049a94273 100644 --- a/horizon/static/horizon/js/horizon.messages.js +++ b/horizon/static/horizon/js/horizon.messages.js @@ -100,7 +100,7 @@ horizon.addInitFunction(function () { }); // Dismiss alert messages when moving on to a new type of action. - $('a.ajax-modal').click(function() { + $('a.ajax-modal').on('click', function() { horizon.clearAllMessages(); }); diff --git a/openstack_dashboard/contrib/developer/static/dashboard/developer/theme-preview/theme-preview.directive.js b/openstack_dashboard/contrib/developer/static/dashboard/developer/theme-preview/theme-preview.directive.js index f7abf562a..fc67dcc7c 100644 --- a/openstack_dashboard/contrib/developer/static/dashboard/developer/theme-preview/theme-preview.directive.js +++ b/openstack_dashboard/contrib/developer/static/dashboard/developer/theme-preview/theme-preview.directive.js @@ -43,7 +43,7 @@ function link(scope, element) { //TODO(tqtran) Use angular, not jQuery - $('a[href="#"]').click(function(e) { + $('a[href="#"]').on('click', function(e) { e.preventDefault(); }); @@ -51,7 +51,7 @@ var $pre = $uibModal.find('pre'); var $button = $('<div id="source-button" class="btn btn-primary btn-xs"><span class="fa fa-code"></span></div>') - .click(function(){ + .on('click', function(){ var $parent = $(this).parent(); var $fragment = stripAngular($parent.clone()); diff --git a/openstack_dashboard/static/js/horizon.flatnetworktopology.js b/openstack_dashboard/static/js/horizon.flatnetworktopology.js index 944b6f4f1..5e9b50f29 100644 --- a/openstack_dashboard/static/js/horizon.flatnetworktopology.js +++ b/openstack_dashboard/static/js/horizon.flatnetworktopology.js @@ -105,12 +105,12 @@ horizon.flat_network_topology = { e.stopImmediatePropagation(); var vnc_window = window.open($(this).attr('href'), vnc_window, 'width=760,height=560'); self.delete_balloon(); - }) - .click(function(){ + }); + $(document).on('click', function(){ self.delete_balloon(); }); - $('.toggle-view > .btn').click(function(){ + $('.toggle-view > .btn').on('click', function(){ self.draw_mode = $(this).data('value'); $('g.network').remove(); horizon.cookies.put('ntp_draw_mode',self.draw_mode); @@ -621,20 +621,20 @@ horizon.flat_network_topology = { 'left': x + 'px' }).show(); - $balloon.find('.delete-device').click(function(){ + $balloon.find('.delete-device').on('click', function(){ var $this = $(this); var delete_modal = horizon.datatables.confirm($this); - delete_modal.find('.btn.btn-danger').click(function () { + delete_modal.find('.btn.btn-danger').on('click', function () { $this.prop('disabled', true); d3.select('#id_' + $this.data('device-id')).classed('loading',true); self.delete_device($this.data('type'),$this.data('device-id')); horizon.modals.spinner.modal('hide'); }); }); - $balloon.find('.delete-port').click(function(){ + $balloon.find('.delete-port').on('click', function(){ var $this = $(this); var delete_modal = horizon.datatables.confirm($this); - delete_modal.find('.btn.btn-danger').click(function () { + delete_modal.find('.btn.btn-danger').on('click', function () { $this.prop('disabled', true); self.delete_port($this.data('router-id'),$this.data('port-id'),$this.data('network-id')); horizon.modals.spinner.modal('hide'); diff --git a/openstack_dashboard/static/js/horizon.networktopology.js b/openstack_dashboard/static/js/horizon.networktopology.js index c94da2953..02cba863d 100644 --- a/openstack_dashboard/static/js/horizon.networktopology.js +++ b/openstack_dashboard/static/js/horizon.networktopology.js @@ -142,7 +142,7 @@ horizon.network_topology = { self.refresh_labels(); }); - angular.element('#center_topology').click(function() { + angular.element('#center_topology').on('click', function() { this.blur(); // remove btn focus after click self.delete_balloon(); // move visualization to the center and reset scale @@ -1101,19 +1101,19 @@ horizon.network_topology = { }) .addClass('leftPosition'); } - _balloon.find('.delete-device').click(function() { + _balloon.find('.delete-device').on('click', function() { var _this = angular.element(this); var delete_modal = horizon.datatables.confirm(_this); - delete_modal.find('.btn.btn-danger').click(function () { + delete_modal.find('.btn.btn-danger').on('click', function () { _this.prop('disabled', true); d3.select('#id_' + _this.data('device-id')).classed('loading',true); self.delete_device(_this.data('type'),_this.data('device-id')); }); }); - _balloon.find('.delete-port').click(function() { + _balloon.find('.delete-port').on('click', function() { var _this = angular.element(this); var delete_modal = horizon.datatables.confirm(_this); - delete_modal.find('.btn.btn-danger').click(function () { + delete_modal.find('.btn.btn-danger').on('click', function () { _this.prop('disabled', true); self.delete_port(_this.data('router-id'),_this.data('port-id'),_this.data('network-id')); }); |