From 4fae13ac6ed65154a6b22413913f6771918fc9db Mon Sep 17 00:00:00 2001 From: Rivery <9858560+xigongdaEricyang@users.noreply.github.com> Date: Tue, 12 Jul 2022 16:26:28 +0800 Subject: [PATCH] feat: add rpm/ deb sqlite (#98) --- src/pages/MachineDashboard/index.tsx | 2 +- src/store/models/machine.ts | 3 +-- src/utils/dashboard.ts | 22 +++++----------------- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/src/pages/MachineDashboard/index.tsx b/src/pages/MachineDashboard/index.tsx index 4bf05e51..d94ea532 100644 --- a/src/pages/MachineDashboard/index.tsx +++ b/src/pages/MachineDashboard/index.tsx @@ -178,7 +178,7 @@ function MachineDashboard(props: IProps) { const getViewPath = (path: string): string => { if (cluster?.id) { - getMachineRouterPath(path, cluster.id); + return getMachineRouterPath(path, cluster.id); } return path; } diff --git a/src/store/models/machine.ts b/src/store/models/machine.ts index b1a0d16c..0e5b1203 100644 --- a/src/store/models/machine.ts +++ b/src/store/models/machine.ts @@ -63,10 +63,9 @@ export function MachineModelWrapper(service,) { start: number; end: number; metric: string; - nameObj: {name: string; showName: (name: string) => void}; clusterID?: string; }) { - const { start, end, clusterID, metric, nameObj } = payload; + const { start, end, clusterID, metric } = payload; const _start = start / 1000; const _end = end / 1000; const step = getProperStep(start, end); diff --git a/src/utils/dashboard.ts b/src/utils/dashboard.ts index 7752fc87..69201077 100644 --- a/src/utils/dashboard.ts +++ b/src/utils/dashboard.ts @@ -22,33 +22,21 @@ export const CARD_HIGH_COLORS = 'rgba(230,113,113,1)'; export const getProperStep = (start: number, end: number) => { const hours = Math.round((end - start) / (3600 * 1000)); if (hours <= 1) { - return 7; + return 30; } if (hours <= 6) { // 6 hour - return 86; + return 30; } if (hours <= 12) { // 12hour - return 172; + return 40; } if (hours <= 24) { // 1 day - return 345; + return 60; } - if (hours <= 72) { - // 3 days - return 691; - } - if (hours <= 168) { - // 1 week - return 2419; - } - if (hours <= 336) { - // 2 week - return 4838; - } - return Math.round((end - start) / MAX_STEP_ALLOW); + return Math.ceil(hours / 24) * 60; }; export const renderUnit = type => {