|
42 | 42 | </a-select-option> |
43 | 43 | </a-select> |
44 | 44 | </a-form-item> |
45 | | - <a-card v-if="form.customactionid" style="margin-bottom: 10px;"> |
| 45 | + <a-card v-if="form.customactionid && (!!currentDescription || !!currentParameters && currentParameters.length > 0)" style="margin-bottom: 10px;"> |
46 | 46 | <div v-if="!!currentDescription"> |
47 | 47 | {{ currentDescription }} |
48 | | - <a-divider /> |
| 48 | + <a-divider v-if="!!currentParameters && currentParameters.length > 0"/> |
49 | 49 | </div> |
50 | 50 | <div v-for="(field, fieldIndex) in currentParameters" :key="fieldIndex"> |
51 | 51 | <a-form-item :name="field.name" :ref="field.name"> |
|
99 | 99 | </template> |
100 | 100 |
|
101 | 101 | <script> |
102 | | -import { ref, reactive, toRaw } from 'vue' |
| 102 | +import { ref, reactive, toRaw, h } from 'vue' |
103 | 103 | import { api } from '@/api' |
104 | 104 | import TooltipLabel from '@/components/widgets/TooltipLabel' |
105 | 105 | import DetailsInput from '@/components/widgets/DetailsInput' |
@@ -249,24 +249,40 @@ export default { |
249 | 249 | jobId: response.runcustomactionresponse.jobid, |
250 | 250 | title: this.currentAction.name || this.$t('label.run.custom.action'), |
251 | 251 | description: this.currentAction.description || this.currentAction.name, |
| 252 | + showSuccessMessage: false, |
252 | 253 | successMethod: (result) => { |
253 | 254 | this.$emit('refresh-data') |
254 | 255 | const actionResponse = result.jobresult?.customactionresult || {} |
255 | 256 | const success = actionResponse.success || false |
256 | | - const message = actionResponse?.result?.message || (success ? 'success' : 'fail') |
257 | | - if (actionResponse.success) { |
258 | | - this.$notification.success({ |
259 | | - message: this.currentAction.name || this.$t('label.run.custom.action'), |
260 | | - description: message, |
261 | | - duration: 0 |
262 | | - }) |
263 | | - } else { |
264 | | - this.$notification.error({ |
265 | | - message: this.currentAction.name || this.$t('label.run.custom.action'), |
266 | | - description: message, |
267 | | - duration: 0 |
268 | | - }) |
269 | | - } |
| 257 | + const message = actionResponse?.result?.message || (success ? 'Success' : 'Failed') |
| 258 | + let details = actionResponse?.result?.details |
| 259 | + try { |
| 260 | + details = JSON.stringify(JSON.parse(details), null, 2) |
| 261 | + } catch (_) {} |
| 262 | + const modalType = success ? this.$success : this.$error |
| 263 | + modalType({ |
| 264 | + title: this.currentAction.name || this.$t('label.run.custom.action'), |
| 265 | + content: h('div', [ |
| 266 | + h('p', `${message}`), |
| 267 | + details |
| 268 | + ? h('div', { |
| 269 | + style: { |
| 270 | + marginTop: '1em', |
| 271 | + maxHeight: '50vh', |
| 272 | + overflowY: 'auto', |
| 273 | + backgroundColor: '#f6f6f6', |
| 274 | + padding: '12px', |
| 275 | + borderRadius: '4px', |
| 276 | + fontFamily: 'monospace', |
| 277 | + whiteSpace: 'pre-wrap', |
| 278 | + wordBreak: 'break-word' |
| 279 | + } |
| 280 | + }, details) |
| 281 | + : null |
| 282 | + ]), |
| 283 | + width: '700px', |
| 284 | + okText: this.$t('label.ok') |
| 285 | + }) |
270 | 286 | }, |
271 | 287 | errorMessage: this.currentAction.name || this.$t('label.run.custom.action'), |
272 | 288 | loadingMessage: this.$t('message.running.custom.action'), |
|
0 commit comments