diff --git a/src/hooks/data.ts b/src/hooks/data.ts index 2b999fc5..00160b42 100644 --- a/src/hooks/data.ts +++ b/src/hooks/data.ts @@ -32,6 +32,7 @@ export enum Calculations { Precision = "precision", ConvertSeconds = "convertSeconds", ConvertMilliseconds = "convertMilliseconds", + MsTos = "msTos", } export enum sizeEnum { XS = "XS", diff --git a/src/hooks/useProcessor.ts b/src/hooks/useProcessor.ts index de90ab08..74d4f954 100644 --- a/src/hooks/useProcessor.ts +++ b/src/hooks/useProcessor.ts @@ -351,6 +351,9 @@ export function aggregation(val: number, config: any): number | string { case Calculations.Precision: data = data.toFixed(2); break; + case Calculations.MsTos: + data = val / 1000; + break; default: data; break; diff --git a/src/layout/components/NavBar.vue b/src/layout/components/NavBar.vue index 126619c2..499c39d4 100644 --- a/src/layout/components/NavBar.vue +++ b/src/layout/components/NavBar.vue @@ -66,7 +66,7 @@ const theme = ref("light"); getVersion(); const setConfig = (value: string) => { pageName.value = value || ""; - theme.value = route.path.includes("/infrastructure/") ? "dark" : "light"; + // theme.value = route.path.includes("/infrastructure/") ? "dark" : "light"; }; const time = computed(() => [ appStore.durationRow.start, @@ -94,6 +94,9 @@ watch( } ); async function getVersion() { + if (appStore.version) { + return; + } const res = await appStore.fetchVersion(); if (res.errors) { ElMessage.error(res.errors); diff --git a/src/views/dashboard/controls/Text.vue b/src/views/dashboard/controls/Text.vue index 0dd0bc3b..abdb1abb 100644 --- a/src/views/dashboard/controls/Text.vue +++ b/src/views/dashboard/controls/Text.vue @@ -38,12 +38,17 @@ limitations under the License. --> class="body" :style="{ backgroundColor: TextColors[graph.backgroundColor], - color: TextColors[graph.fontColor], - fontSize: graph.fontSize + 'px', textAlign: graph.textAlign, }" > - + {{ graph.content }} diff --git a/src/views/dashboard/controls/Widget.vue b/src/views/dashboard/controls/Widget.vue index 29c50792..131f5f2a 100644 --- a/src/views/dashboard/controls/Widget.vue +++ b/src/views/dashboard/controls/Widget.vue @@ -109,11 +109,14 @@ export default defineComponent({ const selectorStore = useSelectorStore(); const graph = computed(() => props.data.graph || {}); const widget = computed(() => props.data.widget || {}); - const isList = ListChartTypes.includes( - (props.data.graph && props.data.graph.type) || "" + const isList = computed(() => + ListChartTypes.includes((props.data.graph && props.data.graph.type) || "") ); - if ((props.needQuery || !dashboardStore.currentDashboard.id) && !isList) { + if ( + (props.needQuery || !dashboardStore.currentDashboard.id) && + !isList.value + ) { queryMetrics(); } @@ -162,11 +165,8 @@ export default defineComponent({ if (props.data.i !== dashboardStore.selectedGrid.i) { return; } - const isList = ListChartTypes.includes( - (props.data.graph && props.data.graph.type) || "" - ); const chart = dashboardStore.selectedGrid.graph || {}; - if (ListChartTypes.includes(chart.type) || isList) { + if (ListChartTypes.includes(chart.type) || isList.value) { return; } queryMetrics(); @@ -175,10 +175,7 @@ export default defineComponent({ watch( () => [selectorStore.currentService, selectorStore.currentDestService], () => { - const isList = ListChartTypes.includes( - (props.data.graph && props.data.graph.type) || "" - ); - if (isList) { + if (isList.value) { return; } if ( @@ -195,12 +192,18 @@ export default defineComponent({ if (dashboardStore.entity === EntityType[0].value) { return; } + if (isList.value) { + return; + } queryMetrics(); } ); watch( () => appStore.durationTime, () => { + if (isList.value) { + return; + } if (dashboardStore.entity === EntityType[1].value) { queryMetrics(); } diff --git a/src/views/dashboard/data.ts b/src/views/dashboard/data.ts index d5e578c0..50026a1c 100644 --- a/src/views/dashboard/data.ts +++ b/src/views/dashboard/data.ts @@ -272,4 +272,5 @@ export const CalculationOpts = [ }, { label: "Convert seconds to YYYY-MM-DD HH:mm:ss", value: "convertSeconds" }, { label: "Precision is 2", value: "precision" }, + { label: "Milliseconds to seconds", value: "msTos" }, ]; diff --git a/src/views/dashboard/graphs/EndpointList.vue b/src/views/dashboard/graphs/EndpointList.vue index 52924694..838a1d9a 100644 --- a/src/views/dashboard/graphs/EndpointList.vue +++ b/src/views/dashboard/graphs/EndpointList.vue @@ -203,8 +203,11 @@ function getLabel(metric: string, index: number) { return encodeURIComponent(metric); } watch( - () => [props.config.metricTypes, props.config.metrics], - async () => { + () => [...(props.config.metricTypes || []), ...(props.config.metrics || [])], + (data, old) => { + if (JSON.stringify(data) === JSON.stringify(old)) { + return; + } queryEndpointMetrics(endpoints.value); } ); @@ -214,6 +217,15 @@ watch( queryEndpoints(); } ); +watch( + () => [...(props.config.metricConfig || [])], + (data, old) => { + if (JSON.stringify(data) === JSON.stringify(old)) { + return; + } + queryEndpointMetrics(endpoints.value); + } +);