mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-14 17:05:10 +00:00
update
This commit is contained in:
parent
ec9749b90c
commit
d621ce8072
@ -19,7 +19,7 @@ limitations under the License. -->
|
|||||||
:value="widgetId"
|
:value="widgetId"
|
||||||
:options="widgets"
|
:options="widgets"
|
||||||
size="small"
|
size="small"
|
||||||
placeholder="Select a metric"
|
placeholder="Select a widget"
|
||||||
@change="updateWidgetConfig({ associateWidget: $event[0].value })"
|
@change="updateWidgetConfig({ associateWidget: $event[0].value })"
|
||||||
class="selectors"
|
class="selectors"
|
||||||
/>
|
/>
|
||||||
@ -35,17 +35,30 @@ const dashboardStore = useDashboardStore();
|
|||||||
const associate = dashboardStore.selectedGrid.associate || {};
|
const associate = dashboardStore.selectedGrid.associate || {};
|
||||||
const widgetId = ref<string>(associate.widgetId || "");
|
const widgetId = ref<string>(associate.widgetId || "");
|
||||||
const widgets = computed(() => {
|
const widgets = computed(() => {
|
||||||
|
const isLinear = ["Bar", "Line"].includes(
|
||||||
|
dashboardStore.selectedGrid.graph && dashboardStore.selectedGrid.graph.type
|
||||||
|
);
|
||||||
|
const isRank = ["TopList"].includes(
|
||||||
|
dashboardStore.selectedGrid.graph && dashboardStore.selectedGrid.graph.type
|
||||||
|
);
|
||||||
const all = [];
|
const all = [];
|
||||||
for (const item of dashboardStore.layout) {
|
for (const item of dashboardStore.layout) {
|
||||||
if (item.type === "Tab") {
|
if (item.type === "Tab") {
|
||||||
if (item.children && item.children.length) {
|
if (item.children && item.children.length) {
|
||||||
for (const child of item.children) {
|
for (const child of item.children) {
|
||||||
if (child.children && child.children.length) {
|
if (child.children && child.children.length) {
|
||||||
const items = child.children.map(
|
const items = child.children.filter(
|
||||||
(d: { i: string; index: string } | any) => {
|
(d: { i: string; index: string } | any) => {
|
||||||
d.value = d.id;
|
if (isLinear) {
|
||||||
d.label = (d.widget && d.widget.title) || d.type || "";
|
d.value = d.id;
|
||||||
return d;
|
d.label = (d.widget && d.widget.title) || d.type || "";
|
||||||
|
return d;
|
||||||
|
}
|
||||||
|
if (isRank && d.type !== "Widget") {
|
||||||
|
d.value = d.id;
|
||||||
|
d.label = (d.widget && d.widget.title) || d.type || "";
|
||||||
|
return d;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
all.push(...items);
|
all.push(...items);
|
||||||
@ -53,9 +66,17 @@ const widgets = computed(() => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
item.value = item.id;
|
if (isLinear) {
|
||||||
item.label = (item.widget && item.widget.title) || item.type || "";
|
item.value = item.id;
|
||||||
all.push(item);
|
item.label = (item.widget && item.widget.title) || item.type || "";
|
||||||
|
all.push(item);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (isRank && item.type !== "Widget") {
|
||||||
|
item.value = item.id;
|
||||||
|
item.label = (item.widget && item.widget.title) || item.type || "";
|
||||||
|
all.push(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return all;
|
return all;
|
||||||
@ -88,4 +109,8 @@ function updateWidgetConfig(param: { [key: string]: string }) {
|
|||||||
.item {
|
.item {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.selectors {
|
||||||
|
width: 500px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user