Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1ebc217

Browse files
authored
fix: update task link AppStatus using task_id (#20543)
Fixes#20515Alternative to#20519Adds `task_id` to `workspaces_expanded` view and updates the "View Task"link in `AppStatuses` component.NOTE: this contains a migration
1 parent06dbada commit1ebc217

File tree

20 files changed

+213
-22
lines changed

20 files changed

+213
-22
lines changed

‎cli/testdata/coder_list_--output_json.golden‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
"allow_renames": false,
9191
"favorite": false,
9292
"next_start_at": "====[timestamp]=====",
93-
"is_prebuild": false
93+
"is_prebuild": false,
94+
"task_id": null
9495
}
9596
]

‎coderd/aitasks_test.go‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@ func TestTasks(t *testing.T) {
259259
// Wait for the workspace to be built.
260260
workspace,err:=client.Workspace(ctx,task.WorkspaceID.UUID)
261261
require.NoError(t,err)
262+
ifassert.True(t,workspace.TaskID.Valid,"task id should be set on workspace") {
263+
assert.Equal(t,task.ID,workspace.TaskID.UUID,"workspace task id should match")
264+
}
262265
coderdtest.AwaitWorkspaceBuildJobCompleted(t,client,workspace.LatestBuild.ID)
263266

264267
// List tasks via experimental API and verify the prompt and status mapping.
@@ -297,6 +300,9 @@ func TestTasks(t *testing.T) {
297300
// Get the workspace and wait for it to be ready.
298301
ws,err:=client.Workspace(ctx,task.WorkspaceID.UUID)
299302
require.NoError(t,err)
303+
ifassert.True(t,ws.TaskID.Valid,"task id should be set on workspace") {
304+
assert.Equal(t,task.ID,ws.TaskID.UUID,"workspace task id should match")
305+
}
300306
coderdtest.AwaitWorkspaceBuildJobCompleted(t,client,ws.LatestBuild.ID)
301307
ws=coderdtest.MustWorkspace(t,client,task.WorkspaceID.UUID)
302308
// Assert invariant: the workspace has exactly one resource with one agent with one app.
@@ -371,6 +377,9 @@ func TestTasks(t *testing.T) {
371377
require.True(t,task.WorkspaceID.Valid,"task should have a workspace ID")
372378
ws,err:=client.Workspace(ctx,task.WorkspaceID.UUID)
373379
require.NoError(t,err)
380+
ifassert.True(t,ws.TaskID.Valid,"task id should be set on workspace") {
381+
assert.Equal(t,task.ID,ws.TaskID.UUID,"workspace task id should match")
382+
}
374383
coderdtest.AwaitWorkspaceBuildJobCompleted(t,client,ws.LatestBuild.ID)
375384

376385
err=exp.DeleteTask(ctx,"me",task.ID)
@@ -417,6 +426,9 @@ func TestTasks(t *testing.T) {
417426
coderdtest.AwaitTemplateVersionJobCompleted(t,client,version.ID)
418427
template:=coderdtest.CreateTemplate(t,client,user.OrganizationID,version.ID)
419428
ws:=coderdtest.CreateWorkspace(t,client,template.ID)
429+
ifassert.False(t,ws.TaskID.Valid,"task id should not be set on non-task workspace") {
430+
assert.Zero(t,ws.TaskID,"non-task workspace task id should be empty")
431+
}
420432
coderdtest.AwaitWorkspaceBuildJobCompleted(t,client,ws.LatestBuild.ID)
421433

422434
exp:=codersdk.NewExperimentalClient(client)

‎coderd/apidoc/docs.go‎

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/apidoc/swagger.json‎

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/dump.sql‎

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
DROPVIEW workspaces_expanded;
2+
3+
-- Recreate the view from 000354_workspace_acl.up.sql
4+
CREATEVIEWworkspaces_expandedAS
5+
SELECTworkspaces.id,
6+
workspaces.created_at,
7+
workspaces.updated_at,
8+
workspaces.owner_id,
9+
workspaces.organization_id,
10+
workspaces.template_id,
11+
workspaces.deleted,
12+
workspaces.name,
13+
workspaces.autostart_schedule,
14+
workspaces.ttl,
15+
workspaces.last_used_at,
16+
workspaces.dormant_at,
17+
workspaces.deleting_at,
18+
workspaces.automatic_updates,
19+
workspaces.favorite,
20+
workspaces.next_start_at,
21+
workspaces.group_acl,
22+
workspaces.user_acl,
23+
visible_users.avatar_urlAS owner_avatar_url,
24+
visible_users.usernameAS owner_username,
25+
visible_users.nameAS owner_name,
26+
organizations.nameAS organization_name,
27+
organizations.display_nameAS organization_display_name,
28+
organizations.iconAS organization_icon,
29+
organizations.descriptionAS organization_description,
30+
templates.nameAS template_name,
31+
templates.display_nameAS template_display_name,
32+
templates.iconAS template_icon,
33+
templates.descriptionAS template_description
34+
FROM (((workspaces
35+
JOIN visible_usersON ((workspaces.owner_id=visible_users.id)))
36+
JOIN organizationsON ((workspaces.organization_id=organizations.id)))
37+
JOIN templatesON ((workspaces.template_id=templates.id)));
38+
39+
COMMENT ON VIEW workspaces_expanded IS'Joins in the display name information such as username, avatar, and organization name.';
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
DROPVIEW workspaces_expanded;
2+
3+
-- Add nullable task_id to workspaces_expanded view
4+
CREATEVIEWworkspaces_expandedAS
5+
SELECTworkspaces.id,
6+
workspaces.created_at,
7+
workspaces.updated_at,
8+
workspaces.owner_id,
9+
workspaces.organization_id,
10+
workspaces.template_id,
11+
workspaces.deleted,
12+
workspaces.name,
13+
workspaces.autostart_schedule,
14+
workspaces.ttl,
15+
workspaces.last_used_at,
16+
workspaces.dormant_at,
17+
workspaces.deleting_at,
18+
workspaces.automatic_updates,
19+
workspaces.favorite,
20+
workspaces.next_start_at,
21+
workspaces.group_acl,
22+
workspaces.user_acl,
23+
visible_users.avatar_urlAS owner_avatar_url,
24+
visible_users.usernameAS owner_username,
25+
visible_users.nameAS owner_name,
26+
organizations.nameAS organization_name,
27+
organizations.display_nameAS organization_display_name,
28+
organizations.iconAS organization_icon,
29+
organizations.descriptionAS organization_description,
30+
templates.nameAS template_name,
31+
templates.display_nameAS template_display_name,
32+
templates.iconAS template_icon,
33+
templates.descriptionAS template_description,
34+
tasks.idAS task_id
35+
FROM ((((workspaces
36+
JOIN visible_usersON ((workspaces.owner_id=visible_users.id)))
37+
JOIN organizationsON ((workspaces.organization_id=organizations.id)))
38+
JOIN templatesON ((workspaces.template_id=templates.id)))
39+
LEFT JOIN tasksON ((workspaces.id=tasks.workspace_id)));
40+
41+
COMMENT ON VIEW workspaces_expanded IS'Joins in the display name information such as username, avatar, and organization name.';
42+

‎coderd/database/modelqueries.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ func (q *sqlQuerier) GetAuthorizedWorkspaces(ctx context.Context, arg GetWorkspa
321321
&i.TemplateDisplayName,
322322
&i.TemplateIcon,
323323
&i.TemplateDescription,
324+
&i.TaskID,
324325
&i.TemplateVersionID,
325326
&i.TemplateVersionName,
326327
&i.LatestBuildCompletedAt,

‎coderd/database/models.go‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp