Skip to content

Commit 228f514

Browse files
committed
fix: display explore display name on hover (#8469)
* fix: display explore display name on hover * a pre-push hook would make my life so much easier
1 parent dfdc66f commit 228f514

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

web-common/src/features/canvas/explore-link/ExploreLink.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
{#if $exploreAvailability.isAvailable}
4141
<ExploreLink
4242
exploreName={$context.exploreName}
43+
displayName={$exploreAvailability.displayName}
4344
{organization}
4445
{project}
4546
{exploreState}

web-common/src/features/components/charts/ChartContainer.svelte

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@
7171
7272
$: exploreAvailability = showExploreLink
7373
? useExploreAvailability($runtime.instanceId, $spec?.metrics_view)
74-
: readable({ isAvailable: false, exploreName: null });
74+
: readable({
75+
isAvailable: false,
76+
exploreName: null,
77+
displayName: undefined,
78+
});
7579
7680
$: exploreName = derived(
7781
exploreAvailability,
@@ -131,6 +135,7 @@
131135
{#if showExploreLink && $exploreAvailability.isAvailable}
132136
<ExploreLink
133137
exploreName={$exploreName}
138+
displayName={$exploreAvailability.displayName}
134139
{organization}
135140
{project}
136141
exploreState={$exploreState}

web-common/src/features/explore-mappers/explore-validation.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ export function useExploreAvailability(
3939
return {
4040
isAvailable: true,
4141
exploreName: selectedDashboard?.meta?.name?.name,
42+
displayName:
43+
selectedDashboard?.explore?.spec?.displayName ||
44+
selectedDashboard?.explore?.state?.validSpec?.displayName,
4245
};
4346
});
4447
}

web-common/src/features/explore-mappers/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export type TransformerArgs<R extends TransformerProperties> = {
3737
export interface ExploreAvailabilityResult {
3838
isAvailable: boolean;
3939
exploreName?: string;
40+
displayName?: string;
4041
error?: string;
4142
}
4243

web-common/src/features/explores/explore-link/ExploreLink.svelte

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import type { ExploreState } from "@rilldata/web-common/features/dashboards/stores/explore-state";
1515
1616
export let exploreName: string;
17+
export let displayName: string | undefined = undefined;
1718
export let organization: string | undefined = undefined;
1819
export let project: string | undefined = undefined;
1920
export let exploreState: Partial<ExploreState> | undefined = undefined;
@@ -56,6 +57,9 @@
5657
}
5758
5859
$: canNavigate = !isNavigating && !!exploreState && !disabled;
60+
$: tooltipText = displayName
61+
? `Go to ${displayName}`
62+
: "Go to Explore Dashboard";
5963
</script>
6064

6165
{#if mode === "dropdown-item"}
@@ -72,15 +76,15 @@
7276
on:click={gotoExplorePage}
7377
size={28}
7478
disabled={!canNavigate}
75-
ariaLabel="Go to Explore Dashboard"
79+
ariaLabel={tooltipText}
7680
disableHover={!canNavigate}
7781
>
7882
{#if isNavigating}
7983
<Spinner status={EntityStatus.Running} size="18px" />
8084
{:else}
8185
<ExploreIcon size="18px" />
8286
{/if}
83-
<div slot="tooltip-content">Go to Explore Dashboard</div>
87+
<div slot="tooltip-content">{tooltipText}</div>
8488
</IconButton>
8589
{:else}
8690
<button
@@ -92,7 +96,7 @@
9296
{#if isNavigating}
9397
<Spinner status={EntityStatus.Running} size="1em" />
9498
{/if}
95-
Go to Explore Dashboard
99+
{tooltipText}
96100
</button>
97101
{/if}
98102

0 commit comments

Comments
 (0)