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:
Alex
2020-04-02 13:16:20 -06:00
committed by GitHub
parent 2f922980f8
commit 50bba57481
2 changed files with 18 additions and 2 deletions

View File

@@ -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

View 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;
};