mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-07-17 21:15:25 +00:00
feat: update Tab
This commit is contained in:
parent
9aab980b35
commit
4e80925745
@ -156,7 +156,6 @@ export const dashboardStore = defineStore({
|
|||||||
d.y = d.y + newItem.h;
|
d.y = d.y + newItem.h;
|
||||||
return d;
|
return d;
|
||||||
});
|
});
|
||||||
console.log(type);
|
|
||||||
items.push(newItem);
|
items.push(newItem);
|
||||||
this.layout[idx].children[tabIndex].children = items;
|
this.layout[idx].children[tabIndex].children = items;
|
||||||
}
|
}
|
||||||
@ -173,7 +172,24 @@ export const dashboardStore = defineStore({
|
|||||||
}
|
}
|
||||||
this.layout[idx].activedTabIndex = index;
|
this.layout[idx].activedTabIndex = index;
|
||||||
},
|
},
|
||||||
|
removeTab(item: LayoutConfig) {
|
||||||
|
this.layout = this.layout.filter((d: LayoutConfig) => d.i !== item.i);
|
||||||
|
},
|
||||||
removeControls(item: LayoutConfig) {
|
removeControls(item: LayoutConfig) {
|
||||||
|
const actived = this.activedGridItem.split("-");
|
||||||
|
const index = this.layout.findIndex(
|
||||||
|
(d: LayoutConfig) => actived[0] === d.i
|
||||||
|
);
|
||||||
|
|
||||||
|
if (actived.length === 3) {
|
||||||
|
const tabIndex = Number(actived[1]);
|
||||||
|
const itemIndex = this.layout[index].children[
|
||||||
|
tabIndex
|
||||||
|
].children.findIndex((d: LayoutConfig) => actived[2] === d.i);
|
||||||
|
|
||||||
|
this.layout[index].children[tabIndex].children.splice(itemIndex, 1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.layout = this.layout.filter((d: LayoutConfig) => d.i !== item.i);
|
this.layout = this.layout.filter((d: LayoutConfig) => d.i !== item.i);
|
||||||
},
|
},
|
||||||
removeTabItem(item: LayoutConfig, index: number) {
|
removeTabItem(item: LayoutConfig, index: number) {
|
||||||
@ -226,11 +242,17 @@ export const dashboardStore = defineStore({
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (actived.length === 3) {
|
if (actived.length === 3) {
|
||||||
this.layout[index].children[actived[1]].children[actived[2]] = {
|
const tabIndex = Number(actived[1]);
|
||||||
...this.layout[index],
|
const itemIndex = this.layout[index].children[
|
||||||
|
tabIndex
|
||||||
|
].children.findIndex((d: LayoutConfig) => actived[2] === d.i);
|
||||||
|
|
||||||
|
this.layout[index].children[tabIndex].children[itemIndex] = {
|
||||||
|
...this.layout[index].children[tabIndex].children[itemIndex],
|
||||||
...param,
|
...param,
|
||||||
};
|
};
|
||||||
this.selectedGrid = this.layout[index];
|
this.selectedGrid =
|
||||||
|
this.layout[index].children[tabIndex].children[itemIndex];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.layout[index] = {
|
this.layout[index] = {
|
||||||
|
@ -75,6 +75,7 @@ function handleClick(e: any) {
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (e.target.className === "ds-main") {
|
if (e.target.className === "ds-main") {
|
||||||
dashboardStore.activeGridItem("");
|
dashboardStore.activeGridItem("");
|
||||||
|
dashboardStore.selectWidget(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -122,7 +122,7 @@ export default defineComponent({
|
|||||||
dashboardStore.activeGridItem(idx);
|
dashboardStore.activeGridItem(idx);
|
||||||
}
|
}
|
||||||
function removeTab() {
|
function removeTab() {
|
||||||
dashboardStore.removeControls(props.data);
|
dashboardStore.removeTab(props.data);
|
||||||
}
|
}
|
||||||
function deleteTabItem(idx: number) {
|
function deleteTabItem(idx: number) {
|
||||||
dashboardStore.removeTabItem(props.data, idx);
|
dashboardStore.removeTabItem(props.data, idx);
|
||||||
|
@ -53,6 +53,7 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
function clickGrid(item: LayoutConfig) {
|
function clickGrid(item: LayoutConfig) {
|
||||||
dashboardStore.activeGridItem(item.i);
|
dashboardStore.activeGridItem(item.i);
|
||||||
|
dashboardStore.selectWidget(item);
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
dashboardStore,
|
dashboardStore,
|
||||||
|
@ -313,7 +313,7 @@ function setTabControls(id: string) {
|
|||||||
dashboardStore.addTabControls("Topology");
|
dashboardStore.addTabControls("Topology");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
dashboardStore.addControl("Widget");
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user