fix(plugin-workflow): add document title (#363)
This commit is contained in:
parent
0a28df510d
commit
09dfd3804e
@ -1,4 +1,4 @@
|
|||||||
import React, { useContext } from 'react';
|
import React, { useContext, useEffect } from 'react';
|
||||||
import { Dropdown, Menu, Button } from 'antd';
|
import { Dropdown, Menu, Button } from 'antd';
|
||||||
import { PlusOutlined } from '@ant-design/icons';
|
import { PlusOutlined } from '@ant-design/icons';
|
||||||
import { cx } from '@emotion/css';
|
import { cx } from '@emotion/css';
|
||||||
@ -7,6 +7,7 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import {
|
import {
|
||||||
useCollection,
|
useCollection,
|
||||||
useCompile,
|
useCompile,
|
||||||
|
useDocumentTitle,
|
||||||
useResourceActionContext
|
useResourceActionContext
|
||||||
} from '..';
|
} from '..';
|
||||||
import { Instruction, instructions, Node } from './nodes';
|
import { Instruction, instructions, Node } from './nodes';
|
||||||
@ -39,6 +40,12 @@ export function WorkflowCanvas() {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { data, refresh, loading } = useResourceActionContext();
|
const { data, refresh, loading } = useResourceActionContext();
|
||||||
|
|
||||||
|
const { setTitle } = useDocumentTitle();
|
||||||
|
useEffect(() => {
|
||||||
|
const { title } = data?.data ?? {};
|
||||||
|
setTitle(`${title ? `${title} - ` : ''}${t('Workflow')}`);
|
||||||
|
}, [data?.data]);
|
||||||
|
|
||||||
if (!data?.data && !loading) {
|
if (!data?.data && !loading) {
|
||||||
return <div>{t('Load failed')}</div>;
|
return <div>{t('Load failed')}</div>;
|
||||||
}
|
}
|
||||||
|
@ -131,8 +131,6 @@ function CalculationConfig({ value, onChange }) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(i18n.t('Collection name'));
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
title: '{{t("Condition")}}',
|
title: '{{t("Condition")}}',
|
||||||
type: 'condition',
|
type: 'condition',
|
||||||
|
Loading…
Reference in New Issue
Block a user