Skip to content

Commit 4b059c4

Browse files
authored
fix: make workspace tooltips actionable (coder#11700)
1 parent 200a87e commit 4b059c4

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

site/src/pages/WorkspacePage/WorkspaceActions/WorkspaceActions.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export const WorkspaceActions: FC<WorkspaceActionsProps> = ({
8383
workspaceUpdatePolicy(workspace, canChangeVersions) === "always" &&
8484
workspace.outdated;
8585

86-
const tooltipText = getTooltipText(workspace, mustUpdate);
86+
const tooltipText = getTooltipText(workspace, mustUpdate, canChangeVersions);
8787
const canBeUpdated = workspace.outdated && canAcceptJobs;
8888

8989
// A mapping of button type to the corresponding React component
@@ -202,17 +202,25 @@ export const WorkspaceActions: FC<WorkspaceActionsProps> = ({
202202
);
203203
};
204204

205-
function getTooltipText(workspace: Workspace, disabled: boolean): string {
206-
if (!disabled) {
205+
function getTooltipText(
206+
workspace: Workspace,
207+
mustUpdate: boolean,
208+
canChangeVersions: boolean,
209+
): string {
210+
if (!mustUpdate && !canChangeVersions) {
207211
return "";
208212
}
209213

214+
if (!mustUpdate && canChangeVersions) {
215+
return "This template requires automatic updates on workspace startup, but template administrators can ignore this policy.";
216+
}
217+
210218
if (workspace.template_require_active_version) {
211-
return "This template requires automatic updates";
219+
return "This template requires automatic updates on workspace startup. Contact your administrator if you want to preserve the template version.";
212220
}
213221

214222
if (workspace.automatic_updates === "always") {
215-
return "You have enabled automatic updates for this workspace";
223+
return "Automatic updates are enabled for this workspace. Modify the update policy in workspace settings if you want to preserve the template version.";
216224
}
217225

218226
return "";

0 commit comments

Comments
 (0)