delete config

This commit is contained in:
Qiuxia Fan 2022-03-26 20:48:49 +08:00
parent a5fe322304
commit cdb776866a
3 changed files with 42 additions and 8 deletions

View File

@ -244,7 +244,7 @@ export enum LegendOpt {
}
export const DepthList = [1, 2, 3, 4, 5].map((item: number) => ({
value: item,
label: item,
label: String(item),
}));
export const Status = [
{ label: "All", value: "ALL" },

View File

@ -119,10 +119,11 @@ function changeMetric(val: string) {
currentIndex.value = index || 0;
const config = getMetricConfig.value;
currentConfig.value = config[index] || {
currentConfig.value = {
unit: "",
label: "",
calculation: "",
...config[index],
};
}
watch(

View File

@ -416,10 +416,22 @@ function updateSettings(config?: { [key: string]: MetricConfigOpt[] }) {
dashboardStore.selectWidget({ ...dashboardStore.selectedGrid, ...param });
dashboardStore.setConfigs({ ...dashboardStore.selectedGrid, ...param });
emit("update", param);
console.log(dashboardStore.selectedGrid);
}
function updateLinkServerMetrics(options: Option[] | any) {
states.linkServerMetrics = options.map((d: Option) => d.value);
changeLinkServerMetrics();
const opt = options.map((d: Option) => d.value);
const index = states.linkServerMetrics.findIndex(
(d: any) => !opt.includes(d)
);
states.linkServerMetrics = opt;
if (index < 0) {
changeLinkServerMetrics();
return;
}
const config = (
dashboardStore.selectedGrid.linkServerMetricConfig || []
).splice(index, 1);
changeLinkServerMetrics({ linkServerMetricConfig: config });
}
async function changeLinkServerMetrics(config?: {
[key: string]: MetricConfigOpt[];
@ -432,8 +444,19 @@ async function changeLinkServerMetrics(config?: {
topologyStore.getLinkServerMetrics(states.linkServerMetrics);
}
function updateLinkClientMetrics(options: Option[] | any) {
states.linkClientMetrics = options.map((d: Option) => d.value);
changeLinkClientMetrics();
const opt = options.map((d: Option) => d.value);
const index = states.linkClientMetrics.findIndex(
(d: any) => !opt.includes(d)
);
states.linkClientMetrics = opt;
if (index < 0) {
changeLinkClientMetrics();
return;
}
const config = (
dashboardStore.selectedGrid.linkClientMetricConfig || []
).splice(index, 1);
changeLinkClientMetrics({ linkClientMetricConfig: config });
}
async function changeLinkClientMetrics(config?: {
[key: string]: MetricConfigOpt[];
@ -446,8 +469,18 @@ async function changeLinkClientMetrics(config?: {
topologyStore.getLinkClientMetrics(states.linkClientMetrics);
}
function updateNodeMetrics(options: Option[] | any) {
states.nodeMetrics = options.map((d: Option) => d.value);
changeNodeMetrics();
const opt = options.map((d: Option) => d.value);
const index = states.nodeMetrics.findIndex((d: any) => !opt.includes(d));
states.nodeMetrics = opt;
if (index < 0) {
changeNodeMetrics();
return;
}
const config = (dashboardStore.selectedGrid.nodeMetricConfig || []).splice(
index,
1
);
changeNodeMetrics({ nodeMetricConfig: config });
}
async function changeNodeMetrics(config?: {
[key: string]: MetricConfigOpt[];