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

View File

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

View File

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

View File

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