Skip to content

Commit 42643b6

Browse files
committed
Add more info to outdated tooltip
1 parent 5bc48df commit 42643b6

File tree

3 files changed

+78
-3
lines changed

3 files changed

+78
-3
lines changed

site/src/components/Tooltips/WorkspaceOutdatedTooltip.tsx

Lines changed: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ import {
1010
import InfoIcon from "@mui/icons-material/InfoOutlined"
1111
import { makeStyles } from "@mui/styles"
1212
import { colors } from "theme/colors"
13+
import { useQuery } from "@tanstack/react-query"
14+
import { getTemplate, getTemplateVersion } from "api/api"
15+
import Box from "@mui/material/Box"
16+
import Skeleton from "@mui/material/Skeleton"
17+
import Link from "@mui/material/Link"
1318

1419
export const Language = {
1520
outdatedLabel: "Outdated",
@@ -20,13 +25,24 @@ export const Language = {
2025

2126
interface TooltipProps {
2227
onUpdateVersion: () => void
28+
templateId: string
2329
ariaLabel?: string
2430
}
2531

26-
export const WorkspaceOutdatedTooltip: FC<
27-
React.PropsWithChildren<TooltipProps>
28-
> = ({ onUpdateVersion, ariaLabel }) => {
32+
export const WorkspaceOutdatedTooltip: FC<TooltipProps> = ({
33+
onUpdateVersion,
34+
ariaLabel,
35+
templateId,
36+
}) => {
2937
const styles = useStyles()
38+
const { data: activeVersion } = useQuery({
39+
queryFn: async () => {
40+
const template = await getTemplate(templateId)
41+
const activeVersion = await getTemplateVersion(template.active_version_id)
42+
return activeVersion
43+
},
44+
queryKey: ["templates", templateId, "activeVersion"],
45+
})
3046

3147
return (
3248
<HelpTooltip
@@ -37,6 +53,63 @@ export const WorkspaceOutdatedTooltip: FC<
3753
>
3854
<HelpTooltipTitle>{Language.outdatedLabel}</HelpTooltipTitle>
3955
<HelpTooltipText>{Language.versionTooltipText}</HelpTooltipText>
56+
57+
<Box
58+
sx={{
59+
display: "flex",
60+
flexDirection: "column",
61+
gap: 1,
62+
py: 1,
63+
fontSize: 13,
64+
}}
65+
>
66+
<Box>
67+
<Box
68+
sx={{
69+
color: (theme) => theme.palette.text.primary,
70+
fontWeight: 600,
71+
}}
72+
>
73+
New version
74+
</Box>
75+
<Box>
76+
{activeVersion ? (
77+
<Link
78+
href={`/templates/docker/versions/${activeVersion.name}`}
79+
target="_blank"
80+
sx={{ color: (theme) => theme.palette.primary.light }}
81+
>
82+
{activeVersion.name}
83+
</Link>
84+
) : (
85+
<Skeleton variant="text" height={20} width={100} />
86+
)}
87+
</Box>
88+
</Box>
89+
90+
<Box>
91+
<Box
92+
sx={{
93+
color: (theme) => theme.palette.text.primary,
94+
fontWeight: 600,
95+
}}
96+
>
97+
Message
98+
</Box>
99+
<Box>
100+
{activeVersion ? (
101+
activeVersion.message === "" ? (
102+
"No message"
103+
) : (
104+
activeVersion.message
105+
)
106+
) : (
107+
<Skeleton variant="text" height={20} width={150} />
108+
)}
109+
</Box>
110+
</Box>
111+
</Box>
112+
40113
<HelpTooltipLinksGroup>
41114
<HelpTooltipAction
42115
icon={RefreshIcon}

site/src/components/WorkspaceStats/WorkspaceStats.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export const WorkspaceStats: FC<WorkspaceStatsProps> = ({
102102

103103
{workspace.outdated && (
104104
<WorkspaceOutdatedTooltip
105+
templateId={workspace.template_id}
105106
onUpdateVersion={handleUpdate}
106107
ariaLabel="update version"
107108
/>

site/src/components/WorkspacesTable/WorkspacesRow.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export const WorkspacesRow: FC<{
3535
{workspace.name}
3636
{workspace.outdated && (
3737
<WorkspaceOutdatedTooltip
38+
templateId={workspace.template_id}
3839
onUpdateVersion={() => {
3940
onUpdateWorkspace(workspace)
4041
}}

0 commit comments

Comments
 (0)