File tree Expand file tree Collapse file tree 2 files changed +17
-14
lines changed
Expand file tree Collapse file tree 2 files changed +17
-14
lines changed Original file line number Diff line number Diff line change 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 ,
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 );
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 />
Original file line number Diff line number Diff line change 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 ) {
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 >
You can’t perform that action at this time.
0 commit comments