Presets: show warning dialog when preset options list has not been opened
parent
83b2846a1d
commit
43b7a8b0d9
|
@ -6589,5 +6589,9 @@
|
|||
"presetsVersionMismatch": {
|
||||
"message": "Preset source version mismatch.<br/>Required version: {{versionRequired}}<br/>Preset source version: {{versionSource}}<br/>Using this preset source could be dangerous.<br/>Do you want to continue?",
|
||||
"description": "Placeholder for the options list dropdown"
|
||||
},
|
||||
"presetsReviewOptionsWarning": {
|
||||
"message": "Please, review the list of options before picking this preset.",
|
||||
"description": "Dialog text to prompt user to review options for the preset"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,11 @@
|
|||
margin-bottom: 2ex;
|
||||
}
|
||||
|
||||
/* multiple select for options - force placeholder color to black/white */
|
||||
#presets_detailed_dialog_content_wrapper .ms-choice>span.placeholder {
|
||||
color: var(--defaultText);
|
||||
}
|
||||
|
||||
.presets-detailed-dialog-property-table {
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
|
|
|
@ -23,6 +23,7 @@ class PresetsDetailedDialog {
|
|||
this._preset = preset;
|
||||
this._setLoadingState(true);
|
||||
this._domDialog[0].showModal();
|
||||
this._optionsShowedAtLeastOnce = false;
|
||||
|
||||
this._presetsRepo.loadPreset(this._preset)
|
||||
.then(() => {
|
||||
|
@ -139,6 +140,7 @@ class PresetsDetailedDialog {
|
|||
onClick: () => this._optionsSelectionChanged(),
|
||||
onCheckAll: () => this._optionsSelectionChanged(),
|
||||
onUncheckAll: () => this._optionsSelectionChanged(),
|
||||
onOpen: () => this._optionsOpened(),
|
||||
hideOptgroupCheckboxes: true,
|
||||
singleRadio: true,
|
||||
selectAll: false,
|
||||
|
@ -154,6 +156,10 @@ class PresetsDetailedDialog {
|
|||
});
|
||||
}
|
||||
|
||||
_optionsOpened() {
|
||||
this._optionsShowedAtLeastOnce = true;
|
||||
}
|
||||
|
||||
_addOptionGroup(parentElement, optionGroup) {
|
||||
const optionGroupElement = $(`<optgroup label="${optionGroup.name}"></optgroup>`);
|
||||
|
||||
|
@ -210,7 +216,14 @@ class PresetsDetailedDialog {
|
|||
}
|
||||
|
||||
_onApplyButtonClicked() {
|
||||
if (!this._preset.completeWarning) {
|
||||
if (this._preset.force_options_review && !this._optionsShowedAtLeastOnce) {
|
||||
const dialogOptions = {
|
||||
title: i18n.getMessage("warningTitle"),
|
||||
text: i18n.getMessage("presetsReviewOptionsWarning"),
|
||||
buttonConfirmText: i18n.getMessage("close"),
|
||||
};
|
||||
GUI.showInformationDialog(dialogOptions);
|
||||
} else if (!this._preset.completeWarning) {
|
||||
this._pickPresetFwVersionCheck();
|
||||
} else {
|
||||
GUI.showYesNoDialog(this._finalDialogYesNoSettings);
|
||||
|
|
|
@ -6,7 +6,7 @@ class PresetParser {
|
|||
}
|
||||
|
||||
readPresetProperties(preset, strings) {
|
||||
const propertiesToRead = ["description", "discussion", "warning", "disclaimer", "include_warning", "include_disclaimer", "discussion"];
|
||||
const propertiesToRead = ["description", "discussion", "warning", "disclaimer", "include_warning", "include_disclaimer", "discussion", "force_options_review"];
|
||||
const propertiesMetadata = {};
|
||||
preset.options = [];
|
||||
|
||||
|
@ -110,11 +110,27 @@ class PresetParser {
|
|||
case this._settings.MetadataTypes.FILE_PATH_ARRAY:
|
||||
this._processArrayProperty(preset, line, propertyName);
|
||||
break;
|
||||
case this._settings.MetadataTypes.BOOLEAN:
|
||||
this._processBooleanProperty(preset, line, propertyName);
|
||||
break;
|
||||
default:
|
||||
this.console.err(`Parcing preset: unknown property type '${this._settings.presetsFileMetadata[property].type}' for the property '${propertyName}'`);
|
||||
}
|
||||
}
|
||||
|
||||
_processBooleanProperty(preset, line, propertyName) {
|
||||
const trueValues = ["true", "yes"];
|
||||
|
||||
const lineLowCase = line.toLowerCase();
|
||||
let result = false;
|
||||
|
||||
if (trueValues.includes(lineLowCase)) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
preset[propertyName] = result;
|
||||
}
|
||||
|
||||
_processArrayProperty(preset, line, propertyName) {
|
||||
if (!preset[propertyName]) {
|
||||
preset[propertyName] = [];
|
||||
|
|
Loading…
Reference in New Issue