Add enable and export actions to list workflow items
This commit is contained in:
parent
99fd973742
commit
5b5b82f288
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<b-button
|
||||
variant="light"
|
||||
size="lg"
|
||||
:variant="variant"
|
||||
:size="size"
|
||||
@click="jsonExport(workflows)"
|
||||
>
|
||||
{{ $t('general:export') }}
|
||||
@ -22,6 +22,16 @@ export default {
|
||||
type: String,
|
||||
default: 'workflows-export',
|
||||
},
|
||||
|
||||
size: {
|
||||
type: String,
|
||||
default: 'md',
|
||||
},
|
||||
|
||||
variant: {
|
||||
type: String,
|
||||
default: 'light',
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
@ -321,6 +321,7 @@
|
||||
data-test-id="button-export-workflow"
|
||||
:workflows="[workflow.workflowID]"
|
||||
:file-name="workflow.meta.name || workflow.handle"
|
||||
size="lg"
|
||||
class="ml-1"
|
||||
/>
|
||||
|
||||
|
||||
@ -24,6 +24,9 @@ import {
|
||||
faAngleLeft,
|
||||
faEllipsisV,
|
||||
faBars,
|
||||
faFileExport,
|
||||
faToggleOn,
|
||||
faToggleOff,
|
||||
} from '@fortawesome/free-solid-svg-icons'
|
||||
|
||||
import {
|
||||
@ -62,4 +65,7 @@ library.add(
|
||||
faAngleLeft,
|
||||
faEllipsisV,
|
||||
faBars,
|
||||
faFileExport,
|
||||
faToggleOn,
|
||||
faToggleOff,
|
||||
)
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
@import="importJSON"
|
||||
/>
|
||||
|
||||
<export />
|
||||
<export size="lg" />
|
||||
|
||||
<c-permissions-button
|
||||
v-if="canGrant"
|
||||
@ -164,6 +164,28 @@
|
||||
/>
|
||||
</b-dropdown-item>
|
||||
|
||||
<b-dropdown-item>
|
||||
<font-awesome-icon
|
||||
:icon="['fas', 'file-export']"
|
||||
/>
|
||||
|
||||
<export
|
||||
data-test-id="button-export-workflow"
|
||||
:workflows="([w.workflowID])"
|
||||
:file-name="w.meta.name || w.handle"
|
||||
variant="link"
|
||||
size="md"
|
||||
class="text-decoration-none p-0 ml-1"
|
||||
/>
|
||||
</b-dropdown-item>
|
||||
|
||||
<b-dropdown-item-button @click="handleStatusChange(w)">
|
||||
<font-awesome-icon
|
||||
:icon="['fas', w.enabled ? 'toggle-off' : 'toggle-on']"
|
||||
/>
|
||||
{{ statusText(w) }}
|
||||
</b-dropdown-item-button>
|
||||
|
||||
<c-input-confirm
|
||||
v-if="w.canDeleteWorkflow && !w.deletedAt"
|
||||
borderless
|
||||
@ -368,6 +390,22 @@ export default {
|
||||
})
|
||||
.catch(this.toastErrorHandler(this.$t(`notification:${event}.failed`)))
|
||||
},
|
||||
|
||||
statusText (w) {
|
||||
return w.enabled ? this.$t('general:disable') : this.$t('general:enable')
|
||||
},
|
||||
|
||||
handleStatusChange ({ workflowID, enabled }) {
|
||||
enabled = !enabled
|
||||
const notificationKey = enabled ? 'enable' : 'disable'
|
||||
|
||||
this.$AutomationAPI.workflowRead({ workflowID }).then((w) => {
|
||||
return this.$AutomationAPI.workflowUpdate({ ...w, enabled }).then((w) => {
|
||||
this.toastSuccess(this.$t(`notification:list.${notificationKey}.success`))
|
||||
this.filterList()
|
||||
})
|
||||
}).catch(this.toastErrorHandler(this.$t(`notification:list.${notificationKey}.failed`)))
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -24,6 +24,7 @@
|
||||
:icon="icon"
|
||||
:class="iconClass"
|
||||
/>
|
||||
|
||||
<span
|
||||
v-if="text"
|
||||
:class="textClass"
|
||||
@ -34,6 +35,7 @@
|
||||
</slot>
|
||||
</b-button>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<b-button
|
||||
data-test-id="button-delete-confirm"
|
||||
@ -52,6 +54,7 @@
|
||||
/>
|
||||
</slot>
|
||||
</b-button>
|
||||
|
||||
<b-button
|
||||
data-test-id="button-delete-cancel"
|
||||
:variant="variantCancel"
|
||||
@ -71,6 +74,7 @@
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="js">
|
||||
export default {
|
||||
props: {
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
clear: Clear
|
||||
description: Description
|
||||
enabled: Enabled
|
||||
enable: Enable
|
||||
disable: Disable
|
||||
error: Error
|
||||
error-expression: Error message (expression)
|
||||
export: Export
|
||||
|
||||
@ -19,6 +19,12 @@ general:
|
||||
list:
|
||||
load:
|
||||
error: Failed to fetch workflows
|
||||
enable:
|
||||
success: Workflow enabled
|
||||
failed: Failed to enable workflow
|
||||
disable:
|
||||
success: Workflow disabled
|
||||
failed: Failed to disable workflow
|
||||
import:
|
||||
'failed-import': Failed to import
|
||||
'imported-workflows': Workflows imported
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user