Skip to content

Commit

Permalink
uxqa fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
briangregoryholmes committed Nov 25, 2024
1 parent a278854 commit 0379681
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { filteredSimpleMeasures } from "@rilldata/web-common/features/dashboards/state-managers/selectors/measures";
import type { DashboardDataSources } from "./types";
import { PivotChipType } from "../../pivot/types";
import { allDimensions } from "./dimensions";

export const pivotSelectors = {
showPivot: ({ dashboard }: DashboardDataSources) => dashboard.pivot.active,
Expand All @@ -19,9 +20,13 @@ export const pivotSelectors = {
description: measure.description,
}));
},
dimensions: ({ validMetricsView, dashboard }: DashboardDataSources) => {
dimensions: ({
validMetricsView,
dashboard,
validExplore,
}: DashboardDataSources) => {
{
const dimensions = validMetricsView?.dimensions ?? [];
const dimensions = allDimensions({ validMetricsView, validExplore });

const columns = dashboard.pivot.columns;
const rows = dashboard.pivot.rows;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</script>

{#if metricsViewName}
{#key exploreName}
{#key exploreName + metricsViewName}
<StateManagersProvider {metricsViewName} {exploreName} visualEditing>
<DashboardStateProvider {exploreName}>
<DashboardUrlStateProvider {metricsViewName}>
Expand Down
14 changes: 7 additions & 7 deletions web-common/src/features/explores/ExplorePreviewCTAs.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@
</Button>
</DropdownMenu.Trigger>
<DropdownMenu.Content align="end">
<DropdownMenu.Item href={`/files${metricsViewFilePath}`}>
<MetricsViewIcon
color={resourceColorMapping[ResourceKind.MetricsView]}
size="16px"
/>
Metrics View
</DropdownMenu.Item>
<DropdownMenu.Item href={`/files${exploreFilePath}`}>
<ExploreIcon
color={resourceColorMapping[ResourceKind.Explore]}
size="16px"
/>
Explore dashboard
</DropdownMenu.Item>
<DropdownMenu.Item href={`/files${metricsViewFilePath}`}>
<MetricsViewIcon
color={resourceColorMapping[ResourceKind.MetricsView]}
size="16px"
/>
Metrics View
</DropdownMenu.Item>
</DropdownMenu.Content>
</DropdownMenu.Root>
{/if}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
if (selectedProxy.size) {
setItems(Array.from(selectedProxy), excludeProxy);
} else {
setItems(items.map(({ name }) => name).filter(isString));
const newItems = items.map(({ name }) => name).filter(isString);
setItems(newItems);
selectedProxy = new Set(newItems);
}
} else if (field === "expression") {
onSelectExpression();
Expand All @@ -71,6 +73,7 @@
}}
/>
<a
class="w-fit"
target="_blank"
href="https://docs.rilldata.com/reference/project-files/explore-dashboards"
>
Expand All @@ -96,6 +99,9 @@
selectedProxy = new Set(items);
setItems(items, exclude);
}}
/>
let:item
>
{items.find((m) => m.name === item)?.displayName ?? item}
</SelectionDropdown>
{/if}
</div>
14 changes: 11 additions & 3 deletions web-common/src/features/workspaces/ExploreWorkspace.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@
import { workspaces } from "@rilldata/web-common/layout/workspace/workspace-stores";
import ViewSelector from "@rilldata/web-common/features/visual-editing/ViewSelector.svelte";
import VisualExploreEditing from "./VisualExploreEditing.svelte";
import DashboardWithProviders from "../dashboards/workspace/DashboardWithProviders.svelte";
import MetricsEditorContainer from "../metrics-views/editor/MetricsEditorContainer.svelte";
import { mapParseErrorsToLines } from "../metrics-views/errors";
import ErrorPage from "@rilldata/web-common/components/ErrorPage.svelte";
import DashboardPage from "/Users/burg/OKAY/rill/web-local/src/routes/(viz)/explore/[name]/+page.svelte";
import { createRuntimeServiceGetExplore } from "@rilldata/web-common/runtime-client";
import Spinner from "../entity-management/Spinner.svelte";
export let fileArtifact: FileArtifact;
Expand All @@ -38,6 +40,10 @@
$: exploreName = $resourceName?.name ?? getNameFromFile(filePath);
$: query = createRuntimeServiceGetExplore(instanceId, { name: exploreName });
$: ({ data } = $query);
$: initLocalUserPreferenceStore(exploreName);
$: resourceQuery = getResource(queryClient, instanceId);
Expand Down Expand Up @@ -118,8 +124,10 @@
header="Unable to load dashboard preview"
statusCode={404}
/>
{:else if metricsViewName && exploreName}
<DashboardWithProviders {exploreName} {metricsViewName} />
{:else if data?.explore && data.metricsView}
<DashboardPage {data} />
{:else}
<Spinner status={1} size="48px" />
{/if}
{/if}
</MetricsEditorContainer>
Expand Down
4 changes: 1 addition & 3 deletions web-local/src/routes/(viz)/explore/[name]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@
import { useProjectParser } from "@rilldata/web-common/features/entity-management/resource-selectors";
import { useExploreValidSpec } from "@rilldata/web-common/features/explores/selectors";
import { runtime } from "@rilldata/web-common/runtime-client/runtime-store";
import { useQueryClient } from "@tanstack/svelte-query";
import type { PageData } from "./$types";
const queryClient = useQueryClient();
import { queryClient } from "@rilldata/web-common/lib/svelte-query/globalQueryClient";
export let data: PageData;
Expand Down

0 comments on commit 0379681

Please sign in to comment.