mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-10 11:33: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 React from "react";
|
||||||
import Enzyme, { shallow } from "enzyme";
|
import Enzyme, { shallow } from "enzyme";
|
||||||
import { AddUser } from "./AddUser.pre";
|
import AddUser from "./AddUser.pre";
|
||||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||||
|
|
||||||
Enzyme.configure({ adapter: new Adapter() });
|
Enzyme.configure({ adapter: new Adapter() });
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import Enzyme, { shallow } from "enzyme";
|
import Enzyme, { shallow } from "enzyme";
|
||||||
import { EditUser } from "./EditUser.pre";
|
import EditUser from "./EditUser.pre";
|
||||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||||
|
|
||||||
Enzyme.configure({ adapter: new Adapter() });
|
Enzyme.configure({ adapter: new Adapter() });
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import Enzyme, { shallow } from "enzyme";
|
import Enzyme, { shallow } from "enzyme";
|
||||||
import { GroupEdit } from "./GroupEdit.pre";
|
import GroupEdit from "./GroupEdit.pre";
|
||||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||||
|
|
||||||
Enzyme.configure({ adapter: new Adapter() });
|
Enzyme.configure({ adapter: new Adapter() });
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import Enzyme, { shallow } from "enzyme";
|
import Enzyme, { shallow } from "enzyme";
|
||||||
import { Groups } from "./Groups.pre";
|
import Groups from "./Groups.pre";
|
||||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||||
|
|
||||||
Enzyme.configure({ adapter: new Adapter() });
|
Enzyme.configure({ adapter: new Adapter() });
|
||||||
|
@@ -24,7 +24,7 @@ const ServerDashboard = (props) => {
|
|||||||
runningDesc = (e) => e.sort((a) => (a.server == null ? 1 : -1));
|
runningDesc = (e) => e.sort((a) => (a.server == null ? 1 : -1));
|
||||||
|
|
||||||
var [addUser, setAddUser] = useState(false),
|
var [addUser, setAddUser] = useState(false),
|
||||||
[sortMethod, setSortMethod] = useState(undefined);
|
[sortMethod, setSortMethod] = useState(null);
|
||||||
|
|
||||||
var {
|
var {
|
||||||
user_data,
|
user_data,
|
||||||
@@ -47,7 +47,9 @@ const ServerDashboard = (props) => {
|
|||||||
|
|
||||||
if (!user_data) return <div></div>;
|
if (!user_data) return <div></div>;
|
||||||
|
|
||||||
if (sortMethod != undefined) user_data = sortMethod(user_data);
|
if (sortMethod != null) {
|
||||||
|
user_data = sortMethod(user_data);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container">
|
<div className="container">
|
||||||
@@ -62,28 +64,28 @@ const ServerDashboard = (props) => {
|
|||||||
User{" "}
|
User{" "}
|
||||||
<SortHandler
|
<SortHandler
|
||||||
sorts={{ asc: usernameAsc, desc: usernameDesc }}
|
sorts={{ asc: usernameAsc, desc: usernameDesc }}
|
||||||
callback={(method) => setSortMethod(method)}
|
callback={(method) => setSortMethod(() => method)}
|
||||||
/>
|
/>
|
||||||
</th>
|
</th>
|
||||||
<th id="admin-header">
|
<th id="admin-header">
|
||||||
Admin{" "}
|
Admin{" "}
|
||||||
<SortHandler
|
<SortHandler
|
||||||
sorts={{ asc: adminAsc, desc: adminDesc }}
|
sorts={{ asc: adminAsc, desc: adminDesc }}
|
||||||
callback={(method) => setSortMethod(method)}
|
callback={(method) => setSortMethod(() => method)}
|
||||||
/>
|
/>
|
||||||
</th>
|
</th>
|
||||||
<th id="last-activity-header">
|
<th id="last-activity-header">
|
||||||
Last Activity{" "}
|
Last Activity{" "}
|
||||||
<SortHandler
|
<SortHandler
|
||||||
sorts={{ asc: dateAsc, desc: dateDesc }}
|
sorts={{ asc: dateAsc, desc: dateDesc }}
|
||||||
callback={(method) => setSortMethod(method)}
|
callback={(method) => setSortMethod(() => method)}
|
||||||
/>
|
/>
|
||||||
</th>
|
</th>
|
||||||
<th id="running-status-header">
|
<th id="running-status-header">
|
||||||
Running{" "}
|
Running{" "}
|
||||||
<SortHandler
|
<SortHandler
|
||||||
sorts={{ asc: runningAsc, desc: runningDesc }}
|
sorts={{ asc: runningAsc, desc: runningDesc }}
|
||||||
callback={(method) => setSortMethod(method)}
|
callback={(method) => setSortMethod(() => method)}
|
||||||
/>
|
/>
|
||||||
</th>
|
</th>
|
||||||
<th id="actions-header">Actions</th>
|
<th id="actions-header">Actions</th>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import Enzyme, { shallow, mount } from "enzyme";
|
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 Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||||
import { HashRouter, Switch } from "react-router-dom";
|
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