Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 5 additions & 1 deletion web-local/src/routes/(viz)/canvas/[name]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
isNotFoundError,
extractErrorStatusCode,
} from "@rilldata/web-common/lib/errors";
import { previewModeStore } from "@rilldata/web-common/layout/preview-mode-store";
import { queryClient } from "@rilldata/web-common/lib/svelte-query/globalQueryClient";
import type { PageData } from "./$types";

Expand All @@ -32,6 +33,8 @@
!$canvasQuery.data &&
$canvasQuery.isError &&
isNotFoundError($canvasQuery.error);

$: homeHref = $previewModeStore ? "/dashboards" : "/";
</script>

{#key `${runtimeClient.instanceId}::${canvasName}`}
Expand All @@ -40,9 +43,10 @@
statusCode={extractErrorStatusCode($canvasQuery.error)}
header="This user can't access this dashboard"
body="The security policy for this dashboard may make contents invisible to you. If you deploy this dashboard, {$selectedMockUserStore?.email} will see a 404."
href={homeHref}
/>
{:else if isCanvasNotFound}
<ErrorPage statusCode={404} header="Dashboard not found" />
<ErrorPage statusCode={404} header="Dashboard not found" href={homeHref} />
{:else}
<div class="flex h-full overflow-hidden">
<div class="flex-1 overflow-hidden">
Expand Down
9 changes: 8 additions & 1 deletion web-local/src/routes/(viz)/explore/[name]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
} from "@rilldata/web-common/lib/errors";
import { eventBus } from "@rilldata/web-common/lib/event-bus/event-bus";
import { queryClient } from "@rilldata/web-common/lib/svelte-query/globalQueryClient";
import { previewModeStore } from "@rilldata/web-common/layout/preview-mode-store";
import { useRuntimeClient } from "@rilldata/web-common/runtime-client/v2";
import type { PageData } from "./$types";

Expand Down Expand Up @@ -76,6 +77,8 @@
$: mockUserHasNoAccess =
$selectedMockUserStore && isNotFoundError($exploreResource.error);

$: homeHref = $previewModeStore ? "/dashboards" : "/";

onNavigate(({ from, to }) => {
const changedDashboard =
!from || !to || from?.params?.name !== to?.params?.name;
Expand All @@ -97,9 +100,10 @@
statusCode={extractErrorStatusCode($exploreResource.error)}
header="This user can't access this dashboard"
body="The security policy for this dashboard may make contents invisible to you. If you deploy this dashboard, {$selectedMockUserStore?.email} will see a 404."
href={homeHref}
/>
{:else if isDashboardNotFound}
<ErrorPage statusCode={404} header="Dashboard not found" />
<ErrorPage statusCode={404} header="Dashboard not found" href={homeHref} />
{:else if $exploreResource.isSuccess}
{#if isExploreReconcilingForFirstTime($exploreResource.data)}
<DashboardBuilding />
Expand All @@ -108,17 +112,20 @@
header="Error building dashboard"
body={$exploreResource.data?.explore?.meta?.reconcileError ??
"An unknown error occurred while building the dashboard."}
href={homeHref}
/>
{:else if dashboardFileHasParseError && dashboardFileHasParseError.length > 0}
<ErrorPage
header="Error parsing dashboard"
body="Please check your dashboard's YAML file for errors."
href={homeHref}
/>
{:else if measures.length === 0 && $selectedMockUserStore !== null}
<ErrorPage
statusCode={extractErrorStatusCode($exploreResource.error)}
header="Error fetching dashboard"
body="No measures available"
href={homeHref}
/>
{:else if metricsViewName}
<div class="h-full overflow-hidden">
Expand Down
Loading