-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Embed: Add ability to navigate a project's dashboards (#4367)
* Refactor `/-/embed` to handle different resource kinds * Delete unused component * Add `click-row` event to Table component * Edit `GetIFrame` handler to allow `navigation` and/or `resource` params * Refactor `DashboardsTable` to account for embedded context * Refactor `LastRefreshedDate` to account for embedded context * Add navigation to `/-/embed` * Fix lint
- Loading branch information
1 parent
2b09f14
commit 385c5cf
Showing
11 changed files
with
218 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 0 additions & 86 deletions
86
web-admin/src/features/dashboards/listing/DashboardList.svelte
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
web-admin/src/features/dashboards/listing/LastRefreshedDate.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<script lang="ts"> | ||
import { Dashboard } from "@rilldata/web-common/features/dashboards"; | ||
import DashboardThemeProvider from "@rilldata/web-common/features/dashboards/DashboardThemeProvider.svelte"; | ||
import DashboardURLStateProvider from "@rilldata/web-common/features/dashboards/proto-state/DashboardURLStateProvider.svelte"; | ||
import { useDashboard } from "@rilldata/web-common/features/dashboards/selectors"; | ||
import StateManagersProvider from "@rilldata/web-common/features/dashboards/state-managers/StateManagersProvider.svelte"; | ||
import DashboardStateProvider from "@rilldata/web-common/features/dashboards/stores/DashboardStateProvider.svelte"; | ||
import { errorStore } from "../errors/error-store"; | ||
export let instanceId: string; | ||
export let dashboardName: string; | ||
$: dashboard = useDashboard(instanceId, dashboardName); | ||
$: isDashboardNotFound = | ||
$dashboard.isError && $dashboard.error?.response?.status === 404; | ||
// We check for metricsView.state.validSpec instead of meta.reconcileError. validSpec persists | ||
// from previous valid dashboards, allowing display even when the current dashboard spec is invalid | ||
// and a meta.reconcileError exists. | ||
$: isDashboardErrored = !$dashboard.data?.metricsView?.state?.validSpec; | ||
// If no dashboard is found, show a 404 page | ||
$: if (isDashboardNotFound) { | ||
errorStore.set({ | ||
statusCode: 404, | ||
header: "Dashboard not found", | ||
body: `The dashboard you requested could not be found. Please check that you provided the name of a working dashboard.`, | ||
}); | ||
} | ||
</script> | ||
|
||
{#if $dashboard.isSuccess} | ||
{#if isDashboardErrored} | ||
<br /> Dashboard Error <br /> | ||
{:else} | ||
{#key dashboardName} | ||
<StateManagersProvider metricsViewName={dashboardName}> | ||
<DashboardStateProvider metricViewName={dashboardName}> | ||
<DashboardURLStateProvider metricViewName={dashboardName}> | ||
<DashboardThemeProvider> | ||
<Dashboard metricViewName={dashboardName} leftMargin={"48px"} /> | ||
</DashboardThemeProvider> | ||
</DashboardURLStateProvider> | ||
</DashboardStateProvider> | ||
</StateManagersProvider> | ||
{/key} | ||
{/if} | ||
{/if} |
Oops, something went wrong.