Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search user functionality added #9532

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion datahub-web-react/src/app/identity/user/SelectRole.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useEffect, useState } from 'react';
import { UserOutlined } from '@ant-design/icons';
import { Select } from 'antd';
import { useApolloClient } from '@apollo/client';
Expand Down Expand Up @@ -49,6 +49,10 @@ export default function SelectRole({ user, userRoleUrn, selectRoleOptions, refet
const [currentRoleUrn, setCurrentRoleUrn] = useState<string>(defaultRoleUrn);
const [isViewingAssignRole, setIsViewingAssignRole] = useState(false);

useEffect(() => {
setCurrentRoleUrn(defaultRoleUrn);
}, [defaultRoleUrn]);

const onSelectRole = (roleUrn: string) => {
setCurrentRoleUrn(roleUrn);
setIsViewingAssignRole(true);
Expand Down
9 changes: 6 additions & 3 deletions datahub-web-react/src/app/identity/user/UserList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const UserList = () => {
const params = QueryString.parse(location.search, { arrayFormat: 'comma' });
const paramsQuery = (params?.query as string) || undefined;
const [query, setQuery] = useState<undefined | string>(undefined);
const [usersList, setUsersList] = useState<Array<any>>([]);
useEffect(() => setQuery(paramsQuery), [paramsQuery]);

const [page, setPage] = useState(1);
Expand Down Expand Up @@ -81,8 +82,9 @@ export const UserList = () => {
});

const totalUsers = usersData?.listUsers?.total || 0;
const users = usersData?.listUsers?.users || [];

useEffect(()=> {
setUsersList(usersData?.listUsers?.users || []);
}, [usersData]);
const onChangePage = (newPage: number) => {
scrollToTop();
setPage(newPage);
Expand Down Expand Up @@ -145,6 +147,7 @@ export const UserList = () => {
onQueryChange={(q) => {
setPage(1);
setQuery(q);
setUsersList([]);
}}
entityRegistry={entityRegistry}
hideRecommendations
Expand All @@ -155,7 +158,7 @@ export const UserList = () => {
locale={{
emptyText: <Empty description="No Users!" image={Empty.PRESENTED_IMAGE_SIMPLE} />,
}}
dataSource={users}
dataSource={usersList}
renderItem={(item: any) => (
<UserListItem
onDelete={() => handleDelete(item.urn as string)}
Expand Down
Loading