From 748adbffef213bb5f41db68df52d72b28289d3a4 Mon Sep 17 00:00:00 2001 From: li Nico <37568394+NicolaCage@users.noreply.github.com> Date: Mon, 7 Mar 2022 16:47:17 +0800 Subject: [PATCH] mod: icon (#45) --- src/App.tsx | 5 +- src/AuthorizedRoute.tsx | 11 +- src/components/MetricPopover/index.tsx | 16 +- .../Service/ServiceCardEdit/index.tsx | 17 +- .../Service/ServiceHeader/index.less | 4 + .../Service/ServiceHeader/index.tsx | 22 +- src/components/StatusPanel/index.tsx | 50 +- src/config/index.ts | 2 +- src/config/rules.ts | 2 +- src/config/service.ts | 2 +- src/pages/LeaderDistribution/index.tsx | 88 +-- src/pages/Login/index.tsx | 53 +- src/pages/MachineDashboard/Cards/CPUCard.tsx | 11 +- src/pages/MachineDashboard/Cards/DiskCard.tsx | 36 +- src/pages/MachineDashboard/Cards/LoadCard.tsx | 9 +- .../MachineDashboard/Cards/MemoryCard.tsx | 14 +- .../MachineDashboard/Cards/NetworkIn.tsx | 9 +- .../MachineDashboard/Cards/NetworkOut.tsx | 9 +- .../MachineDashboard/Detail/CPUDetail.tsx | 16 +- .../MachineDashboard/Detail/DiskDetail.tsx | 16 +- .../MachineDashboard/Detail/LoadDetail.tsx | 16 +- .../MachineDashboard/Detail/MemoryDetail.tsx | 16 +- .../MachineDashboard/Detail/NetworkDetail.tsx | 16 +- src/pages/MachineDashboard/Detail/index.tsx | 191 +++--- src/pages/MachineDashboard/index.tsx | 236 +++++--- src/pages/MainPage/Header/index.tsx | 68 ++- src/pages/MainPage/index.tsx | 160 +++-- src/pages/MainPage/routes.tsx | 551 ++++++++++-------- src/pages/PartitionDistribution/index.tsx | 115 ++-- .../ServiceDashboard/Detail/Panel/index.tsx | 224 ++++--- src/pages/ServiceDashboard/Detail/index.tsx | 317 +++++----- .../CustomServiceQueryPanel/index.tsx | 99 ++-- .../ServiceOverview/index.tsx | 40 +- src/pages/ServiceDashboard/index.tsx | 90 +-- src/pages/ServiceManage/ConfigInfo/index.tsx | 60 +- .../ServiceManage/LongTermTask/index.tsx | 61 +- .../ServiceManage/PartitionInfo/index.tsx | 78 ++- src/pages/ServiceManage/ServiceInfo/index.tsx | 70 ++- .../VersionStatistic/VersionItem/index.tsx | 61 +- src/pages/VersionStatistic/index.tsx | 53 +- src/static/images/Graphd-image.png | Bin 0 -> 1515 bytes src/static/images/Meta-image.png | Bin 0 -> 1734 bytes src/static/images/Storage-image.png | Bin 0 -> 945 bytes src/static/import.d.ts | 14 +- src/store/models/app.ts | 50 +- src/store/models/machine.ts | 161 +++-- src/store/models/nebula.ts | 55 +- src/store/models/service.ts | 53 +- src/store/models/setting.ts | 22 +- src/typings.d.ts | 2 +- src/utils/chart/chart.ts | 147 ++--- src/utils/dashboard.ts | 77 ++- src/utils/http.ts | 34 +- src/utils/interface.ts | 32 +- src/utils/metric.ts | 42 +- src/utils/promQL.ts | 200 ++++--- src/utils/service.ts | 77 +-- src/utils/stat.ts | 10 +- src/utils/url.ts | 7 +- 59 files changed, 2249 insertions(+), 1648 deletions(-) create mode 100644 src/static/images/Graphd-image.png create mode 100644 src/static/images/Meta-image.png create mode 100644 src/static/images/Storage-image.png diff --git a/src/App.tsx b/src/App.tsx index 5af290a2..21af1925 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -25,13 +25,14 @@ type IProps = RouteComponentProps; class App extends React.Component { currentLocale; + constructor(props: IProps) { super(props); const regx = /lang=(\w+)/g; const match = regx.exec(props.history.location.search); const lang = document.documentElement.getAttribute('lang'); - - if(!cookies.get('locale')){ + + if (!cookies.get('locale')) { if (match) { cookies.set('locale', match[1] === 'EN_US' ? 'EN_US' : 'ZH_CN'); } else { diff --git a/src/AuthorizedRoute.tsx b/src/AuthorizedRoute.tsx index 9595b79c..2f7fc909 100644 --- a/src/AuthorizedRoute.tsx +++ b/src/AuthorizedRoute.tsx @@ -1,6 +1,11 @@ import React from 'react'; import { connect } from 'react-redux'; -import { Redirect, Route, RouteComponentProps, withRouter } from 'react-router-dom'; +import { + Redirect, + Route, + RouteComponentProps, + withRouter, +} from 'react-router-dom'; import cookies from 'js-cookie'; import { IRootState } from '@/store'; @@ -25,10 +30,8 @@ const AuthorizedRoute = (props: IProps) => { ) : ( ); - } else { - return ; } + return ; }; - export default connect(mapState, mapDispatch)(withRouter(AuthorizedRoute)); diff --git a/src/components/MetricPopover/index.tsx b/src/components/MetricPopover/index.tsx index 02f4dbd8..c9312409 100644 --- a/src/components/MetricPopover/index.tsx +++ b/src/components/MetricPopover/index.tsx @@ -20,12 +20,18 @@ export const MetricPopover = (props: { list }) => { content={
-
+ {props.list.map(option => { - if(intl.get(`metric_description.${option.metric}`)){ - return - {intl.get(`metric_description.${option.metric}`)} - ; + if (intl.get(`metric_description.${option.metric}`)) { + return ( + + {intl.get(`metric_description.${option.metric}`)} + + ); } })}
diff --git a/src/components/Service/ServiceCardEdit/index.tsx b/src/components/Service/ServiceCardEdit/index.tsx index 4bdc6203..51a7abc3 100644 --- a/src/components/Service/ServiceCardEdit/index.tsx +++ b/src/components/Service/ServiceCardEdit/index.tsx @@ -27,13 +27,16 @@ class ServiceCardEdit extends React.Component { formRef = React.createRef(); handleUpdateMetricType = (value: string) => { - const { serviceMetric = { spaces: [], graphd: [], storaged:[], metad:[] }, editType } = this.props; + const { + serviceMetric = { spaces: [], graphd: [], storaged: [], metad: [] }, + editType, + } = this.props; const metric = serviceMetric[`${editType}d`].filter( item => item.metric === value, )[0]; this.formRef.current!.setFieldsValue({ metricFunction: metric?.metricType[0].value, - space: '' + space: '', }); }; @@ -61,7 +64,8 @@ class ServiceCardEdit extends React.Component { }; render() { - const { editIndex, editType, serviceMetric, panelConfig, onClose } = this.props; + const { editIndex, editType, serviceMetric, panelConfig, onClose } = + this.props; const editItem = panelConfig[editType][editIndex]; return (
@@ -101,13 +105,10 @@ class ServiceCardEdit extends React.Component { item => item.metric === metric, )[0]?.isSpaceMetric; return getFieldValue('metric') && isSpaceMetric ? ( - + {serviceMetric.spaces?.map(space => (