Skip to content

Commit

Permalink
fix: hide grains smaller than smallest_time_grain from pivot sidebar (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
djbarnwal authored and ericpgreen2 committed Oct 17, 2024
1 parent d553424 commit 73f4a26
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions web-common/src/features/dashboards/pivot/PivotSidebar.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
<script lang="ts">
import Search from "@rilldata/web-common/components/icons/Search.svelte";
import { getStateManagers } from "@rilldata/web-common/features/dashboards/state-managers/state-managers";
import { useTimeControlStore } from "@rilldata/web-common/features/dashboards/time-controls/time-control-store";
import {
getAllowedTimeGrains,
isGrainBigger,
} from "@rilldata/web-common/lib/time/grains";
import { V1TimeGrain } from "@rilldata/web-common/runtime-client";
import { slide } from "svelte/transition";
import PivotDrag from "./PivotDrag.svelte";
import { getAllowedTimeGrains } from "@rilldata/web-common/lib/time/grains";
import { PivotChipType } from "./types";
import type { PivotChipData } from "./types";
import Search from "@rilldata/web-common/components/icons/Search.svelte";
import { slide } from "svelte/transition";
import { PivotChipType } from "./types";
const CHIP_HEIGHT = 34;
Expand Down Expand Up @@ -38,9 +42,15 @@
.filter((m) => m.type === PivotChipType.Time)
.concat($rows.dimension.filter((d) => d.type === PivotChipType.Time));
$: timeGrainOptions = allTimeGrains.filter(
(tgo) => !usedTimeGrains.some((utg) => utg.id === tgo.id),
);
$: timeGrainOptions = allTimeGrains
.filter((tgo) => !usedTimeGrains.some((utg) => utg.id === tgo.id))
.filter(
(tgo) =>
$timeControlsStore.minTimeGrain === undefined ||
$timeControlsStore.minTimeGrain ===
V1TimeGrain.TIME_GRAIN_UNSPECIFIED ||
!isGrainBigger($timeControlsStore.minTimeGrain, tgo.id),
);
$: filteredMeasures = filterBasedOnSearch($measures, searchText);
$: filteredDimensions = filterBasedOnSearch($dimensions, searchText);
Expand Down

1 comment on commit 73f4a26

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.