Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb85d5d8

Browse files
authored
feat: add warning about use of old/removed/invalid experiments (#12962)
1 parentcb8c576 commitb85d5d8

File tree

5 files changed

+87
-15
lines changed

5 files changed

+87
-15
lines changed

‎site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPage.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Helmet } from "react-helmet-async";
33
import{useQuery}from"react-query";
44
import{deploymentDAUs}from"api/queries/deployment";
55
import{entitlements}from"api/queries/entitlements";
6-
import{availableExperiments}from"api/queries/experiments";
6+
import{availableExperiments,experiments}from"api/queries/experiments";
77
import{pageTitle}from"utils/page";
88
import{useDeploySettings}from"../DeploySettingsLayout";
99
import{GeneralSettingsPageView}from"./GeneralSettingsPageView";
@@ -12,7 +12,14 @@ const GeneralSettingsPage: FC = () => {
1212
const{ deploymentValues}=useDeploySettings();
1313
constdeploymentDAUsQuery=useQuery(deploymentDAUs());
1414
constentitlementsQuery=useQuery(entitlements());
15-
constexperimentsQuery=useQuery(availableExperiments());
15+
constenabledExperimentsQuery=useQuery(experiments());
16+
constsafeExperimentsQuery=useQuery(availableExperiments());
17+
18+
constsafeExperiments=safeExperimentsQuery.data?.safe??[];
19+
constinvalidExperiments=
20+
enabledExperimentsQuery.data?.filter((exp)=>{
21+
return!safeExperiments.includes(exp);
22+
})??[];
1623

1724
return(
1825
<>
@@ -24,7 +31,8 @@ const GeneralSettingsPage: FC = () => {
2431
deploymentDAUs={deploymentDAUsQuery.data}
2532
deploymentDAUsError={deploymentDAUsQuery.error}
2633
entitlements={entitlementsQuery.data}
27-
safeExperiments={experimentsQuery.data?.safe??[]}
34+
invalidExperiments={invalidExperiments}
35+
safeExperiments={safeExperiments}
2836
/>
2937
</>
3038
);

‎site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPageView.stories.tsx

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ const meta: Meta<typeof GeneralSettingsPageView> = {
4040
},
4141
],
4242
deploymentDAUs:MockDeploymentDAUResponse,
43+
invalidExperiments:[],
4344
safeExperiments:[],
4445
},
4546
};
@@ -102,6 +103,43 @@ export const allExperimentsEnabled: Story = {
102103
hidden:false,
103104
},
104105
],
105-
safeExperiments:[],
106+
safeExperiments:["shared-ports"],
107+
invalidExperiments:["invalid"],
108+
},
109+
};
110+
111+
exportconstinvalidExperimentsEnabled:Story={
112+
args:{
113+
deploymentOptions:[
114+
{
115+
name:"Access URL",
116+
description:
117+
"The URL that users will use to access the Coder deployment.",
118+
flag:"access-url",
119+
flag_shorthand:"",
120+
value:"https://dev.coder.com",
121+
hidden:false,
122+
},
123+
{
124+
name:"Wildcard Access URL",
125+
description:
126+
'Specifies the wildcard hostname to use for workspace applications in the form "*.example.com".',
127+
flag:"wildcard-access-url",
128+
flag_shorthand:"",
129+
value:"*--apps.dev.coder.com",
130+
hidden:false,
131+
},
132+
{
133+
name:"Experiments",
134+
description:
135+
"Enable one or more experiments. These are not ready for production. Separate multiple experiments with commas, or enter '*' to opt-in to all available experiments.",
136+
flag:"experiments",
137+
value:["invalid","*"],
138+
flag_shorthand:"",
139+
hidden:false,
140+
},
141+
],
142+
safeExperiments:["shared-ports"],
143+
invalidExperiments:["invalid"],
106144
},
107145
};

