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

feat: add warning about use of old/removed/invalid experiments#12962

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
dannykopping merged 14 commits intocoder:mainfromdannykopping:dk/old-exps
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
14 commits
Select commitHold shift + click to select a range
4ab6e9c
Add experiments detail API & tests
dannykoppingApr 15, 2024
c65406e
make site/src/api/typesGenerated.ts
dannykoppingApr 15, 2024
31d5d60
Render invalid experiments warning
dannykoppingApr 15, 2024
bd10174
make gen
dannykoppingApr 15, 2024
ead1d7e
make site/src/api/typesGenerated.ts
dannykoppingApr 15, 2024
5e5f2ac
Reset all backend changes
dannykoppingApr 16, 2024
54f2462
Moving towards frontend-only solution
dannykoppingApr 16, 2024
acb0d03
Add storybook test
dannykoppingApr 16, 2024
66f7ef4
Appeasing the linter
dannykoppingApr 16, 2024
61d6595
Merge branch 'main' of github.com:/coder/coder into dk/old-exps
dannykoppingApr 17, 2024
69b26cb
Review feedback
dannykoppingApr 17, 2024
8836f25
Fixing e2e tests by displaying safe but unset experiments which was t…
dannykoppingApr 17, 2024
a604f17
Review comments
dannykoppingApr 17, 2024
236dc9d
make fmt
dannykoppingApr 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3,7 +3,7 @@ import { Helmet } from "react-helmet-async";
import { useQuery } from "react-query";
import { deploymentDAUs } from "api/queries/deployment";
import { entitlements } from "api/queries/entitlements";
import { availableExperiments } from "api/queries/experiments";
import { availableExperiments, experiments } from "api/queries/experiments";
import { pageTitle } from "utils/page";
import { useDeploySettings } from "../DeploySettingsLayout";
import { GeneralSettingsPageView } from "./GeneralSettingsPageView";
Expand All@@ -12,7 +12,14 @@ const GeneralSettingsPage: FC = () => {
const { deploymentValues } = useDeploySettings();
const deploymentDAUsQuery = useQuery(deploymentDAUs());
const entitlementsQuery = useQuery(entitlements());
const experimentsQuery = useQuery(availableExperiments());
const enabledExperimentsQuery = useQuery(experiments());
const safeExperimentsQuery = useQuery(availableExperiments());

const safeExperiments = safeExperimentsQuery.data?.safe ?? [];
const invalidExperiments =
enabledExperimentsQuery.data?.filter((exp) => {
return !safeExperiments.includes(exp);
}) ?? [];

return (
<>
Expand All@@ -24,7 +31,8 @@ const GeneralSettingsPage: FC = () => {
deploymentDAUs={deploymentDAUsQuery.data}
deploymentDAUsError={deploymentDAUsQuery.error}
entitlements={entitlementsQuery.data}
safeExperiments={experimentsQuery.data?.safe ?? []}
invalidExperiments={invalidExperiments}
safeExperiments={safeExperiments}
/>
</>
);
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,6 +40,7 @@ const meta: Meta<typeof GeneralSettingsPageView> = {
},
],
deploymentDAUs: MockDeploymentDAUResponse,
invalidExperiments: [],
safeExperiments: [],
},
};
Expand DownExpand Up@@ -102,6 +103,43 @@ export const allExperimentsEnabled: Story = {
hidden: false,
},
],
safeExperiments: [],
safeExperiments: ["shared-ports"],
invalidExperiments: ["invalid"],
},
};

