Skip to content

Commit

Permalink
Hide the "Start pivot" button, when embeds.hide_pivot: true
Browse files Browse the repository at this point in the history
  • Loading branch information
ericpgreen2 committed Dec 4, 2024
1 parent b2826f3 commit 55857b5
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* to be displayed in explore
*/
import { getStateManagers } from "@rilldata/web-common/features/dashboards/state-managers/state-managers";
import { eventBus } from "@rilldata/web-common/lib/event-bus/event-bus";
import {
createQueryServiceMetricsViewAggregation,
type MetricsViewSpecDimensionV2,
Expand All @@ -14,19 +15,18 @@
type V1MetricsViewSpec,
type V1TimeRange,
} from "@rilldata/web-common/runtime-client";
import { getDimensionFilterWithSearch } from "./dimension-table-utils";
import DimensionHeader from "./DimensionHeader.svelte";
import DimensionTable from "./DimensionTable.svelte";
import { eventBus } from "@rilldata/web-common/lib/event-bus/event-bus";
import { sanitiseExpression } from "../stores/filter-utils";
import { mergeDimensionAndMeasureFilter } from "../filters/measure-filters/measure-filter-utils";
import { getFiltersForOtherDimensions } from "../selectors";
import type { DimensionThresholdFilter } from "../stores/metrics-explorer-entity";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import { getComparisonRequestMeasures } from "../dashboard-utils";
import { mergeDimensionAndMeasureFilter } from "../filters/measure-filters/measure-filter-utils";
import { getSort } from "../leaderboard/leaderboard-utils";
import { getFiltersForOtherDimensions } from "../selectors";
import { getMeasuresForDimensionTable } from "../state-managers/selectors/dashboard-queries";
import { getComparisonRequestMeasures } from "../dashboard-utils";
import { dimensionSearchText } from "../stores/dashboard-stores";
import { sanitiseExpression } from "../stores/filter-utils";
import type { DimensionThresholdFilter } from "../stores/metrics-explorer-entity";
import DimensionHeader from "./DimensionHeader.svelte";
import DimensionTable from "./DimensionTable.svelte";
import { getDimensionFilterWithSearch } from "./dimension-table-utils";
const queryLimit = 250;
Expand All @@ -40,6 +40,7 @@
export let visibleMeasureNames: string[];
export let timeControlsReady: boolean;
export let dimension: MetricsViewSpecDimensionV2;
export let hideStartPivotButton = false;
const {
selectors: {
Expand Down Expand Up @@ -207,6 +208,7 @@
isFetching={$sortedQuery?.isFetching}
bind:searchText={$dimensionSearchText}
onToggleSearchItems={toggleAllSearchItems}
{hideStartPivotButton}
/>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
export let isRowsEmpty = true;
export let searchText: string;
export let onToggleSearchItems: () => void;
export let hideStartPivotButton = false;
const exportDash = createQueryServiceExport();
Expand Down Expand Up @@ -219,14 +220,16 @@
exploreName={$exploreName}
/>
{/if}
<button
class="h-6 px-1.5 py-px rounded-sm hover:bg-gray-200 text-gray-700"
on:click={() => {
startPivotForDimensionTable();
}}
>
Start Pivot
</button>
{#if !hideStartPivotButton}
<button
class="h-6 px-1.5 py-px rounded-sm hover:bg-gray-200 text-gray-700"
on:click={() => {
startPivotForDimensionTable();
}}
>
Start Pivot
</button>
{/if}
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,27 @@
import SelectAllButton from "@rilldata/web-common/features/dashboards/dimension-table/SelectAllButton.svelte";
import ReplacePivotDialog from "@rilldata/web-common/features/dashboards/pivot/ReplacePivotDialog.svelte";
import { getStateManagers } from "@rilldata/web-common/features/dashboards/state-managers/state-managers";
import { metricsExplorerStore } from "@rilldata/web-common/features/dashboards/stores/dashboard-stores";
import {
dimensionSearchText,
metricsExplorerStore,
} from "@rilldata/web-common/features/dashboards/stores/dashboard-stores";
import ComparisonSelector from "@rilldata/web-common/features/dashboards/time-controls/ComparisonSelector.svelte";
import DelayedSpinner from "@rilldata/web-common/features/entity-management/DelayedSpinner.svelte";
import { TIME_GRAIN } from "@rilldata/web-common/lib/time/config";
import type { TimeGrain } from "@rilldata/web-common/lib/time/types";
import { slideRight } from "@rilldata/web-common/lib/transitions";
import {
V1ExportFormat,
createQueryServiceExport,
} from "@rilldata/web-common/runtime-client";
import { fly } from "svelte/transition";
import ExportMenu from "../../exports/ExportMenu.svelte";
import { featureFlags } from "../../feature-flags";
import { PivotChipType } from "../pivot/types";
import type { TDDComparison } from "./types";
import TimeGrainSelector from "../time-controls/TimeGrainSelector.svelte";
import exportTDD from "./export-tdd";
import ExportMenu from "../../exports/ExportMenu.svelte";
import {
createQueryServiceExport,
V1ExportFormat,
} from "@rilldata/web-common/runtime-client";
import { getTDDExportArgs } from "./getTDDExportArgs";
import { dimensionSearchText } from "@rilldata/web-common/features/dashboards/stores/dashboard-stores";
import type { TDDComparison } from "./types";
export let exploreName: string;
export let dimensionName: string;
Expand All @@ -43,6 +45,7 @@
export let isRowsEmpty = false;
export let expandedMeasureName: string;
export let onToggleSearchItems: () => void;
export let hideStartPivotButton = false;
const { adminServer, exports } = featureFlags;
const exportDash = createQueryServiceExport();
Expand Down Expand Up @@ -262,15 +265,17 @@
{exploreName}
/>
{/if}
<Button
compact
type="text"
on:click={() => {
startPivotForTDD();
}}
>
Start Pivot
</Button>
{#if !hideStartPivotButton}
<Button
compact
type="text"
on:click={() => {
startPivotForTDD();
}}
>
Start Pivot
</Button>
{/if}
</div>
{/if}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script lang="ts">
import Compare from "@rilldata/web-common/components/icons/Compare.svelte";
import { eventBus } from "@rilldata/web-common/lib/event-bus/event-bus";
import {
SortDirection,
SortType,
Expand All @@ -9,6 +8,7 @@
import { metricsExplorerStore } from "@rilldata/web-common/features/dashboards/stores/dashboard-stores";
import { useTimeControlStore } from "@rilldata/web-common/features/dashboards/time-controls/time-control-store";
import { debounce } from "@rilldata/web-common/lib/create-debouncer";
import { eventBus } from "@rilldata/web-common/lib/event-bus/event-bus";
import { TIME_GRAIN } from "@rilldata/web-common/lib/time/config";
import { timeFormat } from "d3-time-format";
import { onDestroy } from "svelte";
Expand All @@ -23,6 +23,7 @@
export let exploreName: string;
export let expandedMeasureName: string;
export let hideStartPivotButton = false;
const stateManagers = getStateManagers();
const {
Expand Down Expand Up @@ -199,6 +200,7 @@
isRowsEmpty={!rowHeaderLabels.length}
{exploreName}
onToggleSearchItems={toggleAllSearchItems}
{hideStartPivotButton}
/>

{#if $timeDimensionDataStore?.isError}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
export let exploreName: string;
export let workspaceWidth: number;
export let hideStartPivotButton = false;
const {
selectors: {
Expand Down Expand Up @@ -315,14 +316,16 @@
}}
/>

<button
class="h-6 px-1.5 py-px rounded-sm hover:bg-gray-200 text-gray-700 ml-auto"
on:click={() => {
startPivotForTimeseries();
}}
>
Start Pivot
</button>
{#if !hideStartPivotButton}
<button
class="h-6 px-1.5 py-px rounded-sm hover:bg-gray-200 text-gray-700 ml-auto"
on:click={() => {
startPivotForTimeseries();
}}
>
Start Pivot
</button>
{/if}
{/if}
</div>

Expand Down
12 changes: 9 additions & 3 deletions web-common/src/features/dashboards/workspace/Dashboard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
import { selectedMockUserStore } from "../granular-access-policies/stores";
import LeaderboardDisplay from "../leaderboard/LeaderboardDisplay.svelte";
import RowsViewerAccordion from "../rows-viewer/RowsViewerAccordion.svelte";
import TimeDimensionDisplay from "../time-dimension-details/TimeDimensionDisplay.svelte";
import MetricsTimeSeriesCharts from "../time-series/MetricsTimeSeriesCharts.svelte";
import { getStateManagers } from "../state-managers/state-managers";
import { useTimeControlStore } from "../time-controls/time-control-store";
import TimeDimensionDisplay from "../time-dimension-details/TimeDimensionDisplay.svelte";
import MetricsTimeSeriesCharts from "../time-series/MetricsTimeSeriesCharts.svelte";
export let exploreName: string;
export let metricsViewName: string;
Expand Down Expand Up @@ -129,6 +129,7 @@
<MetricsTimeSeriesCharts
{exploreName}
workspaceWidth={exploreContainerWidth}
hideStartPivotButton={hidePivot}
/>
{:else}
<MeasuresContainer {exploreContainerWidth} {metricsViewName} />
Expand All @@ -138,7 +139,11 @@

{#if expandedMeasureName}
<hr class="border-t border-gray-200 -ml-4" />
<TimeDimensionDisplay {exploreName} {expandedMeasureName} />
<TimeDimensionDisplay
{exploreName}
{expandedMeasureName}
hideStartPivotButton={hidePivot}
/>
{:else}
<div class="pt-2 pl-1 border-l overflow-auto w-full">
{#if selectedDimension}
Expand All @@ -155,6 +160,7 @@
visibleMeasureNames={$visibleMeasures.map(
({ name }) => name ?? "",
)}
hideStartPivotButton={hidePivot}
/>
{:else}
<LeaderboardDisplay
Expand Down

0 comments on commit 55857b5

Please sign in to comment.