@@ -116,17 +116,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
116
116
</v-tooltip >
117
117
</v-card-actions >
118
118
<v-snackbar
119
- v-model =" showSnackbar"
120
- v-bind =" snackbarProps"
121
- data-cy =" response-snackbar"
119
+ v-model =" showWarning"
120
+ timeout =" 4e3"
121
+ color =" amber accent-2"
122
+ light
123
+ data-cy =" warning-snack"
122
124
>
123
- {{ response.msg }}
125
+ {{ warningMsg }}
124
126
<template v-slot :action =" { attrs } " >
125
127
<v-btn
126
- @click =" showSnackbar = false"
128
+ @click =" showWarning = false"
127
129
icon
128
130
v-bind =" attrs"
129
- data-cy =" snackbar -close"
131
+ data-cy =" snack -close"
130
132
>
131
133
<v-icon >
132
134
{{ $options.icons.close }}
@@ -143,7 +145,8 @@ import EditRuntimeForm from '@/components/graphqlFormGenerator/EditRuntimeForm.v
143
145
import Markdown from ' @/components/Markdown'
144
146
import {
145
147
getMutationShortDesc ,
146
- getMutationExtendedDesc
148
+ getMutationExtendedDesc ,
149
+ mutationStatus
147
150
} from ' @/utils/aotf'
148
151
import { mdiClose } from ' @mdi/js'
149
152
@@ -186,10 +189,7 @@ export default {
186
189
data : () => ({
187
190
isValid: false ,
188
191
submitting: false ,
189
- response: {
190
- msg: null ,
191
- level: ' warn'
192
- }
192
+ warningMsg: null
193
193
}),
194
194
195
195
computed: {
@@ -201,26 +201,13 @@ export default {
201
201
extendedDescription () {
202
202
return getMutationExtendedDesc (this .mutation .description )
203
203
},
204
- showSnackbar : {
204
+ showWarning : {
205
205
get () {
206
- return Boolean (this .response . msg )
206
+ return Boolean (this .warningMsg )
207
207
},
208
208
set (val) {
209
- if (! val) this .response . msg = null
209
+ if (! val) this .warningMsg = null
210
210
}
211
- },
212
- snackbarProps () {
213
- return this .response .level === ' error'
214
- ? {
215
- timeout: - 1 ,
216
- color: ' red accent-2' ,
217
- dark: true
218
- }
219
- : {
220
- timeout: 4e3 ,
221
- color: ' amber accent-2' ,
222
- light: true
223
- }
224
211
}
225
212
},
226
213
@@ -230,16 +217,13 @@ export default {
230
217
this .submitting = true
231
218
this .$refs .form .submit ().then (response => {
232
219
this .submitting = false
233
- if (response .status .name .includes (' failed' )) {
234
- this .response .msg = response .message
235
- this .response .level = ' error'
236
- } else if (response .status .name === ' warn' ) {
237
- this .response .msg = response .message
238
- this .response .level = ' warn'
239
- } else {
220
+ if (response .status === mutationStatus .SUCCEEDED ) {
240
221
// Close the form on success
241
222
this .cancel ()
223
+ } else if (response .status === mutationStatus .WARN ) {
224
+ this .warningMsg = response .message
242
225
}
226
+ // else if error, an alert is generated by AOTF
243
227
})
244
228
}
245
229
},
0 commit comments