‎site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPageView.tsx

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
importAlertTitlefrom"@mui/material/AlertTitle";
12
importtype{FC}from"react";
23
importtype{
34
SerpentOption,
@@ -13,6 +14,7 @@ import { ErrorAlert } from "components/Alert/ErrorAlert";
1314
import{Stack}from"components/Stack/Stack";
1415
import{useDeploymentOptions}from"utils/deployOptions";
1516
import{docs}from"utils/docs";
17+
import{Alert}from"../../../components/Alert/Alert";
1618
import{Header}from"../Header";
1719
importOptionsTablefrom"../OptionsTable";
1820
import{ChartSection}from"./ChartSection";
@@ -22,7 +24,8 @@ export type GeneralSettingsPageViewProps = {
2224
deploymentDAUs?:DAUsResponse;
2325
deploymentDAUsError:unknown;
2426
entitlements:Entitlements|undefined;
25-
safeExperiments:Experiments|undefined;
27+
readonlyinvalidExperiments:Experiments|string[];
28+
readonlysafeExperiments:Experiments|string[];
2629
};
2730

2831
exportconstGeneralSettingsPageView:FC<GeneralSettingsPageViewProps>=({
@@ -31,6 +34,7 @@ export const GeneralSettingsPageView: FC<GeneralSettingsPageViewProps> = ({
3134
deploymentDAUsError,
3235
entitlements,
3336
safeExperiments,
37+
invalidExperiments,
3438
})=>{
3539
return(
3640
<>
@@ -58,6 +62,28 @@ export const GeneralSettingsPageView: FC<GeneralSettingsPageViewProps> = ({
5862
</ChartSection>
5963
</div>
6064
)}
65+
{invalidExperiments.length>0&&(
66+
<Alertseverity="warning">
67+
<AlertTitle>Invalid experiments in use:</AlertTitle>
68+
<ul>
69+
{invalidExperiments.map((it)=>(
70+
<likey={it}>
71+
<pre>{it}</pre>
72+
</li>
73+
))}
74+
</ul>
75+
It is recommended that you remove these experiments from your
76+
configuration as they have no effect. See{" "}
77+
<a
78+
href="https://coder.com/docs/v2/latest/cli/server#--experiments"
79+
target="_blank"
80+
rel="noreferrer"
81+
>
82+
the documentation
83+
</a>{" "}
84+
for more details.
85+
</Alert>
86+
)}
6187
<OptionsTable
6288
options={useDeploymentOptions(
6389
deploymentOptions,

‎site/src/pages/DeploySettingsPage/Option.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import{css,typeInterpolation,typeTheme,useTheme}from"@emotion/react";
2-
importCheckCircleOutlinedfrom"@mui/icons-material/CheckCircleOutlined";
2+
importBuildCircleOutlinedIconfrom"@mui/icons-material/BuildCircleOutlined";
33
importtype{FC,HTMLAttributes,PropsWithChildren}from"react";
44
import{DisabledBadge,EnabledBadge}from"components/Badges/Badges";
55
import{MONOSPACE_FONT_FAMILY}from"theme/constants";
@@ -91,11 +91,11 @@ export const OptionValue: FC<OptionValueProps> = (props) => {
9191
}}
9292
>
9393
{isEnabled&&(
94-
<CheckCircleOutlined
94+
<BuildCircleOutlinedIcon
9595
css={(theme)=>({
9696
width:16,
9797
height:16,
98-
color:theme.palette.success.light,
98+
color:theme.palette.mode,
9999
margin:"0 8px",
100100
})}
101101
/>

‎site/src/pages/DeploySettingsPage/optionValue.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ export function optionValue(
3838
([key,value])=>`"${key}"->"${value}"`,
3939
);
4040
case"Experiments":{
41-
constexperimentMap:Record<string,boolean>|undefined=
42-
additionalValues?.reduce(
43-
(acc,v)=>{
44-
return{ ...acc,[v]:option.value.includes("*") ?true :false};
45-
},
46-
{}asRecord<string,boolean>,
47-
);
41+
constexperimentMap=additionalValues?.reduce<Record<string,boolean>>(
42+
(acc,v)=>{
43+
acc[v]=option.value.includes("*");
44+
returnacc;
45+
},
46+
{},
47+
);
4848

4949
if(!experimentMap){
5050
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp