Skip to content

Commit 063538a

Browse files
committed
not now pls
1 parent 84f8785 commit 063538a

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

dogfood/coder/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ data "coder_parameter" "image_type" {
4242
type = "string"
4343
name = "Coder Image"
4444
default = "codercom/oss-dogfood:latest"
45-
description = "The Docker image used to run your workspace. Choose between nix and non-nix images."
45+
description = "The Docker image used to run your workspace."
4646
option {
47-
icon = "/icon/coder.svg"
48-
name = "Dogfood (Default)"
47+
icon = "/icon/ubuntu.svg"
48+
name = "Dogfood Ubuntu"
4949
value = "codercom/oss-dogfood:latest"
5050
}
5151
option {

site/src/pages/CreateWorkspacePage/CreateWorkspaceExperimentRouter.tsx

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import CreateWorkspacePageExperimental from "./CreateWorkspacePageExperimental";
55
import { useParams } from "react-router-dom";
66
import { useQuery } from "react-query";
77
import { templateByName } from "api/queries/templates";
8+
import { Loader } from "components/Loader/Loader";
9+
import { ErrorAlert } from "components/Alert/ErrorAlert";
810

911
const CreateWorkspaceExperimentRouter: FC = () => {
1012
const { experiments } = useDashboard();
@@ -13,20 +15,36 @@ const CreateWorkspaceExperimentRouter: FC = () => {
1315
const { organization: organizationName = "default", template: templateName } =
1416
useParams() as { organization?: string; template: string };
1517
const templateQuery = useQuery(
16-
templateByName(organizationName, templateName),
17-
);
18-
19-
const something = JSON.parse(
20-
localStorage.getItem(`parameters.${templateQuery.data?.id}.optOut`) ?? "",
18+
dynamicParametersEnabled
19+
? templateByName(organizationName, templateName)
20+
: { enabled: false },
2121
);
2222

2323
if (dynamicParametersEnabled) {
24-
return <CreateWorkspacePageExperimental />;
24+
if (templateQuery.isLoading) {
25+
return <Loader />;
26+
}
27+
28+
if (!templateQuery.data) {
29+
return <ErrorAlert error={templateQuery.error} />;
30+
}
31+
32+
const hasOptedOut =
33+
localStorage.Item(`parameters.${templateQuery.data.id}.optOut`) == "true";
34+
return (
35+
<CreateWorkspaceContext.Provider value={{}}>
36+
{hasOptedOut ? (
37+
<CreateWorkspacePage />
38+
) : (
39+
<CreateWorkspacePageExperimental />
40+
)}
41+
</CreateWorkspaceContext.Provider>
42+
);
2543
}
2644

2745
return <CreateWorkspacePage />;
2846
};
2947

3048
export default CreateWorkspaceExperimentRouter;
3149

32-
const CreateWorkspaceProvider = createContext(undefined);
50+
const CreateWorkspaceContext = createContext<{}>({});

0 commit comments

Comments
 (0)