mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: populate default created_by and add not-null constraint in templates (#2290)
This commit is contained in:
@@ -247,7 +247,7 @@ export interface Template {
|
||||
readonly description: string
|
||||
readonly max_ttl_ms: number
|
||||
readonly min_autostart_interval_ms: number
|
||||
readonly created_by_id?: string
|
||||
readonly created_by_id: string
|
||||
readonly created_by_name: string
|
||||
}
|
||||
|
||||
|
||||
@@ -23,12 +23,3 @@ UsedByMany.args = {
|
||||
},
|
||||
activeVersion: Mocks.MockTemplateVersion,
|
||||
}
|
||||
|
||||
export const UnknownCreator = Template.bind({})
|
||||
UnknownCreator.args = {
|
||||
template: {
|
||||
...Mocks.MockTemplate,
|
||||
created_by_name: "",
|
||||
},
|
||||
activeVersion: Mocks.MockTemplateVersion,
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ const Language = {
|
||||
userPlural: "users",
|
||||
userSingular: "user",
|
||||
createdByLabel: "Created by",
|
||||
defaultTemplateCreator: "<unknown>",
|
||||
}
|
||||
|
||||
export interface TemplateStatsProps {
|
||||
@@ -50,7 +49,7 @@ export const TemplateStats: FC<TemplateStatsProps> = ({ template, activeVersion
|
||||
<div className={styles.statsDivider} />
|
||||
<div className={styles.statItem}>
|
||||
<span className={styles.statsLabel}>{Language.createdByLabel}</span>
|
||||
<span className={styles.statsValue}>{template.created_by_name || Language.defaultTemplateCreator}</span>
|
||||
<span className={styles.statsValue}>{template.created_by_name}</span>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
@@ -50,7 +50,6 @@ export const Language = {
|
||||
templateTooltipText: "With templates you can create a common configuration for your workspaces using Terraform.",
|
||||
templateTooltipLink: "Manage templates",
|
||||
createdByLabel: "Created by",
|
||||
defaultTemplateCreator: "<unknown>",
|
||||
}
|
||||
|
||||
const TemplateHelpTooltip: React.FC = () => {
|
||||
@@ -140,7 +139,7 @@ export const TemplatesPageView: FC<TemplatesPageViewProps> = (props) => {
|
||||
<TableCell>{Language.developerCount(template.workspace_owner_count)}</TableCell>
|
||||
|
||||
<TableCell data-chromatic="ignore">{dayjs().to(dayjs(template.updated_at))}</TableCell>
|
||||
<TableCell>{template.created_by_name || Language.defaultTemplateCreator}</TableCell>
|
||||
<TableCell>{template.created_by_name}</TableCell>
|
||||
<TableCell>
|
||||
<div className={styles.arrowCell}>
|
||||
<KeyboardArrowRight className={styles.arrowRight} />
|
||||
|
||||
Reference in New Issue
Block a user