mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add author filter command to template filtering (#19202)
Can do `author:username` to filter templates created by a certain author. Adding to help clean out some templates that I created on our dev instance. This makes sorting a bit easier.
This commit is contained in:
@@ -541,6 +541,7 @@ type TemplateFilter struct {
|
||||
OrganizationID uuid.UUID `typescript:"-"`
|
||||
ExactName string `typescript:"-"`
|
||||
FuzzyName string `typescript:"-"`
|
||||
AuthorUsername string `typescript:"-"`
|
||||
SearchQuery string `json:"q,omitempty"`
|
||||
}
|
||||
|
||||
@@ -562,6 +563,11 @@ func (f TemplateFilter) asRequestOption() RequestOption {
|
||||
if f.FuzzyName != "" {
|
||||
params = append(params, fmt.Sprintf("name:%q", f.FuzzyName))
|
||||
}
|
||||
|
||||
if f.AuthorUsername != "" {
|
||||
params = append(params, fmt.Sprintf("author:%q", f.AuthorUsername))
|
||||
}
|
||||
|
||||
if f.SearchQuery != "" {
|
||||
params = append(params, f.SearchQuery)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user