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

View File

@ -50,7 +50,7 @@ const collection = {
{ {
type: 'boolean', type: 'boolean',
name: 'enabled', name: 'enabled',
interface: 'radio', interface: 'radioGroup',
uiSchema: { uiSchema: {
title: `{{t("Status", { ns: "${NAMESPACE}" })}}`, title: `{{t("Status", { ns: "${NAMESPACE}" })}}`,
type: 'string', type: 'string',
@ -159,6 +159,20 @@ export const workflowSchema: ISchema = {
}, },
}, },
properties: { 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: { create: {
type: 'void', type: 'void',
title: '{{t("Add new")}}', title: '{{t("Add new")}}',