- Notifications
You must be signed in to change notification settings - Fork914
feat: add has-ai-task filters to the /workspaces and /templates endpoints#18387
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
base:main
Are you sure you want to change the base?
Conversation
fb3b8ec
tod32f3e4
Compare41eebab
to31aa2b2
CompareThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM, with a couple nits.
@@ -25,7 +25,7 @@ func userACLMatcher(m sqltypes.VariableMatcher) sqltypes.VariableMatcher { | |||
func TemplateConverter() *sqltypes.VariableConverter { | |||
matcher := sqltypes.NewVariableConverter().RegisterMatcher( | |||
resourceIDMatcher(), | |||
organizationOwnerMatcher(), | |||
sqltypes.StringVarMatcher("t.organization_id :: text", []string{"input", "object", "org_owner"}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Is this the only case where we need to update theorganization_id
alias?
templateWithAI := coderdtest.CreateTemplate(t, client, user.OrganizationID, versionWithAI.ID) | ||
templateWithoutAI := coderdtest.CreateTemplate(t, client, user.OrganizationID, versionWithoutAI.ID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Let's keep the terminology consistent. This would apply toversionWith{,out}AI
as well.
templateWithAI:=coderdtest.CreateTemplate(t,client,user.OrganizationID,versionWithAI.ID) | |
templateWithoutAI:=coderdtest.CreateTemplate(t,client,user.OrganizationID,versionWithoutAI.ID) | |
templateWithAITask:=coderdtest.CreateTemplate(t,client,user.OrganizationID,versionWithAI.ID) | |
templateWithoutAITask:=coderdtest.CreateTemplate(t,client,user.OrganizationID,versionWithoutAI.ID) |
@@ -136,7 +136,7 @@ func (api *API) workspace(rw http.ResponseWriter, r *http.Request) { | |||
// @Security CoderSessionToken | |||
// @Produce json | |||
// @Tags Workspaces | |||
// @Param q query string false "Search query in the format `key:value`. Available keys are: owner, template, name, status, has-agent, dormant, last_used_after, last_used_before." | |||
// @Param q query string false "Search query in the format `key:value`. Available keys are: owner, template, name, status, has-agent, dormant, last_used_after, last_used_before, has-ai-task." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Damn, seems like we already have two naming conventions (has-agent
,last_used_after
) 😞
I think we should support both by replacing the separators with one or the other.
Could be in a separate PR though, or just turned into an issue since this isn't your fault.
HasAITask: true, | ||
}) | ||
wsWithoutAI := dbgen.Workspace(t, db, database.WorkspaceTable{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Ditto.
This PR allows filtering templates and workspaces with the
has-ai-task
filter as described in theCoder Tasks RFC.