mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-06-29 09:26:20 +00:00
fix: pick calendar with a wrong time range and set a unique value for dashboard grid key (#139)
This commit is contained in:
parent
9c0bb988e6
commit
adb457d660
@ -552,7 +552,7 @@ const ok = (info: any) => {
|
|||||||
if (props.right && _time.getTime() / 100000 > start.value) {
|
if (props.right && _time.getTime() / 100000 > start.value) {
|
||||||
emit("setDates", _time, "right");
|
emit("setDates", _time, "right");
|
||||||
}
|
}
|
||||||
if (!(props.left && props.right)) {
|
if (!(props.left || props.right)) {
|
||||||
emit("setDates", _time);
|
emit("setDates", _time);
|
||||||
}
|
}
|
||||||
emit("ok", info === "h");
|
emit("ok", info === "h");
|
||||||
|
@ -29,9 +29,9 @@ limitations under the License. -->
|
|||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in options"
|
v-for="item in options"
|
||||||
:key="item.value"
|
:key="item.value || ''"
|
||||||
:label="item.label"
|
:label="item.label || ''"
|
||||||
:value="item.value"
|
:value="item.value || ''"
|
||||||
>
|
>
|
||||||
</el-option>
|
</el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
|
@ -154,7 +154,10 @@ export function useSourceProcessor(
|
|||||||
const c = (config.metricConfig && config.metricConfig[index]) || {};
|
const c = (config.metricConfig && config.metricConfig[index]) || {};
|
||||||
|
|
||||||
if (type === MetricQueryTypes.ReadMetricsValues) {
|
if (type === MetricQueryTypes.ReadMetricsValues) {
|
||||||
source[m] = calculateExp(resp.data[keys[index]].values.values, c);
|
source[m] =
|
||||||
|
(resp.data[keys[index]] &&
|
||||||
|
calculateExp(resp.data[keys[index]].values.values, c)) ||
|
||||||
|
[];
|
||||||
}
|
}
|
||||||
if (type === MetricQueryTypes.ReadLabeledMetricsValues) {
|
if (type === MetricQueryTypes.ReadLabeledMetricsValues) {
|
||||||
const resVal = Object.values(resp.data)[0] || [];
|
const resVal = Object.values(resp.data)[0] || [];
|
||||||
|
@ -238,6 +238,8 @@ function optimizeTemplate(
|
|||||||
children: (LayoutConfig & {
|
children: (LayoutConfig & {
|
||||||
moved?: boolean;
|
moved?: boolean;
|
||||||
standard?: unknown;
|
standard?: unknown;
|
||||||
|
label?: string;
|
||||||
|
value?: string;
|
||||||
})[]
|
})[]
|
||||||
) {
|
) {
|
||||||
for (const child of children || []) {
|
for (const child of children || []) {
|
||||||
@ -245,6 +247,8 @@ function optimizeTemplate(
|
|||||||
delete child.activedTabIndex;
|
delete child.activedTabIndex;
|
||||||
delete child.standard;
|
delete child.standard;
|
||||||
delete child.id;
|
delete child.id;
|
||||||
|
delete child.label;
|
||||||
|
delete child.value;
|
||||||
if (isEmptyObject(child.graph)) {
|
if (isEmptyObject(child.graph)) {
|
||||||
delete child.graph;
|
delete child.graph;
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@ import { ref, computed } from "vue";
|
|||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||||
import getDashboard from "@/hooks/useDashboardsSession";
|
import getDashboard from "@/hooks/useDashboardsSession";
|
||||||
import { LayoutConfig } from "@/types/dashboard";
|
|
||||||
import { Option } from "@/types/app";
|
import { Option } from "@/types/app";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
@ -40,24 +39,20 @@ const associate = dashboardStore.selectedGrid.associate || [];
|
|||||||
const widgetIds = ref<string[]>(
|
const widgetIds = ref<string[]>(
|
||||||
associate.map((d: { widgetId: string }) => d.widgetId)
|
associate.map((d: { widgetId: string }) => d.widgetId)
|
||||||
);
|
);
|
||||||
const widgets = computed(() => {
|
const widgets: any = computed(() => {
|
||||||
const all = getDashboard(dashboardStore.currentDashboard).widgets;
|
const all = getDashboard(dashboardStore.currentDashboard).widgets;
|
||||||
const items = all.filter(
|
const items = all.filter((d: any) => {
|
||||||
(d: { value: string; label: string } & LayoutConfig) => {
|
const isLinear = ["Bar", "Line", "Area"].includes(
|
||||||
const isLinear = ["Bar", "Line", "Area"].includes(
|
(d.graph && d.graph.type) || ""
|
||||||
(d.graph && d.graph.type) || ""
|
);
|
||||||
);
|
if (isLinear && d.id && dashboardStore.selectedGrid.id !== d.id) {
|
||||||
if (isLinear && d.id && dashboardStore.selectedGrid.id !== d.id) {
|
return { value: d.id, label: (d.widget && d.widget.name) || d.id };
|
||||||
d.value = d.id;
|
|
||||||
d.label = (d.widget && d.widget.name) || d.id;
|
|
||||||
return d;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
return items;
|
return items;
|
||||||
});
|
});
|
||||||
function updateWidgetConfig(options: Option[]) {
|
function updateWidgetConfig(options: Option[]) {
|
||||||
const { widgets } = getDashboard(dashboardStore.currentDashboard);
|
const arr: any = getDashboard(dashboardStore.currentDashboard).widgets;
|
||||||
const opt = options.map((d: Option) => {
|
const opt = options.map((d: Option) => {
|
||||||
return { widgetId: d.value };
|
return { widgetId: d.value };
|
||||||
});
|
});
|
||||||
@ -72,7 +67,7 @@ function updateWidgetConfig(options: Option[]) {
|
|||||||
// remove unuse association widget option
|
// remove unuse association widget option
|
||||||
for (const id of widgetIds.value) {
|
for (const id of widgetIds.value) {
|
||||||
if (!newVal.includes(id)) {
|
if (!newVal.includes(id)) {
|
||||||
const w = widgets.find((d: { id: string }) => d.id === id);
|
const w = arr.find((d: { id: string }) => d.id === id);
|
||||||
const config = {
|
const config = {
|
||||||
...w,
|
...w,
|
||||||
associate: [],
|
associate: [],
|
||||||
@ -84,7 +79,7 @@ function updateWidgetConfig(options: Option[]) {
|
|||||||
for (let i = 0; i < opt.length; i++) {
|
for (let i = 0; i < opt.length; i++) {
|
||||||
const item = JSON.parse(JSON.stringify(opt));
|
const item = JSON.parse(JSON.stringify(opt));
|
||||||
item[i] = { widgetId: dashboardStore.selectedGrid.id };
|
item[i] = { widgetId: dashboardStore.selectedGrid.id };
|
||||||
const w = widgets.find((d: { id: string }) => d.id === opt[i].widgetId);
|
const w = arr.find((d: { id: string }) => d.id === opt[i].widgetId);
|
||||||
const config = {
|
const config = {
|
||||||
...w,
|
...w,
|
||||||
associate: item,
|
associate: item,
|
||||||
|
@ -87,7 +87,7 @@ limitations under the License. -->
|
|||||||
:w="item.w"
|
:w="item.w"
|
||||||
:h="item.h"
|
:h="item.h"
|
||||||
:i="item.i"
|
:i="item.i"
|
||||||
:key="item.i"
|
:key="item.id"
|
||||||
@click="clickTabGrid($event, item)"
|
@click="clickTabGrid($event, item)"
|
||||||
:class="{ active: activeTabWidget === item.i }"
|
:class="{ active: activeTabWidget === item.i }"
|
||||||
:drag-ignore-from="dragIgnoreFrom"
|
:drag-ignore-from="dragIgnoreFrom"
|
||||||
|
@ -28,7 +28,7 @@ limitations under the License. -->
|
|||||||
:w="item.w"
|
:w="item.w"
|
||||||
:h="item.h"
|
:h="item.h"
|
||||||
:i="item.i"
|
:i="item.i"
|
||||||
:key="item.i"
|
:key="item.id"
|
||||||
@click="clickGrid(item, $event)"
|
@click="clickGrid(item, $event)"
|
||||||
:class="{ active: dashboardStore.activedGridItem === item.i }"
|
:class="{ active: dashboardStore.activedGridItem === item.i }"
|
||||||
:drag-ignore-from="dragIgnoreFrom"
|
:drag-ignore-from="dragIgnoreFrom"
|
||||||
|
@ -308,7 +308,9 @@ async function setSourceSelector() {
|
|||||||
}
|
}
|
||||||
selectorStore.setCurrentPod(currentPod);
|
selectorStore.setCurrentPod(currentPod);
|
||||||
states.currentPod = currentPod.label;
|
states.currentPod = currentPod.label;
|
||||||
const process = params.processId || selectorStore.processes[0].id;
|
const process =
|
||||||
|
params.processId ||
|
||||||
|
(selectorStore.processes.length && selectorStore.processes[0].id);
|
||||||
let currentProcess;
|
let currentProcess;
|
||||||
if (states.currentProcess) {
|
if (states.currentProcess) {
|
||||||
currentProcess = selectorStore.processes.find(
|
currentProcess = selectorStore.processes.find(
|
||||||
|
Loading…
Reference in New Issue
Block a user