Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove useless #226

Merged
merged 1 commit into from
Mar 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/pages/MachineDashboard/index.module.less
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,17 @@
}

.singelNodeMonitor {
background-color: #fff;
background-color: #fff;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.08);
padding: 16px;
margin: 24px 0;
}

.singelNodeMonitorHeader {
display: flex;
justify-content: space-between;
margin-bottom: 24px;
}

.monitorTitle {
Expand Down
78 changes: 36 additions & 42 deletions src/pages/MachineDashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ function MachineDashboard(props: IProps) {
<DashboardCard
key={key}
title={cardObj[key].title}
viewPath={cardObj[key].viewPath ? getViewPath(cardObj[key].viewPath) : undefined }
viewPath={cardObj[key].viewPath ? getViewPath(cardObj[key].viewPath) : undefined}
>
<MetricCard
ref={ref => metricRefs[key] = ref}
Expand All @@ -236,50 +236,44 @@ function MachineDashboard(props: IProps) {
</div>
</div>
<div className={styles.singelNodeMonitor}>
<div className={styles.monitorTitle}>{intl.get('device.nodeResource.singleNodeTitle')}</div>
<div className={styles.action}>
<TimeSelect value={timeRange} onChange={handleTimeSelectChange} />
<DashboardSelect className={styles.instanceSelect} value={curInstance} onChange={handleInstanceChange}>
<div className={styles.singelNodeMonitorHeader}>
<div className={styles.monitorTitle}>{intl.get('device.nodeResource.singleNodeTitle')}</div>
<div className={styles.action}>
<TimeSelect value={timeRange} onChange={handleTimeSelectChange} />
<DashboardSelect className={styles.instanceSelect} value={curInstance} onChange={handleInstanceChange}>
{
instanceList.map((instance: string) => (
<Option key={instance} value={instance}>{instance}</Option>
))
}
</DashboardSelect>
</div>
</div>
<Spin spinning={singleNodeLoading}>
<Row>
<Col span={12}>
<DashboardCard
title={intl.get('device.nodeResource.waterLevel')}
>
<WaterLevelCard nodeResource={resourceInfos.find(info => info.host === curInstance)} />
</DashboardCard >
</Col>
<Col span={12}>
<DashboardCard
title={intl.get('device.disk')}
viewPath={getViewPath("/machine/disk")}
>
<DiskCard ref={diskCardRef} cluster={cluster} instance={curInstance} asyncBatchQueries={asyncBatchQueries} />
</DashboardCard >
</Col>
</Row>
<div className={styles.chartContent}>
{
instanceList.map((instance: string) => (
<Option key={instance} value={instance}>{instance}</Option>
))
renderCardContent()
}
</DashboardSelect>
<Button
type="primary"
onClick={() => { }}
className={`${styles.primaryBtn} ${styles.addPanelBtn}`}
>
<Icon icon="#iconPlus" />
{intl.get('common.addPanel')}
</Button>
</div>
</div>
</Spin>
</div>
<Spin spinning={singleNodeLoading}>
<Row>
<Col span={12}>
<DashboardCard
title={intl.get('device.nodeResource.waterLevel')}
>
<WaterLevelCard nodeResource={resourceInfos.find(info => info.host === curInstance)} />
</DashboardCard >
</Col>
<Col span={12}>
<DashboardCard
title={intl.get('device.disk')}
viewPath={getViewPath("/machine/disk")}
>
<DiskCard ref={diskCardRef} cluster={cluster} instance={curInstance} asyncBatchQueries={asyncBatchQueries} />
</DashboardCard >
</Col>
</Row>
<div className={styles.chartContent}>
{
renderCardContent()
}
</div>
</Spin>
</div>
);
}
Expand Down
52 changes: 0 additions & 52 deletions src/store/models/machine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,13 @@ import { getQueryRangeInfo } from '@/utils';

const PROMQL = LINUX;
export interface IState {
cpuStat: IStatRangeItem[];
diskStat: IStatRangeItem[];
memoryStat: IStatRangeItem[];
loadStat: IStatRangeItem[];
networkOutStat: IStatRangeItem[];
networkInStat: IStatRangeItem[];
networkStat: IStatRangeItem[];
memorySizeStat: IStatSingleItem[];
diskSizeStat: IStatSingleItem[];
instanceList: string[];
metricsFilterValues: MetricsPanelValue;
}

export function MachineModelWrapper(service,) {
return createModel({
state: {
cpuStat: [] as IStatRangeItem[],
diskStat: [] as IStatRangeItem[],
memoryStat: [] as IStatRangeItem[],
networkOutStat: [] as IStatRangeItem[],
networkInStat: [] as IStatRangeItem[],
networkStat: [] as IStatRangeItem[],
loadStat: [] as IStatRangeItem[],
memorySizeStat: [] as IStatSingleItem[],
diskSizeStat: [] as IStatSingleItem[],
instanceList: [] as string[],
metricsFilterValues: InitMachineMetricsFilterValues,
},
Expand Down Expand Up @@ -95,9 +77,6 @@ export function MachineModelWrapper(service,) {
...payload,
nameObj: getMetricsUniqName(MetricScene.CPU)
});
this.update({
cpuStat,
});
return cpuStat;
},

Expand All @@ -111,9 +90,6 @@ export function MachineModelWrapper(service,) {
...payload,
nameObj: getMetricsUniqName(MetricScene.MEMORY)
});
this.update({
memoryStat,
});
return memoryStat;
},

Expand All @@ -126,9 +102,6 @@ export function MachineModelWrapper(service,) {
if (code === 0) {
memorySizeStat = data.result;
}
this.update({
memorySizeStat,
});
return memorySizeStat;
},

Expand All @@ -142,9 +115,6 @@ export function MachineModelWrapper(service,) {
...payload,
nameObj: getMetricsUniqName(MetricScene.DISK)
});
this.update({
diskStat,
});
return diskStat;
},

Expand All @@ -157,9 +127,6 @@ export function MachineModelWrapper(service,) {
if (code === 0) {
diskSizeStat = data.result;
}
this.update({
diskSizeStat,
});
return diskSizeStat;
},

Expand All @@ -173,9 +140,6 @@ export function MachineModelWrapper(service,) {
...payload,
nameObj: getMetricsUniqName(MetricScene.LOAD)
});
this.update({
loadStat,
});
return loadStat;
},

Expand All @@ -188,22 +152,6 @@ export function MachineModelWrapper(service,) {
}) {
const { start, end, metric, clusterID, inOrOut } = payload;
let networkStat = await this.asyncGetMetricsData({ start, end, metric, clusterID, nameObj: getMetricsUniqName(MetricScene.NETWORK) });
switch (inOrOut) {
case 'in':
this.update({
networkInStat: networkStat,
});
break;
case 'out':
this.update({
networkOutStat: networkStat,
});
break;
default:
this.update({
networkStat,
});
}
return networkStat;
},

Expand Down
5 changes: 0 additions & 5 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,6 @@ export class LocalStorageStorageUtil {
}
}

export const clearNebulaConnection = () => {
SessionStorageUtil.removeItem('nebulaConnect');
cookies.remove('nsid');
}

export const getMenuPathByKey = (menuList: any[], activeKey: string): string[] => {
let path: string[] = [];
for(let i = 0; i < menuList.length; i++) {
Expand Down