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