Skip to content

Commit 4476666

Browse files
[dashboard] Add tooltip for possibly truncated values in workspace list
1 parent 9f41b1d commit 4476666

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

components/dashboard/src/components/Tooltip.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ import { useState } from 'react';
99
export interface TooltipProps {
1010
children: React.ReactChild[] | React.ReactChild;
1111
content: string;
12+
className?: string;
1213
}
1314

1415
function Tooltip(props: TooltipProps) {
1516
const [expanded, setExpanded] = useState(false);
1617

1718
return (
18-
<div onMouseLeave={() => setExpanded(false)} onMouseEnter={() => setExpanded(true)} className="relative">
19-
<div>
19+
<div onMouseLeave={() => setExpanded(false)} onMouseEnter={() => setExpanded(true)} className={"relative " + (props.className || "")}>
20+
<div className={props.className}>
2021
{props.children}
2122
</div>
2223
{expanded ?

components/dashboard/src/workspaces/WorkspaceEntry.tsx

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,31 @@ export function WorkspaceEntry({ desc, model, isAdmin, stopWorkspace }: Props) {
8686
<WorkspaceStatusIndicator instance={desc?.latestInstance} />
8787
</div>
8888
<div className="flex flex-col w-3/12">
89-
<a href={startUrl.toString()}><div className="font-medium text-gray-800 dark:text-gray-100 overflow-ellipsis truncate w-full hover:text-blue-600 dark:hover:text-blue-400">{ws.id}</div></a>
90-
<a href={project ? 'https://' + project : undefined}><div className="text-sm overflow-ellipsis truncate w-full text-gray-400 hover:text-blue-600 dark:hover:text-blue-400">{project || 'Unknown'}</div></a>
89+
<Tooltip content={ws.id}>
90+
<a href={startUrl.toString()}>
91+
<div className="font-medium text-gray-800 dark:text-gray-100 overflow-ellipsis truncate w-full hover:text-blue-600 dark:hover:text-blue-400">{ws.id}</div>
92+
</a>
93+
</Tooltip>
94+
<Tooltip content={project || 'Unknown'}>
95+
<a href={project ? 'https://' + project : undefined}>
96+
<div className="text-sm overflow-ellipsis truncate w-full text-gray-400 hover:text-blue-600 dark:hover:text-blue-400">{project || 'Unknown'}</div>
97+
</a>
98+
</Tooltip>
9199
</div>
92100
<div className="flex flex-col w-4/12">
93-
<div className="text-gray-500 overflow-ellipsis truncate w-full">{ws.description}</div>
94-
<a href={ws.contextURL}>
95-
<div className="text-sm text-gray-400 overflow-ellipsis truncate w-full hover:text-blue-600 dark:hover:text-blue-400">{ws.contextURL}</div>
96-
</a>
101+
<Tooltip content={ws.description}>
102+
<div className="text-gray-500 overflow-ellipsis truncate w-full">{ws.description}</div>
103+
</Tooltip>
104+
<Tooltip content={ws.contextURL}>
105+
<a href={ws.contextURL}>
106+
<div className="text-sm text-gray-400 overflow-ellipsis truncate w-full hover:text-blue-600 dark:hover:text-blue-400">{ws.contextURL}</div>
107+
</a>
108+
</Tooltip>
97109
</div>
98110
<div className="flex flex-col items-start w-2/12">
99-
<div className="text-gray-500 overflow-ellipsis truncate w-full">{currentBranch}</div>
111+
<Tooltip content={currentBranch} className="w-full">
112+
<div className="text-gray-500 overflow-ellipsis truncate w-full">{currentBranch}</div>
113+
</Tooltip>
100114
<PendingChangesDropdown workspaceInstance={desc.latestInstance} />
101115
</div>
102116
<div className="flex w-2/12 self-center">

0 commit comments

Comments
 (0)