mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 03:16:12 +00:00
system: replace confirm() use for consistency (#7801)
This commit is contained in:
parent
cb09c6671b
commit
f5ed3cf3d6
@ -134,7 +134,7 @@ class WidgetManager {
|
||||
this.persistedOptions = configuration.options;
|
||||
} catch (error) {
|
||||
// persisted config likely out of date, reset to defaults
|
||||
this._restoreDefaults(false);
|
||||
this.__restoreDefaults();
|
||||
}
|
||||
|
||||
const promises = data.modules.map(async (item) => {
|
||||
@ -564,18 +564,37 @@ class WidgetManager {
|
||||
return $panel;
|
||||
}
|
||||
|
||||
_restoreDefaults(confirmDialog = true) {
|
||||
if (confirmDialog) {
|
||||
if (!confirm(this.gettext.restoreconfirm)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
__restoreDefaults(dialog) {
|
||||
$.ajax({type: "POST", url: "/api/core/dashboard/restoreDefaults"}).done((response) => {
|
||||
if (response['result'] == 'failed') {
|
||||
console.error('Failed to restore default widgets');
|
||||
if (dialog !== undefined) {
|
||||
dialog.close();
|
||||
}
|
||||
} else {
|
||||
window.location.reload();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
_restoreDefaults() {
|
||||
BootstrapDialog.show({
|
||||
title: this.gettext.restore,
|
||||
draggable: true,
|
||||
animate: false,
|
||||
message: this.gettext.restoreconfirm,
|
||||
buttons: [{
|
||||
label: this.gettext.ok,
|
||||
hotkey: 13,
|
||||
action: (dialog) => {
|
||||
this.__restoreDefaults(dialog);
|
||||
}
|
||||
}, {
|
||||
label: this.gettext.cancel,
|
||||
action: (dialog) => {
|
||||
dialog.close();
|
||||
}
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user