fix(site): exclude workspace schedule settings for prebuilt workspaces (#18826)

## Description

This PR updates the UI to avoid rendering workspace schedule settings
(autostop, autostart, etc.) for prebuilt workspaces. Instead, it
displays an informational message with a link to the relevant
documentation.

## Changes

* Introduce `IsPrebuild` parameter to `convertWorkspace` to indicate
whether the workspace is a prebuild.
* Prevent the Workspace Schedule settings form from rendering in the UI
for prebuilt workspaces.
* Display an info alert with a link to documentation when viewing a
prebuilt workspace.

<img width="2980" height="864" alt="Screenshot 2025-07-10 at 13 16 13"
src="https://github.com/user-attachments/assets/5f831c21-50bb-4e05-beea-dbeb930ddff8"
/>


Relates with: https://github.com/coder/coder/pull/18762

---------

Co-authored-by: BrunoQuaresma <bruno_nonato_quaresma@hotmail.com>
This commit is contained in:
Susana Ferreira
2025-07-15 14:11:04 +01:00
committed by GitHub
co-authored by BrunoQuaresma
parent e4d3453e2b
commit dad033ee3d
11 changed files with 218 additions and 68 deletions
+35 -32
View File
@@ -8667,6 +8667,7 @@ If the schedule is empty, the user will be updated to use the default schedule.|
"healthy": false
},
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"is_prebuild": true,
"last_used_at": "2019-08-24T14:15:22Z",
"latest_app_status": {
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
@@ -8906,38 +8907,39 @@ If the schedule is empty, the user will be updated to use the default schedule.|
### Properties
| Name | Type | Required | Restrictions | Description |
|---------------------------------------------|------------------------------------------------------------|----------|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `allow_renames` | boolean | false | | |
| `automatic_updates` | [codersdk.AutomaticUpdates](#codersdkautomaticupdates) | false | | |
| `autostart_schedule` | string | false | | |
| `created_at` | string | false | | |
| `deleting_at` | string | false | | Deleting at indicates the time at which the workspace will be permanently deleted. A workspace is eligible for deletion if it is dormant (a non-nil dormant_at value) and a value has been specified for time_til_dormant_autodelete on its template. |
| `dormant_at` | string | false | | Dormant at being non-nil indicates a workspace that is dormant. A dormant workspace is no longer accessible must be activated. It is subject to deletion if it breaches the duration of the time_til_ field on its template. |
| `favorite` | boolean | false | | |
| `health` | [codersdk.WorkspaceHealth](#codersdkworkspacehealth) | false | | Health shows the health of the workspace and information about what is causing an unhealthy status. |
| `id` | string | false | | |
| `last_used_at` | string | false | | |
| `latest_app_status` | [codersdk.WorkspaceAppStatus](#codersdkworkspaceappstatus) | false | | |
| `latest_build` | [codersdk.WorkspaceBuild](#codersdkworkspacebuild) | false | | |
| `name` | string | false | | |
| `next_start_at` | string | false | | |
| `organization_id` | string | false | | |
| `organization_name` | string | false | | |
| `outdated` | boolean | false | | |
| `owner_avatar_url` | string | false | | |
| `owner_id` | string | false | | |
| `owner_name` | string | false | | Owner name is the username of the owner of the workspace. |
| `template_active_version_id` | string | false | | |
| `template_allow_user_cancel_workspace_jobs` | boolean | false | | |
| `template_display_name` | string | false | | |
| `template_icon` | string | false | | |
| `template_id` | string | false | | |
| `template_name` | string | false | | |
| `template_require_active_version` | boolean | false | | |
| `template_use_classic_parameter_flow` | boolean | false | | |
| `ttl_ms` | integer | false | | |
| `updated_at` | string | false | | |
| Name | Type | Required | Restrictions | Description |
|---------------------------------------------|------------------------------------------------------------|----------|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `allow_renames` | boolean | false | | |
| `automatic_updates` | [codersdk.AutomaticUpdates](#codersdkautomaticupdates) | false | | |
| `autostart_schedule` | string | false | | |
| `created_at` | string | false | | |
| `deleting_at` | string | false | | Deleting at indicates the time at which the workspace will be permanently deleted. A workspace is eligible for deletion if it is dormant (a non-nil dormant_at value) and a value has been specified for time_til_dormant_autodelete on its template. |
| `dormant_at` | string | false | | Dormant at being non-nil indicates a workspace that is dormant. A dormant workspace is no longer accessible must be activated. It is subject to deletion if it breaches the duration of the time_til_ field on its template. |
| `favorite` | boolean | false | | |
| `health` | [codersdk.WorkspaceHealth](#codersdkworkspacehealth) | false | | Health shows the health of the workspace and information about what is causing an unhealthy status. |
| `id` | string | false | | |
| `is_prebuild` | boolean | false | | Is prebuild indicates whether the workspace is a prebuilt workspace. Prebuilt workspaces are owned by the prebuilds system user and have specific behavior, such as being managed differently from regular workspaces. Once a prebuilt workspace is claimed by a user, it transitions to a regular workspace, and IsPrebuild returns false. |
| `last_used_at` | string | false | | |
| `latest_app_status` | [codersdk.WorkspaceAppStatus](#codersdkworkspaceappstatus) | false | | |
| `latest_build` | [codersdk.WorkspaceBuild](#codersdkworkspacebuild) | false | | |
| `name` | string | false | | |
| `next_start_at` | string | false | | |
| `organization_id` | string | false | | |
| `organization_name` | string | false | | |
| `outdated` | boolean | false | | |
| `owner_avatar_url` | string | false | | |
| `owner_id` | string | false | | |
| `owner_name` | string | false | | Owner name is the username of the owner of the workspace. |
| `template_active_version_id` | string | false | | |
| `template_allow_user_cancel_workspace_jobs` | boolean | false | | |
| `template_display_name` | string | false | | |
| `template_icon` | string | false | | |
| `template_id` | string | false | | |
| `template_name` | string | false | | |
| `template_require_active_version` | boolean | false | | |
| `template_use_classic_parameter_flow` | boolean | false | | |
| `ttl_ms` | integer | false | | |
| `updated_at` | string | false | | |
#### Enumerated Values
@@ -10505,6 +10507,7 @@ If the schedule is empty, the user will be updated to use the default schedule.|
"healthy": false
},
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"is_prebuild": true,
"last_used_at": "2019-08-24T14:15:22Z",
"latest_app_status": {
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
+6
View File
@@ -67,6 +67,7 @@ of the template will be used.
"healthy": false
},
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"is_prebuild": true,
"last_used_at": "2019-08-24T14:15:22Z",
"latest_app_status": {
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
@@ -353,6 +354,7 @@ curl -X GET http://coder-server:8080/api/v2/users/{user}/workspace/{workspacenam
"healthy": false
},
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"is_prebuild": true,
"last_used_at": "2019-08-24T14:15:22Z",
"latest_app_status": {
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
@@ -664,6 +666,7 @@ of the template will be used.
"healthy": false
},
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"is_prebuild": true,
"last_used_at": "2019-08-24T14:15:22Z",
"latest_app_status": {
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
@@ -953,6 +956,7 @@ curl -X GET http://coder-server:8080/api/v2/workspaces \
"healthy": false
},
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"is_prebuild": true,
"last_used_at": "2019-08-24T14:15:22Z",
"latest_app_status": {
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
@@ -1223,6 +1227,7 @@ curl -X GET http://coder-server:8080/api/v2/workspaces/{workspace} \
"healthy": false
},
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"is_prebuild": true,
"last_used_at": "2019-08-24T14:15:22Z",
"latest_app_status": {
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",
@@ -1625,6 +1630,7 @@ curl -X PUT http://coder-server:8080/api/v2/workspaces/{workspace}/dormant \
"healthy": false
},
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"is_prebuild": true,
"last_used_at": "2019-08-24T14:15:22Z",
"latest_app_status": {
"agent_id": "2b1e3b65-2c04-4fa2-a2d7-467901e98978",