Users list fixes (#7)
* Updated dependencies * Imported changes from old repo for users reconnect * Added add group buttons * Removed console logs * partial fix for total user issue * Added sort to users list Co-authored-by: Benjamin Perez <benjamin@bexsoft.net> Co-authored-by: Daniel Valdivia <hola@danielvaldivia.com>
This commit is contained in:
@@ -32,6 +32,7 @@ import {
|
||||
} from "@material-ui/core";
|
||||
import Typography from "@material-ui/core/Typography";
|
||||
import { User, UsersList } from "./types";
|
||||
import { usersSort } from '../../../utils/sortFunctions';
|
||||
import { MinTablePaginationActions } from "../../../common/MinTablePaginationActions";
|
||||
import AddUser from "./AddUser";
|
||||
import DeleteUser from "./DeleteUser";
|
||||
@@ -135,8 +136,8 @@ class Users extends React.Component<IUsersProps, IUsersState> {
|
||||
.then((res: UsersList) => {
|
||||
this.setState({
|
||||
loading: false,
|
||||
records: res.users,
|
||||
totalRecords: res.total_users,
|
||||
records: res.users.sort(usersSort),
|
||||
totalRecords: res.users.length,
|
||||
error: ""
|
||||
});
|
||||
// if we get 0 results, and page > 0 , go down 1 page
|
||||
|
||||
15
portal-ui/src/utils/sortFunctions.ts
Normal file
15
portal-ui/src/utils/sortFunctions.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
interface sortInterface {
|
||||
accessKey: string;
|
||||
}
|
||||
|
||||
export const usersSort = (a: sortInterface, b: sortInterface) => {
|
||||
if (a.accessKey > b.accessKey) {
|
||||
return 1;
|
||||
}
|
||||
if (a.accessKey < b.accessKey) {
|
||||
return -1;
|
||||
}
|
||||
// a must be equal to b
|
||||
return 0;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user