diff --git a/web-common/src/features/dashboards/pivot/PivotDisplay.svelte b/web-common/src/features/dashboards/pivot/PivotDisplay.svelte index 5f1e0ee0ce2..9d429858c51 100644 --- a/web-common/src/features/dashboards/pivot/PivotDisplay.svelte +++ b/web-common/src/features/dashboards/pivot/PivotDisplay.svelte @@ -12,6 +12,9 @@ let showPanels = true; $: pivotDataStore = usePivotDataStore(stateManagers); + + $: isFetching = $pivotDataStore.isFetching; + $: assembled = $pivotDataStore.assembled;
@@ -22,10 +25,10 @@ {#if showPanels} {/if} - +
{#if !$pivotDataStore?.data || $pivotDataStore?.data?.length === 0} - + {:else} {/if} diff --git a/web-common/src/features/dashboards/pivot/PivotEmpty.svelte b/web-common/src/features/dashboards/pivot/PivotEmpty.svelte index d8a1866b7b9..dc543db6e08 100644 --- a/web-common/src/features/dashboards/pivot/PivotEmpty.svelte +++ b/web-common/src/features/dashboards/pivot/PivotEmpty.svelte @@ -6,6 +6,7 @@ import EmptyTableIcon from "./EmptyTableIcon.svelte"; export let isFetching = false; + export let assembled = false; const stateManagers = getStateManagers(); const { @@ -46,6 +47,11 @@ href="https://docs.rilldata.com/explore/filters/pivot">docs.
+ {:else if assembled} + +
+ No data to show for the selected filters. +
{:else}
diff --git a/web-common/src/features/dashboards/pivot/pivot-data-store.ts b/web-common/src/features/dashboards/pivot/pivot-data-store.ts index d597735e00d..ad9642b4367 100644 --- a/web-common/src/features/dashboards/pivot/pivot-data-store.ts +++ b/web-common/src/features/dashboards/pivot/pivot-data-store.ts @@ -462,6 +462,23 @@ function createPivotDataStore(ctx: StateManagers): PivotDataStore { }); } + /** + * If there are no axes values, return an empty table + */ + if ( + rowDimensionAxes?.data?.[anchorDimension]?.length === 0 || + totalsRowResponse?.data?.data?.length === 0 + ) { + return axesSet({ + isFetching: false, + data: [], + columnDef: [], + assembled: true, + totalColumns: 0, + totalsRowData: displayTotalsRow ? [] : undefined, + }); + } + const totalsRowData = getTotalsRow( config, columnDimensionAxes?.data,