64 lines
2.9 KiB
JavaScript
64 lines
2.9 KiB
JavaScript
import React, { useState } from 'react';
|
|
import { Row, Descriptions, Typography, Button, Modal, Space } from 'antd';
|
|
import ApplicationUpsert from '../upsert';
|
|
export default function Render(props) {
|
|
const { id, name, description, type, oakFullpath, oakDirty, oakExecuting, dv, wv, soaVersion } = props.data;
|
|
const { t, clean, execute } = props.methods;
|
|
const [open, setOpen] = useState(false);
|
|
if (id && oakFullpath) {
|
|
return (<>
|
|
<Modal destroyOnClose open={open} width={500} onCancel={() => {
|
|
clean();
|
|
setOpen(false);
|
|
}} footer={<Space>
|
|
<Button onClick={async () => {
|
|
clean();
|
|
setOpen(false);
|
|
}} disabled={oakExecuting}>
|
|
{t('common::action.cancel')}
|
|
</Button>
|
|
<Button type="primary" onClick={async () => {
|
|
await execute();
|
|
setOpen(false);
|
|
}} disabled={!oakDirty || oakExecuting}>
|
|
{t('common::action.confirm')}
|
|
</Button>
|
|
</Space>}>
|
|
<ApplicationUpsert oakPath={oakFullpath} oakId={id}/>
|
|
</Modal>
|
|
<Descriptions column={2} bordered>
|
|
<Descriptions.Item label="id">
|
|
<Typography.Paragraph copyable>
|
|
{id}
|
|
</Typography.Paragraph>
|
|
</Descriptions.Item>
|
|
<Descriptions.Item label={t('application:attr.name')}>
|
|
{name}
|
|
</Descriptions.Item>
|
|
<Descriptions.Item label={t('application:attr.description')}>
|
|
{description}
|
|
</Descriptions.Item>
|
|
<Descriptions.Item label={t('application:attr.type')}>
|
|
{t(`application:v.type.${type}`)}
|
|
</Descriptions.Item>
|
|
<Descriptions.Item label={t('application:attr.soaVersion')}>
|
|
{soaVersion || t('common::unset')}
|
|
</Descriptions.Item>
|
|
<Descriptions.Item label={t('application:attr.dangerousVersions')}>
|
|
{dv}
|
|
</Descriptions.Item>
|
|
<Descriptions.Item label={t('application:attr.warningVersions')}>
|
|
{wv}
|
|
</Descriptions.Item>
|
|
<Descriptions.Item span={2}>
|
|
<Row justify="end">
|
|
<Button type="primary" onClick={() => setOpen(true)}>
|
|
{t('common::action.update')}
|
|
</Button>
|
|
</Row>
|
|
</Descriptions.Item>
|
|
</Descriptions>
|
|
</>);
|
|
}
|
|
}
|