Adjust how prompts are handled on FE
This commit is contained in:
parent
8fc97c60e2
commit
06831c0df6
@ -145,11 +145,6 @@ export default {
|
||||
stepID,
|
||||
input,
|
||||
})
|
||||
.then(() => {
|
||||
setTimeout(() => {
|
||||
this.$store.dispatch('wfPrompts/update')
|
||||
}, 500)
|
||||
})
|
||||
.catch(this.toastErrorHandler(this.$t('notification:automation.scriptFailed')))
|
||||
.finally(() => {
|
||||
this.processing = false
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
// This mixin is used on View component of Records.
|
||||
|
||||
import { compose, validator, NoID } from '@cortezaproject/corteza-js'
|
||||
import { mapGetters, mapActions } from 'vuex'
|
||||
import { mapGetters } from 'vuex'
|
||||
import { throttle } from 'lodash'
|
||||
|
||||
export default {
|
||||
@ -66,10 +66,6 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
...mapActions({
|
||||
updatePrompts: 'wfPrompts/update',
|
||||
}),
|
||||
|
||||
/**
|
||||
* Handle form submit for record create & update
|
||||
*
|
||||
@ -170,7 +166,6 @@ export default {
|
||||
record = new compose.Record(this.module, r)
|
||||
})
|
||||
.then(() => this.dispatchUiEvent('afterFormSubmit', record, { $records: records }))
|
||||
.then(() => this.updatePrompts())
|
||||
.then(() => {
|
||||
if (record.valueErrors.set) {
|
||||
throw new Error(this.toastWarning(this.$t('notification:record.validationWarnings')))
|
||||
@ -239,7 +234,6 @@ export default {
|
||||
record = new compose.Record(this.module, r)
|
||||
})
|
||||
.then(() => this.dispatchUiEvent('afterFormSubmit', record))
|
||||
.then(() => this.updatePrompts())
|
||||
.then(() => {
|
||||
if (this.record.valueErrors.set) {
|
||||
this.toastWarning(this.$t('notification:record.validationWarnings'))
|
||||
@ -272,7 +266,6 @@ export default {
|
||||
.dispatchUiEvent('beforeDelete')
|
||||
.then(() => this.$ComposeAPI.recordDelete(this.record))
|
||||
.then(this.dispatchUiEvent('afterDelete'))
|
||||
.then(this.updatePrompts())
|
||||
.then(() => {
|
||||
this.record = undefined
|
||||
this.initialRecordState = undefined
|
||||
@ -293,7 +286,6 @@ export default {
|
||||
.dispatchUiEvent('beforeUndelete')
|
||||
.then(() => this.$ComposeAPI.recordUndelete(this.record))
|
||||
.then(this.dispatchUiEvent('afterUndelete'))
|
||||
.then(this.updatePrompts())
|
||||
.then(() => {
|
||||
this.record = undefined
|
||||
this.initialRecordState = undefined
|
||||
@ -338,7 +330,6 @@ export default {
|
||||
|
||||
throw err
|
||||
})
|
||||
.then(this.updatePrompts())
|
||||
.then(() => {
|
||||
this.toastSuccess(this.$t('notification:record.bulkRecordUpdateSuccess'))
|
||||
this.onModalHide()
|
||||
|
||||
@ -36,12 +36,13 @@ export default {
|
||||
props: {
|
||||
hideToasts: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
|
||||
data () {
|
||||
return {
|
||||
passive: new Set(),
|
||||
passive: [],
|
||||
|
||||
hasFocus: null,
|
||||
hasFocusObserver: 0,
|
||||
@ -96,7 +97,7 @@ export default {
|
||||
*/
|
||||
toasts () {
|
||||
return this.hideToasts ? [] : [
|
||||
...this.passive.values(),
|
||||
...this.passive,
|
||||
...this.active
|
||||
]
|
||||
},
|
||||
@ -128,8 +129,8 @@ export default {
|
||||
immediate: true,
|
||||
handler (wc) {
|
||||
wc.forEach(p => {
|
||||
if (p.passive) {
|
||||
this.passive.add(p)
|
||||
if (p.passive && !this.passive.some(({ prompt }) => prompt.stateID === p.prompt.stateID)) {
|
||||
this.passive.push(p)
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -161,10 +162,14 @@ export default {
|
||||
this.resume(values)
|
||||
},
|
||||
|
||||
onToastHide ({ prompt, passive}) {
|
||||
if (passive) return
|
||||
|
||||
this.cancel(prompt)
|
||||
onToastHide ({ prompt, passive }) {
|
||||
setTimeout(() => {
|
||||
if (passive) {
|
||||
this.passive = this.passive.filter(({ prompt: p }) => p.stateID !== prompt.stateID)
|
||||
} else {
|
||||
this.cancel(prompt)
|
||||
}
|
||||
}, 300)
|
||||
},
|
||||
|
||||
pVal (prompt, k, def = undefined) {
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<c-prompt-toast
|
||||
:hide-toasts="hideToasts"
|
||||
/>
|
||||
<c-prompt-toast :hide-toasts="hideToasts" />
|
||||
<c-prompt-modal />
|
||||
</div>
|
||||
</template>
|
||||
@ -29,6 +27,7 @@ export default {
|
||||
props: {
|
||||
hideToasts: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user