feat(plugin-workflow): add filter button for workflows list (#2555)

This commit is contained in:
Junyi 2023-08-28 22:48:02 +07:00 committed by GitHub
parent 1a82e92ae3
commit 5411faf9d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 12 deletions

View File

@ -2,6 +2,7 @@ import {
CollectionManagerContext,
PluginManagerContext,
SchemaComponent,
SchemaComponentContext,
SettingsCenterProvider,
} from '@nocobase/client';
import { Card, Tooltip } from 'antd';
@ -26,19 +27,22 @@ export function useWorkflowContext() {
}
function WorkflowPane() {
const ctx = useContext(SchemaComponentContext);
return (
<Card bordered={false}>
<SchemaComponent
schema={workflowSchema}
components={{
Tooltip,
WorkflowLink,
ExecutionResourceProvider,
ExecutionLink,
OpenDrawer,
ExecutionStatusSelect,
}}
/>
<SchemaComponentContext.Provider value={{ ...ctx, designable: false }}>
<SchemaComponent
schema={workflowSchema}
components={{
Tooltip,
WorkflowLink,
ExecutionResourceProvider,
ExecutionLink,
OpenDrawer,
ExecutionStatusSelect,
}}
/>
</SchemaComponentContext.Provider>
</Card>
);
}

View File

@ -50,7 +50,7 @@ const collection = {
{
type: 'boolean',
name: 'enabled',
interface: 'radio',
interface: 'radioGroup',
uiSchema: {
title: `{{t("Status", { ns: "${NAMESPACE}" })}}`,
type: 'string',
@ -159,6 +159,20 @@ export const workflowSchema: ISchema = {
},
},
properties: {
filter: {
type: 'void',
title: '{{ t("Filter") }}',
default: {
$and: [{ title: { $includes: '' } }],
},
'x-action': 'filter',
'x-component': 'Filter.Action',
'x-component-props': {
icon: 'FilterOutlined',
useProps: '{{ cm.useFilterActionProps }}',
},
'x-align': 'left',
},
create: {
type: 'void',
title: '{{t("Add new")}}',