Add error notifications for field/layout expression evaluation
This commit is contained in:
@@ -22,7 +22,7 @@ export default {
|
||||
Object.keys(res).forEach(v => {
|
||||
if (!res[v]) this.conditions.push(v)
|
||||
})
|
||||
}).catch(this.toastErrorHandler(this.$t('record.fieldConditions.error')))
|
||||
}).catch(this.toastErrorHandler(this.$t('notification:record.fieldConditions.failed')))
|
||||
},
|
||||
|
||||
prepareFieldConditionsData () {
|
||||
|
||||
@@ -326,7 +326,7 @@
|
||||
:disabled="layout.pageLayoutID === '0'"
|
||||
:title="$t('page-layout.tooltip.builder')"
|
||||
class="d-flex align-items-center"
|
||||
:to="{ name: 'admin.pages.builder', query: { layoutID: layout.pageLayoutID} }"
|
||||
:to="{ name: 'admin.pages.builder', query: { layoutID: layout.pageLayoutID } }"
|
||||
>
|
||||
<font-awesome-icon
|
||||
:icon="['fas', 'tools']"
|
||||
@@ -382,6 +382,7 @@
|
||||
ok-variant="primary"
|
||||
cancel-variant="link"
|
||||
size="xl"
|
||||
scrollable
|
||||
@ok="updateLayout()"
|
||||
@cancel="layoutEditor.layout = undefined"
|
||||
@hide="layoutEditor.layout = undefined"
|
||||
|
||||
@@ -394,8 +394,10 @@ export default {
|
||||
expressions[layout.pageLayoutID] = config.visibility.expression
|
||||
})
|
||||
|
||||
return this.$SystemAPI.expressionEvaluate({ variables, expressions }).catch(() => {
|
||||
return this.$SystemAPI.expressionEvaluate({ variables, expressions }).catch(e => {
|
||||
this.toastErrorHandler(this.$t('notification:evaluate.failed'))(e)
|
||||
Object.keys(expressions).forEach(key => (expressions[key] = false))
|
||||
|
||||
return expressions
|
||||
})
|
||||
},
|
||||
|
||||
@@ -162,7 +162,8 @@ export default {
|
||||
},
|
||||
|
||||
pageBuilder () {
|
||||
return { name: 'admin.pages.builder', params: { pageID: this.page.pageID } }
|
||||
const { pageLayoutID } = this.layout || {}
|
||||
return { name: 'admin.pages.builder', params: { pageID: this.page.pageID }, query: { layoutID: pageLayoutID } }
|
||||
},
|
||||
},
|
||||
|
||||
@@ -259,8 +260,10 @@ export default {
|
||||
expressions[layout.pageLayoutID] = config.visibility.expression
|
||||
})
|
||||
|
||||
return this.$SystemAPI.expressionEvaluate({ variables, expressions }).catch(() => {
|
||||
return this.$SystemAPI.expressionEvaluate({ variables, expressions }).catch(e => {
|
||||
this.toastErrorHandler(this.$t('notification:evaluate.failed'))(e)
|
||||
Object.keys(expressions).forEach(key => (expressions[key] = false))
|
||||
|
||||
return expressions
|
||||
})
|
||||
},
|
||||
|
||||
@@ -259,7 +259,6 @@ record:
|
||||
help: Example
|
||||
field: Field
|
||||
condition: Condition
|
||||
error: Could not evaluate condition
|
||||
recordList:
|
||||
addRecord: Add
|
||||
cancelSelection: Cancel
|
||||
|
||||
@@ -134,6 +134,8 @@ record:
|
||||
validationErrors: check error messages on the form
|
||||
validationWarnings: Record saved successfully, check warning messages on the form
|
||||
staleDataRefresh: Stale record data, all unsaved changes will be lost. Do you wish to refresh the data now?
|
||||
fieldConditions:
|
||||
failed: Failed to evaluate record block field conditions
|
||||
record-list:
|
||||
corrupted-filter: Corrupted filter
|
||||
incorrect-filter-structure: Incorrect structure of filter {{filterID}}
|
||||
@@ -148,4 +150,5 @@ connection:
|
||||
read-failed: Failed to read connection
|
||||
sensitivity-level:
|
||||
fetch-failed: Failed to fetch sensitivity levels
|
||||
|
||||
evaluate:
|
||||
failed: Failed to evaluate expression
|
||||
|
||||
Reference in New Issue
Block a user