39 lines
1.9 KiB
JavaScript
39 lines
1.9 KiB
JavaScript
import assert from "assert";
|
|
import { Tabs, Flex, Button, Alert } from 'antd';
|
|
import Styles from './web.pc.module.less';
|
|
const ShipSettingComponentDict = {};
|
|
export function registerShipSettingComponent(entity, component) {
|
|
assert(!ShipSettingComponentDict[entity]);
|
|
ShipSettingComponentDict[entity] = component;
|
|
}
|
|
export default function render(props) {
|
|
const { oakId, oakFullpath, oakDirty, executable } = props.data;
|
|
const { t, execute, clean } = props.methods;
|
|
const entities = Object.keys(ShipSettingComponentDict);
|
|
if (oakId && oakFullpath && entities.length) {
|
|
return (<Tabs className={Styles.container} tabPosition="left" items={entities.map((entity) => {
|
|
const Comp = ShipSettingComponentDict[entity];
|
|
return {
|
|
label: (<div className={Styles.systemLabel}>
|
|
{t(`${entity}:name`)}
|
|
</div>),
|
|
key: entity,
|
|
children: (<Flex vertical>
|
|
<Comp systemId={oakId} oakPath={`${oakFullpath}.${entity}$system`}/>
|
|
<Flex gap="middle" justify='end'>
|
|
<Button type="primary" disabled={!executable} onClick={() => execute()}>
|
|
{t('common::confirm')}
|
|
</Button>
|
|
<Button disabled={!oakDirty} onClick={() => clean()}>
|
|
{t('common::reset')}
|
|
</Button>
|
|
</Flex>
|
|
</Flex>)
|
|
};
|
|
})}/>);
|
|
}
|
|
return (<Flex className={Styles.tips} vertical align="stretch">
|
|
<Alert type="info" message={t("help.header")}/>
|
|
</Flex>);
|
|
}
|