feat(plugin-workflow): allow to delete execution in list (#5135)

* refactor(plugin-workflow): allow to delete execution in list

* fix(plugin-workflow): fix mistake import
This commit is contained in:
Junyi 2024-08-28 14:43:40 +08:00 committed by GitHub
parent 67d2f85a99
commit 3809108afa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,9 +13,9 @@ import { Link } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { message } from 'antd';
import { useActionContext, useRecord, useResourceActionContext, useResourceContext } from '@nocobase/client';
import { useActionContext, useResourceActionContext, useResourceContext } from '@nocobase/client';
import { ExecutionStatusOptions } from '../constants';
import { ExecutionStatusOptions, EXECUTION_STATUS } from '../constants';
import { NAMESPACE } from '../locale';
import { getWorkflowDetailPath } from '../utils';
@ -116,6 +116,19 @@ export const executionSchema = {
icon: 'ReloadOutlined',
},
},
delete: {
type: 'void',
title: '{{t("Delete")}}',
'x-component': 'Action',
'x-component-props': {
icon: 'DeleteOutlined',
useAction: '{{ cm.useBulkDestroyAction }}',
confirm: {
title: "{{t('Delete record')}}",
content: "{{t('Are you sure you want to delete it?')}}",
},
},
},
clear: {
type: 'void',
title: '{{t("Clear")}}',
@ -148,6 +161,9 @@ export const executionSchema = {
'x-component': 'Table.Void',
'x-component-props': {
rowKey: 'id',
rowSelection: {
type: 'checkbox',
},
useDataSource: '{{ cm.useDataSourceFromRAC }}',
},
properties: {
@ -220,6 +236,28 @@ export const executionSchema = {
type: 'void',
'x-component': 'ExecutionLink',
},
delete: {
type: 'void',
title: '{{ t("Delete") }}',
'x-component': 'Action.Link',
'x-component-props': {
confirm: {
title: "{{t('Delete record')}}",
content: "{{t('Are you sure you want to delete it?')}}",
},
useAction: '{{ cm.useDestroyActionAndRefreshCM }}',
},
'x-reactions': [
{
dependencies: ['..status'],
fulfill: {
state: {
visible: `{{ $deps[0] !== ${EXECUTION_STATUS.STARTED} }}`,
},
},
},
],
},
},
},
},