@@ -10,6 +10,11 @@ import {
10
10
import InfoIcon from "@mui/icons-material/InfoOutlined"
11
11
import { makeStyles } from "@mui/styles"
12
12
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"
13
18
14
19
export const Language = {
15
20
outdatedLabel : "Outdated" ,
@@ -20,13 +25,24 @@ export const Language = {
20
25
21
26
interface TooltipProps {
22
27
onUpdateVersion : ( ) => void
28
+ templateId : string
23
29
ariaLabel ?: string
24
30
}
25
31
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
+ } ) => {
29
37
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
+ } )
30
46
31
47
return (
32
48
< HelpTooltip
@@ -37,6 +53,63 @@ export const WorkspaceOutdatedTooltip: FC<
37
53
>
38
54
< HelpTooltipTitle > { Language . outdatedLabel } </ HelpTooltipTitle >
39
55
< 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
+
40
113
< HelpTooltipLinksGroup >
41
114
< HelpTooltipAction
42
115
icon = { RefreshIcon }
0 commit comments