diff --git a/src/components/Icon.vue b/src/components/Icon.vue index 10becdac..fc6a0ce1 100644 --- a/src/components/Icon.vue +++ b/src/components/Icon.vue @@ -21,7 +21,7 @@ limitations under the License. --> lg: size === 'lg', xl: size === 'xl', logo: size === 'logo', - loading: loading, + loading, }" > @@ -73,4 +73,15 @@ defineProps({ width: 30px; } } +@keyframes loading { + 0% { + -webkit-transform: rotate(0deg); + transform: rotate(0deg); + } + + to { + -webkit-transform: rotate(1turn); + transform: rotate(1turn); + } +} diff --git a/src/router/index.ts b/src/router/index.ts index 80068c3e..4ab9d190 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -26,7 +26,6 @@ import { routesEvent } from "./event"; import { routesAlert } from "./alert"; import { routesSetting } from "./setting"; import { routesAlarm } from "./alarm"; -import { useTimeoutFn } from "@/hooks/useTimeout"; const routes: Array = [ ...routesGen, @@ -52,7 +51,7 @@ router.beforeEach((to, from, next) => { // const token = window.localStorage.getItem("skywalking-authority"); if ((window as any).axiosCancel.length !== 0) { for (const func of (window as any).axiosCancel) { - useTimeoutFn(func(), 0); + setTimeout(func(), 0); } (window as any).axiosCancel = []; } diff --git a/src/store/modules/dashboard.ts b/src/store/modules/dashboard.ts index 24a19e33..73c53075 100644 --- a/src/store/modules/dashboard.ts +++ b/src/store/modules/dashboard.ts @@ -71,7 +71,8 @@ export const dashboardStore = defineStore({ metrics: [""], }; if (type === "Tab") { - newItem.h = 24; + newItem.h = 36; + newItem.activedTabIndex = 0; newItem.children = [ { name: "Tab1", @@ -96,14 +97,15 @@ export const dashboardStore = defineStore({ }; } if (type === "Trace" || type === "Profile") { - newItem.h = 36; + newItem.h = 24; } + this.activedGridItem = newItem.i; + this.selectedGrid = newItem; this.layout = this.layout.map((d: LayoutConfig) => { d.y = d.y + newItem.h; return d; }); this.layout.push(newItem); - this.activedGridItem = newItem.i; }, addTabItem(item: LayoutConfig) { const idx = this.layout.findIndex((d: LayoutConfig) => d.i === item.i); @@ -117,7 +119,7 @@ export const dashboardStore = defineStore({ }; this.layout[idx].children?.push(i); }, - addTabWidget(tabIndex: number) { + addTabControls(type: string) { const activedGridItem = this.activedGridItem.split("-")[0]; const idx = this.layout.findIndex( (d: LayoutConfig) => d.i === activedGridItem @@ -125,32 +127,52 @@ export const dashboardStore = defineStore({ if (idx < 0) { return; } + const tabIndex = this.layout[idx].activedTabIndex; const { children } = this.layout[idx].children[tabIndex]; - const newWidget = { - x: 0, - y: 0, - w: 24, - h: 12, + const newItem: LayoutConfig = { + ...NewControl, i: String(children.length), - type: "Widget", - widget: { - title: "Title", - }, - graph: {}, - standard: {}, + type, + metricTypes: [""], + metrics: [""], }; + if (type === "Topology") { + newItem.w = 4; + newItem.h = 6; + newItem.graph = { + fontColor: "white", + backgroundColor: "green", + iconTheme: true, + content: "Topology", + fontSize: 18, + showDepth: true, + }; + } + if (type === "Trace" || type === "Profile") { + newItem.h = 24; + } if (this.layout[idx].children) { const items = children.map((d: LayoutConfig) => { - d.y = d.y + newWidget.h; + d.y = d.y + newItem.h; return d; }); - items.push(newWidget); + console.log(type); + items.push(newItem); this.layout[idx].children[tabIndex].children = items; } }, activeGridItem(index: string) { this.activedGridItem = index; }, + setActiveTabIndex(index: number) { + const idx = this.layout.findIndex( + (d: LayoutConfig) => d.i === this.activedGridItem + ); + if (idx < 0) { + return; + } + this.layout[idx].activedTabIndex = index; + }, removeControls(item: LayoutConfig) { this.layout = this.layout.filter((d: LayoutConfig) => d.i !== item.i); }, diff --git a/src/types/dashboard.ts b/src/types/dashboard.ts index b8c0544e..c0ec3d86 100644 --- a/src/types/dashboard.ts +++ b/src/types/dashboard.ts @@ -27,6 +27,7 @@ export interface LayoutConfig { type: string; metricTypes: string[]; children?: any; + activedTabIndex?: number; } export interface WidgetConfig { diff --git a/src/views/dashboard/controls/Tab.vue b/src/views/dashboard/controls/Tab.vue index 5c31a87d..bb9b0101 100644 --- a/src/views/dashboard/controls/Tab.vue +++ b/src/views/dashboard/controls/Tab.vue @@ -37,16 +37,11 @@ limitations under the License. --> /> - + - - - - -
@@ -74,7 +69,8 @@ limitations under the License. --> @click="clickTabGrid($event, item)" :class="{ active: activeTabWidget === item.i }" > - @@ -83,94 +79,117 @@ limitations under the License. -->
Please add widgets.
-