fix duration

This commit is contained in:
Qiuxia Fan 2022-07-29 10:38:50 +08:00
parent 7818a11aa5
commit 01a7cd3736
3 changed files with 27 additions and 6 deletions

View File

@ -28,6 +28,8 @@ import { useDashboardStore } from "@/store/modules/dashboard";
import getDashboard from "@/hooks/useDashboardsSession"; import getDashboard from "@/hooks/useDashboardsSession";
import { useAppStoreWithOut } from "@/store/modules/app"; import { useAppStoreWithOut } from "@/store/modules/app";
import dateFormatStep, { dateFormatTime } from "@/utils/dateFormat"; import dateFormatStep, { dateFormatTime } from "@/utils/dateFormat";
import getLocalTime from "@/utils/localtime";
import { enumDeclaration } from "@babel/types";
const eventStore = useEventStore(); const eventStore = useEventStore();
/*global defineProps, Nullable */ /*global defineProps, Nullable */
@ -134,8 +136,8 @@ function associateTraceLog(
filters: { filters: {
sourceId: props.data.id || "", sourceId: props.data.id || "",
duration: { duration: {
startTime: null, start: null,
endTime: null, end: null,
step: appStore.duration.step, step: appStore.duration.step,
}, },
}, },
@ -148,8 +150,16 @@ function associateTraceLog(
filters: { filters: {
sourceId: props.data.id || "", sourceId: props.data.id || "",
duration: { duration: {
startTime: dateFormatStep(start, appStore.duration.step, true), start: dateFormatStep(
endTime: dateFormatStep(end, appStore.duration.step, true), getLocalTime(appStore.utc, start),
appStore.duration.step,
true
),
end: dateFormatStep(
getLocalTime(appStore.utc, end),
appStore.duration.step,
true
),
step: appStore.duration.step, step: appStore.duration.step,
}, },
}, },

View File

@ -160,6 +160,9 @@ const logStore = useLogStore();
const traceId = ref<string>( const traceId = ref<string>(
(props.data.filters && props.data.filters.traceId) || "" (props.data.filters && props.data.filters.traceId) || ""
); );
const duration = ref<any>(
(props.data.filters && props.data.filters.duration) || appStore.durationTime
);
const keywordsOfContent = ref<string[]>([]); const keywordsOfContent = ref<string[]>([]);
const excludingKeywordsOfContent = ref<string[]>([]); const excludingKeywordsOfContent = ref<string[]>([]);
const tagsList = ref<string[]>([]); const tagsList = ref<string[]>([]);
@ -252,7 +255,7 @@ function searchLogs() {
pagePathId: endpoint || state.endpoint.id || undefined, pagePathId: endpoint || state.endpoint.id || undefined,
serviceVersionId: instance || state.instance.id || undefined, serviceVersionId: instance || state.instance.id || undefined,
paging: { pageNum: 1, pageSize: 15 }, paging: { pageNum: 1, pageSize: 15 },
queryDuration: appStore.durationTime, queryDuration: duration,
category: state.category.value, category: state.category.value,
}); });
} else { } else {
@ -346,6 +349,7 @@ onUnmounted(() => {
}; };
dashboardStore.setWidget(item); dashboardStore.setWidget(item);
traceId.value = ""; traceId.value = "";
duration.value = appStore.durationTime;
}); });
watch( watch(
() => selectorStore.currentService, () => selectorStore.currentService,
@ -381,6 +385,7 @@ watch(
return; return;
} }
traceId.value = props.data.filters.traceId || ""; traceId.value = props.data.filters.traceId || "";
duration.value = props.data.filters.duration || appStore.durationTime;
init(); init();
} }
} }

View File

@ -105,6 +105,7 @@ import ConditionTags from "@/views/components/ConditionTags.vue";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { EntityType } from "../../data"; import { EntityType } from "../../data";
import { LayoutConfig } from "@/types/dashboard"; import { LayoutConfig } from "@/types/dashboard";
// import { Duration, DurationTime } from "@/types/app";
/*global defineProps, Recordable */ /*global defineProps, Recordable */
const props = defineProps({ const props = defineProps({
@ -122,6 +123,9 @@ const appStore = useAppStoreWithOut();
const selectorStore = useSelectorStore(); const selectorStore = useSelectorStore();
const dashboardStore = useDashboardStore(); const dashboardStore = useDashboardStore();
const traceStore = useTraceStore(); const traceStore = useTraceStore();
const duration = ref<any>(
(props.data.filters && props.data.filters.duration) || appStore.durationTime
);
const minTraceDuration = ref<number>(); const minTraceDuration = ref<number>();
const maxTraceDuration = ref<number>(); const maxTraceDuration = ref<number>();
const tagsList = ref<string[]>([]); const tagsList = ref<string[]>([]);
@ -198,7 +202,7 @@ function searchTraces() {
endpointId: endpoint || state.endpoint.id || undefined, endpointId: endpoint || state.endpoint.id || undefined,
serviceInstanceId: instance || state.instance.id || undefined, serviceInstanceId: instance || state.instance.id || undefined,
traceState: state.status.value || "ALL", traceState: state.status.value || "ALL",
queryDuration: appStore.durationTime, queryDuration: duration.value,
minTraceDuration: Number(minTraceDuration.value), minTraceDuration: Number(minTraceDuration.value),
maxTraceDuration: Number(maxTraceDuration.value), maxTraceDuration: Number(maxTraceDuration.value),
queryOrder: "BY_DURATION", queryOrder: "BY_DURATION",
@ -238,6 +242,7 @@ onUnmounted(() => {
}; };
dashboardStore.setWidget(item); dashboardStore.setWidget(item);
traceId.value = ""; traceId.value = "";
duration.value = appStore.durationTime;
}); });
watch( watch(
() => [selectorStore.currentPod], () => [selectorStore.currentPod],
@ -273,6 +278,7 @@ watch(
return; return;
} }
traceId.value = props.data.filters.traceId || ""; traceId.value = props.data.filters.traceId || "";
duration.value = props.data.filters.duration || appStore.durationTime;
init(); init();
} }
} }