ui: menu/item: eslint fixes and code cleanup/refactoring/modernize

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-05-19 10:00:57 +02:00
parent 8f6397a2a3
commit bdc157f8f4

View File

@ -9,27 +9,23 @@ Ext.define('PVE.menu.Item', {
dangerous: false,
initComponent: function() {
var me = this;
let me = this;
if (me.handler) {
me.setHandler(me.handler, me.scope);
}
me.callParent();
},
setHandler: function(fn, scope) {
var me = this;
let me = this;
me.scope = scope;
me.handler = function(button, e) {
var rec, msg;
if (me.confirmMsg) {
msg = me.confirmMsg;
Ext.MessageBox.defaultButton = me.dangerous ? 2 : 1;
Ext.Msg.show({
title: gettext('Confirm'),
icon: me.dangerous ? Ext.Msg.WARNING : Ext.Msg.QUESTION,
msg: msg,
msg: me.confirmMsg,
buttons: Ext.Msg.YESNO,
defaultFocus: me.dangerous ? 'no' : 'yes',
callback: function(btn) {