From 3ead224651abdf0f2723d3cadc5e0283f5a6fb4e Mon Sep 17 00:00:00 2001 From: Muhsin Shah C P Date: Wed, 25 Jan 2023 18:55:00 +0530 Subject: [PATCH] [bug-fix] User can't update the single workspace name (#5426) * fix: user can update the workspace name * fixed a bug * fixed multi-org list issues --- .../OrganizationManager/CustomSelect.jsx | 85 +++++++++++++------ frontend/src/_ui/Header/index.jsx | 9 +- 2 files changed, 61 insertions(+), 33 deletions(-) diff --git a/frontend/src/_components/OrganizationManager/CustomSelect.jsx b/frontend/src/_components/OrganizationManager/CustomSelect.jsx index 967319fd02..dc9f132b4e 100644 --- a/frontend/src/_components/OrganizationManager/CustomSelect.jsx +++ b/frontend/src/_components/OrganizationManager/CustomSelect.jsx @@ -4,30 +4,36 @@ import { components } from 'react-select'; import { EditOrganization } from './EditOrganization'; import { CreateOrganization } from './CreateOrganization'; import { useTranslation } from 'react-i18next'; +import { authenticationService } from '@/_services'; const Menu = (props) => { const { t } = useTranslation(); + const { admin } = authenticationService.currentUserValue; return (
-
props.selectProps.setShowEditOrg(true)}> -
-
{props?.selectProps?.value?.label}
-
- - - - + {admin && ( + <> +
props.selectProps.setShowEditOrg(true)}> +
+
{props?.selectProps?.value?.label}
+
+ + + + +
+
-
-
-
+
+ + )}
{props.children}
{ const [showEditOrg, setShowEditOrg] = useState(false); const [showCreateOrg, setShowCreateOrg] = useState(false); + const isSingleOrganization = window.public_config?.DISABLE_MULTI_WORKSPACE === 'true'; + const { organization, admin } = authenticationService.currentUserValue; + return ( <> - + )} ); }; diff --git a/frontend/src/_ui/Header/index.jsx b/frontend/src/_ui/Header/index.jsx index a974f44c33..02fb10c8ba 100644 --- a/frontend/src/_ui/Header/index.jsx +++ b/frontend/src/_ui/Header/index.jsx @@ -2,23 +2,16 @@ import React from 'react'; import cx from 'classnames'; import Breadcrumbs from '../Breadcrumbs'; import { OrganizationList } from '@/_components/OrganizationManager/List'; -import { authenticationService } from '@/_services'; function Header() { const currentVersion = localStorage.getItem('currentVersion'); const darkMode = localStorage.getItem('darkMode') === 'true'; - const isSingleOrganization = window.public_config?.DISABLE_MULTI_WORKSPACE === 'true'; - const { organization } = authenticationService.currentUserValue; return (
- {isSingleOrganization ? ( - {organization} - ) : ( - - )} +