File tree Expand file tree Collapse file tree 3 files changed +36
-41
lines changed
pages/TemplatePage/TemplateSummaryPage Expand file tree Collapse file tree 3 files changed +36
-41
lines changed Original file line number Diff line number Diff line change
1
+ import { FC } from "react"
2
+ import * as TypesGen from "api/typesGenerated"
3
+ import { AlertBanner } from "components/AlertBanner/AlertBanner"
4
+ import { Maybe } from "components/Conditionals/Maybe"
5
+ import Link from "@material-ui/core/Link"
6
+
7
+ export interface TemplateVersionWarnings {
8
+ warnings ?: TypesGen . TemplateVersionWarning [ ]
9
+ }
10
+
11
+ export const TemplateVersionWarnings : FC <
12
+ React . PropsWithChildren < TemplateVersionWarnings >
13
+ > = ( { warnings } ) => {
14
+ if ( ! warnings ) {
15
+ return < > </ >
16
+ }
17
+
18
+ return (
19
+ < Maybe condition = { Boolean ( warnings . includes ( "DEPRECATED_PARAMETERS" ) ) } >
20
+ < AlertBanner severity = "warning" >
21
+ < div >
22
+ This template uses legacy parameters which will be deprecated in the
23
+ next Coder release. Learn how to migrate in{ " " }
24
+ < Link href = "https://coder.com/docs/v2/latest/templates/parameters#migration" >
25
+ our documentation
26
+ </ Link >
27
+ .
28
+ </ div >
29
+ </ AlertBanner >
30
+ </ Maybe >
31
+ )
32
+ }
Original file line number Diff line number Diff line change @@ -26,8 +26,7 @@ import {
26
26
PageHeaderTitle ,
27
27
PageHeaderSubtitle ,
28
28
} from "components/PageHeader/FullWidthPageHeader"
29
- import { Maybe } from "components/Conditionals/Maybe"
30
- import { Link } from "@material-ui/core"
29
+ import { TemplateVersionWarnings } from "components/TemplateVersionWarnings/TemplateVersionWarnings"
31
30
32
31
export enum WorkspaceErrors {
33
32
GET_BUILDS_ERROR = "getBuildsError" ,
@@ -190,24 +189,7 @@ export const Workspace: FC<React.PropsWithChildren<WorkspaceProps>> = ({
190
189
handleClick = { ( ) => navigate ( `/templates` ) }
191
190
/>
192
191
193
- { templateWarnings && (
194
- < Maybe
195
- condition = { Boolean (
196
- templateWarnings . includes ( "DEPRECATED_PARAMETERS" ) ,
197
- ) }
198
- >
199
- < AlertBanner severity = "warning" >
200
- < div >
201
- This template uses legacy parameters which will be deprecated
202
- in the next Coder release. Learn how to migrate in{ " " }
203
- < Link href = "https://coder.com/docs/v2/latest/templates/parameters#migration" >
204
- our documentation
205
- </ Link >
206
- .
207
- </ div >
208
- </ AlertBanner >
209
- </ Maybe >
210
- ) }
192
+ < TemplateVersionWarnings warnings = { templateWarnings } />
211
193
212
194
{ failedBuildLogs && (
213
195
< Stack >
Original file line number Diff line number Diff line change @@ -11,9 +11,7 @@ import { FC, useEffect } from "react"
11
11
import { DAUChart } from "../../../components/DAUChart/DAUChart"
12
12
import { TemplateSummaryData } from "./data"
13
13
import { useLocation , useNavigate } from "react-router-dom"
14
- import { Maybe } from "components/Conditionals/Maybe"
15
- import { AlertBanner } from "components/AlertBanner/AlertBanner"
16
- import Link from "@material-ui/core/Link"
14
+ import { TemplateVersionWarnings } from "components/TemplateVersionWarnings/TemplateVersionWarnings"
17
15
18
16
export interface TemplateSummaryPageViewProps {
19
17
data ?: TemplateSummaryData
@@ -51,24 +49,7 @@ export const TemplateSummaryPageView: FC<TemplateSummaryPageViewProps> = ({
51
49
52
50
return (
53
51
< Stack spacing = { 4 } >
54
- { activeVersion . warnings && (
55
- < Maybe
56
- condition = { Boolean (
57
- activeVersion . warnings . includes ( "DEPRECATED_PARAMETERS" ) ,
58
- ) }
59
- >
60
- < AlertBanner severity = "warning" >
61
- < div >
62
- This template uses legacy parameters which will be deprecated in
63
- the next Coder release. Learn how to migrate in{ " " }
64
- < Link href = "https://coder.com/docs/v2/latest/templates/parameters#migration" >
65
- our documentation
66
- </ Link >
67
- .
68
- </ div >
69
- </ AlertBanner >
70
- </ Maybe >
71
- ) }
52
+ < TemplateVersionWarnings warnings = { activeVersion . warnings } />
72
53
< TemplateStats template = { template } activeVersion = { activeVersion } />
73
54
{ daus && < DAUChart daus = { daus } /> }
74
55
< TemplateResourcesTable resources = { getStartedResources ( resources ) } />
You can’t perform that action at this time.
0 commit comments