mirror of
https://github.com/apache/skywalking-booster-ui.git
synced 2025-05-14 00:37:33 +00:00
link log from trace
This commit is contained in:
parent
d5c263e271
commit
7ae484671b
@ -39,6 +39,7 @@ interface DashboardState {
|
||||
dashboards: DashboardItem[];
|
||||
currentDashboard: Nullable<DashboardItem>;
|
||||
editMode: boolean;
|
||||
currentTabIndex: number;
|
||||
}
|
||||
|
||||
export const dashboardStore = defineStore({
|
||||
@ -56,6 +57,7 @@ export const dashboardStore = defineStore({
|
||||
dashboards: [],
|
||||
currentDashboard: null,
|
||||
editMode: false,
|
||||
currentTabIndex: 0,
|
||||
}),
|
||||
actions: {
|
||||
setLayout(data: LayoutConfig[]) {
|
||||
@ -189,6 +191,7 @@ export const dashboardStore = defineStore({
|
||||
this.activedGridItem = index;
|
||||
},
|
||||
setActiveTabIndex(index: number, target?: number) {
|
||||
this.currentTabIndex = index;
|
||||
const m = target || this.activedGridItem;
|
||||
const idx = this.layout.findIndex((d: LayoutConfig) => d.i === m);
|
||||
if (idx < 0) {
|
||||
|
@ -259,6 +259,26 @@ export default defineComponent({
|
||||
}
|
||||
}
|
||||
);
|
||||
watch(
|
||||
() => dashboardStore.currentTabIndex,
|
||||
() => {
|
||||
activeTabIndex.value = dashboardStore.currentTabIndex;
|
||||
dashboardStore.activeGridItem(props.data.i);
|
||||
dashboardStore.selectWidget(props.data);
|
||||
const l = dashboardStore.layout.findIndex(
|
||||
(d: LayoutConfig) => d.i === props.data.i
|
||||
);
|
||||
dashboardStore.setCurrentTabItems(
|
||||
dashboardStore.layout[l].children[activeTabIndex.value].children
|
||||
);
|
||||
needQuery.value = true;
|
||||
if (route.params.activeTabIndex) {
|
||||
let p = location.href.split("/tab/")[0];
|
||||
p = p + "/tab/" + activeTabIndex.value;
|
||||
history.replaceState({}, "", p);
|
||||
}
|
||||
}
|
||||
);
|
||||
return {
|
||||
handleClick,
|
||||
layoutUpdatedEvent,
|
||||
|
@ -123,8 +123,6 @@ limitations under the License. -->
|
||||
import dayjs from "dayjs";
|
||||
import { ref, defineComponent, computed, inject } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useRoute } from "vue-router";
|
||||
import router from "@/router";
|
||||
import { useTraceStore } from "@/store/modules/trace";
|
||||
import { Option } from "@/types/app";
|
||||
import copy from "@/utils/copy";
|
||||
@ -134,7 +132,6 @@ import { ElMessage } from "element-plus";
|
||||
import getDashboard from "@/hooks/useDashboardsSession";
|
||||
import { useDashboardStore } from "@/store/modules/dashboard";
|
||||
import { LayoutConfig } from "@/types/dashboard";
|
||||
import { local } from "d3-selection";
|
||||
|
||||
export default defineComponent({
|
||||
name: "TraceDetail",
|
||||
@ -146,7 +143,6 @@ export default defineComponent({
|
||||
/*global Nullable */
|
||||
const options: LayoutConfig | undefined = inject("options");
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const traceStore = useTraceStore();
|
||||
const loading = ref<boolean>(false);
|
||||
const traceId = ref<string>("");
|
||||
@ -178,8 +174,12 @@ export default defineComponent({
|
||||
|
||||
async function searchTraceLogs() {
|
||||
const { widgets } = getDashboard(dashboardStore.currentDashboard);
|
||||
const widget =
|
||||
widgets.filter((d: { type: string }) => d.type === "Log")[0] || {};
|
||||
const widget = widgets.filter(
|
||||
(d: { type: string }) => d.type === "Log"
|
||||
)[0];
|
||||
if (!widget) {
|
||||
return;
|
||||
}
|
||||
const item = {
|
||||
...widget,
|
||||
filters: {
|
||||
@ -190,25 +190,18 @@ export default defineComponent({
|
||||
dashboardStore.setWidget(item);
|
||||
const logTabIndex = widget.id.split("-");
|
||||
const traceTabindex = options?.id?.split("-") || [];
|
||||
if (logTabIndex[1] === traceTabindex[1] || logTabIndex[1] === undefined) {
|
||||
let container: Nullable<Element>;
|
||||
if (logTabIndex[1] === undefined) {
|
||||
container = document.querySelector(".ds-main");
|
||||
} else {
|
||||
container = document.querySelector(".tab-layout");
|
||||
}
|
||||
if (container && options) {
|
||||
container.scrollTop = options.y * 10;
|
||||
}
|
||||
let container: Nullable<Element>;
|
||||
|
||||
if (logTabIndex[1] === undefined) {
|
||||
container = document.querySelector(".ds-main");
|
||||
} else {
|
||||
let path = "";
|
||||
if (route.params.activeTabIndex === undefined) {
|
||||
path = location.href + "/tab/" + logTabIndex[1];
|
||||
} else {
|
||||
const p = location.href.split("/tab/")[0];
|
||||
path = p + "/tab/" + logTabIndex[1];
|
||||
}
|
||||
location.href = path;
|
||||
container = document.querySelector(".tab-layout");
|
||||
}
|
||||
if (logTabIndex[1] && logTabIndex[1] !== traceTabindex[1]) {
|
||||
dashboardStore.setActiveTabIndex(Number(logTabIndex[1]));
|
||||
}
|
||||
if (container && widget) {
|
||||
container.scrollTop = widget.y * 10;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user