From 4358268a2bccadc5a4bbfd795031f75ccbefa0ee Mon Sep 17 00:00:00 2001 From: NicolaCage Date: Wed, 6 Jul 2022 17:40:49 +0800 Subject: [PATCH] mod: config --- .../Service/ServiceHeader/index.less | 3 +- src/config/locale/en-US/common.json | 1 + src/config/locale/zh-CN/common.json | 1 + src/pages/MachineDashboard/index.less | 10 +- src/pages/MachineDashboard/index.tsx | 2 +- src/pages/ServiceDashboard/index.less | 12 +- src/pages/ServiceManage/ConfigInfo/index.less | 4 + src/pages/ServiceManage/ConfigInfo/index.tsx | 119 ++++++++++-------- src/utils/http.ts | 2 +- 9 files changed, 89 insertions(+), 65 deletions(-) diff --git a/src/components/Service/ServiceHeader/index.less b/src/components/Service/ServiceHeader/index.less index 7e4657dd..0718164d 100644 --- a/src/components/Service/ServiceHeader/index.less +++ b/src/components/Service/ServiceHeader/index.less @@ -1,8 +1,7 @@ .service-content-header { height: 50px; - padding: 12px 20px; + padding: 12px; width: 100%; - border-bottom: 1px solid #d9d9d9; display: flex; justify-content: space-between; diff --git a/src/config/locale/en-US/common.json b/src/config/locale/en-US/common.json index fa2aaf65..2f661eca 100644 --- a/src/config/locale/en-US/common.json +++ b/src/config/locale/en-US/common.json @@ -30,6 +30,7 @@ "manual": "User Manual", "forum": "Forum", "forumLink": "https://discuss.nebula-graph.io/", + "configTip": "Please enter a configuration name", "all":"All", "metricLabel": "instance", "updateFrequency": "frequency" diff --git a/src/config/locale/zh-CN/common.json b/src/config/locale/zh-CN/common.json index 5a23b3ed..c8ce78ab 100644 --- a/src/config/locale/zh-CN/common.json +++ b/src/config/locale/zh-CN/common.json @@ -32,5 +32,6 @@ "forumLink": "https://discuss.nebula-graph.com.cn/", "all":"全部", "updateFrequency": "更新频率", + "configTip": "请输入配置名进行搜索", "metricLabel": "实例" } \ No newline at end of file diff --git a/src/pages/MachineDashboard/index.less b/src/pages/MachineDashboard/index.less index 5fb958ea..780ea6d5 100644 --- a/src/pages/MachineDashboard/index.less +++ b/src/pages/MachineDashboard/index.less @@ -1,8 +1,12 @@ +.machine-dashboard-spinning, .ant-spin-container{ + min-height: 100%; +} .machine-dashboard { - height: 100%; + min-height: 100%; // overflow-y: auto; display: flex; flex-direction: column; + background-color: #fff; .common-header { background: #fff; @@ -17,7 +21,9 @@ .dashboard-card { height: 100%; - + .inner{ + border: 1px solid #D9D9D9; + } .nebula-chart-line { height: 100%; } diff --git a/src/pages/MachineDashboard/index.tsx b/src/pages/MachineDashboard/index.tsx index 26676169..2c1e0801 100644 --- a/src/pages/MachineDashboard/index.tsx +++ b/src/pages/MachineDashboard/index.tsx @@ -192,7 +192,7 @@ function MachineDashboard(props: IProps) { } return ( - +
.service-table-item { flex: 1; background: #fff; - margin-bottom: 30px; - border: 1px solid #dcdcdc; + // margin-bottom: 30px; + padding-top: 10px; + border-top: 1px solid #dcdcdc; > .ant-row { height: calc(100% - 50px); diff --git a/src/pages/ServiceManage/ConfigInfo/index.less b/src/pages/ServiceManage/ConfigInfo/index.less index fc807be7..c9694ece 100644 --- a/src/pages/ServiceManage/ConfigInfo/index.less +++ b/src/pages/ServiceManage/ConfigInfo/index.less @@ -12,4 +12,8 @@ } } } + input{ + width: 265px; + float: right; + } } diff --git a/src/pages/ServiceManage/ConfigInfo/index.tsx b/src/pages/ServiceManage/ConfigInfo/index.tsx index f3ddf363..42709ec4 100644 --- a/src/pages/ServiceManage/ConfigInfo/index.tsx +++ b/src/pages/ServiceManage/ConfigInfo/index.tsx @@ -1,6 +1,6 @@ import _ from 'lodash'; -import React from 'react'; -import { Radio, Table } from 'antd'; +import React, { useEffect, useState } from 'react'; +import { Radio,Input, Table } from 'antd'; import intl from 'react-intl-universal'; import { connect } from 'react-redux'; import { IDispatch, IRootState } from '@/store'; @@ -19,63 +19,74 @@ const mapDispatch = (dispatch: IDispatch) => ({ interface IProps extends ReturnType, ReturnType {} -class ConfigInfo extends React.Component { - componentDidMount() { - this.props.asyncGetServiceConfigs('graph'); - } +const NebulaConfig: React.FC = (props: IProps) => { + const [name, setName] = useState(''); + + useEffect(()=>{ + props.asyncGetServiceConfigs('graph'); + },[]) - handleModuleChange = e => { + const handleModuleChange = e => { trackEvent('service-info', 'click_module'); - this.props.asyncGetServiceConfigs(e.target.value); + props.asyncGetServiceConfigs(e.target.value); }; - render() { - const { configs, loading } = this.props; - const columns = [ - { - title: ( - - ), - dataIndex: 'name', - }, - { - title: ( - - ), - dataIndex: 'value', - }, - ]; - return ( -
-
- - Storage - Graph - {/* TODO: Nebula 2.0.1 does not support meta modifications, support can be released in later versions - Meta - */} - -
- record.value + record.name} - dataSource={configs} - columns={columns} + const getData = () => { + if (!name) { + return configs; + } + return configs.filter((config: any) => config.name.includes(name)); + }; + + const { configs, loading } = props; + const columns = [ + { + title: ( + + ), + dataIndex: 'name', + }, + { + title: ( + + ), + dataIndex: 'value', + }, + ]; + return ( +
+
+ + Storage + Graph + {/* TODO: Nebula 2.0.1 does not support meta modifications, support can be released in later versions + Meta + */} + + setName(e.target.value)} />
- ); - } +
record.value + record.name} + dataSource={getData()} + columns={columns} + /> + + ); } -export default connect(mapState, mapDispatch)(ConfigInfo); +export default connect(mapState, mapDispatch)(NebulaConfig); diff --git a/src/utils/http.ts b/src/utils/http.ts index 591bc4a5..c2a522fb 100644 --- a/src/utils/http.ts +++ b/src/utils/http.ts @@ -14,7 +14,7 @@ export const interceptorFn = (store) => { service.interceptors.response.use( (response: any) => { const { code, message } = response.data; - + let _code; //HACK: get graph,storage server data if(response.config?.url.includes('api-graph')||response.config?.url.includes('api-storage')){