@@ -46,7 +46,7 @@
@@ -90,6 +90,16 @@ export default {
return ['advanced', 'simple'].includes(value)
},
},
+ /**
+ * Whether the formula input has a formula value set or not.
+ * Used to determine if we need to show a confirmation prompt
+ * or not when the mode changes from advanced to simple.
+ */
+ hasValue: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
allowNodeSelection: {
type: Boolean,
required: false,
@@ -170,7 +180,14 @@ export default {
},
toggleMode() {
if (this.mode === 'advanced') {
- this.showAdvancedModeModal()
+ if (this.hasValue) {
+ // If we have a value then we want the user to confirm
+ // they're happy for the formula to be reset.
+ this.showAdvancedModeModal()
+ } else {
+ // If we have no value then we can safely switch modes.
+ this.$emit('mode-changed', 'simple')
+ }
} else {
this.$emit('mode-changed', 'advanced')
}
diff --git a/web-frontend/modules/core/components/formula/FormulaInputField.vue b/web-frontend/modules/core/components/formula/FormulaInputField.vue
index 8d669fbd60..ca751a38d9 100644
--- a/web-frontend/modules/core/components/formula/FormulaInputField.vue
+++ b/web-frontend/modules/core/components/formula/FormulaInputField.vue
@@ -19,6 +19,7 @@
:node-selected="nodeSelected"
:loading="loading"
:mode="mode"
+ :has-value="value.length > 0"
:allow-node-selection="allowNodeSelection"
:nodes-hierarchy="nodesHierarchy"
@node-selected="handleNodeSelected"
diff --git a/web-frontend/modules/core/locales/en.json b/web-frontend/modules/core/locales/en.json
index 2ebaf3809c..53c2f55412 100644
--- a/web-frontend/modules/core/locales/en.json
+++ b/web-frontend/modules/core/locales/en.json
@@ -846,10 +846,11 @@
"operators": "Operators",
"search": "Search",
"useRegularInputModalTitle": "Use regular input for this field?",
- "useRegularInput": "Use regular input",
- "useAdvancedInput": "Use advanced input",
- "useAdvancedInputModalTitle": "Use advanced input for this field?",
- "modalMessage": "Your field’s content will be cleared and it will not be possible to recover it."
+ "useSimpleInput": "Switch to basic mode",
+ "useSimpleInputModalTitle": "Switch to basic mode?",
+ "useAdvancedInput": "Switch to expert mode",
+ "useAdvancedInputModalTitle": "Switch to expert mode?",
+ "modalMessage": "Switching to a different mode will clear the current formula. Are you sure you want to continue?"
},
"dataExplorer": {
"noMatchingNodesText": "No matching results were found.",