-
Notifications
You must be signed in to change notification settings - Fork 889
feat(coderd): add parameter insights to template insights #8656
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
29cb4b2
680da6e
05d7a2c
bf218e9
6eb728f
05c91c7
2e37d6a
e605a15
6afb914
81146cd
580826f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1227,6 +1227,25 @@ func (q *querier) GetTemplateInsights(ctx context.Context, arg database.GetTempl | |
return q.db.GetTemplateInsights(ctx, arg) | ||
} | ||
|
||
func (q *querier) GetTemplateParameterInsights(ctx context.Context, arg database.GetTemplateParameterInsightsParams) ([]database.GetTemplateParameterInsightsRow, error) { | ||
for _, templateID := range arg.TemplateIDs { | ||
template, err := q.db.GetTemplateByID(ctx, templateID) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
if err := q.authorizeContext(ctx, rbac.ActionUpdate, template); err != nil { | ||
return nil, err | ||
} | ||
} | ||
if len(arg.TemplateIDs) == 0 { | ||
if err := q.authorizeContext(ctx, rbac.ActionUpdate, rbac.ResourceTemplate.All()); err != nil { | ||
return nil, err | ||
} | ||
} | ||
Comment on lines
+1231
to
+1245
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.
Edit: or you could leverage 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. Turns out this wasn't a useful suggestion :( |
||
return q.db.GetTemplateParameterInsights(ctx, arg) | ||
} | ||
|
||
func (q *querier) GetTemplateVersionByID(ctx context.Context, tvid uuid.UUID) (database.TemplateVersion, error) { | ||
tv, err := q.db.GetTemplateVersionByID(ctx, tvid) | ||
if err != nil { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
note: this will generally only be called with a single TemplateID as a parameter, so we hopefully shouldn't see a pathological case of querying hundreds of templates.