From 7fac64ba7ff637f1966f46b801355c4c8538aa99 Mon Sep 17 00:00:00 2001 From: Dhiraj Kumar Date: Wed, 11 Dec 2024 17:36:54 +0530 Subject: [PATCH] Fix: display pct bar in dimension table --- .../dimension-table/DimensionDisplay.svelte | 4 +++- .../state-managers/selectors/dimension-table.ts | 16 ++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/web-common/src/features/dashboards/dimension-table/DimensionDisplay.svelte b/web-common/src/features/dashboards/dimension-table/DimensionDisplay.svelte index f158c205844..b34fca09ec0 100644 --- a/web-common/src/features/dashboards/dimension-table/DimensionDisplay.svelte +++ b/web-common/src/features/dashboards/dimension-table/DimensionDisplay.svelte @@ -75,7 +75,9 @@ instanceId, metricsViewName, { - measures: [{ name: activeMeasureName }], + measures: visibleMeasureNames.map((measureName) => ({ + name: measureName, + })), where: sanitiseExpression( mergeDimensionAndMeasureFilter( getFiltersForOtherDimensions(whereFilter, dimensionName), diff --git a/web-common/src/features/dashboards/state-managers/selectors/dimension-table.ts b/web-common/src/features/dashboards/state-managers/selectors/dimension-table.ts index a0424f4f4fb..805434247a7 100644 --- a/web-common/src/features/dashboards/state-managers/selectors/dimension-table.ts +++ b/web-common/src/features/dashboards/state-managers/selectors/dimension-table.ts @@ -1,22 +1,22 @@ +import type { VirtualizedTableColumns } from "@rilldata/web-common/components/virtualized-table/types"; import type { MetricsViewSpecDimensionV2, RpcStatus, V1MetricsViewAggregationResponse, V1MetricsViewTotalsResponse, } from "@rilldata/web-common/runtime-client"; -import type { DashboardDataSources } from "./types"; +import type { QueryObserverResult } from "@tanstack/svelte-query"; +import { isSummableMeasure } from "../../dashboard-utils"; +import type { DimensionTableRow } from "../../dimension-table/dimension-table-types"; import { prepareDimensionTableRows, prepareVirtualizedDimTableColumns, } from "../../dimension-table/dimension-table-utils"; -import { allMeasures, visibleMeasures } from "./measures"; -import type { QueryObserverResult } from "@tanstack/svelte-query"; -import { isSummableMeasure } from "../../dashboard-utils"; -import { isTimeComparisonActive } from "./time-range"; import { activeMeasureName, isValidPercentOfTotal } from "./active-measure"; import { selectedDimensionValues } from "./dimension-filters"; -import type { DimensionTableRow } from "../../dimension-table/dimension-table-types"; -import type { VirtualizedTableColumns } from "@rilldata/web-common/components/virtualized-table/types"; +import { allMeasures, visibleMeasures } from "./measures"; +import { isTimeComparisonActive } from "./time-range"; +import type { DashboardDataSources } from "./types"; export const selectedDimensionValueNames = ( dashData: DashboardDataSources, @@ -55,7 +55,7 @@ export const virtualizedTableColumns = if (totalsQuery?.data?.data) { measures.map((m) => { if (m.name && isSummableMeasure(m)) { - measureTotals[m.name] = totalsQuery.data?.data?.[m.name]; + measureTotals[m.name] = totalsQuery.data?.data?.[0]?.[m.name]; } }); }