fix(core): filter the minichart by duration from api which is 30D (#12740)

This commit is contained in:
Piyush Bhaskar
2025-11-06 14:58:51 +05:30
committed by GitHub
parent 5542b7318b
commit efdca4bff1
3 changed files with 21 additions and 10 deletions

View File

@@ -33,7 +33,7 @@
import FlowRootTopBar from "./FlowRootTopBar.vue";
import FlowConcurrency from "./FlowConcurrency.vue";
import DemoAuditLogs from "../demo/AuditLogs.vue";
import {useAuthStore} from "override/stores/auth"
import {useAuthStore} from "override/stores/auth";
import {useMiscStore} from "override/stores/misc";
export default {
@@ -59,13 +59,12 @@
"$route.params.tab": {
immediate: true,
handler: function (newTab) {
if (newTab === "overview") {
if (newTab === "overview" || newTab === "executions") {
const dateTimeKeys = ["startDate", "endDate", "timeRange"];
if (!Object.keys(this.$route.query).some((key) => dateTimeKeys.some((dateTimeKey) => key.includes(dateTimeKey)))) {
const miscStore = useMiscStore();
const defaultDuration = miscStore.configs?.chartDefaultDuration || "P30D";
const newQuery = {...this.$route.query, "filters[timeRange][EQUALS]": defaultDuration};
const DEFAULT_DURATION = this.miscStore.configs?.chartDefaultDuration ?? "P30D";
const newQuery = {...this.$route.query, "filters[timeRange][EQUALS]": DEFAULT_DURATION};
this.$router.replace({name: this.$route.name, params: this.$route.params, query: newQuery});
}
}
@@ -314,7 +313,7 @@
}
},
computed: {
...mapStores(useCoreStore, useFlowStore, useAuthStore),
...mapStores(useCoreStore, useFlowStore, useAuthStore, useMiscStore),
routeInfo() {
return {
title: this.$route.params.id,

View File

@@ -204,6 +204,7 @@
<template #default="scope">
<TimeSeries
:chart="mappedChart(scope.row.id, scope.row.namespace)"
:filters="chartFilters()"
showDefault
short
/>
@@ -287,6 +288,7 @@
import {useFlowStore} from "../../stores/flow";
import {useAuthStore} from "override/stores/auth";
import {useMiscStore} from "override/stores/misc";
import {useExecutionsStore} from "../../stores/executions";
import {useTableColumns} from "../../composables/useTableColumns";
@@ -307,6 +309,7 @@
const flowStore = useFlowStore();
const authStore = useAuthStore();
const executionsStore = useExecutionsStore();
const miscStore = useMiscStore();
const route = useRoute();
const router = useRouter();
@@ -622,6 +625,15 @@
return MAPPED_CHARTS;
}
function chartFilters() {
const DEFAULT_DURATION = miscStore.configs?.chartDefaultDuration ?? "P30D";
return [{
field: "timeRange",
value: DEFAULT_DURATION,
operation: "EQUALS"
}];
}
onMounted(() => {
const query = {...route.query};
const queryKeys = Object.keys(query);

View File

@@ -31,6 +31,7 @@
const namespace = computed(() => route.params?.id) as Ref<string>;
const miscStore = useMiscStore();
const namespacesStore = useNamespacesStore();
watch(namespace, (newID) => {
@@ -40,13 +41,12 @@
});
watch(() => route.params.tab, (newTab) => {
if (newTab === "overview") {
if (newTab === "overview" || newTab === "executions") {
const dateTimeKeys = ["startDate", "endDate", "timeRange"];
if (!Object.keys(route.query).some((key) => dateTimeKeys.some((dateTimeKey) => key.includes(dateTimeKey)))) {
const miscStore = useMiscStore();
const defaultDuration = miscStore.configs?.chartDefaultDuration || "P30D";
const newQuery = {...route.query, "filters[timeRange][EQUALS]": defaultDuration};
const DEFAULT_DURATION = miscStore.configs?.chartDefaultDuration ?? "P30D";
const newQuery = {...route.query, "filters[timeRange][EQUALS]": DEFAULT_DURATION};
router.replace({name: route.name, params: route.params, query: newQuery});
}
}