Skip to content

Commit e28639e

Browse files
committed
Format
1 parent 6719ed6 commit e28639e

File tree

2 files changed

+93
-92
lines changed

2 files changed

+93
-92
lines changed

site/src/pages/TemplatePage/TemplatePageView.tsx

Lines changed: 91 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const TemplatePageView: FC<React.PropsWithChildren<TemplatePageViewProps>
5151
templateVersions,
5252
handleDeleteTemplate,
5353
deleteTemplateError,
54-
canDeleteTemplate
54+
canDeleteTemplate,
5555
}) => {
5656
const styles = useStyles()
5757
const readme = frontMatter(activeTemplateVersion.readme)
@@ -61,102 +61,103 @@ export const TemplatePageView: FC<React.PropsWithChildren<TemplatePageViewProps>
6161
return resources.filter((resource) => resource.workspace_transition === "start")
6262
}
6363

64-
const createWorkspaceButton = (className: string) => <Link
65-
underline="none"
66-
component={RouterLink}
67-
to={`/templates/${template.name}/workspace`}
68-
>
69-
<Button className={className} startIcon={<AddCircleOutline />}>{Language.createButton}</Button>
70-
</Link>
71-
64+
const createWorkspaceButton = (className: string) => (
65+
<Link underline="none" component={RouterLink} to={`/templates/${template.name}/workspace`}>
66+
<Button className={className} startIcon={<AddCircleOutline />}>
67+
{Language.createButton}
68+
</Button>
69+
</Link>
70+
)
7271

