mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-12 04:23:01 +00:00
Fix useState sort method assignment bug
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import Enzyme, { shallow } from "enzyme";
|
||||
import { AddUser } from "./AddUser.pre";
|
||||
import AddUser from "./AddUser.pre";
|
||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||
|
||||
Enzyme.configure({ adapter: new Adapter() });
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import Enzyme, { shallow } from "enzyme";
|
||||
import { EditUser } from "./EditUser.pre";
|
||||
import EditUser from "./EditUser.pre";
|
||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||
|
||||
Enzyme.configure({ adapter: new Adapter() });
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import Enzyme, { shallow } from "enzyme";
|
||||
import { GroupEdit } from "./GroupEdit.pre";
|
||||
import GroupEdit from "./GroupEdit.pre";
|
||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||
|
||||
Enzyme.configure({ adapter: new Adapter() });
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import Enzyme, { shallow } from "enzyme";
|
||||
import { Groups } from "./Groups.pre";
|
||||
import Groups from "./Groups.pre";
|
||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||
|
||||
Enzyme.configure({ adapter: new Adapter() });
|
||||
|
@@ -24,7 +24,7 @@ const ServerDashboard = (props) => {
|
||||
runningDesc = (e) => e.sort((a) => (a.server == null ? 1 : -1));
|
||||
|
||||
var [addUser, setAddUser] = useState(false),
|
||||
[sortMethod, setSortMethod] = useState(undefined);
|
||||
[sortMethod, setSortMethod] = useState(null);
|
||||
|
||||
var {
|
||||
user_data,
|
||||
@@ -47,7 +47,9 @@ const ServerDashboard = (props) => {
|
||||
|
||||
if (!user_data) return <div></div>;
|
||||
|
||||
if (sortMethod != undefined) user_data = sortMethod(user_data);
|
||||
if (sortMethod != null) {
|
||||
user_data = sortMethod(user_data);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="container">
|
||||
@@ -62,28 +64,28 @@ const ServerDashboard = (props) => {
|
||||
User{" "}
|
||||
<SortHandler
|
||||
sorts={{ asc: usernameAsc, desc: usernameDesc }}
|
||||
callback={(method) => setSortMethod(method)}
|
||||
callback={(method) => setSortMethod(() => method)}
|
||||
/>
|
||||
</th>
|
||||
<th id="admin-header">
|
||||
Admin{" "}
|
||||
<SortHandler
|
||||
sorts={{ asc: adminAsc, desc: adminDesc }}
|
||||
callback={(method) => setSortMethod(method)}
|
||||
callback={(method) => setSortMethod(() => method)}
|
||||
/>
|
||||
</th>
|
||||
<th id="last-activity-header">
|
||||
Last Activity{" "}
|
||||
<SortHandler
|
||||
sorts={{ asc: dateAsc, desc: dateDesc }}
|
||||
callback={(method) => setSortMethod(method)}
|
||||
callback={(method) => setSortMethod(() => method)}
|
||||
/>
|
||||
</th>
|
||||
<th id="running-status-header">
|
||||
Running{" "}
|
||||
<SortHandler
|
||||
sorts={{ asc: runningAsc, desc: runningDesc }}
|
||||
callback={(method) => setSortMethod(method)}
|
||||
callback={(method) => setSortMethod(() => method)}
|
||||
/>
|
||||
</th>
|
||||
<th id="actions-header">Actions</th>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import Enzyme, { shallow, mount } from "enzyme";
|
||||
import { ServerDashboard } from "./ServerDashboard.pre";
|
||||
import ServerDashboard from "./ServerDashboard.pre";
|
||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||
import { HashRouter, Switch } from "react-router-dom";
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user