Skip to content

Commit c5a4f9c

Browse files
committed
Add versions to the dashboard
1 parent fcd1b44 commit c5a4f9c

File tree

2 files changed

+48
-12
lines changed

2 files changed

+48
-12
lines changed

components/dashboard/src/settings/SelectIDE.tsx

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ export default function SelectIDE(props: SelectIDEProps) {
7575
const [ideOptions, setIdeOptions] = useState<IDEOptions | undefined>(undefined);
7676
useEffect(() => {
7777
(async () => {
78-
const ideopts = await getGitpodService().server.getIDEOptions();
78+
const ideOptions = await getGitpodService().server.getIDEOptions();
7979
// TODO: Compatible with ide-config not deployed, need revert after ide-config deployed
80-
delete ideopts.options["code-latest"];
81-
delete ideopts.options["code-desktop-insiders"];
80+
delete ideOptions.options["code-latest"];
81+
delete ideOptions.options["code-desktop-insiders"];
8282

83-
setIdeOptions(ideopts);
83+
setIdeOptions(ideOptions);
8484
})();
8585
}, []);
8686

@@ -95,8 +95,9 @@ export default function SelectIDE(props: SelectIDEProps) {
9595
<div className={`my-4 gap-3 flex flex-wrap max-w-3xl`}>
9696
{allIdeOptions.map(([id, option]) => {
9797
const selected = defaultIde === id;
98+
const version = useLatestVersion ? option.latestImageVersion : option.imageVersion;
9899
const onSelect = () => actuallySetDefaultIde(id);
99-
return renderIdeOption(option, selected, onSelect);
100+
return renderIdeOption(option, selected, version, onSelect);
100101
})}
101102
</div>
102103
{ideOptions.options[defaultIde]?.notes && (
@@ -176,20 +177,45 @@ function orderedIdeOptions(ideOptions: IDEOptions) {
176177
});
177178
}
178179

179-
function renderIdeOption(option: IDEOption, selected: boolean, onSelect: () => void): JSX.Element {
180+
function renderIdeOption(
181+
option: IDEOption,
182+
selected: boolean,
183+
version: IDEOption["imageVersion"],
184+
onSelect: () => void,
185+
): JSX.Element {
180186
const label = option.type === "desktop" ? "" : option.type;
181187
const card = (
182-
<SelectableCardSolid className="w-36 h-40" title={option.title} selected={selected} onClick={onSelect}>
188+
<SelectableCardSolid className="w-36 h-44" title={option.title} selected={selected} onClick={onSelect}>
183189
<div className="flex justify-center mt-3">
184190
<img className="w-16 filter-grayscale self-center" src={option.logo} alt="logo" />
185191
</div>
186-
{label ? (
192+
<div
193+
className="mt-2 px-3 py-1 self-center"
194+
style={{
195+
minHeight: "1.75rem",
196+
}}
197+
>
198+
{label ? (
199+
<span
200+
className={`font-semibold text-sm ${
201+
selected ? "text-gray-100 dark:text-gray-600" : "text-gray-600 dark:text-gray-500"
202+
} uppercase`}
203+
>
204+
{label}
205+
</span>
206+
) : (
207+
<></>
208+
)}
209+
</div>
210+
211+
{version ? (
187212
<div
188-
className={`font-semibold text-sm ${
213+
className={`font-semibold text-xs ${
189214
selected ? "text-gray-100 dark:text-gray-600" : "text-gray-600 dark:text-gray-500"
190-
} uppercase mt-2 px-3 py-1 self-center`}
215+
} uppercase px-3 self-center`}
216+
title="The IDE's current version on Gitpod"
191217
>
192-
{label}
218+
{version}
193219
</div>
194220
) : (
195221
<></>

components/gitpod-protocol/src/ide-protocol.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export interface IDEOption {
8787
label?: string;
8888

8989
/**
90-
* Notes to the IDE option that are renderd in the preferences when a user
90+
* Notes to the IDE option that are rendered in the preferences when a user
9191
* chooses this IDE.
9292
*/
9393
notes?: string[];
@@ -126,4 +126,14 @@ export interface IDEOption {
126126
* The latest plugin image ref for the latest IDE image, this image ref always resolve to digest.
127127
*/
128128
pluginLatestImage?: string;
129+
130+
/**
131+
* ImageVersion the semantic version of the IDE image.
132+
*/
133+
imageVersion?: string;
134+
135+
/**
136+
* LatestImageVersion the semantic version of the latest IDE image.
137+
*/
138+
latestImageVersion?: string;
129139
}

0 commit comments

Comments
 (0)