101 lines
3.7 KiB
TypeScript
101 lines
3.7 KiB
TypeScript
import React, { useState } from 'react';
|
|
import { Row, Modal, Descriptions, Typography, Button, Space } from 'antd';
|
|
import { WebComponentProps } from 'oak-frontend-base';
|
|
|
|
import { EntityDict } from '../../../oak-app-domain';
|
|
import SystemUpsert from '../upsert';
|
|
import Styles from './web.pc.module.less';
|
|
|
|
export default function Render(
|
|
props: WebComponentProps<
|
|
EntityDict,
|
|
'platform',
|
|
false,
|
|
{
|
|
name: string;
|
|
description: string;
|
|
oakId: string;
|
|
folder: string;
|
|
super: boolean;
|
|
}
|
|
>
|
|
) {
|
|
const { oakId, folder, name, description, 'super': isSuper, oakFullpath, oakExecutable, oakExecuting } = props.data;
|
|
const { t, execute, clean } = props.methods;
|
|
|
|
const [open, setOpen] = useState(false);
|
|
if (oakFullpath) {
|
|
return (
|
|
<>
|
|
<Modal
|
|
open={open}
|
|
onCancel={() => {
|
|
clean();
|
|
setOpen(false);
|
|
}}
|
|
width={500}
|
|
footer={
|
|
<Space>
|
|
<Button
|
|
// type='primary'
|
|
onClick={async () => {
|
|
clean();
|
|
setOpen(false);
|
|
}}
|
|
disabled={oakExecuting}
|
|
>
|
|
{t('common::action.cancel')}
|
|
</Button>
|
|
<Button
|
|
type="primary"
|
|
onClick={async () => {
|
|
await execute();
|
|
setOpen(false);
|
|
}}
|
|
disabled={
|
|
oakExecutable !== true || oakExecuting
|
|
}
|
|
>
|
|
{t('common::action.confirm')}
|
|
</Button>
|
|
</Space>
|
|
}
|
|
>
|
|
<div className={Styles.upsert}>
|
|
<SystemUpsert oakId={oakId} oakPath={oakFullpath} />
|
|
</div>
|
|
</Modal>
|
|
<Descriptions column={2} bordered>
|
|
<Descriptions.Item label="id">
|
|
<Typography.Paragraph copyable>
|
|
{oakId}
|
|
</Typography.Paragraph>
|
|
</Descriptions.Item>
|
|
<Descriptions.Item label={t('system:attr.name')}>
|
|
{name}
|
|
</Descriptions.Item>
|
|
<Descriptions.Item label={t('system:attr.description')}>
|
|
{description}
|
|
</Descriptions.Item>
|
|
<Descriptions.Item label={t('system:attr.super')}>
|
|
{isSuper ? '是' : '否'}
|
|
</Descriptions.Item>
|
|
<Descriptions.Item label={t('system:attr.folder')}>
|
|
{folder}
|
|
</Descriptions.Item>
|
|
<Descriptions.Item>
|
|
<Row justify="end">
|
|
<Button
|
|
type="primary"
|
|
onClick={() => setOpen(true)}
|
|
>
|
|
{t('common::action.update')}
|
|
</Button>
|
|
</Row>
|
|
</Descriptions.Item>
|
|
</Descriptions>
|
|
</>
|
|
);
|
|
}
|
|
return null;
|
|
} |