- Notifications
You must be signed in to change notification settings - Fork1k
feat: add notification for task status#19965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
b20b801
06ed8c7
b433146
1503e05
5bcc9dc
a33540d
6bd39ec
e75e648
74dc3ee
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -2313,6 +2313,13 @@ func (q *querier) GetLatestCryptoKeyByFeature(ctx context.Context, feature datab | ||
return q.db.GetLatestCryptoKeyByFeature(ctx, feature) | ||
} | ||
func (q *querier) GetLatestWorkspaceAppStatusesByAppID(ctx context.Context, appID uuid.UUID) ([]database.WorkspaceAppStatus, error) { | ||
if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceSystem); err != nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I realize the other functions around here do the same but I think we were wanting to stop introducing more uses of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. AFAIK, there isn’t a dedicated resource for workspace apps, so operations on them currently authorize against There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This is unfortunately a pre-existing issue from the introduction of app statuses. It may be worth addressing in a follow-up. | ||
return nil, err | ||
} | ||
return q.db.GetLatestWorkspaceAppStatusesByAppID(ctx, appID) | ||
} | ||
func (q *querier) GetLatestWorkspaceAppStatusesByWorkspaceIDs(ctx context.Context, ids []uuid.UUID) ([]database.WorkspaceAppStatus, error) { | ||
if err := q.authorizeContext(ctx, policy.ActionRead, rbac.ResourceSystem); err != nil { | ||
return nil, err | ||
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Obligatory reminder to check migration number before merge! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
-- Remove Task 'working' transition template notification | ||
DELETEFROM notification_templatesWHERE id='bd4b7168-d05e-4e19-ad0f-3593b77aa90f'; | ||
-- Remove Task 'idle' transition template notification | ||
DELETEFROM notification_templatesWHERE id='d4a6271c-cced-4ed0-84ad-afd02a9c7799'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
-- Task transition to 'working' status | ||
INSERT INTO notification_templates ( | ||
id, | ||
name, | ||
title_template, | ||
body_template, | ||
actions, | ||
"group", | ||
method, | ||
kind, | ||
enabled_by_default | ||
) VALUES ( | ||
'bd4b7168-d05e-4e19-ad0f-3593b77aa90f', | ||
'Task Working', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. I kept the terminology aligned with the current workspace agent app status ( | ||
E'Task ''{{.Labels.workspace}}'' is working', | ||
E'The task ''{{.Labels.task}}'' transitioned to a working state.', | ||
'[ | ||
{ | ||
"label": "View task", | ||
"url": "{{base_url}}/tasks/{{.UserUsername}}/{{.Labels.workspace}}" | ||
}, | ||
{ | ||
"label": "View workspace", | ||
"url": "{{base_url}}/@{{.UserUsername}}/{{.Labels.workspace}}" | ||
} | ||
]'::jsonb, | ||
'Task Events', | ||
NULL, | ||
'system'::notification_template_kind, | ||
true | ||
); | ||
-- Task transition to 'idle' status | ||
INSERT INTO notification_templates ( | ||
id, | ||
name, | ||
title_template, | ||
body_template, | ||
actions, | ||
"group", | ||
method, | ||
kind, | ||
enabled_by_default | ||
) VALUES ( | ||
'd4a6271c-cced-4ed0-84ad-afd02a9c7799', | ||
'Task Idle', | ||
E'Task ''{{.Labels.workspace}}'' is idle', | ||
E'The task ''{{.Labels.task}}'' is idle and ready for input.', | ||
'[ | ||
{ | ||
"label": "View task", | ||
"url": "{{base_url}}/tasks/{{.UserUsername}}/{{.Labels.workspace}}" | ||
}, | ||
{ | ||
"label": "View workspace", | ||
"url": "{{base_url}}/@{{.UserUsername}}/{{.Labels.workspace}}" | ||
} | ||
]'::jsonb, | ||
'Task Events', | ||
NULL, | ||
'system'::notification_template_kind, | ||
true | ||
); |
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.