Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.52 uxqa fixes #6167

Merged
merged 6 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
12 changes: 8 additions & 4 deletions web-common/src/features/dashboards/stores/dashboard-stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,17 @@ function syncDimensions(
}

metricsExplorer.pivot.rows.dimension =
metricsExplorer.pivot.rows.dimension.filter((dimension) =>
dimensionsSet.has(dimension.id),
metricsExplorer.pivot.rows.dimension.filter(
(dimension) =>
dimensionsSet.has(dimension.id) ||
dimension.type === PivotChipType.Time,
);

metricsExplorer.pivot.columns.dimension =
metricsExplorer.pivot.columns.dimension.filter((dimension) =>
dimensionsSet.has(dimension.id),
metricsExplorer.pivot.columns.dimension.filter(
(dimension) =>
dimensionsSet.has(dimension.id) ||
dimension.type === PivotChipType.Time,
);

if (metricsExplorer.allDimensionsVisible) {
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>
30 changes: 16 additions & 14 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 { createRuntimeServiceGetExplore } from "@rilldata/web-common/runtime-client";
import Spinner from "../entity-management/Spinner.svelte";
import DashboardWithProviders from "../dashboards/workspace/DashboardWithProviders.svelte";

export let fileArtifact: FileArtifact;

Expand All @@ -31,33 +33,31 @@
path: filePath,
resourceName,
fileName,
getResource,
getAllErrors,
remoteContent,
} = fileArtifact);

$: exploreName = $resourceName?.name ?? getNameFromFile(filePath);

$: initLocalUserPreferenceStore(exploreName);
$: query = createRuntimeServiceGetExplore(instanceId, { name: exploreName });

$: resourceQuery = getResource(queryClient, instanceId);
$: ({ data: resources } = $query);

$: ({ data: resource } = $resourceQuery);
$: initLocalUserPreferenceStore(exploreName);

$: exploreResource = resources?.explore;
$: metricsViewResource = resources?.metricsView;

$: allErrorsQuery = getAllErrors(queryClient, instanceId);
$: allErrors = $allErrorsQuery;
$: resourceIsReconciling = resourceIsLoading(resource);
$: resourceIsReconciling = resourceIsLoading(exploreResource);

$: workspace = workspaces.get(filePath);
$: selectedViewStore = workspace.view;

$: selectedView = $selectedViewStore ?? "code";

$: exploreResource = resource?.explore;

$: metricsViewName = resource?.meta?.refs?.find(
(ref) => ref.kind === ResourceKind.MetricsView,
)?.name;
$: metricsViewName = metricsViewResource?.meta?.name?.name;

$: lineBasedRuntimeErrors = mapParseErrorsToLines(
allErrors,
Expand All @@ -79,7 +79,7 @@

<WorkspaceContainer>
<WorkspaceHeader
{resource}
resource={exploreResource}
hasUnsavedChanges={$hasUnsavedChanges}
onTitleChange={onChangeCallback}
slot="header"
Expand Down Expand Up @@ -118,15 +118,17 @@
header="Unable to load dashboard preview"
statusCode={404}
/>
{:else if metricsViewName && exploreName}
{:else if exploreName && metricsViewName}
<DashboardWithProviders {exploreName} {metricsViewName} />
{:else}
<Spinner status={1} size="48px" />
{/if}
{/if}
</MetricsEditorContainer>

<VisualExploreEditing
slot="inspector"
{exploreResource}
exploreResource={exploreResource?.explore}
{metricsViewName}
{exploreName}
{fileArtifact}
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
Loading