🙌 OpenHands: AI-Driven Development
fix(device-verify): rename 'Workspace' dropdown to 'Organization' (#15057)
Tim O'Farrell94ddd67631a3
diff --git a/frontend/src/i18n/declaration.ts b/frontend/src/i18n/declaration.tsindex ef42c5c673..ae4737f74b 100644--- a/frontend/src/i18n/declaration.ts+++ b/frontend/src/i18n/declaration.ts@@ -376,7 +376,7 @@ export enum I18nKey {WORKSPACE$BROWSER_TAB_LABEL = "WORKSPACE$BROWSER_TAB_LABEL",WORKSPACE$JUPYTER_TAB_LABEL = "WORKSPACE$JUPYTER_TAB_LABEL",WORKSPACE$CODE_EDITOR_TAB_LABEL = "WORKSPACE$CODE_EDITOR_TAB_LABEL",- WORKSPACE$TITLE = "WORKSPACE$TITLE",+ ORG$LABEL = "ORG$LABEL",TERMINAL$WAITING_FOR_CLIENT = "TERMINAL$WAITING_FOR_CLIENT",CODE_EDITOR$FILE_SAVED_SUCCESSFULLY = "CODE_EDITOR$FILE_SAVED_SUCCESSFULLY",CODE_EDITOR$SAVING_LABEL = "CODE_EDITOR$SAVING_LABEL",@@ -1466,7 +1466,7 @@ export enum I18nKey {DEVICE$CONTINUE = "DEVICE$CONTINUE",DEVICE$AUTH_REQUIRED = "DEVICE$AUTH_REQUIRED",DEVICE$SIGN_IN_PROMPT = "DEVICE$SIGN_IN_PROMPT",- DEVICE$WORKSPACE_SWITCH_FAILED = "DEVICE$WORKSPACE_SWITCH_FAILED",+ DEVICE$ORG_SWITCH_FAILED = "DEVICE$ORG_SWITCH_FAILED",CTA$ENTERPRISE_TITLE = "CTA$ENTERPRISE_TITLE",CTA$ENTERPRISE_DESCRIPTION = "CTA$ENTERPRISE_DESCRIPTION",CTA$LEARN_MORE = "CTA$LEARN_MORE",diff --git a/frontend/src/i18n/translation.json b/frontend/src/i18n/translation.jsonindex 87bc226578..b21311ebb8 100644--- a/frontend/src/i18n/translation.json+++ b/frontend/src/i18n/translation.json@@ -6391,22 +6391,22 @@"uk": "Редактор коду","ca": "Editor de codi"},- "WORKSPACE$TITLE": {- "en": "Workspace",- "zh-CN": "工作区",- "de": "Arbeitsbereich",- "ko-KR": "작업 공간",- "no": "Arbeidsområde",- "zh-TW": "工作區",- "it": "Area di lavoro",- "pt": "Espaço de trabalho",- "es": "Espacio de trabajo",- "ar": "مساحة العمل",- "fr": "Espace de travail",- "tr": "Çalışma Alanı",- "ja": "ワークスペース",- "uk": "Робочий простір",- "ca": "Espai de treball"+ "ORG$LABEL": {+ "en": "Organization",+ "zh-CN": "组织",+ "de": "Organisation",+ "ko-KR": "조직",+ "no": "Organisasjon",+ "zh-TW": "組織",+ "it": "Organizzazione",+ "pt": "Organização",+ "es": "Organización",+ "ar": "المنظمة",+ "fr": "Organisation",+ "tr": "Organizasyon",+ "ja": "組織",+ "uk": "Організація",+ "ca": "Organització"},"TERMINAL$WAITING_FOR_CLIENT": {"en": "Waiting for client to become ready...",@@ -24921,22 +24921,22 @@"uk": "Будь ласка, увійдіть, щоб авторизувати свій пристрій.","ca": "Inicieu sessió per autoritzar el vostre dispositiu."},- "DEVICE$WORKSPACE_SWITCH_FAILED": {- "en": "Could not switch workspace. Please try selecting a different workspace.",- "ja": "ワークスペースを切り替えられませんでした。別のワークスペースを選択してください。",- "zh-CN": "无法切换工作区。请尝试选择其他工作区。",- "zh-TW": "無法切換工作區。請嘗試選擇其他工作區。",- "ko-KR": "작업 공간을 전환할 수 없습니다. 다른 작업 공간을 선택해 주세요.",- "no": "Kunne ikke bytte arbeidsområde. Prøv å velge et annet arbeidsområde.",- "ar": "تعذر تبديل مساحة العمل. يرجى تجربة تحديد مساحة عمل مختلفة.",- "de": "Arbeitsbereich konnte nicht gewechselt werden. Bitte wählen Sie einen anderen Arbeitsbereich.",- "fr": "Impossible de changer d'espace de travail. Veuillez essayer de sélectionner un autre espace de travail.",- "it": "Impossibile cambiare area di lavoro. Prova a selezionare un'area di lavoro diversa.",- "pt": "Não foi possível mudar o espaço de trabalho. Tente selecionar um espaço de trabalho diferente.",- "es": "No se pudo cambiar el espacio de trabajo. Intenta seleccionar otro espacio de trabajo.",- "tr": "Çalışma alanı değiştirilemedi. Lütfen farklı bir çalışma alanı seçmeyi deneyin.",- "uk": "Не вдалося переключити робочий простір. Будь ласка, виберіть інший робочий простір.",- "ca": "No s'ha pogut canviar l'espai de treball. Proveu de seleccionar un altre espai de treball."+ "DEVICE$ORG_SWITCH_FAILED": {+ "en": "Could not switch organization. Please try selecting a different organization.",+ "ja": "組織を切り替えられませんでした。別の組織を選択してください。",+ "zh-CN": "无法切换组织。请尝试选择其他组织。",+ "zh-TW": "無法切換組織。請嘗試選擇其他組織。",+ "ko-KR": "조직을 전환할 수 없습니다. 다른 조직을 선택해 주세요.",+ "no": "Kunne ikke bytte organisasjon. Prøv å velge en annen organisasjon.",+ "ar": "تعذر تبديل المنظمة. يرجى تجربة تحديد منظمة مختلفة.",+ "de": "Organisation konnte nicht gewechselt werden. Bitte wählen Sie eine andere Organisation.",+ "fr": "Impossible de changer d'organisation. Veuillez essayer de sélectionner une autre organisation.",+ "it": "Impossibile cambiare organizzazione. Prova a selezionare un'organizzazione diversa.",+ "pt": "Não foi possível mudar a organização. Tente selecionar uma organização diferente.",+ "es": "No se pudo cambiar la organización. Intenta seleccionar otra organización.",+ "tr": "Organizasyon değiştirilemedi. Lütfen farklı bir organizasyon seçmeyi deneyin.",+ "uk": "Не вдалося переключити організацію. Будь ласка, виберіть іншу організацію.",+ "ca": "No s'ha pogut canviar l'organització. Proveu de seleccionar una altra organització."},"CTA$ENTERPRISE_TITLE": {"en": "Get OpenHands For Enterprise",diff --git a/frontend/src/routes/device-verify.test.tsx b/frontend/src/routes/device-verify.test.tsxindex 1b8d0312e1..d2834a4f73 100644--- a/frontend/src/routes/device-verify.test.tsx+++ b/frontend/src/routes/device-verify.test.tsx@@ -205,23 +205,23 @@ describe("DeviceVerify", () => {mockState.isEnterpriseCloud = false;});- describe("workspace dropdown visibility", () => {- it("renders the workspace dropdown in SaaS mode with multiple orgs", () => {+ describe("organization dropdown visibility", () => {+ it("renders the organization dropdown in SaaS mode with multiple orgs", () => {renderDeviceVerify();expect(getDropdown()).toBeInTheDocument();- expect(screen.getByText("WORKSPACE$TITLE")).toBeInTheDocument();+ expect(screen.getByText("ORG$LABEL")).toBeInTheDocument();});- it("does not render the workspace dropdown when useShouldHideOrgSelector returns true", () => {+ it("does not render the organization dropdown when useShouldHideOrgSelector returns true", () => {mockState.hideOrgSelector = true;renderDeviceVerify();expect(screen.queryByTestId("device-verify-org-selector")).toBeNull();- expect(screen.queryByText("WORKSPACE$TITLE")).toBeNull();+ expect(screen.queryByText("ORG$LABEL")).toBeNull();});});- describe("workspace default", () => {- it("defaults the dropdown to the user's current workspace", () => {+ describe("organization default", () => {+ it("defaults the dropdown to the user's current organization", () => {mockState.selectedOrgId = "org-b";renderDeviceVerify();const input = getDropdown().querySelector("input") as HTMLInputElement;@@ -229,7 +229,7 @@ describe("DeviceVerify", () => {});});- describe("workspace switch — happy path", () => {+ describe("organization switch — happy path", () => {it("calls switchOrganization.mutate with the new org payload when a different org is picked", async () => {renderDeviceVerify();// current org is org-a ("Alpha"); pick org-b ("Beta").@@ -272,12 +272,12 @@ describe("DeviceVerify", () => {});});- describe("failed workspace switch", () => {+ describe("failed organization switch", () => {/*** Reproduces the race-condition that Hiep's review flagged:* the switch request fails server-side, `isPending` flips back to* false, and we must NOT allow Authorize to fire against the wrong- * workspace. The Authorize button must stay disabled and a toast+ * organization. The Authorize button must stay disabled and a toast* must be surfaced.*/it("keeps the Authorize button disabled and shows an error toast when the switch fails", async () => {@@ -305,17 +305,17 @@ describe("DeviceVerify", () => {expect(getAuthorizeButton()).toBeDisabled();// The user is told why.expect(displayErrorToast).toHaveBeenCalledWith(- "DEVICE$WORKSPACE_SWITCH_FAILED",+ "DEVICE$ORG_SWITCH_FAILED",);});/**- * After a failed switch, picking a different workspace must clear the+ * After a failed switch, picking a different organization must clear the* failure flag so the Authorize button can re-enable for the new* attempt. Without this, the user would be permanently locked out- * of authorizing the device against any workspace.+ * of authorizing the device against any organization.*/- it("re-enables the Authorize button when the user picks a different workspace after a failed switch", async () => {+ it("re-enables the Authorize button when the user picks a different organization after a failed switch", async () => {renderDeviceVerify();// First switch fails.@@ -329,7 +329,7 @@ describe("DeviceVerify", () => {});expect(getAuthorizeButton()).toBeDisabled();- // User picks a *different* workspace (Gamma). The onChange handler+ // User picks a *different* organization (Gamma). The onChange handler// clears the local switchFailed flag before kicking off the new// mutation, so once the new in-flight switch completes the Authorize// button can re-enable.diff --git a/frontend/src/routes/device-verify.tsx b/frontend/src/routes/device-verify.tsxindex 7c563e7345..30efef8e8b 100644--- a/frontend/src/routes/device-verify.tsx+++ b/frontend/src/routes/device-verify.tsx@@ -27,15 +27,15 @@ export default function DeviceVerify() {const [isProcessing, setIsProcessing] = useState(false);const { isEnterpriseCloud } = useAppMode();- // Organization dropdown state — defaults to the user's current workspace.+ // Organization dropdown state — defaults to the user's current organization.const { data: orgData, isLoading: isOrgsLoading } = useOrganizations();const { organizationId: selectedOrgId } = useSelectedOrganizationId();const { mutate: switchOrganization, isPending: isSwitchingOrg } =useSwitchOrganization();const shouldHideOrgSelector = useShouldHideOrgSelector();- // Tracks the most recent failed workspace switch so Authorize stays disabled- // until the user picks a different workspace. Cleared on the next onChange.+ // Tracks the most recent failed organization switch so Authorize stays disabled+ // until the user picks a different organization. Cleared on the next onChange.const [switchFailed, setSwitchFailed] = useState(false);const organizations = orgData?.organizations;@@ -216,7 +216,7 @@ export default function DeviceVerify() {<div className="mb-6"><label className="flex flex-col gap-2"><span className="text-sm font-medium">- {t(I18nKey.WORKSPACE$TITLE)}+ {t(I18nKey.ORG$LABEL)}</span><DropdowntestId="device-verify-org-selector"@@ -250,7 +250,7 @@ export default function DeviceVerify() {{onError: () => {displayErrorToast(- t(I18nKey.DEVICE$WORKSPACE_SWITCH_FAILED),+ t(I18nKey.DEVICE$ORG_SWITCH_FAILED),);setSwitchFailed(true);},