兼容Modal属性

This commit is contained in:
whyour 2022-09-17 22:50:58 +08:00
parent 6e56a55f6f
commit 518e8903a3
21 changed files with 122 additions and 101 deletions

View File

@ -72,7 +72,7 @@
"devDependencies": { "devDependencies": {
"@ant-design/icons": "^4.7.0", "@ant-design/icons": "^4.7.0",
"@ant-design/pro-layout": "^6.33.1", "@ant-design/pro-layout": "^6.33.1",
"@monaco-editor/react": "^4.3.1", "@monaco-editor/react": "4.2.1",
"@sentry/react": "^7.12.1", "@sentry/react": "^7.12.1",
"@types/body-parser": "^1.19.2", "@types/body-parser": "^1.19.2",
"@types/cors": "^2.8.12", "@types/cors": "^2.8.12",

View File

@ -326,10 +326,6 @@
background-color: #373739; background-color: #373739;
} }
.ant-layout-sider {
border-right: 1px solid rgba(0, 0, 0, 0.06) !important;
}
.ant-pro-sider-logo { .ant-pro-sider-logo {
padding: 16px 8px !important; padding: 16px 8px !important;

View File

@ -136,7 +136,7 @@ export default function (props: any) {
}, []); }, []);
useEffect(() => { useEffect(() => {
if (!user) return; if (!user || !user.username) return;
ws.current = new SockJS( ws.current = new SockJS(
`${location.origin}/api/ws?token=${localStorage.getItem(config.authKey)}`, `${location.origin}/api/ws?token=${localStorage.getItem(config.authKey)}`,
); );
@ -146,9 +146,9 @@ export default function (props: any) {
const data = JSON.parse(e.data); const data = JSON.parse(e.data);
if (data.type === 'ping') { if (data.type === 'ping') {
if (data && data.message === 'hanhh') { if (data && data.message === 'hanhh') {
console.log('websocket连接成功', e); console.log('WS connection succeeded !!!');
} else { } else {
console.log('websocket连接失败', e); console.log('WS connection Failed !!!', e);
} }
} }
setSocketMessage(data); setSocketMessage(data);
@ -186,8 +186,9 @@ export default function (props: any) {
if ( if (
['/login', '/initialization', '/error'].includes(props.location.pathname) ['/login', '/initialization', '/error'].includes(props.location.pathname)
) { ) {
document.title = `${(config.documentTitleMap as any)[props.location.pathname] document.title = `${
} - `; (config.documentTitleMap as any)[props.location.pathname]
} - `;
if ( if (
systemInfo?.isInitialized && systemInfo?.isInitialized &&
props.location.pathname === '/initialization' props.location.pathname === '/initialization'

View File

@ -445,7 +445,7 @@ const CronDetailModal = ({
</div> </div>
} }
centered centered
visible={visible} open={visible}
forceRender forceRender
footer={false} footer={false}
onCancel={() => handleCancel()} onCancel={() => handleCancel()}

View File

@ -119,7 +119,7 @@ const CronLogModal = ({
return ( return (
<Modal <Modal
title={titleElement()} title={titleElement()}
visible={visible} open={visible}
centered centered
className="log-modal" className="log-modal"
bodyStyle={{ bodyStyle={{

View File

@ -48,7 +48,7 @@ const CronModal = ({
return ( return (
<Modal <Modal
title={cron ? '编辑任务' : '新建任务'} title={cron ? '编辑任务' : '新建任务'}
visible={visible} open={visible}
forceRender forceRender
centered centered
maskClosable={false} maskClosable={false}
@ -172,7 +172,7 @@ const CronLabelModal = ({
return ( return (
<Modal <Modal
title="批量修改标签" title="批量修改标签"
visible={visible} open={visible}
footer={buttons} footer={buttons}
centered centered
maskClosable={false} maskClosable={false}

View File

@ -138,7 +138,7 @@ const ViewCreateModal = ({
return ( return (
<Modal <Modal
title={view ? '编辑视图' : '新建视图'} title={view ? '编辑视图' : '新建视图'}
visible={visible} open={visible}
forceRender forceRender
width={580} width={580}
centered centered

View File

@ -212,7 +212,7 @@ const ViewManageModal = ({
return ( return (
<Modal <Modal
title="视图管理" title="视图管理"
visible={visible} open={visible}
centered centered
width={620} width={620}
onCancel={() => handleCancel()} onCancel={() => handleCancel()}

View File

@ -498,17 +498,24 @@ const Dependence = ({ headerStyle, isPhone, socketMessage }: any) => {
size="small" size="small"
tabPosition="top" tabPosition="top"
onChange={onTabChange} onChange={onTabChange}
> items={[
<Tabs.TabPane tab="NodeJs" key="nodejs"> {
{panelContent()} key: 'nodejs',
</Tabs.TabPane> label: 'NodeJs',
<Tabs.TabPane tab="Python3" key="python3"> children: panelContent(),
{panelContent()} },
</Tabs.TabPane> {
<Tabs.TabPane tab="Linux" key="linux"> key: 'python3',
{panelContent()} label: 'Python3',
</Tabs.TabPane> children: panelContent(),
</Tabs> },
{
key: 'linux',
label: 'Linux',
children: panelContent(),
},
]}
/>
<DependenceModal <DependenceModal
visible={isModalVisible} visible={isModalVisible}
handleCancel={handleCancel} handleCancel={handleCancel}

View File

@ -112,7 +112,7 @@ const DependenceLogModal = ({
return ( return (
<Modal <Modal
title={titleElement()} title={titleElement()}
visible={visible} open={visible}
centered centered
className="log-modal" className="log-modal"
bodyStyle={{ bodyStyle={{

View File

@ -71,7 +71,7 @@ const DependenceModal = ({
return ( return (
<Modal <Modal
title={dependence ? '编辑依赖' : '新建依赖'} title={dependence ? '编辑依赖' : '新建依赖'}
visible={visible} open={visible}
forceRender forceRender
centered centered
maskClosable={false} maskClosable={false}

View File

@ -44,7 +44,7 @@ const EditNameModal = ({
return ( return (
<Modal <Modal
title="修改环境变量名称" title="修改环境变量名称"
visible={visible} open={visible}
forceRender forceRender
centered centered
maskClosable={false} maskClosable={false}

View File

@ -60,7 +60,7 @@ const EnvModal = ({
return ( return (
<Modal <Modal
title={env ? '编辑变量' : '新建变量'} title={env ? '编辑变量' : '新建变量'}
visible={visible} open={visible}
forceRender forceRender
centered centered
maskClosable={false} maskClosable={false}

View File

@ -214,7 +214,7 @@ const EditModal = ({
width={'100%'} width={'100%'}
headerStyle={{ padding: '11px 24px' }} headerStyle={{ padding: '11px 24px' }}
onClose={cancel} onClose={cancel}
visible={visible} open={visible}
> >
<SplitPane <SplitPane
split="vertical" split="vertical"

View File

@ -101,7 +101,7 @@ const EditScriptNameModal = ({
return ( return (
<Modal <Modal
title="新建" title="新建"
visible={visible} open={visible}
forceRender forceRender
centered centered
maskClosable={false} maskClosable={false}

View File

@ -41,7 +41,7 @@ const SaveModal = ({
return ( return (
<Modal <Modal
title="保存文件" title="保存文件"
visible={visible} open={visible}
forceRender forceRender
centered centered
maskClosable={false} maskClosable={false}

View File

@ -41,7 +41,7 @@ const SettingModal = ({
return ( return (
<Modal <Modal
title="运行设置" title="运行设置"
visible={visible} open={visible}
forceRender forceRender
centered centered
onCancel={() => handleCancel()} onCancel={() => handleCancel()}

View File

@ -46,7 +46,7 @@ const AppModal = ({
return ( return (
<Modal <Modal
title={app ? '编辑应用' : '新建应用'} title={app ? '编辑应用' : '新建应用'}
visible={visible} open={visible}
forceRender forceRender
centered centered
maskClosable={false} maskClosable={false}

View File

@ -333,70 +333,87 @@ const Setting = ({
size="small" size="small"
tabPosition="top" tabPosition="top"
onChange={tabChange} onChange={tabChange}
> items={[
<Tabs.TabPane tab="安全设置" key="security"> {
<SecuritySettings user={user} userChange={reloadUser} /> key: 'security',
</Tabs.TabPane> label: '安全设置',
<Tabs.TabPane tab="应用设置" key="app"> children: <SecuritySettings user={user} userChange={reloadUser} />,
<Table },
columns={columns} {
pagination={false} key: 'app',
dataSource={dataSource} label: '应用设置',
rowKey="id" children: (
size="middle" <Table
scroll={{ x: 768 }} columns={columns}
loading={loading} pagination={false}
/> dataSource={dataSource}
</Tabs.TabPane> rowKey="id"
<Tabs.TabPane tab="通知设置" key="notification"> size="middle"
<NotificationSetting data={notificationInfo} /> scroll={{ x: 768 }}
</Tabs.TabPane> loading={loading}
<Tabs.TabPane tab="登录日志" key="login">
<LoginLog data={loginLogData} />
</Tabs.TabPane>
<Tabs.TabPane tab="其他设置" key="other">
<Form layout="vertical" form={form}>
<Form.Item
label="主题设置"
name="theme"
initialValue={defaultTheme}
>
<Radio.Group
options={optionsWithDisabled}
onChange={themeChange}
value={defaultTheme}
optionType="button"
buttonStyle="solid"
/> />
</Form.Item> ),
<Form.Item },
label="日志删除频率" {
name="frequency" key: 'notification',
tooltip="每x天自动删除x天以前的日志" label: '通知设置',
> children: <NotificationSetting data={notificationInfo} />,
<Input.Group compact> },
<InputNumber {
addonBefore="每" key: 'login',
addonAfter="天" label: '登录日志',
style={{ width: 150 }} children: <LoginLog data={loginLogData} />,
min={0} },
value={logRemoveFrequency} {
onChange={(value) => setLogRemoveFrequency(value)} key: 'other',
/> label: '其他设置',
<Button type="primary" onClick={updateRemoveLogFrequency}> children: (
<Form layout="vertical" form={form}>
</Button> <Form.Item
</Input.Group> label="主题设置"
</Form.Item> name="theme"
<Form.Item label="检查更新" name="update"> initialValue={defaultTheme}
<CheckUpdate socketMessage={socketMessage} /> >
</Form.Item> <Radio.Group
</Form> options={optionsWithDisabled}
</Tabs.TabPane> onChange={themeChange}
<Tabs.TabPane tab="关于" key="about"> value={defaultTheme}
<About /> optionType="button"
</Tabs.TabPane> buttonStyle="solid"
</Tabs> />
</Form.Item>
<Form.Item
label="日志删除频率"
name="frequency"
tooltip="每x天自动删除x天以前的日志"
>
<Input.Group compact>
<InputNumber
addonBefore="每"
addonAfter="天"
style={{ width: 150 }}
min={0}
value={logRemoveFrequency}
onChange={(value) => setLogRemoveFrequency(value)}
/>
<Button type="primary" onClick={updateRemoveLogFrequency}>
</Button>
</Input.Group>
</Form.Item>
<Form.Item label="检查更新" name="update">
<CheckUpdate socketMessage={socketMessage} />
</Form.Item>
</Form>
),
},
{
key: 'about',
label: '关于',
children: <About />,
},
]}
></Tabs>
<AppModal <AppModal
visible={isModalVisible} visible={isModalVisible}
handleCancel={handleCancel} handleCancel={handleCancel}

View File

@ -93,7 +93,7 @@ const SubscriptionLogModal = ({
return ( return (
<Modal <Modal
title={titleElement()} title={titleElement()}
visible={visible} open={visible}
centered centered
className="log-modal" className="log-modal"
bodyStyle={{ bodyStyle={{

View File

@ -272,7 +272,7 @@ const SubscriptionModal = ({
</span> </span>
) )
} }
visible={visible} open={visible}
forceRender forceRender
centered centered
maskClosable={false} maskClosable={false}