mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
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:
@@ -175,6 +175,7 @@ export interface CreateParameterRequest {
|
||||
// From codersdk/organizations.go
|
||||
export interface CreateTemplateRequest {
|
||||
readonly name: string
|
||||
readonly display_name?: string
|
||||
readonly description?: string
|
||||
readonly icon?: string
|
||||
readonly template_version_id: string
|
||||
@@ -612,6 +613,7 @@ export interface Template {
|
||||
readonly updated_at: string
|
||||
readonly organization_id: string
|
||||
readonly name: string
|
||||
readonly display_name: string
|
||||
readonly provisioner: ProvisionerType
|
||||
readonly active_version_id: string
|
||||
readonly workspace_owner_count: number
|
||||
@@ -696,6 +698,7 @@ export interface UpdateTemplateACL {
|
||||
// From codersdk/templates.go
|
||||
export interface UpdateTemplateMeta {
|
||||
readonly name?: string
|
||||
readonly display_name?: string
|
||||
readonly description?: string
|
||||
readonly icon?: string
|
||||
readonly default_ttl_ms?: number
|
||||
|
||||
@@ -69,6 +69,7 @@ export const TemplateSettingsForm: FC<TemplateSettingsForm> = ({
|
||||
useFormik<UpdateTemplateMeta>({
|
||||
initialValues: {
|
||||
name: template.name,
|
||||
display_name: template.display_name,
|
||||
description: template.description,
|
||||
// on display, convert from ms => hours
|
||||
default_ttl_ms: template.default_ttl_ms / MS_HOUR_CONVERSION,
|
||||
|
||||
@@ -24,6 +24,7 @@ const renderTemplateSettingsPage = async () => {
|
||||
|
||||
const validFormValues = {
|
||||
name: "Name",
|
||||
display_name: "Test Template",
|
||||
description: "A description",
|
||||
icon: "A string",
|
||||
default_ttl_ms: 1,
|
||||
|
||||
@@ -189,6 +189,7 @@ export const MockTemplate: TypesGen.Template = {
|
||||
updated_at: "2022-05-18T17:39:01.382927298Z",
|
||||
organization_id: MockOrganization.id,
|
||||
name: "test-template",
|
||||
display_name: "Test Template",
|
||||
provisioner: MockProvisioner.provisioners[0],
|
||||
active_version_id: MockTemplateVersion.id,
|
||||
workspace_owner_count: 2,
|
||||
|
||||
Reference in New Issue
Block a user