fix: workflow-trigger (#1413)
Co-authored-by: sealday <sealday@gmail.com> Reviewed-on: daoyoucloud/tachybase#1413
This commit is contained in:
parent
1c9b3b40eb
commit
4cee56eed7
@ -2,14 +2,11 @@ import {
|
|||||||
ActionDesigner,
|
ActionDesigner,
|
||||||
SchemaSettings,
|
SchemaSettings,
|
||||||
SchemaSettingsItemType,
|
SchemaSettingsItemType,
|
||||||
useDesignable,
|
|
||||||
useSchemaToolbar,
|
useSchemaToolbar,
|
||||||
WorkflowConfig,
|
WorkflowConfig,
|
||||||
} from '@tachybase/client';
|
} from '@tachybase/client';
|
||||||
import { isValid, useFieldSchema } from '@tachybase/schema';
|
import { isValid, useFieldSchema } from '@tachybase/schema';
|
||||||
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
|
|
||||||
const schemaSettingsItems: SchemaSettingsItemType[] = [
|
const schemaSettingsItems: SchemaSettingsItemType[] = [
|
||||||
{
|
{
|
||||||
name: 'editButton',
|
name: 'editButton',
|
||||||
@ -19,32 +16,6 @@ const schemaSettingsItems: SchemaSettingsItemType[] = [
|
|||||||
return buttonEditorProps;
|
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',
|
name: 'workflowConfig',
|
||||||
Component: WorkflowConfig,
|
Component: WorkflowConfig,
|
||||||
|
@ -42,7 +42,12 @@ export class OmniTrigger extends Trigger {
|
|||||||
triggerWorkflowsArray.push(key);
|
triggerWorkflowsArray.push(key);
|
||||||
}
|
}
|
||||||
const workflows = Array.from(this.workflow.enabledCache.values())
|
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) => {
|
.sort((a, b) => {
|
||||||
const aIndex = triggerWorkflowsArray.indexOf(a.key);
|
const aIndex = triggerWorkflowsArray.indexOf(a.key);
|
||||||
const bIndex = triggerWorkflowsArray.indexOf(b.key);
|
const bIndex = triggerWorkflowsArray.indexOf(b.key);
|
||||||
|
Loading…
Reference in New Issue
Block a user