fix(plugin-workflow): add document title (#363)

This commit is contained in:
Junyi 2022-05-05 20:55:35 +08:00 committed by GitHub
parent 0a28df510d
commit 09dfd3804e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -1,4 +1,4 @@
import React, { useContext } from 'react';
import React, { useContext, useEffect } from 'react';
import { Dropdown, Menu, Button } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import { cx } from '@emotion/css';
@ -7,6 +7,7 @@ import { useTranslation } from 'react-i18next';
import {
useCollection,
useCompile,
useDocumentTitle,
useResourceActionContext
} from '..';
import { Instruction, instructions, Node } from './nodes';
@ -39,6 +40,12 @@ export function WorkflowCanvas() {
const { t } = useTranslation();
const { data, refresh, loading } = useResourceActionContext();
const { setTitle } = useDocumentTitle();
useEffect(() => {
const { title } = data?.data ?? {};
setTitle(`${title ? `${title} - ` : ''}${t('Workflow')}`);
}, [data?.data]);
if (!data?.data && !loading) {
return <div>{t('Load failed')}</div>;
}

View File

@ -131,8 +131,6 @@ function CalculationConfig({ value, onChange }) {
);
}
console.log(i18n.t('Collection name'));
export default {
title: '{{t("Condition")}}',
type: 'condition',