Fix/plugin workflow (#349)

* fix(plugin-workflow): fix i18n

* fix(plugin-workflow): fix default enabled value of workflows
This commit is contained in:
Junyi 2022-04-30 17:29:15 +08:00 committed by GitHub
parent 8ee25e1109
commit 01c7c95369
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 14 additions and 27 deletions

View File

@ -284,4 +284,5 @@ export default {
// workflows // workflows
'Execution History': 'History', 'Execution History': 'History',
'Parallel branch': 'Branch',
} }

View File

@ -460,13 +460,11 @@ export default {
'Condition': '条件判断', 'Condition': '条件判断',
'Mode': '模式', 'Mode': '模式',
'Reject on false': '通行模式', 'Continue when "Yes"': '“是”则继续',
'Branch results': '分支模式', 'Branch into "Yes" and "No"': '“是”和“否”分别继续',
'Continue when result is "Yes"': '判断为“是”时继续',
'Make 2 branches for "Yes" and "No"': '判断结果分为“是”和“否”两个分支,分别继续',
'Conditions': '条件配置', 'Conditions': '条件配置',
'Parallel': '并行', 'Parallel branch': '分支',
'All succeeded': '全部成功', 'All succeeded': '全部成功',
'Any succeeded': '任意成功', 'Any succeeded': '任意成功',
'Continue after all branches succeeded': '全部分支都成功后才能继续', 'Continue after all branches succeeded': '全部分支都成功后才能继续',

View File

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
import { css, cx } from "@emotion/css"; import { css, cx } from "@emotion/css";
import { Button, Select, Tooltip } from "antd"; import { Button, Select } from "antd";
import { CloseCircleOutlined, QuestionCircleOutlined } from '@ant-design/icons'; import { CloseCircleOutlined } from '@ant-design/icons';
import { Trans, useTranslation } from "react-i18next"; import { Trans, useTranslation } from "react-i18next";
import { NodeDefaultView } from "."; import { NodeDefaultView } from ".";
@ -150,25 +150,11 @@ export default {
enum: [ enum: [
{ {
value: true, value: true,
label: ( label: i18n.t('Continue when "Yes"')
<Tooltip
title={i18n.t('Continue when result is "Yes"')}
placement="bottom"
>
{i18n.t('Reject on false')} <QuestionCircleOutlined style={{ color: '#999' }} />
</Tooltip>
)
}, },
{ {
value: false, value: false,
label: ( label: i18n.t('Branch results')
<Tooltip
title={i18n.t('Make 2 branches for "Yes" and "No"')}
placement="bottom"
>
{i18n.t('Branch results')} <QuestionCircleOutlined style={{ color: '#999' }} />
</Tooltip>
)
} }
], ],
}, },

View File

@ -11,7 +11,7 @@ import { useTranslation } from "react-i18next";
// import { SchemaComponent } from "../../schema-component"; // import { SchemaComponent } from "../../schema-component";
export default { export default {
title: '{{t("Parallel")}}', title: '{{t("Parallel branch")}}',
type: 'parallel', type: 'parallel',
group: 'control', group: 'control',
fieldset: { fieldset: {
@ -39,7 +39,7 @@ export default {
value: 'any', value: 'any',
label: ( label: (
<Tooltip <Tooltip
title="Continue after any branch succeeded" title={i18n.t('Continue after any branch succeeded')}
placement="bottom" placement="bottom"
> >
{i18n.t('Any succeeded')} <QuestionCircleOutlined style={{ color: '#999' }} /> {i18n.t('Any succeeded')} <QuestionCircleOutlined style={{ color: '#999' }} />

View File

@ -55,6 +55,7 @@ const collection = {
], ],
'x-component': 'Radio.Group', 'x-component': 'Radio.Group',
'x-decorator': 'FormItem', 'x-decorator': 'FormItem',
default: false
} as ISchema } as ISchema
} }
], ],

View File

@ -16,7 +16,8 @@ export default {
interface: 'boolean', interface: 'boolean',
type: 'boolean', type: 'boolean',
name: 'enabled', name: 'enabled',
title: '启用' title: '启用',
defaultValue: false
}, },
{ {
interface: 'textarea', interface: 'textarea',

View File

@ -45,7 +45,7 @@ export default {
if (!Collection) { if (!Collection) {
return; return;
} }
// TODO: duplication when mode change should be considered
for (let [key, event] of MODE_BITMAP_EVENTS.entries()) { for (let [key, event] of MODE_BITMAP_EVENTS.entries()) {
if (mode & key) { if (mode & key) {
if (!Collection.model.options.hooks[event]?.find(item => item.name && item.name === this.getHookId())) { if (!Collection.model.options.hooks[event]?.find(item => item.name && item.name === this.getHookId())) {