fix: workflow-trigger (#1413)

Co-authored-by: sealday <sealday@gmail.com>
Reviewed-on: daoyoucloud/tachybase#1413
This commit is contained in:
sealday 2024-07-31 14:15:08 +08:00
parent 1c9b3b40eb
commit 4cee56eed7
2 changed files with 6 additions and 30 deletions

View File

@ -2,14 +2,11 @@ import {
ActionDesigner,
SchemaSettings,
SchemaSettingsItemType,
useDesignable,
useSchemaToolbar,
WorkflowConfig,
} from '@tachybase/client';
import { isValid, useFieldSchema } from '@tachybase/schema';
import { useTranslation } from 'react-i18next';
const schemaSettingsItems: SchemaSettingsItemType[] = [
{
name: 'editButton',
@ -19,32 +16,6 @@ const schemaSettingsItems: SchemaSettingsItemType[] = [
return buttonEditorProps;
},
},
{
name: 'Date',
type: 'select',
useComponentProps() {
const { dn } = useDesignable();
const { t } = useTranslation();
const fieldSchema = useFieldSchema();
return {
title: t('Data will be updated'),
options: [
{ label: t('Selected'), value: 'selected' },
{ label: t('All'), value: 'all' },
],
value: fieldSchema['x-action-settings']?.['updateMode'],
onChange: (value) => {
fieldSchema['x-action-settings']['updateMode'] = value;
dn.emit('patch', {
schema: {
'x-uid': fieldSchema['x-uid'],
'x-action-settings': fieldSchema['x-action-settings'],
},
});
},
};
},
},
{
name: 'workflowConfig',
Component: WorkflowConfig,

View File

@ -42,7 +42,12 @@ export class OmniTrigger extends Trigger {
triggerWorkflowsArray.push(key);
}
const workflows = Array.from(this.workflow.enabledCache.values())
.filter((item) => item.type === OmniTrigger.TYPE && item.config.collection === jointCollectionName)
.filter(
(item) =>
item.type === OmniTrigger.TYPE &&
item.config.collection === jointCollectionName &&
triggerWorkflowsArray.includes(item.key),
)
.sort((a, b) => {
const aIndex = triggerWorkflowsArray.indexOf(a.key);
const bIndex = triggerWorkflowsArray.indexOf(b.key);