diff --git a/src/components/MetricPopover/index.module.less b/src/components/MetricPopover/index.module.less index fefb4067..02f99d92 100644 --- a/src/components/MetricPopover/index.module.less +++ b/src/components/MetricPopover/index.module.less @@ -1,5 +1,7 @@ .popover-metric { width: 100%; + max-height: 80vh; + overflow-y: auto; .metric-content { width: 100%; display: flex; diff --git a/src/components/MetricPopover/index.tsx b/src/components/MetricPopover/index.tsx index 676285c1..16460b98 100644 --- a/src/components/MetricPopover/index.tsx +++ b/src/components/MetricPopover/index.tsx @@ -18,6 +18,7 @@ export const MetricPopover = (props: { list }) => {
diff --git a/src/config/locale/en-US/common.json b/src/config/locale/en-US/common.json index fc5706d0..880b646c 100644 --- a/src/config/locale/en-US/common.json +++ b/src/config/locale/en-US/common.json @@ -48,5 +48,6 @@ "port": "Port" }, "addhostSuccess": "{host} add host success", - "successDelay": "Success, Please refresh the page later to view" + "successDelay": "Success, Please refresh the page later to view", + "running": "Running" } \ No newline at end of file diff --git a/src/config/locale/zh-CN/common.json b/src/config/locale/zh-CN/common.json index e761f2cd..3c9d13a4 100644 --- a/src/config/locale/zh-CN/common.json +++ b/src/config/locale/zh-CN/common.json @@ -48,5 +48,6 @@ "port": "端口号" }, "addhostSuccess": "{host} add host 成功", - "successDelay": "操作成功,请稍后刷新页面查看" + "successDelay": "操作成功,请稍后刷新页面查看", + "running": "运行中" } \ No newline at end of file diff --git a/src/pages/MetricDetail/index.tsx b/src/pages/MetricDetail/index.tsx index 3b3192f5..dd8719a2 100644 --- a/src/pages/MetricDetail/index.tsx +++ b/src/pages/MetricDetail/index.tsx @@ -185,7 +185,6 @@ function MetricDetail(props: Props) { }, [curMetricsFilterValues.instanceList, dataSource]) const updateChart = () => { - const [startTimestamps, endTimestamps] = calcTimeRange(curMetricsFilterValues.timeRange); const metricScene = getMetricSecene(metricType); const data = metricType === MetricTypeName.Disk ? getDiskData({ diff --git a/src/pages/ServiceDashboard/Detail/index.tsx b/src/pages/ServiceDashboard/Detail/index.tsx index 56d2a5c5..f9279b88 100644 --- a/src/pages/ServiceDashboard/Detail/index.tsx +++ b/src/pages/ServiceDashboard/Detail/index.tsx @@ -14,6 +14,7 @@ import { getMachineRouterPath, AggregationType, getMinNum, + getTickIntervalByGap, } from '@/utils/dashboard'; import { IDispatch, IRootState } from '@/store'; // import { VALUE_TYPE } from '@/utils/promQL'; @@ -204,7 +205,6 @@ function ServiceDetail(props: IProps) { const updateChart = () => { const { aliasConfig } = props; const { instanceList } = metricsFilterValues; - const [startTimestamps, endTimestamps] = calcTimeRange(metricsFilterValues.timeRange); metricCharts.forEach((chart, i) => { const data = getDataByType({ data: dataSources[i] || [], @@ -212,10 +212,12 @@ function ServiceDetail(props: IProps) { nameObj: getMetricsUniqName(MetricScene.SERVICE), aliasConfig, }); + const realRange = data.length>0?(data[data.length-1].time - data[0].time):0; + const tickInterval = getTickIntervalByGap(Math.floor(realRange / 10)); // 10 ticks max chart.chartRef.updateDetailChart({ type: serviceType, valueType: chart.metric.valueType, - tickInterval: getProperTickInterval(endTimestamps - startTimestamps), + tickInterval, maxNum: getMaxNum(data), minNum: getMinNum(data), }).changeData(data); diff --git a/src/pages/ServiceManage/Overview/index.tsx b/src/pages/ServiceManage/Overview/index.tsx index cbe1bcd6..c9a901d6 100644 --- a/src/pages/ServiceManage/Overview/index.tsx +++ b/src/pages/ServiceManage/Overview/index.tsx @@ -23,6 +23,7 @@ const mapDispatch: any = (dispatch: IDispatch) => ({ asyncGetHostsInfo: dispatch.nebula.asyncGetHostsInfo, asyncGetServices: dispatch.nebula.asyncGetServices, asyncExecNGQL: dispatch.nebula.asyncExecNGQL, + getJobs: dispatch.nebula.getJobs, clear: dispatch.nebula.clear, }); @@ -57,10 +58,9 @@ const OverviewCardHeader = (props: IHaderProps) => { const Overview: React.FC = (props: IProps) => { const { cluster, currentSpace, spaces, baseRouter = '/management', nebulaConnect } = props; - + const [balancing, setBalancing] = useState(false); const modalHandler = useRef(); const [hosts, setHosts] = useState([]); - useEffect(() => { props.clear(); },[cluster]) @@ -93,6 +93,7 @@ const Overview: React.FC = (props: IProps) => { if (code === 0) { message.success(intl.get('common.successDelay')); props.asyncGetServices(); + getBalanceStatus(); } }; @@ -117,6 +118,7 @@ const Overview: React.FC = (props: IProps) => { if (code === 0) { message.success(intl.get('common.successDelay')); props.asyncGetServices(); + getBalanceStatus(); } handleModalClose(); } @@ -124,6 +126,23 @@ const Overview: React.FC = (props: IProps) => { }; + const getBalanceStatus = async () => { + const { code,data } = await props.getJobs(); + if (code === 0) { + const hasRunningBalance = data.tables.find(item => item.Command.indexOf("BALANCE") && item.status === 'RUNNING'); + setBalancing(hasRunningBalance); + } + } + + useEffect(() => { + const interval = setInterval(() => { + getBalanceStatus(); + }, 2000); + return ()=>{ + clearInterval(interval); + } + },[]) + const handleModalShow = async () => { if (modalHandler && modalHandler.current) { modalHandler.current.show(); @@ -183,17 +202,19 @@ const Overview: React.FC = (props: IProps) => { ) diff --git a/src/pages/ServiceManage/PartitionInfo/index.less b/src/pages/ServiceManage/PartitionInfo/index.less index 9f008782..7b80a3a8 100644 --- a/src/pages/ServiceManage/PartitionInfo/index.less +++ b/src/pages/ServiceManage/PartitionInfo/index.less @@ -14,5 +14,6 @@ .common-header .service-screen .ant-input-group-wrapper { width: 250px; + text-align: left; } } diff --git a/src/store/models/nebula.ts b/src/store/models/nebula.ts index 558e2a09..1411fa6c 100644 --- a/src/store/models/nebula.ts +++ b/src/store/models/nebula.ts @@ -35,6 +35,12 @@ export function NebulaModelWrapper(serviceApi, state, _effects) { }), }, effects: (dispatch: any) => ({ + async getJobs() { + const { code, data } = (await serviceApi.execNGQL({ + gql: 'show jobs', + })) as any; + return { code,data }; + }, async asyncGetServiceConfigs(module) { const data = module === 'graph' ? await serviceApi.getGraphConfig() : await serviceApi.getStorageConfig() as any;