Fix(plugin workflow): fix collection data form view (#301)

* fix(plugin-workflow): change collection fields view to right configuration

* fix(plugin-workflow): fix type
This commit is contained in:
Junyi 2022-04-19 22:41:18 +08:00 committed by GitHub
parent f426c8a3ba
commit 111b9e67b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 7 deletions

View File

@ -399,7 +399,7 @@ export const CollectionFieldset = observer(({ value, onChange, useProps }: any)
: { type: 'constant', value: value[field.name] }; : { type: 'constant', value: value[field.name] };
return ( return (
<FormItem label={compile(field.title)}> <FormItem label={compile(field.uiSchema?.title)}>
<VariableTypesContext.Provider value={VTypes}> <VariableTypesContext.Provider value={VTypes}>
<Operand <Operand
value={operand} value={operand}
@ -413,7 +413,7 @@ export const CollectionFieldset = observer(({ value, onChange, useProps }: any)
}} }}
> >
{operand.type === 'constant' {operand.type === 'constant'
? <SchemaComponent schema={field.schema} /> ? <SchemaComponent schema={{ ...field.uiSchema, name: field.name }} />
: null : null
} }
</Operand> </Operand>

View File

@ -1,5 +1,6 @@
import { css } from "@emotion/css"; import { css } from "@emotion/css";
import { useForm } from "@formily/react"; import { useForm } from "@formily/react";
import { useCollectionManager } from "../../collection-manager";
import { useCollectionFilterOptions } from "../../collection-manager/action-hooks"; import { useCollectionFilterOptions } from "../../collection-manager/action-hooks";
export const collection = { export const collection = {
@ -26,8 +27,9 @@ export const values = {
'x-component': 'CollectionFieldset', 'x-component': 'CollectionFieldset',
'x-component-props': { 'x-component-props': {
useProps() { useProps() {
const { getCollectionFields } = useCollectionManager();
const { values: form } = useForm(); const { values: form } = useForm();
const fields = useCollectionFilterOptions(form.collection); const fields = getCollectionFields(form.collection);
return { fields }; return { fields };
} }
} }

View File

@ -44,7 +44,7 @@ export default {
type: 'boolean', type: 'boolean',
title: '使用事务', title: '使用事务',
name: 'useTransaction', name: 'useTransaction',
defaultValue: false defaultValue: true
}, },
{ {
interface: 'linkTo', interface: 'linkTo',

View File

@ -76,7 +76,7 @@ export default class ExecutionModel extends Model {
getTransaction() { getTransaction() {
const { sequelize } = (<typeof WorkflowModel>this.constructor).database; const { sequelize } = (<typeof WorkflowModel>this.constructor).database;
// @ts-ignore // @ts-ignore
if (!this.useTransaction || sequelize.options.dialect === 'sqlite') { if (!this.useTransaction) {
return undefined; return undefined;
} }
@ -172,7 +172,7 @@ export default class ExecutionModel extends Model {
// TODO(optimize): many checking of resuming or new could be improved // TODO(optimize): many checking of resuming or new could be improved
// could be implemented separately in exec() / resume() // could be implemented separately in exec() / resume()
if (job instanceof Model) { if (job instanceof Model) {
savedJob = (await job.save({ transaction: this.transaction })) as JobModel; savedJob = (await job.save({ transaction: this.transaction })) as unknown as JobModel;
} else { } else {
const upstreamId = prevJob instanceof Model ? prevJob.get('id') : null; const upstreamId = prevJob instanceof Model ? prevJob.get('id') : null;
savedJob = await this.saveJob({ savedJob = await this.saveJob({
@ -238,7 +238,7 @@ export default class ExecutionModel extends Model {
executionId: this.id, executionId: this.id,
}, },
{ transaction: this.transaction }, { transaction: this.transaction },
)) as [JobModel, boolean | null]; )) as unknown as [JobModel, boolean | null];
this.jobsMap.set(job.id, job); this.jobsMap.set(job.id, job);
this.jobsMapByNodeId[job.nodeId] = job.result; this.jobsMapByNodeId[job.nodeId] = job.result;