Skip to content

Commit 28b79e9

Browse files
committed
fix: canvas analyst chat not showing up in embed (#8938)
* fix: canvas analyst chat not showing up in embed * fix lint
1 parent 1f33477 commit 28b79e9

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

web-admin/src/features/embeds/TopNavigationBarEmbed.svelte

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import { featureFlags } from "@rilldata/web-common/features/feature-flags";
77
import LastRefreshedDate from "@rilldata/web-admin/features/dashboards/listing/LastRefreshedDate.svelte";
88
import ChatToggle from "@rilldata/web-common/features/chat/layouts/sidebar/ChatToggle.svelte";
9-
import { ResourceKind } from "@rilldata/web-common/features/entity-management/resource-selectors.ts";
109
import type {
1110
V1Resource,
1211
V1ResourceName,
@@ -19,12 +18,9 @@
1918
const { twoTieredNavigation, dashboardChat } = featureFlags;
2019
2120
$: onProjectPage = !activeResource;
21+
$: showDashboardChat = $dashboardChat && !onProjectPage;
2222
23-
$: shouldRender =
24-
navigationEnabled ||
25-
($dashboardChat &&
26-
(activeResource?.kind === ResourceKind.Explore.toString() ||
27-
activeResource?.kind === ResourceKind.MetricsView.toString()));
23+
$: shouldRender = navigationEnabled || showDashboardChat;
2824
2925
// Dashboard breadcrumb
3026
$: dashboardsQuery = useValidDashboards(instanceId);
@@ -87,7 +83,7 @@
8783
<div class="flex-1" />
8884
{/if}
8985

90-
{#if $dashboardChat && (activeResource?.kind === ResourceKind.Explore.toString() || activeResource?.kind === ResourceKind.MetricsView.toString())}
86+
{#if showDashboardChat}
9187
<div class="flex gap-x-4 items-center">
9288
<LastRefreshedDate dashboard={activeResource?.name} />
9389
<ChatToggle />

web-admin/src/routes/-/embed/+layout.svelte

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,20 @@
4646
name: $page.params.name,
4747
};
4848
49-
$: showTopBar =
50-
navigationEnabled ||
51-
($dashboardChat &&
52-
(activeResource?.kind === ResourceKind.Explore.toString() ||
53-
activeResource?.kind === ResourceKind.MetricsView.toString()));
5449
$: onProjectPage = !activeResource;
5550
51+
$: showDashboardChat = $dashboardChat && !onProjectPage;
52+
// Resource kind can be metrics view in some cases. But internally to render it will have to have an equivalent explore.
53+
$: correctedKindForChat =
54+
activeResource?.kind === ResourceKind.MetricsView
55+
? ResourceKind.Explore
56+
: (activeResource?.kind as
57+
| ResourceKind.Explore
58+
| ResourceKind.Canvas
59+
| undefined);
60+
61+
$: showTopBar = navigationEnabled || showDashboardChat;
62+
5663
// Suppress browser back/forward
5764
beforeNavigate((nav) => {
5865
if (!navigationEnabled) {
@@ -143,8 +150,8 @@
143150
<div class="flex-1 overflow-hidden">
144151
<slot />
145152
</div>
146-
{#if $dashboardChat && activeResource?.kind === ResourceKind.Explore}
147-
<DashboardChat />
153+
{#if showDashboardChat && correctedKindForChat}
154+
<DashboardChat kind={correctedKindForChat} />
148155
{/if}
149156
</div>
150157
</RuntimeProvider>

0 commit comments

Comments
 (0)