7372
return (
7473
<Margins>
7574
<>
76-
{deleteTemplateError && <ErrorSummary error={deleteTemplateError} dismissible />}
77-
<PageHeader
78-
actions={
79-
<Stack direction="row" spacing={1}>
80-
<Link
81-
underline="none"
82-
component={RouterLink}
83-
to={`/templates/${template.name}/settings`}
84-
>
85-
<Button variant="outlined" startIcon={<SettingsOutlined />}>
86-
{Language.settingsButton}
87-
</Button>
88-
</Link>
75+
{deleteTemplateError && <ErrorSummary error={deleteTemplateError} dismissible />}
76+
<PageHeader
77+
actions={
78+
<Stack direction="row" spacing={1}>
79+
<Link
80+
underline="none"
81+
component={RouterLink}
82+
to={`/templates/${template.name}/settings`}
83+
>
84+
<Button variant="outlined" startIcon={<SettingsOutlined />}>
85+
{Language.settingsButton}
86+
</Button>
87+
</Link>
8988

90-
{canDeleteTemplate ?
91-
<DropdownButton
92-
primaryAction={createWorkspaceButton(styles.actionButton)}
93-
secondaryActions={[
94-
{
95-
action: "delete",
96-
button: <DeleteButton handleAction={() => handleDeleteTemplate(template.id)} />,
97-
},
98-
]}
99-
canCancel={false}
100-
/>
101-
:
102-
createWorkspaceButton("")
103-
}
89+
{canDeleteTemplate ? (
90+
<DropdownButton
91+
primaryAction={createWorkspaceButton(styles.actionButton)}
92+
secondaryActions={[
93+
{
94+
action: "delete",
95+
button: (
96+
<DeleteButton handleAction={() => handleDeleteTemplate(template.id)} />
97+
),
98+
},
99+
]}
100+
canCancel={false}
101+
/>
102+
) : (
103+
createWorkspaceButton("")
104+
)}
105+
</Stack>
106+
}
107+
>
108+
<Stack direction="row" spacing={3} className={styles.pageTitle}>
109+
<div>
110+
{hasIcon ? (
111+
<div className={styles.iconWrapper}>
112+
<img src={template.icon} alt="" />
113+
</div>
114+
) : (
115+
<Avatar className={styles.avatar}>{firstLetter(template.name)}</Avatar>
116+
)}
117+
</div>
118+
<div>
119+
<PageHeaderTitle>{template.name}</PageHeaderTitle>
120+
<PageHeaderSubtitle>
121+
{template.description === "" ? Language.noDescription : template.description}
122+
</PageHeaderSubtitle>
123+
</div>
104124
</Stack>
105-
}
106-
>
107-
<Stack direction="row" spacing={3} className={styles.pageTitle}>
108-
<div>
109-
{hasIcon ? (
110-
<div className={styles.iconWrapper}>
111-
<img src={template.icon} alt="" />
112-
</div>
113-
) : (
114-
<Avatar className={styles.avatar}>{firstLetter(template.name)}</Avatar>
115-
)}
116-
</div>
117-
<div>
118-
<PageHeaderTitle>{template.name}</PageHeaderTitle>
119-
<PageHeaderSubtitle>
120-
{template.description === "" ? Language.noDescription : template.description}
121-
</PageHeaderSubtitle>
122-
</div>
123-
</Stack>
124-
</PageHeader>
125+
</PageHeader>
125126

126-
<Stack spacing={2.5}>
127-
<TemplateStats template={template} activeVersion={activeTemplateVersion} />
128-
<WorkspaceSection
129-
title={Language.resourcesTitle}
130-
contentsProps={{ className: styles.resourcesTableContents }}
131-
>
132-
<TemplateResourcesTable resources={getStartedResources(templateResources)} />
133-
</WorkspaceSection>
134-
<WorkspaceSection
135-
title={Language.readmeTitle}
136-
contentsProps={{ className: styles.readmeContents }}
137-
>
138-
<div className={styles.markdownWrapper}>
139-
<ReactMarkdown
140-
components={{
141-
a: ({ href, target, children }) => (
142-
<Link href={href} target={target}>
143-
{children}
144-
</Link>
145-
),
146-
}}
147-
>
148-
{readme.body}
149-
</ReactMarkdown>
150-
</div>
151-
</WorkspaceSection>
152-
<WorkspaceSection
153-
title={Language.versionsTitle}
154-
contentsProps={{ className: styles.versionsTableContents }}
155-
>
156-
<VersionsTable versions={templateVersions} />
157-
</WorkspaceSection>
158-
</Stack>
159-
</>
127+
<Stack spacing={2.5}>
128+
<TemplateStats template={template} activeVersion={activeTemplateVersion} />
129+
<WorkspaceSection
130+
title={Language.resourcesTitle}
131+
contentsProps={{ className: styles.resourcesTableContents }}
132+
>
133+
<TemplateResourcesTable resources={getStartedResources(templateResources)} />
134+
</WorkspaceSection>
135+
<WorkspaceSection
136+
title={Language.readmeTitle}
137+
contentsProps={{ className: styles.readmeContents }}
138+
>
139+
<div className={styles.markdownWrapper}>
140+
<ReactMarkdown
141+
components={{
142+
a: ({ href, target, children }) => (
143+
<Link href={href} target={target}>
144+
{children}
145+
</Link>
146+
),
147+
}}
148+
>
149+
{readme.body}
150+
</ReactMarkdown>
151+
</div>
152+
</WorkspaceSection>
153+
<WorkspaceSection
154+
title={Language.versionsTitle}
155+
contentsProps={{ className: styles.versionsTableContents }}
156+
>
157+
<VersionsTable versions={templateVersions} />
158+
</WorkspaceSection>
159+
</Stack>
160+
</>
160161
</Margins>
161162
)
162163
}

site/src/xServices/auth/authXService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ export const permissionsToCheck = {
4545
},
4646
[checks.deleteTemplates]: {
4747
object: {
48-
resource_type: "template"
48+
resource_type: "template",
4949
},
50-
action: "delete"
50+
action: "delete",
5151
},
5252
[checks.viewAuditLog]: {
5353
object: {

0 commit comments

Comments
 (0)