export const invalidExperimentsEnabled: Story = {
args: {
deploymentOptions: [
{
name: "Access URL",
description:
"The URL that users will use to access the Coder deployment.",
flag: "access-url",
flag_shorthand: "",
value: "https://dev.coder.com",
hidden: false,
},
{
name: "Wildcard Access URL",
description:
'Specifies the wildcard hostname to use for workspace applications in the form "*.example.com".',
flag: "wildcard-access-url",
flag_shorthand: "",
value: "*--apps.dev.coder.com",
hidden: false,
},
{
name: "Experiments",
description:
"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.",
flag: "experiments",
value: ["invalid", "*"],
flag_shorthand: "",
hidden: false,
},
],
safeExperiments: ["shared-ports"],
invalidExperiments: ["invalid"],
},
};
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
import AlertTitle from "@mui/material/AlertTitle";
import type { FC } from "react";
import type {
SerpentOption,
Expand All@@ -13,6 +14,7 @@ import { ErrorAlert } from "components/Alert/ErrorAlert";
import { Stack } from "components/Stack/Stack";
import { useDeploymentOptions } from "utils/deployOptions";
import { docs } from "utils/docs";
import { Alert } from "../../../components/Alert/Alert";
import { Header } from "../Header";
import OptionsTable from "../OptionsTable";
import { ChartSection } from "./ChartSection";
Expand All@@ -22,7 +24,8 @@ export type GeneralSettingsPageViewProps = {
deploymentDAUs?: DAUsResponse;
deploymentDAUsError: unknown;
entitlements: Entitlements | undefined;
safeExperiments: Experiments | undefined;
readonly invalidExperiments: Experiments | string[];
readonly safeExperiments: Experiments | string[];
};

export const GeneralSettingsPageView: FC<GeneralSettingsPageViewProps> = ({
Expand All@@ -31,6 +34,7 @@ export const GeneralSettingsPageView: FC<GeneralSettingsPageViewProps> = ({
deploymentDAUsError,
entitlements,
safeExperiments,
invalidExperiments,
}) => {
return (
<>
Expand DownExpand Up@@ -58,6 +62,28 @@ export const GeneralSettingsPageView: FC<GeneralSettingsPageViewProps> = ({
</ChartSection>
</div>
)}
{invalidExperiments.length > 0 && (
<Alert severity="warning">
<AlertTitle>Invalid experiments in use:</AlertTitle>
<ul>
{invalidExperiments.map((it) => (
<li key={it}>
<pre>{it}</pre>
</li>
))}
</ul>
It is recommended that you remove these experiments from your
configuration as they have no effect. See{" "}
<a
href="https://coder.com/docs/v2/latest/cli/server#--experiments"
target="_blank"
rel="noreferrer"
>
the documentation
</a>{" "}
for more details.
</Alert>
)}
<OptionsTable
options={useDeploymentOptions(
deploymentOptions,
Expand Down
6 changes: 3 additions & 3 deletionssite/src/pages/DeploySettingsPage/Option.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
import { css, type Interpolation, type Theme, useTheme } from "@emotion/react";
importCheckCircleOutlined from "@mui/icons-material/CheckCircleOutlined";
importBuildCircleOutlinedIcon from "@mui/icons-material/BuildCircleOutlined";
import type { FC, HTMLAttributes, PropsWithChildren } from "react";
import { DisabledBadge, EnabledBadge } from "components/Badges/Badges";
import { MONOSPACE_FONT_FAMILY } from "theme/constants";
Expand DownExpand Up@@ -91,11 +91,11 @@ export const OptionValue: FC<OptionValueProps> = (props) => {
}}
>
{isEnabled && (
<CheckCircleOutlined
<BuildCircleOutlinedIcon
css={(theme) => ({
width: 16,
height: 16,
color: theme.palette.success.light,
color: theme.palette.mode,
margin: "0 8px",
})}
/>
Expand Down
14 changes: 7 additions & 7 deletionssite/src/pages/DeploySettingsPage/optionValue.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,13 +38,13 @@ export function optionValue(
([key, value]) => `"${key}"->"${value}"`,
);
case "Experiments": {
const experimentMap:Record<string, boolean> | undefined =
additionalValues?.reduce(
(acc, v) => {
return{ ...acc, [v]: option.value.includes("*") ? true : false };
},
{} as Record<string, boolean>,
);
const experimentMap = additionalValues?.reduce<Record<string, boolean>>(
(acc, v) => {
acc[v] = option.value.includes("*");
return acc;
},
{},
);

if (!experimentMap) {
break;
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp