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
This commit is contained in:
manchandavishal 2023-04-11 23:26:46 +05:30
parent 7d44796eca
commit 6b0aa20179
4 changed files with 15 additions and 15 deletions

View File

@ -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();
});

View File

@ -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());

View File

@ -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');

View File

@ -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'));
});