Skip to content

Commit

Permalink
feat: add rpm/ deb sqlite (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
xigongdaEricyang authored Jul 12, 2022
1 parent 0e10436 commit 4fae13a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/pages/MachineDashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 1 addition & 2 deletions src/store/models/machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
22 changes: 5 additions & 17 deletions src/utils/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down

0 comments on commit 4fae13a

Please sign in to comment.