mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-27 02:16:18 +00:00
parent
c34281251f
commit
6b0a32cfb4
@ -19,7 +19,6 @@ import { EntityData } from './components/common/PopOverCard/EntityPopOverCard';
|
|||||||
import { LOCALSTORAGE_USER_PROFILES } from './constants/constants';
|
import { LOCALSTORAGE_USER_PROFILES } from './constants/constants';
|
||||||
import { CurrentTourPageType } from './enums/tour.enum';
|
import { CurrentTourPageType } from './enums/tour.enum';
|
||||||
import { ResourcePermission } from './generated/entity/policies/accessControl/resourcePermission';
|
import { ResourcePermission } from './generated/entity/policies/accessControl/resourcePermission';
|
||||||
import { Role } from './generated/entity/teams/role';
|
|
||||||
import {
|
import {
|
||||||
EntityReference as UserTeams,
|
EntityReference as UserTeams,
|
||||||
User,
|
User,
|
||||||
@ -42,7 +41,6 @@ class AppState {
|
|||||||
userDataProfiles: Record<string, User> = {};
|
userDataProfiles: Record<string, User> = {};
|
||||||
entityData: Record<string, EntityData> = {};
|
entityData: Record<string, EntityData> = {};
|
||||||
userTeams: Array<UserTeams> = [];
|
userTeams: Array<UserTeams> = [];
|
||||||
userRoles: Array<Role> = [];
|
|
||||||
userPermissions: ResourcePermission[] = [];
|
userPermissions: ResourcePermission[] = [];
|
||||||
userProfilePics: Array<{
|
userProfilePics: Array<{
|
||||||
id: string;
|
id: string;
|
||||||
@ -68,14 +66,12 @@ class AppState {
|
|||||||
updateNewUser: action,
|
updateNewUser: action,
|
||||||
updateAuthProvide: action,
|
updateAuthProvide: action,
|
||||||
updateAuthState: action,
|
updateAuthState: action,
|
||||||
updateUserRole: action,
|
|
||||||
updateUsers: action,
|
updateUsers: action,
|
||||||
updateUserPermissions: action,
|
updateUserPermissions: action,
|
||||||
updateExplorePageTab: action,
|
updateExplorePageTab: action,
|
||||||
getCurrentUserDetails: action,
|
getCurrentUserDetails: action,
|
||||||
getAllUsers: action,
|
getAllUsers: action,
|
||||||
getAllTeams: action,
|
getAllTeams: action,
|
||||||
getAllRoles: action,
|
|
||||||
getAllPermissions: action,
|
getAllPermissions: action,
|
||||||
getUserProfilePic: action,
|
getUserProfilePic: action,
|
||||||
updateUserProfilePic: action,
|
updateUserProfilePic: action,
|
||||||
@ -107,9 +103,6 @@ class AppState {
|
|||||||
updateUserTeam(data: Array<UserTeams>) {
|
updateUserTeam(data: Array<UserTeams>) {
|
||||||
this.userTeams = data;
|
this.userTeams = data;
|
||||||
}
|
}
|
||||||
updateUserRole(data: Array<Role>) {
|
|
||||||
this.userRoles = data;
|
|
||||||
}
|
|
||||||
updateUserDetails(data: User) {
|
updateUserDetails(data: User) {
|
||||||
this.userDetails = data;
|
this.userDetails = data;
|
||||||
this.nonSecureUserDetails = data;
|
this.nonSecureUserDetails = data;
|
||||||
@ -277,10 +270,6 @@ class AppState {
|
|||||||
return this.userTeams;
|
return this.userTeams;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAllRoles() {
|
|
||||||
return this.userRoles;
|
|
||||||
}
|
|
||||||
|
|
||||||
getAllPermissions() {
|
getAllPermissions() {
|
||||||
return this.userPermissions;
|
return this.userPermissions;
|
||||||
}
|
}
|
||||||
|
@ -26,9 +26,13 @@ import React, {
|
|||||||
} from 'react';
|
} from 'react';
|
||||||
import { useHistory, useLocation } from 'react-router-dom';
|
import { useHistory, useLocation } from 'react-router-dom';
|
||||||
import Select from 'react-select';
|
import Select from 'react-select';
|
||||||
import AppState from '../../AppState';
|
import { getRoles } from '../../axiosAPIs/rolesAPIV1';
|
||||||
import { getTeams } from '../../axiosAPIs/teamsAPI';
|
import { getTeams } from '../../axiosAPIs/teamsAPI';
|
||||||
import { getUserPath, TERM_ADMIN } from '../../constants/constants';
|
import {
|
||||||
|
getUserPath,
|
||||||
|
PAGE_SIZE_LARGE,
|
||||||
|
TERM_ADMIN,
|
||||||
|
} from '../../constants/constants';
|
||||||
import { observerOptions } from '../../constants/Mydata.constants';
|
import { observerOptions } from '../../constants/Mydata.constants';
|
||||||
import {
|
import {
|
||||||
getUserCurrentTab,
|
getUserCurrentTab,
|
||||||
@ -767,16 +771,32 @@ const Users = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const fetchRoles = async () => {
|
||||||
|
try {
|
||||||
|
const response = await getRoles(
|
||||||
|
'',
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
false,
|
||||||
|
PAGE_SIZE_LARGE
|
||||||
|
);
|
||||||
|
setRoles(response.data);
|
||||||
|
} catch (err) {
|
||||||
|
setRoles([]);
|
||||||
|
showErrorToast(
|
||||||
|
err as AxiosError,
|
||||||
|
jsonData['api-error-messages']['fetch-roles-error']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchMoreFeed(isInView as boolean, paging, isFeedLoading);
|
fetchMoreFeed(isInView as boolean, paging, isFeedLoading);
|
||||||
}, [isInView, paging, isFeedLoading]);
|
}, [isInView, paging, isFeedLoading]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
setRoles(AppState.userRoles);
|
|
||||||
}, [AppState.userRoles]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchTeams();
|
fetchTeams();
|
||||||
|
fetchRoles();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -16,11 +16,12 @@ import { observer } from 'mobx-react';
|
|||||||
import { LoadingState } from 'Models';
|
import { LoadingState } from 'Models';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { useHistory, useParams } from 'react-router-dom';
|
import { useHistory, useParams } from 'react-router-dom';
|
||||||
import AppState from '../../AppState';
|
|
||||||
import { createBot } from '../../axiosAPIs/botsAPI';
|
import { createBot } from '../../axiosAPIs/botsAPI';
|
||||||
|
import { getRoles } from '../../axiosAPIs/rolesAPIV1';
|
||||||
import { createUser } from '../../axiosAPIs/userAPI';
|
import { createUser } from '../../axiosAPIs/userAPI';
|
||||||
import PageContainerV1 from '../../components/containers/PageContainerV1';
|
import PageContainerV1 from '../../components/containers/PageContainerV1';
|
||||||
import CreateUserComponent from '../../components/CreateUser/CreateUser.component';
|
import CreateUserComponent from '../../components/CreateUser/CreateUser.component';
|
||||||
|
import { PAGE_SIZE_LARGE } from '../../constants/constants';
|
||||||
import {
|
import {
|
||||||
GlobalSettingOptions,
|
GlobalSettingOptions,
|
||||||
GlobalSettingsMenuCategory,
|
GlobalSettingsMenuCategory,
|
||||||
@ -116,9 +117,28 @@ const CreateUserPage = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const fetchRoles = async () => {
|
||||||
|
try {
|
||||||
|
const response = await getRoles(
|
||||||
|
'',
|
||||||
|
undefined,
|
||||||
|
undefined,
|
||||||
|
false,
|
||||||
|
PAGE_SIZE_LARGE
|
||||||
|
);
|
||||||
|
setRoles(response.data);
|
||||||
|
} catch (err) {
|
||||||
|
setRoles([]);
|
||||||
|
showErrorToast(
|
||||||
|
err as AxiosError,
|
||||||
|
jsonData['api-error-messages']['fetch-roles-error']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setRoles(AppState.userRoles);
|
fetchRoles();
|
||||||
}, [AppState.userRoles]);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageContainerV1>
|
<PageContainerV1>
|
||||||
|
@ -22,7 +22,6 @@ import {
|
|||||||
getSuggestedTeams,
|
getSuggestedTeams,
|
||||||
getSuggestedUsers,
|
getSuggestedUsers,
|
||||||
} from '../axiosAPIs/miscAPI';
|
} from '../axiosAPIs/miscAPI';
|
||||||
import { getRoles } from '../axiosAPIs/rolesAPIV1';
|
|
||||||
import { getUserById, getUserByName, getUsers } from '../axiosAPIs/userAPI';
|
import { getUserById, getUserByName, getUsers } from '../axiosAPIs/userAPI';
|
||||||
import { WILD_CARD_CHAR } from '../constants/char.constants';
|
import { WILD_CARD_CHAR } from '../constants/char.constants';
|
||||||
import { SettledStatus } from '../enums/axios.enum';
|
import { SettledStatus } from '../enums/axios.enum';
|
||||||
@ -41,20 +40,9 @@ export const getAllUsersList = (arrQueryFields = ''): void => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const getAllRoles = (): void => {
|
|
||||||
getRoles('', undefined, undefined, false, 100)
|
|
||||||
.then((res) => {
|
|
||||||
AppState.updateUserRole(res.data);
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
AppState.updateUserRole([]);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export const fetchAllUsers = () => {
|
export const fetchAllUsers = () => {
|
||||||
AppState.loadUserProfilePics();
|
AppState.loadUserProfilePics();
|
||||||
getAllUsersList('profile,teams,roles');
|
getAllUsersList('profile,teams,roles');
|
||||||
getAllRoles();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getUserDataFromOidc = (
|
export const getUserDataFromOidc = (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user