Unverified Commit aafd96f4 authored by zhu-mingye's avatar zhu-mingye Committed by GitHub

[Refactor][web] system settings web (#2008)

parent c48fe09a
......@@ -219,17 +219,18 @@ export default [
routes: [
{
path: '/settings',
redirect: '/settings/flinksetting',
redirect: '/settings/globalsetting',
},
{
path: '/settings/flinksetting',
name: 'flinksetting',
path: '/settings/globalsetting',
name: 'globalsetting',
icon: 'SettingOutlined',
// component: './SettingCenter/FlinkSettings',
component: './SettingCenter/GlobalSetting',
footerRender: false,
},
{
path: '/settings/system',
name: 'system',
path: '/settings/systemlog',
name: 'systemlog',
icon: 'InfoCircleOutlined',
component: './SettingCenter/SystemInfo',
},
......
......@@ -24,7 +24,7 @@ const Footer: React.FC = () => {
const currentYear = new Date().getFullYear();
return (
<DefaultFooter
style={{background: 'none'}}
style={{background: 'none', bottom: 0 }}
copyright={`${currentYear} ` + l('app.copyright.produced')}
links={[
{
......
......@@ -31,6 +31,7 @@ export default {
'button.batchDisable': 'Batch Disable',
'button.more': 'More',
'button.config': 'Config',
'button.modify': 'Modify',
'button.edit': 'Edit',
'button.start': 'Start',
'button.stop': 'Stop',
......
......@@ -59,8 +59,8 @@ export default {
'menu.auth.namespace': 'NameSpace',
'menu.auth.tenant': 'Tenant',
'menu.settings': 'Setting Center',
'menu.settings.flinksetting': 'Flink Settings',
'menu.settings.system': 'System Info',
'menu.settings.globalsetting': 'Global Settings',
'menu.settings.systemlog': 'System Log',
'menu.settings.process': 'Process List',
'menu.settings.services': 'Servers List',
'menu.metrics': 'Dashboard',
......
......@@ -464,6 +464,46 @@ export default {
//-------------------------------- setting center --------------------------------
//setting
'sys.setting.dinky': 'Dinky Env Configuration',
'sys.setting.flink': 'Flink Configuration',
'sys.setting.maven': 'Maven Configuration',
'sys.setting.ds': 'DolphinScheduler Configuration',
'sys.setting.dinky.tooltip': 'Mainly modify system variables to ensure stable operation of basic functions',
'sys.setting.flink.tooltip': 'Dinky docking Flink main parameters',
'sys.setting.maven.tooltip': 'The main parameters of Maven compilation',
'sys.setting.ds.tooltip': 'DolphinScheduler plug-in settings that allow you to push dinky tasks to the DolphinScheduler workflow',
'sys.setting.modify': 'Modify Settings {key}',
'sys.env.settings.pythonHome': 'Python Env variables',
'sys.env.settings.pythonHome.note': 'Python Env variables',
'sys.setting.tag.extend': 'Extended Configuration',
'sys.setting.tag.core': 'Core Configuration',
'sys.setting.tag.integration': 'Integration Configuration',
'sys.setting.tag.system': 'System Configuration',
'sys.env.settings.dinkyAddr': 'Dinky Address',
'sys.env.settings.dinkyAddr.note': 'The address must be the same as the address configured in the Dinky Application background url',
'sys.flink.settings.useRestAPI': 'Use Rest API',
'sys.flink.settings.useRestAPI.note': 'Whether to use RestAPI when operating and maintaining Flink tasks',
'sys.flink.settings.sqlSeparator': 'SQL Separator',
'sys.flink.settings.sqlSeparator.note': 'SQL Separator',
'sys.flink.settings.jobIdWait': 'Job submission waiting time',
'sys.flink.settings.jobIdWait.note': 'Maximum waiting time (seconds) for obtaining Job ID when submitting Application or PerJob tasks',
'sys.maven.settings.settingsFilePath': 'Maven configuration file path',
'sys.maven.settings.settingsFilePath.note': 'Maven configuration file path, eg: /opt/maven/conf/settings.xml , please fill in the full path, including the settings.xml file name',
'sys.maven.settings.repository': 'Maven warehouse address',
'sys.maven.settings.repository.note': 'Maven warehouse address',
'sys.maven.settings.repositoryUser': 'Maven warehouse user name',
'sys.maven.settings.repositoryUser.note': 'Maven private server authentication user name',
'sys.maven.settings.repositoryPassword': 'Maven warehouse password',
'sys.maven.settings.repositoryPassword.note': 'Maven private server authentication password',
'sys.dolphinscheduler.settings.enable': 'Whether to enable',
'sys.dolphinscheduler.settings.enable.note': 'Whether it is enabled or not, the relevant functions of DolphinScheduler can only be used after it is enabled, please ensure that the relevant configuration of DolphinScheduler is correct',
'sys.dolphinscheduler.settings.url': 'DolphinScheduler address',
'sys.dolphinscheduler.settings.url.note': 'The address must be consistent with the address configured in the DolphinScheduler background, eg: http://127.0.0.1:12345/dolphinscheduler',
'sys.dolphinscheduler.settings.token': 'DolphinScheduler Token',
'sys.dolphinscheduler.settings.token.note': 'DolphinScheduler‘s Token, please create a token in DolphinScheduler’s Security Center->Token Management, and fill in the configuration',
'sys.dolphinscheduler.settings.projectName': 'DolphinScheduler project name',
'sys.dolphinscheduler.settings.projectName.note': 'The project name specified in DolphinScheduler, case insensitive',
// process
'sys.process.id': 'Process ID',
'sys.process.name': 'Process Name',
......
......@@ -31,6 +31,7 @@ export default {
'button.batchDisable': '批量禁用',
'button.more': '更多',
'button.config': '配置',
'button.modify': '修改',
'button.edit': '编辑',
'button.start': '启动',
'button.stop': '停止',
......
......@@ -59,8 +59,8 @@ export default {
'menu.auth.namespace': '命名空间',
'menu.auth.tenant': '租户',
'menu.settings': '配置中心',
'menu.settings.flinksetting': 'Flink 配置',
'menu.settings.system': '系统信息',
'menu.settings.globalsetting': '全局配置',
'menu.settings.systemlog': '系统日志',
'menu.settings.process': '进程列表',
'menu.settings.services': '服务器列表',
'menu.metrics': '监控',
......
......@@ -466,6 +466,48 @@ export default {
//-------------------------------- setting center --------------------------------
//setting
'sys.setting.dinky': 'Dinky 环境配置',
'sys.setting.flink': 'Flink 配置',
'sys.setting.maven': 'Maven 配置',
'sys.setting.ds': 'DolphinSchuder 配置',
'sys.setting.dinky.tooltip': '主要以修改系统变量为主,保证基础功能稳定运行',
'sys.setting.flink.tooltip': 'Dinky对接 Flink 主要参数',
'sys.setting.maven.tooltip': 'Maven 编译的主要参数',
'sys.setting.ds.tooltip': '海豚调度插件设置,可以让您把dinky任务丝滑推到海豚调度器工作流上',
'sys.setting.modify': '修改配置 {key}',
'sys.setting.tag.extend': '扩展配置',
'sys.setting.tag.core': '核心配置',
'sys.setting.tag.integration': '集成配置',
'sys.setting.tag.system': '系统配置',
'sys.env.settings.pythonHome': 'Python 环境变量',
'sys.env.settings.pythonHome.note': 'Python 环境变量',
'sys.env.settings.dinkyAddr': 'Dinky 地址',
'sys.env.settings.dinkyAddr.note': '该地址必须与Dinky Application后台url中配置的地址相同',
'sys.flink.settings.useRestAPI': '使用 Rest API',
'sys.flink.settings.useRestAPI.note': '在运维 Flink 任务时是否使用 RestAPI',
'sys.flink.settings.sqlSeparator': 'SQL 分隔符',
'sys.flink.settings.sqlSeparator.note': 'SQL 分隔符',
'sys.flink.settings.jobIdWait': 'Job 提交等待时间',
'sys.flink.settings.jobIdWait.note': '提交 Application 或 PerJob 任务时获取 Job ID 的最大等待时间(秒)',
'sys.maven.settings.settingsFilePath': 'Maven 配置文件路径',
'sys.maven.settings.settingsFilePath.note': 'Maven 配置文件路径, eg: /opt/maven/conf/settings.xml , 请注意填写全路径,包含settings.xml文件名',
'sys.maven.settings.repository': 'Maven 仓库地址',
'sys.maven.settings.repository.note': 'Maven 仓库地址',
'sys.maven.settings.repositoryUser': 'Maven 仓库用户名',
'sys.maven.settings.repositoryUser.note': 'Maven 私服认证用户名',
'sys.maven.settings.repositoryPassword': 'Maven 仓库密码',
'sys.maven.settings.repositoryPassword.note': 'Maven 私服认证密码',
'sys.dolphinscheduler.settings.enable': '是否启用',
'sys.dolphinscheduler.settings.enable.note': '是否启用, 启用后才能使用 DolphinScheduler 的相关功能, 请确保 DolphinScheduler 的相关配置正确',
'sys.dolphinscheduler.settings.url': 'DolphinScheduler 地址',
'sys.dolphinscheduler.settings.url.note': '地址必须和DolphinScheduler后台配置的地址一致,eg: http://127.0.0.1:12345/dolphinscheduler',
'sys.dolphinscheduler.settings.token': 'DolphinScheduler Token',
'sys.dolphinscheduler.settings.token.note': 'DolphinScheduler的Token,请在DolphinScheduler的安全中心->Token管理中创建一个token,并填入该配置中',
'sys.dolphinscheduler.settings.projectName': 'DolphinScheduler 项目名',
'sys.dolphinscheduler.settings.projectName.note': 'DolphinScheduler 中指定的项目名称,不区分大小写',
// process
'sys.process.id': '进程ID',
'sys.process.name': '进程名',
......
......@@ -63,7 +63,7 @@ const JarList: React.FC<JarListProps> = (props) => {
tooltip: l("rc.gp.ucl.orderLine.tooltip"),
copyable: true,
render: (dom:any, record:BuildJarList) => {
return <Tag color={record.orderLine> 3 ? 'default': 'success'} >{`No.${record.orderLine}`}</Tag>
return <Tag style={{marginLeft: 10}} color={record.orderLine> 3 ? 'default': 'success'} >{`No.${record.orderLine}`}</Tag>
}
},
{
......
......@@ -31,7 +31,7 @@ import {
STATUS_MAPPING,
} from "@/services/constants";
import {l} from "@/utils/intl";
import {Button, Empty, Popconfirm, Tag} from "antd";
import {Button, Empty, Popconfirm, Tag} from 'antd';
import {BranchesOutlined, BuildTwoTone} from "@ant-design/icons";
import {
GIT_PROJECT_BUILD_STEP,
......@@ -41,7 +41,7 @@ import {
renderBranchesTagColor
} from "@/pages/RegCenter/GitProject/constans";
import {ShowCodeTreeIcon} from "@/components/Icons/CustomIcons";
import {addOrUpdateData, queryList} from "@/services/api";
import {queryList} from "@/services/api";
import {BuildSteps} from "@/pages/RegCenter/GitProject/components/BuildSteps";
import {CodeTree} from "@/pages/RegCenter/GitProject/components/CodeTree";
import {CreateBtn} from "@/components/CallBackButton/CreateBtn";
......@@ -154,7 +154,7 @@ const ProjectProTable: React.FC = () => {
dataIndex: 'id',
tooltip: l("rc.gp.level.tooltip"),
render: (dom: any,record:GitProject) => {
return <Tag color={record.orderLine> 3 ? 'default': 'success'} >{`No.${record.orderLine}`}</Tag>
return <Tag style={{marginLeft: 10}} color={record.orderLine> 3 ? 'default': 'success'} >{`No.${record.orderLine}`}</Tag>
},
},
{
......@@ -223,7 +223,7 @@ const ProjectProTable: React.FC = () => {
filters: STATUS_MAPPING(),
filterMultiple: false,
valueEnum: STATUS_ENUM(),
render: ( _:string, record:GitProject) => {
render: ( _:any, record:GitProject) => {
return <EnableSwitchBtn key={`${record.id}_enable`} record={record}
onChange={() => handleChangeEnable(record)}/>;
},
......@@ -232,7 +232,7 @@ const ProjectProTable: React.FC = () => {
title: l("global.table.operate"),
valueType: "option",
width: "10vw",
render: (text:string, record:GitProject) => [
render: (text:any, record:GitProject) => [
<ShowLogBtn disabled={record.buildStep === 0} key={`${record.id}_showLog`} onClick={() => handleShowLog(record)}/>,
<Button
key={`${record.id}_code`}
......
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {BaseConfigProperties} from '@/types/SettingCenter/data';
import {ProCard} from '@ant-design/pro-components';
import GeneralConfig from '@/pages/SettingCenter/GlobalSetting/SettingOverView/GeneralConfig';
import {l} from '@/utils/intl';
import {Tag} from 'antd';
import React from 'react';
interface DSConfigProps {
data: BaseConfigProperties[];
onSave: (data: BaseConfigProperties) => void;
}
export const DSConfig = ({data, onSave}: DSConfigProps) => {
const [loading, setLoading] = React.useState(false);
const onSaveHandler = (data: BaseConfigProperties) => {
setLoading(true);
onSave(data);
setTimeout(() => {
setLoading(false);
}, 1000);
};
return <>
<ProCard
title={l('sys.setting.ds')}
tooltip={l('sys.setting.ds.tooltip')}
size="small"
headerBordered ghost collapsible
defaultCollapsed={false}
>
<GeneralConfig
loading={loading}
onSave={onSaveHandler}
tag={<><Tag color={'default'}>{l('sys.setting.tag.integration')}</Tag></>}
data={data}
/>
</ProCard>
</>;
};
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {BaseConfigProperties} from '@/types/SettingCenter/data';
import {ProCard} from '@ant-design/pro-components';
import GeneralConfig from '@/pages/SettingCenter/GlobalSetting/SettingOverView/GeneralConfig';
import {l} from '@/utils/intl';
import {Tag} from 'antd';
import React from 'react';
interface EnvConfigProps {
data: BaseConfigProperties[];
onSave: (data: BaseConfigProperties) => void;
}
export const EnvConfig = ({data, onSave}: EnvConfigProps) => {
const [loading, setLoading] = React.useState(false);
const onSaveHandler = (data: BaseConfigProperties) => {
setLoading(true);
onSave(data);
setTimeout(() => {
setLoading(false);
}, 1000);
};
return <>
<ProCard
title={l('sys.setting.dinky')}
tooltip={l('sys.setting.dinky.tooltip')}
size="small"
headerBordered collapsible ghost
defaultCollapsed={false}
>
<GeneralConfig
loading={loading}
onSave={onSaveHandler}
tag={<><Tag color={'error'}>{l('sys.setting.tag.system')}</Tag></>}
data={data}
/>
</ProCard>
</>;
};
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {BaseConfigProperties} from '@/types/SettingCenter/data';
import {ProCard} from '@ant-design/pro-components';
import GeneralConfig from '@/pages/SettingCenter/GlobalSetting/SettingOverView/GeneralConfig';
import {l} from '@/utils/intl';
import {Tag} from 'antd';
import React from 'react';
interface FlinkConfigProps {
data: BaseConfigProperties[];
onSave: (data: BaseConfigProperties) => void;
}
export const FlinkConfig = ({data, onSave}: FlinkConfigProps) => {
const [loading, setLoading] = React.useState(false);
const onSaveHandler = (data: BaseConfigProperties) => {
setLoading(true);
onSave(data);
setTimeout(() => {
setLoading(false);
}, 1000);
};
return <>
<ProCard
title={l('sys.setting.flink')}
tooltip={l('sys.setting.flink.tooltip')}
size="small"
headerBordered collapsible ghost
defaultCollapsed={false}
>
<GeneralConfig
loading={loading}
onSave={onSaveHandler}
tag={<>
<Tag color={'success'}>{l('sys.setting.tag.extend')}</Tag>
<Tag color={'processing'}>{l('sys.setting.tag.core')}</Tag></>}
data={data}
/>
</ProCard>
</>;
};
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
import React, {useRef} from 'react';
import {ProList} from '@ant-design/pro-components';
import {BaseConfigProperties} from '@/types/SettingCenter/data';
import {Descriptions, Input, Space, Switch} from 'antd';
import {l} from '@/utils/intl';
import {SaveTwoTone, SettingTwoTone} from '@ant-design/icons';
import {EditBtn} from '@/components/CallBackButton/EditBtn';
import {SWITCH_OPTIONS} from '@/services/constants';
import {ActionType} from '@ant-design/pro-table';
import {ProListMetas, ProListProps} from '@ant-design/pro-list';
import {BackIcon} from '@/components/Icons/CustomIcons';
type GeneralConfigProps = {
data: BaseConfigProperties[];
tag: React.ReactNode;
onSave: (data: BaseConfigProperties) => void;
loading: boolean;
}
const GeneralConfig: React.FC<GeneralConfigProps> = (props) => {
const {data, tag, onSave: handleSubmit, loading} = props;
const actionRef = useRef<ActionType>();
const handleSave = (data: BaseConfigProperties) => {
handleSubmit(data);
actionRef.current?.reload();
};
/**
* render actions for each entity in the list
* @param action startEditable
* @param entity entity
*/
const renderActions = (action: any, entity: BaseConfigProperties) => {
return entity.frontType === 'boolean' ? [] : [
<EditBtn
key="edit"
onClick={() => {
action.startEditable(entity.key);
}}
/>
];
};
/**
* render title for each entity in the list
* @param entity
*/
const renderTitle = (entity: BaseConfigProperties) => {
return <>
<Descriptions.Item>
{l(`sys.${entity.key}`)}
</Descriptions.Item>
<Space style={{marginLeft: 15}} size={0}>
{tag}
</Space>
</>;
};
/**
* render value for each entity in the list
* @param entity
*/
const renderValue = (entity: BaseConfigProperties) => {
return <>
{
entity.frontType === 'boolean' ?
<Switch
{...SWITCH_OPTIONS()}
style={{width: '4vw'}}
checked={entity.value}
onChange={(checked) => handleSubmit({...entity, value: checked})}
/> :
<Input style={{width: '30vw'}} disabled value={entity.value}/>
}
</>;
};
const metasRestProps: ProListMetas = {
title: {
editable: false,
render: (dom: any, entity: BaseConfigProperties) => renderTitle(entity),
},
avatar: {
editable: false,
render: () => <SettingTwoTone/>,
},
description: {
editable: false,
render: (dom: any, entity: BaseConfigProperties) => <>{l(`sys.${entity.key}.note`)}</>
},
content: {
dataIndex: 'value',
render: (dom: any, entity: BaseConfigProperties) => renderValue(entity),
},
actions: {
render: (text: any, row: BaseConfigProperties, index: number, action: any) => renderActions(action, row),
},
};
/**
* rest props for ProList
*/
const restProps: ProListProps = {
rowKey: 'key',
style: {margin: 0},
loading: loading,
actionRef: actionRef,
size: 'small',
dataSource: data,
showActions: 'hover',
metas: {...metasRestProps},
editable: {
saveText: <><SaveTwoTone title={l('button.save')}/></>,
cancelText: <><BackIcon title={l('button.back')}/></>,
actionRender: (row, config, dom) => row.frontType === 'boolean' ? [] : [dom.save, dom.cancel],
onSave: async (key, record) => handleSave(record),
}
};
/**
* render list
*/
return <>
<ProList<BaseConfigProperties> {...restProps} />
</>;
};
export default GeneralConfig;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {BaseConfigProperties} from '@/types/SettingCenter/data';
import {ProCard} from '@ant-design/pro-components';
import GeneralConfig from '@/pages/SettingCenter/GlobalSetting/SettingOverView/GeneralConfig';
import {l} from '@/utils/intl';
import {Tag} from 'antd';
import React from 'react';
interface MavenConfigProps {
data: BaseConfigProperties[];
onSave: (data: BaseConfigProperties) => void;
}
export const MavenConfig = ({data, onSave}: MavenConfigProps) => {
const [loading, setLoading] = React.useState(false);
const onSaveHandler = (data: BaseConfigProperties) => {
setLoading(true);
onSave(data);
setTimeout(() => {
setLoading(false);
}, 1000);
};
return <>
<ProCard
title={l('sys.setting.maven')}
tooltip={l('sys.setting.maven.tooltip')}
size="small"
headerBordered collapsible ghost
defaultCollapsed={false}
>
<GeneralConfig
loading={loading}
onSave={onSaveHandler}
tag={<><Tag color={'default'}>{l('sys.setting.tag.integration')}</Tag></>}
data={data}
/>
</ProCard>
</>;
};
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React, {memo, useEffect} from 'react';
import {API_CONSTANTS, RESPONSE_CODE} from '@/services/constants';
import {handleOption, queryDataByParams} from '@/services/BusinessCrud';
import {BaseConfigProperties, Settings} from '@/types/SettingCenter/data';
import {EnvConfig} from '@/pages/SettingCenter/GlobalSetting/SettingOverView/EnvConfig';
import {FlinkConfig} from '@/pages/SettingCenter/GlobalSetting/SettingOverView/FlinkConfig';
import {MavenConfig} from '@/pages/SettingCenter/GlobalSetting/SettingOverView/MavenConfig';
import {DSConfig} from '@/pages/SettingCenter/GlobalSetting/SettingOverView/DSConfig';
import {l} from '@/utils/intl';
const SettingOverView = () => {
const [data, setData] = React.useState<Settings>({dolphinscheduler: [], env: [], flink: [], maven: []});
const fetchData = async () => {
await queryDataByParams(API_CONSTANTS.SYSTEM_GET_ALL_CONFIG).then((res) => {
setData(res);
});
};
useEffect(() => {
fetchData();
}, []);
const handleSaveSubmit = async (data: BaseConfigProperties) => {
// todo: save data of update data
const {code} = await handleOption(API_CONSTANTS.SYSTEM_MODIFY_CONFIG, l('sys.setting.modify', '', {key: data.key}), data);
if (code === RESPONSE_CODE.SUCCESS) await fetchData();
};
const renderData = () => {
if (data) {
const {env: dinkyEnv, flink: flinkConfig, maven: mavenConfig, dolphinscheduler: dsConfig} = data;
return <>
<EnvConfig onSave={handleSaveSubmit} data={dinkyEnv}/>
<FlinkConfig onSave={handleSaveSubmit} data={flinkConfig}/>
<MavenConfig onSave={handleSaveSubmit} data={mavenConfig}/>
<DSConfig onSave={handleSaveSubmit} data={dsConfig}/>
</>;
}
};
return <>
{renderData()}
</>;
};
export default memo(SettingOverView);
......@@ -15,3 +15,13 @@
* limitations under the License.
*/
import {PageContainer} from '@ant-design/pro-components';
import SettingOverView from '@/pages/SettingCenter/GlobalSetting/SettingOverView';
export default () => {
return <>
<PageContainer title={false}>
<SettingOverView/>
</PageContainer>
</>;
}
......@@ -171,6 +171,10 @@ export const API_CONSTANTS = {
// system config center
// global config list
SYSTEM_GET_ALL_CONFIG: "/api/sysConfig/getAll",
// update global config by key
SYSTEM_MODIFY_CONFIG: "/api/sysConfig/modifyConfig",
//-- system root logs
SYSTEM_ROOT_LOG: "/api/system/getRootLog",
// -- get logs list
......
......@@ -15,7 +15,7 @@
* limitations under the License.
*/
// ============================ System Info ============================
export type ProcessSteps = {
stepStatus: string;
info: string;
......@@ -40,3 +40,18 @@ export type Process = {
steps: ProcessSteps[];
userId: number;
}
// ============================ System Settings ============================
export type Settings = {
dolphinscheduler: BaseConfigProperties[];
env: BaseConfigProperties[];
flink: BaseConfigProperties[];
maven: BaseConfigProperties[];
}
export type BaseConfigProperties = {
key: string;
value: any;
note: string;
frontType: string;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment