From ff035350fe5a1d6675082ad2e08f4ff2a48e605a Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Thu, 5 Jan 2023 19:33:31 +0000 Subject: [PATCH 1/3] refactor: split GeneralSettings page <> View --- site/src/AppRouter.tsx | 5 ++++- .../GeneralSettingsPage.tsx | 20 +++++++++++++++++++ .../GeneralSettingsPageView.tsx} | 20 ++++++++----------- 3 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPage.tsx rename site/src/pages/DeploySettingsPage/{GeneralSettingsPage.tsx => GeneralSettingsPage/GeneralSettingsPageView.tsx} (55%) diff --git a/site/src/AppRouter.tsx b/site/src/AppRouter.tsx index 58d32623649b0..237f22152b39e 100644 --- a/site/src/AppRouter.tsx +++ b/site/src/AppRouter.tsx @@ -71,7 +71,10 @@ const SettingsGroupPage = lazy( () => import("./pages/GroupsPage/SettingsGroupPage"), ) const GeneralSettingsPage = lazy( - () => import("./pages/DeploySettingsPage/GeneralSettingsPage"), + () => + import( + "./pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPage" + ), ) const SecuritySettingsPage = lazy( () => import("./pages/DeploySettingsPage/SecuritySettingsPage"), diff --git a/site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPage.tsx b/site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPage.tsx new file mode 100644 index 0000000000000..0cb1528a88247 --- /dev/null +++ b/site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPage.tsx @@ -0,0 +1,20 @@ +import { useDeploySettings } from "components/DeploySettingsLayout/DeploySettingsLayout" +import React from "react" +import { Helmet } from "react-helmet-async" +import { pageTitle } from "util/page" +import { GeneralSettingsPageView } from "./GeneralSettingsPageView" + +const GeneralSettingsPage: React.FC = () => { + const { deploymentConfig: deploymentConfig } = useDeploySettings() + + return ( + <> + + Codestin Search App + + + + ) +} + +export default GeneralSettingsPage diff --git a/site/src/pages/DeploySettingsPage/GeneralSettingsPage.tsx b/site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPageView.tsx similarity index 55% rename from site/src/pages/DeploySettingsPage/GeneralSettingsPage.tsx rename to site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPageView.tsx index 26a39f4dbb858..e5e20760c0c62 100644 --- a/site/src/pages/DeploySettingsPage/GeneralSettingsPage.tsx +++ b/site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPageView.tsx @@ -1,18 +1,16 @@ -import { useDeploySettings } from "components/DeploySettingsLayout/DeploySettingsLayout" +import { DeploymentConfig } from "api/typesGenerated" import { Header } from "components/DeploySettingsLayout/Header" import OptionsTable from "components/DeploySettingsLayout/OptionsTable" -import React from "react" -import { Helmet } from "react-helmet-async" -import { pageTitle } from "util/page" - -const GeneralSettingsPage: React.FC = () => { - const { deploymentConfig: deploymentConfig } = useDeploySettings() +export type GeneralSettingsPageViewProps = { + deploymentConfig: Pick +} +export const GeneralSettingsPageView = ({ + deploymentConfig, +}: GeneralSettingsPageViewProps): JSX.Element => { + console.log(deploymentConfig, " is this") return ( <> - - Codestin Search App -
{ ) } - -export default GeneralSettingsPage From 3e77eccd1494e98f6f874cfc63d5f3201bbce008 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Thu, 5 Jan 2023 19:33:40 +0000 Subject: [PATCH 2/3] feat: add story for generalsettingspageview --- .../GeneralSettingsPageView.stories.tsx | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPageView.stories.tsx diff --git a/site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPageView.stories.tsx b/site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPageView.stories.tsx new file mode 100644 index 0000000000000..93544a0e5aa0a --- /dev/null +++ b/site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPageView.stories.tsx @@ -0,0 +1,33 @@ +import { ComponentMeta, Story } from "@storybook/react" +import { + GeneralSettingsPageView, + GeneralSettingsPageViewProps, +} from "./GeneralSettingsPageView" + +export default { + title: "pages/GeneralSettingsPageView", + component: GeneralSettingsPageView, + argTypes: { + deploymentConfig: { + defaultValue: { + access_url: { + name: "Access URL", + usage: + "External URL to access your deployment. This must be accessible by all provisioned workspaces.", + value: "https://dev.coder.com", + }, + wildcard_access_url: { + name: "Wildcard Access URL", + usage: + 'Specifies the wildcard hostname to use for workspace applications in the form "*.example.com".', + value: "*--apps.dev.coder.com", + }, + }, + }, + }, +} as ComponentMeta + +const Template: Story = (args) => ( + +) +export const Page = Template.bind({}) From 79285175be8cdd614ebf5876ebcde2d6d8cf72fc Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Thu, 5 Jan 2023 15:56:06 -0700 Subject: [PATCH 3/3] Update site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPageView.tsx Co-authored-by: Asher --- .../GeneralSettingsPage/GeneralSettingsPageView.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPageView.tsx b/site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPageView.tsx index e5e20760c0c62..d68d18ff3a45d 100644 --- a/site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPageView.tsx +++ b/site/src/pages/DeploySettingsPage/GeneralSettingsPage/GeneralSettingsPageView.tsx @@ -8,7 +8,6 @@ export type GeneralSettingsPageViewProps = { export const GeneralSettingsPageView = ({ deploymentConfig, }: GeneralSettingsPageViewProps): JSX.Element => { - console.log(deploymentConfig, " is this") return ( <>