feat: Add template display name (backend) (#4966)

* Rename to nameValidator

* Refactor: NameValid

* Fix: comment

* Define new migration

* Include display_name

* Update typesGenerated.ts

* Update meta

* Adjust tests

* CLI tests

* Fix: audit

* Fix: omitempty

* site: display_name is optional

* unit: TestUsernameValid

* entities.ts: add display_name

* site: TemplateSettingsPage.test.tsx

* Fix: TemplateSettingsForm.tsx

* Adjust tests

* Add comment to display_name column

* Fix: rename

* Fix: make

* Loosen regexp

* Fix: err check

* Fix: template name length

* Allow for whitespaces

* Update migration number
This commit is contained in:
Marcin Tojek
2022-11-10 21:51:09 +01:00
committed by GitHub
parent f3eb662208
commit 2042b575dc
23 changed files with 219 additions and 57 deletions
+3
View File
@@ -14,6 +14,7 @@ import (
func templateEdit() *cobra.Command {
var (
name string
displayName string
description string
icon string
defaultTTL time.Duration
@@ -40,6 +41,7 @@ func templateEdit() *cobra.Command {
// NOTE: coderd will ignore empty fields.
req := codersdk.UpdateTemplateMeta{
Name: name,
DisplayName: displayName,
Description: description,
Icon: icon,
DefaultTTLMillis: defaultTTL.Milliseconds(),
@@ -55,6 +57,7 @@ func templateEdit() *cobra.Command {
}
cmd.Flags().StringVarP(&name, "name", "", "", "Edit the template name")
cmd.Flags().StringVarP(&displayName, "display-name", "", "", "Edit the template display name")
cmd.Flags().StringVarP(&description, "description", "", "", "Edit the template description")
cmd.Flags().StringVarP(&icon, "icon", "", "", "Edit the template icon path")
cmd.Flags().DurationVarP(&defaultTTL, "default-ttl", "", 0, "Edit the template default time before shutdown - workspaces created from this template to this value.")