From 0d69b8db525f010526139cb4a5f51a0ef6def006 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Jun 2023 15:35:12 +0000 Subject: [PATCH 1/3] chore: Bump i18next from 21.9.1 to 22.5.0 in /site Bumps [i18next](https://github.com/i18next/i18next) from 21.9.1 to 22.5.0. - [Release notes](https://github.com/i18next/i18next/releases) - [Changelog](https://github.com/i18next/i18next/blob/master/CHANGELOG.md) - [Commits](https://github.com/i18next/i18next/compare/v21.9.1...v22.5.0) --- updated-dependencies: - dependency-name: i18next dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- site/package.json | 2 +- site/yarn.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/site/package.json b/site/package.json index 07d84ae49b50f..2d58280aab27d 100644 --- a/site/package.json +++ b/site/package.json @@ -64,7 +64,7 @@ "formik": "2.4.1", "front-matter": "4.0.2", "history": "5.3.0", - "i18next": "21.9.1", + "i18next": "22.5.0", "jest-environment-jsdom": "29.5.0", "jest-location-mock": "1.0.9", "just-debounce-it": "3.1.1", diff --git a/site/yarn.lock b/site/yarn.lock index 9c68f1eddcac3..845dbf00ac599 100644 --- a/site/yarn.lock +++ b/site/yarn.lock @@ -1004,7 +1004,7 @@ resolved "https://registry.yarnpkg.com/@babel/regjsgen/-/regjsgen-0.8.0.tgz#f0ba69b075e1f05fb2825b7fad991e7adbb18310" integrity sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA== -"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.15.4", "@babel/runtime@^7.17.2", "@babel/runtime@^7.17.8", "@babel/runtime@^7.18.3", "@babel/runtime@^7.20.6", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.0", "@babel/runtime@^7.3.1", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.3", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.12.5", "@babel/runtime@^7.15.4", "@babel/runtime@^7.17.8", "@babel/runtime@^7.18.3", "@babel/runtime@^7.20.6", "@babel/runtime@^7.20.7", "@babel/runtime@^7.21.0", "@babel/runtime@^7.3.1", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.3", "@babel/runtime@^7.8.4", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2": version "7.22.3" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.22.3.tgz#0a7fce51d43adbf0f7b517a71f4c3aaca92ebcbb" integrity sha512-XsDuspWKLUsxwCp6r7EhsExHtYfbe5oAGQ19kqngTdCPUoPQzOPdUbD/pB9PJiwb2ptYKQDjSJT3R6dC+EPqfQ== @@ -6805,12 +6805,12 @@ hyphenate-style-name@^1.0.3: resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.4.tgz#691879af8e220aea5750e8827db4ef62a54e361d" integrity sha512-ygGZLjmXfPHj+ZWh6LwbC37l43MhfztxetbFCoYTM2VjkIUpeHgSNn7QIyVFj7YQ1Wl9Cbw5sholVJPzWvC2MQ== -i18next@21.9.1: - version "21.9.1" - resolved "https://registry.yarnpkg.com/i18next/-/i18next-21.9.1.tgz#9e3428990f5b2cc9ac1b98dd025f3e411c368249" - integrity sha512-ITbDrAjbRR73spZAiu6+ex5WNlHRr1mY+acDi2ioTHuUiviJqSz269Le1xHAf0QaQ6GgIHResUhQNcxGwa/PhA== +i18next@22.5.0: + version "22.5.0" + resolved "https://registry.yarnpkg.com/i18next/-/i18next-22.5.0.tgz#16d98eba7c748ab183a36505046b5b91f87e989b" + integrity sha512-sqWuJFj+wJAKQP2qBQ+b7STzxZNUmnSxrehBCCj9vDOW9RDYPfqCaK1Hbh2frNYQuPziz6O2CGoJPwtzY3vAYA== dependencies: - "@babel/runtime" "^7.17.2" + "@babel/runtime" "^7.20.6" iconv-lite@0.4.24, iconv-lite@^0.4.24: version "0.4.24" From 30523f923b8dada169e563e0e79c3d22b6b01734 Mon Sep 17 00:00:00 2001 From: Rodrigo Maia Date: Fri, 9 Jun 2023 18:05:52 -0500 Subject: [PATCH 2/3] fix i18n types --- .../AuditLogDescription.test.tsx | 2 +- .../EditRolesButton/EditRolesButton.tsx | 4 +-- site/src/components/Form/Form.tsx | 7 +++-- site/src/components/Resources/AgentStatus.tsx | 29 ++++++++----------- .../CreateTemplatePage/CreateTemplateForm.tsx | 27 ++++++++--------- .../CreateTemplatePage/CreateTemplatePage.tsx | 2 +- .../pages/CreateTokenPage/CreateTokenForm.tsx | 20 +++++-------- .../pages/CreateTokenPage/CreateTokenPage.tsx | 2 +- .../CreateWorkspacePageView.tsx | 4 +-- .../StarterTemplatesPage.tsx | 2 +- .../TemplateSettingsForm.tsx | 16 +++++----- .../TemplateSettingsPage.test.tsx | 2 +- .../TemplateScheduleForm.tsx | 14 ++++----- .../TemplateSchedulePage.test.tsx | 2 +- .../TemplateVariablesForm.tsx | 4 +-- .../TokensPage/TokensPageView.tsx | 2 +- site/src/pages/UsersPage/UsersPage.test.tsx | 2 +- .../WorkspacePage/WorkspaceReadyPage.tsx | 2 +- .../WorkspaceParametersForm.tsx | 4 +-- .../WorkspaceSchedulePage.tsx | 2 +- .../WorkspaceSettingsForm.tsx | 4 +-- site/src/utils/richParameters.ts | 12 ++++---- 22 files changed, 79 insertions(+), 86 deletions(-) diff --git a/site/src/components/AuditLogRow/AuditLogDescription/AuditLogDescription.test.tsx b/site/src/components/AuditLogRow/AuditLogDescription/AuditLogDescription.test.tsx index 4de181cbef02d..be9be76b5ac27 100644 --- a/site/src/components/AuditLogRow/AuditLogDescription/AuditLogDescription.test.tsx +++ b/site/src/components/AuditLogRow/AuditLogDescription/AuditLogDescription.test.tsx @@ -11,7 +11,7 @@ import { render } from "testHelpers/renderHelpers" import { screen } from "@testing-library/react" import { i18n } from "i18n" -const t = (str: string, variables?: Record) => +const t = (str: string, variables: Record) => i18n.t(str, variables) const getByTextContent = (text: string) => { diff --git a/site/src/components/EditRolesButton/EditRolesButton.tsx b/site/src/components/EditRolesButton/EditRolesButton.tsx index 0cb9a21ece8b8..39c1b40bdb875 100644 --- a/site/src/components/EditRolesButton/EditRolesButton.tsx +++ b/site/src/components/EditRolesButton/EditRolesButton.tsx @@ -77,7 +77,7 @@ export const EditRolesButton: FC = ({ ref={anchorRef} size="small" className={styles.editButton} - title={t("editUserRolesTooltip")} + title={t("editUserRolesTooltip") || ""} onClick={() => setIsOpen(true)} > @@ -101,7 +101,7 @@ export const EditRolesButton: FC = ({
{roles.map((role) => ( diff --git a/site/src/components/Form/Form.tsx b/site/src/components/Form/Form.tsx index af1df96bb929d..9bc223abee16b 100644 --- a/site/src/components/Form/Form.tsx +++ b/site/src/components/Form/Form.tsx @@ -118,6 +118,8 @@ export const FormFooter: FC = (props) => { /> ) } +const getFlexDirection = ({ direction }: FormContextValue = {}): "row" | "column" => + direction === "horizontal" ? "row" as const : "column" as const const useStyles = makeStyles((theme) => ({ form: { @@ -136,8 +138,7 @@ const useStyles = makeStyles((theme) => ({ alignItems: "flex-start", gap: ({ direction }: FormContextValue = {}) => direction === "horizontal" ? theme.spacing(15) : theme.spacing(3), - flexDirection: ({ direction }: FormContextValue = {}) => - direction === "horizontal" ? "row" : "column", + flexDirection: getFlexDirection, [theme.breakpoints.down("md")]: { flexDirection: "column", @@ -156,7 +157,7 @@ const useStyles = makeStyles((theme) => ({ [theme.breakpoints.down("md")]: { width: "100%", - position: "initial", + position: "initial" as const, }, }, diff --git a/site/src/components/Resources/AgentStatus.tsx b/site/src/components/Resources/AgentStatus.tsx index e414f1a06aba4..c69a154ff1ba5 100644 --- a/site/src/components/Resources/AgentStatus.tsx +++ b/site/src/components/Resources/AgentStatus.tsx @@ -19,14 +19,14 @@ import Link from "@mui/material/Link" // connected:ready, connected:shutting_down, connected:shutdown_timeout, // connected:shutdown_error, connected:off. -const ReadyLifecycle: React.FC = () => { +const ReadyLifecycle = () => { const styles = useStyles() const { t } = useTranslation("workspacePage") return (
) @@ -34,13 +34,12 @@ const ReadyLifecycle: React.FC = () => { const StartingLifecycle: React.FC = () => { const styles = useStyles() - const { t } = useTranslation("workspacePage") return ( - +
@@ -135,13 +134,12 @@ const StartErrorLifecycle: React.FC<{ const ShuttingDownLifecycle: React.FC = () => { const styles = useStyles() - const { t } = useTranslation("workspacePage") return ( - +
@@ -236,13 +234,12 @@ const ShutdownErrorLifecycle: React.FC<{ const OffLifecycle: React.FC = () => { const styles = useStyles() - const { t } = useTranslation("workspacePage") return ( - +
@@ -294,13 +291,12 @@ const ConnectedStatus: React.FC<{ const DisconnectedStatus: React.FC = () => { const styles = useStyles() - const { t } = useTranslation("workspacePage") return ( - +
@@ -309,13 +305,12 @@ const DisconnectedStatus: React.FC = () => { const ConnectingStatus: React.FC = () => { const styles = useStyles() - const { t } = useTranslation("workspacePage") return ( - +
diff --git a/site/src/pages/CreateTemplatePage/CreateTemplateForm.tsx b/site/src/pages/CreateTemplatePage/CreateTemplateForm.tsx index 371c784c64963..01694b4865775 100644 --- a/site/src/pages/CreateTemplatePage/CreateTemplateForm.tsx +++ b/site/src/pages/CreateTemplatePage/CreateTemplateForm.tsx @@ -71,25 +71,26 @@ const validationSchema = Yup.object({ ), description: Yup.string().max( MAX_DESCRIPTION_CHAR_LIMIT, - i18next.t("form.error.descriptionMax", { ns: "createTemplatePage" }), + "Please enter a description that is less than or equal to 128 characters." ), icon: Yup.string().optional(), default_ttl_hours: Yup.number() .integer() .min( 0, - i18next.t("form.error.defaultTTLMin", { ns: "templateSettingsPage" }), + "Default time until autostop must not be less than 0." ) .max( 24 * MAX_TTL_DAYS /* 7 days in hours */, - i18next.t("form.error.defaultTTLMax", { ns: "templateSettingsPage" }), + "Please enter a limit that is less than or equal to 168 hours (7 days)." ), max_ttl_hours: Yup.number() .integer() - .min(0, i18next.t("form.error.maxTTLMin", { ns: "templateSettingsPage" })) + .min(0, + "Maximum time until autostop must not be less than 0.") .max( 24 * MAX_TTL_DAYS /* 7 days in hours */, - i18next.t("form.error.maxTTLMax", { ns: "templateSettingsPage" }), + "Please enter a limit that is less than or equal to 168 hours(7 days)." ), }) @@ -223,8 +224,8 @@ export const CreateTemplateForm: FC = ({ {/* General info */} {starterTemplate ? ( @@ -255,8 +256,8 @@ export const CreateTemplateForm: FC = ({ {/* Display info */} = ({ {/* Schedule */} @@ -384,8 +385,8 @@ export const CreateTemplateForm: FC = ({ {/* Operations */} @@ -291,7 +291,7 @@ export const CreateWorkspacePageView: FC< diff --git a/site/src/pages/StarterTemplatesPage/StarterTemplatesPage.tsx b/site/src/pages/StarterTemplatesPage/StarterTemplatesPage.tsx index db34f7f90db3c..973c6d709c7d8 100644 --- a/site/src/pages/StarterTemplatesPage/StarterTemplatesPage.tsx +++ b/site/src/pages/StarterTemplatesPage/StarterTemplatesPage.tsx @@ -17,7 +17,7 @@ const StarterTemplatesPage: FC = () => { return ( <> - {pageTitle(t("title"))} + {pageTitle(t("title").toString())} diff --git a/site/src/pages/TemplateSettingsPage/TemplateGeneralSettingsPage/TemplateSettingsForm.tsx b/site/src/pages/TemplateSettingsPage/TemplateGeneralSettingsPage/TemplateSettingsForm.tsx index fc81ec0d19c9c..3c1afc6bc091f 100644 --- a/site/src/pages/TemplateSettingsPage/TemplateGeneralSettingsPage/TemplateSettingsForm.tsx +++ b/site/src/pages/TemplateSettingsPage/TemplateGeneralSettingsPage/TemplateSettingsForm.tsx @@ -36,7 +36,7 @@ export const getValidationSchema = (): Yup.AnyObjectSchema => ), description: Yup.string().max( MAX_DESCRIPTION_CHAR_LIMIT, - i18next.t("descriptionMaxError", { ns: "templateSettingsPage" }), + i18next.t("descriptionMaxError", { ns: "templateSettingsPage" }).toString(), ), allow_user_cancel_workspace_jobs: Yup.boolean(), icon: iconValidator, @@ -82,11 +82,11 @@ export const TemplateSettingsForm: FC = ({ return ( = ({ = ({