mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-14 09:00:50 +00:00
update event associations
This commit is contained in:
parent
b8ff623eb8
commit
1f98d2bfa1
@ -115,6 +115,10 @@ watch(
|
|||||||
}
|
}
|
||||||
if (props.filters) {
|
if (props.filters) {
|
||||||
if (props.filters.isRange) {
|
if (props.filters.isRange) {
|
||||||
|
if (!props.filters.duration.startTime) {
|
||||||
|
setOptions(props.option);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const list = props.option.series[0].data.map(
|
const list = props.option.series[0].data.map(
|
||||||
(d: (number | string)[]) => d[0]
|
(d: (number | string)[]) => d[0]
|
||||||
);
|
);
|
||||||
|
@ -125,22 +125,37 @@ function associateTraceLog(
|
|||||||
const widgets = dashboard.filter((d: { type: string }) =>
|
const widgets = dashboard.filter((d: { type: string }) =>
|
||||||
["Trace", "Log"].includes(d.type)
|
["Trace", "Log"].includes(d.type)
|
||||||
);
|
);
|
||||||
|
const index = items[0];
|
||||||
|
const i = events[index - 1 || 0];
|
||||||
for (const widget of widgets) {
|
for (const widget of widgets) {
|
||||||
const index = items[0];
|
if (isNaN(index)) {
|
||||||
const i = events[index - 1 || 0];
|
const item = {
|
||||||
const { start, end } = setEndTime(i.start, i.end, index);
|
...widget,
|
||||||
const item = {
|
filters: {
|
||||||
...widget,
|
sourceId: props.data.id || "",
|
||||||
filters: {
|
duration: {
|
||||||
sourceId: props.data.id || "",
|
startTime: null,
|
||||||
duration: {
|
endTime: null,
|
||||||
startTime: dateFormatStep(start, appStore.duration.step, true),
|
step: appStore.duration.step,
|
||||||
endTime: dateFormatStep(end, appStore.duration.step, true),
|
},
|
||||||
step: appStore.duration.step,
|
|
||||||
},
|
},
|
||||||
},
|
};
|
||||||
};
|
dashboardStore.setWidget(item);
|
||||||
dashboardStore.setWidget(item);
|
} else {
|
||||||
|
const { start, end } = setEndTime(i.start, i.end);
|
||||||
|
const item = {
|
||||||
|
...widget,
|
||||||
|
filters: {
|
||||||
|
sourceId: props.data.id || "",
|
||||||
|
duration: {
|
||||||
|
startTime: dateFormatStep(start, appStore.duration.step, true),
|
||||||
|
endTime: dateFormatStep(end, appStore.duration.step, true),
|
||||||
|
step: appStore.duration.step,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
dashboardStore.setWidget(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function associateMetrics(
|
function associateMetrics(
|
||||||
@ -167,41 +182,54 @@ function associateMetrics(
|
|||||||
const i = events[index - 1 || 0];
|
const i = events[index - 1 || 0];
|
||||||
|
|
||||||
for (const widget of widgets) {
|
for (const widget of widgets) {
|
||||||
const { start, end } = setEndTime(i.start, i.end, index);
|
if (isNaN(index)) {
|
||||||
const startTime = dateFormatTime(start, appStore.duration.step);
|
const item = {
|
||||||
const endTime = dateFormatTime(end, appStore.duration.step);
|
...widget,
|
||||||
const item = {
|
filters: {
|
||||||
...widget,
|
sourceId: dashboardStore.selectedGrid.id || "",
|
||||||
filters: {
|
isRange: true,
|
||||||
sourceId: dashboardStore.selectedGrid.id || "",
|
duration: {
|
||||||
isRange: true,
|
startTime: null,
|
||||||
duration: {
|
endTime: null,
|
||||||
startTime,
|
},
|
||||||
endTime,
|
|
||||||
},
|
},
|
||||||
},
|
};
|
||||||
};
|
dashboardStore.setWidget(item);
|
||||||
dashboardStore.setWidget(item);
|
} else {
|
||||||
|
const { start, end } = setEndTime(i.start, i.end);
|
||||||
|
const startTime = dateFormatTime(start, appStore.duration.step);
|
||||||
|
const endTime = dateFormatTime(end, appStore.duration.step);
|
||||||
|
const item = {
|
||||||
|
...widget,
|
||||||
|
filters: {
|
||||||
|
sourceId: dashboardStore.selectedGrid.id || "",
|
||||||
|
isRange: true,
|
||||||
|
duration: {
|
||||||
|
startTime,
|
||||||
|
endTime,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
dashboardStore.setWidget(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function setEndTime(start: Date, end: Date, index: number) {
|
function setEndTime(start: Date, end: Date) {
|
||||||
let time: Date | number = end;
|
let time: Date | number = end;
|
||||||
if (!isNaN(index)) {
|
let diff = 60000;
|
||||||
let diff = 60000;
|
switch (appStore.duration.step) {
|
||||||
switch (appStore.duration.step) {
|
case "MINUTE":
|
||||||
case "MINUTE":
|
diff = 60000;
|
||||||
diff = 60000;
|
break;
|
||||||
break;
|
case "HOUR":
|
||||||
case "HOUR":
|
diff = 3600000;
|
||||||
diff = 3600000;
|
break;
|
||||||
break;
|
case "DAY":
|
||||||
case "DAY":
|
diff = 3600000 * 24;
|
||||||
diff = 3600000 * 24;
|
break;
|
||||||
break;
|
}
|
||||||
}
|
if (!end || end.getTime() - start.getTime() < diff) {
|
||||||
if (!end || end.getTime() - start.getTime() < diff) {
|
time = start.getTime() + diff;
|
||||||
time = start.getTime() + diff;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return { start, end: new Date(time) };
|
return { start, end: new Date(time) };
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user