diff --git a/ui/src/components/DestinationStack/Actions/LoadStacks.tsx b/ui/src/components/DestinationStack/Actions/LoadStacks.tsx
index adebdcc36..157f1b48a 100644
--- a/ui/src/components/DestinationStack/Actions/LoadStacks.tsx
+++ b/ui/src/components/DestinationStack/Actions/LoadStacks.tsx
@@ -192,7 +192,7 @@ const LoadStacks = (props: LoadFileFormatProps) => {
(a: IDropDown, b: IDropDown) =>
new Date(b?.created_at)?.getTime() - new Date(a?.created_at)?.getTime()
);
-
+
setAllStack(stackArray);
//Set selected Stack
const selectedStackData = validateArray(stackArray)
diff --git a/ui/src/components/MainHeader/index.tsx b/ui/src/components/MainHeader/index.tsx
index db86ecb27..5031ca462 100644
--- a/ui/src/components/MainHeader/index.tsx
+++ b/ui/src/components/MainHeader/index.tsx
@@ -1,6 +1,6 @@
// Libraries
import { useEffect, useState } from 'react';
-import { useNavigate, useLocation } from 'react-router-dom';
+import { useNavigate, useLocation, Link } from 'react-router-dom';
import { cbModal, Dropdown, Tooltip} from '@contentstack/venus-components';
import { useDispatch, useSelector } from 'react-redux';
@@ -164,9 +164,9 @@ const MainHeader = () => {
{logo?.image?.url ? (
- {/* */}
+
- {/* */}
+
) : (
@@ -189,18 +189,22 @@ const MainHeader = () => {
{(location.pathname == '/projects' || location.pathname.includes('/projects/')) &&
-
,
- }
- ]}
- type="click"
- className="Profile_card"
- >
-
{name}
-
+
+ ,
+ }
+ ]}
+ type="click"
+ className="Profile_card"
+ >
+ {name}
+
+
+
+
}
diff --git a/ui/src/components/ProfileHeader/index.tsx b/ui/src/components/ProfileHeader/index.tsx
index 63c3a9414..7b1846a6e 100644
--- a/ui/src/components/ProfileHeader/index.tsx
+++ b/ui/src/components/ProfileHeader/index.tsx
@@ -29,6 +29,11 @@ const ProfileCard = () => {
{user?.first_name} {user?.last_name}
{user?.email}
+
+ Region : {user?.region}
+
+
+
- setSearchText(search?.trim())
+ onChange={(search: string) =>{
+ setSearchText(search)}
}
width="large"
onClear={true}
@@ -37,7 +37,7 @@ const ProjectsHeader = ({
debounceSearch={true}
id="search-project-input"
version="v2"
- disabled={allProject && allProject?.length <= 0 && searchText?.length <= 0}
+ //disabled={allProject && allProject?.length <= 0 }
/>
{/* {allProject && allProject?.length > 0 ? (
diff --git a/ui/src/context/app/app.interface.ts b/ui/src/context/app/app.interface.ts
index b14c3abaf..67329ca2a 100644
--- a/ui/src/context/app/app.interface.ts
+++ b/ui/src/context/app/app.interface.ts
@@ -45,6 +45,7 @@ export interface User {
mobile_number: string;
country_code: string;
organizations: Organization[];
+ region:string;
}
export interface FileDetails {
isLocalPath?: boolean;
@@ -221,7 +222,7 @@ export interface IAppContext {
authToken: string;
setAuthToken: (token: string) => void;
user: User;
- updateUser: (user: User) => void;
+ setUser: (user: User) => void;
organisationsList: IDropDown[];
updateOrganisationsList: (list: IDropDown[]) => void;
selectedOrganisation: IDropDown;
@@ -264,7 +265,8 @@ export const DEFAULT_USER: User = {
last_name: '',
mobile_number: '',
country_code: '',
- organizations: []
+ organizations: [],
+ region:''
};
export const DEFAULT_FILE: IFile = {
@@ -413,7 +415,7 @@ export const DEFAULT_APP_CONTEXT: IAppContext = {
return;
},
user: DEFAULT_USER,
- updateUser: function (): void {
+ setUser: function (): void {
return;
},
isAuthenticated: false,
diff --git a/ui/src/context/app/app.provider.tsx b/ui/src/context/app/app.provider.tsx
index d0cf355b7..320729c2e 100644
--- a/ui/src/context/app/app.provider.tsx
+++ b/ui/src/context/app/app.provider.tsx
@@ -139,7 +139,7 @@ const AppContextProvider: FC = ({ children }) => {
authToken: authToken,
setAuthToken: (token: string) => setAuthToken(() => token),
user: user,
- updateUser: (user: User) => setUser(user),
+ setUser: (user: User) => setUser(user),
isAuthenticated: isAuthenticated,
setIsAuthenticated: (flag: boolean) => setIsAuthenticated(flag),
newMigrationData: newMigration,
diff --git a/ui/src/pages/Login/index.tsx b/ui/src/pages/Login/index.tsx
index 060ee5bde..8bc306a1f 100644
--- a/ui/src/pages/Login/index.tsx
+++ b/ui/src/pages/Login/index.tsx
@@ -3,7 +3,7 @@ import { FC,useEffect, useState } from 'react';
import { useNavigate, useLocation } from 'react-router-dom';
import { useDispatch, useSelector } from 'react-redux';
-import { getUserDetails, setAuthToken } from '../../store/slice/authSlice';
+import { getUserDetails, setAuthToken, setUser } from '../../store/slice/authSlice';
import {
Button,
Field,
@@ -36,6 +36,7 @@ import AccountPage from '../../components/AccountPage';
// Styles
import './index.scss';
+import { RootState } from '../../store';
const Login: FC = () => {
const [data, setData] = useState({});
@@ -56,7 +57,7 @@ const Login: FC = () => {
}, []);
const { login, two_factor_authentication: twoFactorAuthentication } = data;
-
+ const user = useSelector((state:RootState)=>state?.authentication?.user);
const accountData = {
heading: data?.heading,
subtitle: data?.subtitle,
@@ -162,7 +163,11 @@ const Login: FC = () => {
authToken: response?.data?.app_token,
isAuthenticated: true
}
-
+ const userObj = {
+ ...user,
+ region : region,
+ }
+ dispatch( setUser(userObj));
dispatch(setAuthToken(authenticationObj));
setLoginStates((prev) => ({ ...prev, submitted: true }));
diff --git a/ui/src/pages/Projects/index.tsx b/ui/src/pages/Projects/index.tsx
index ebfc8d1f7..769798421 100644
--- a/ui/src/pages/Projects/index.tsx
+++ b/ui/src/pages/Projects/index.tsx
@@ -4,7 +4,7 @@ import { PageLayout, EmptyState, Button, Icon, cbModal, StackCardSkeleton} from
import { jsonToHtml } from '@contentstack/json-rte-serializer';
import HTMLReactParser from 'html-react-parser';
import { useLocation } from 'react-router-dom';
-import { useDispatch, useSelector } from 'react-redux';
+import {useSelector } from 'react-redux';
// Redux
import { RootState } from '../../store';
diff --git a/ui/src/store/slice/authSlice.tsx b/ui/src/store/slice/authSlice.tsx
index c57c1fc38..c202891be 100644
--- a/ui/src/store/slice/authSlice.tsx
+++ b/ui/src/store/slice/authSlice.tsx
@@ -80,7 +80,10 @@ const authSlice = createSlice({
state.isAuthenticated = action?.payload?.isAuthenticated;
},
setUser : (state, action) => {
- state.user = action?.payload;
+ state.user = {
+ ...state.user,
+ ...action?.payload,
+ };
},
reInitiliseState: (state) => {
state.authToken = '';
@@ -101,7 +104,10 @@ const authSlice = createSlice({
},
extraReducers: (builder) => {
builder.addCase(getUserDetails?.fulfilled,(state, action:any)=>{
- state.user = action?.payload?.user;
+ state.user = {
+ ...state.user,
+ ...action.payload.user,
+ };
state.organisationsList = action?.payload?.organisationsList;
state.selectedOrganisation = action?.payload?.selectedOrganisation ;
state.isAuthenticated = !isEmptyString(state?.authToken || '');