mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-17 23:13:00 +00:00
Remove unused imports and variables
This commit is contained in:
@@ -21,7 +21,17 @@
|
|||||||
"semi": "off",
|
"semi": "off",
|
||||||
"quotes": "off",
|
"quotes": "off",
|
||||||
"prettier/prettier": "warn",
|
"prettier/prettier": "warn",
|
||||||
"no-unused-vars": "warn"
|
"no-unused-vars": "off",
|
||||||
|
"unused-imports/no-unused-imports": "error",
|
||||||
|
"unused-imports/no-unused-vars": [
|
||||||
|
"warn",
|
||||||
|
{
|
||||||
|
"vars": "all",
|
||||||
|
"varsIgnorePattern": "^regeneratorRuntime|^_",
|
||||||
|
"args": "after-used",
|
||||||
|
"argsIgnorePattern": "^_"
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,3 @@
|
|||||||
import { combineReducers } from "redux";
|
|
||||||
|
|
||||||
export const initialState = {
|
export const initialState = {
|
||||||
user_data: undefined,
|
user_data: undefined,
|
||||||
user_page: 0,
|
user_page: 0,
|
||||||
|
@@ -1,9 +1,7 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { compose, withProps } from "recompose";
|
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import { jhapiRequest } from "../../util/jhapiUtil";
|
|
||||||
|
|
||||||
const AddUser = (props) => {
|
const AddUser = (props) => {
|
||||||
var [users, setUsers] = useState([]),
|
var [users, setUsers] = useState([]),
|
||||||
@@ -84,9 +82,6 @@ const AddUser = (props) => {
|
|||||||
/[!@#$%^&*(),.?":{}|<>]/g.test(e) == false
|
/[!@#$%^&*(),.?":{}|<>]/g.test(e) == false
|
||||||
);
|
);
|
||||||
if (filtered_users.length < users.length) {
|
if (filtered_users.length < users.length) {
|
||||||
let removed_users = users.filter(
|
|
||||||
(e) => !filtered_users.includes(e)
|
|
||||||
);
|
|
||||||
setUsers(filtered_users);
|
setUsers(filtered_users);
|
||||||
failRegexEvent();
|
failRegexEvent();
|
||||||
}
|
}
|
||||||
|
@@ -16,7 +16,9 @@ jest.mock("react-redux", () => ({
|
|||||||
|
|
||||||
describe("AddUser Component: ", () => {
|
describe("AddUser Component: ", () => {
|
||||||
var mockAsync = () =>
|
var mockAsync = () =>
|
||||||
jest.fn().mockImplementation(() => Promise.resolve({ key: "value" }));
|
jest
|
||||||
|
.fn()
|
||||||
|
.mockImplementation(() => Promise.resolve({ key: "value", status: 200 }));
|
||||||
|
|
||||||
var addUserJsx = (callbackSpy) => (
|
var addUserJsx = (callbackSpy) => (
|
||||||
<Provider store={createStore(() => {}, {})}>
|
<Provider store={createStore(() => {}, {})}>
|
||||||
@@ -25,7 +27,7 @@ describe("AddUser Component: ", () => {
|
|||||||
addUsers={callbackSpy}
|
addUsers={callbackSpy}
|
||||||
failRegexEvent={callbackSpy}
|
failRegexEvent={callbackSpy}
|
||||||
updateUsers={callbackSpy}
|
updateUsers={callbackSpy}
|
||||||
history={{ push: (a) => {} }}
|
history={{ push: () => {} }}
|
||||||
/>
|
/>
|
||||||
</HashRouter>
|
</HashRouter>
|
||||||
</Provider>
|
</Provider>
|
||||||
@@ -36,7 +38,7 @@ describe("AddUser Component: ", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
useDispatch.mockImplementation((callback) => {
|
useDispatch.mockImplementation(() => {
|
||||||
return () => {};
|
return () => {};
|
||||||
});
|
});
|
||||||
useSelector.mockImplementation((callback) => {
|
useSelector.mockImplementation((callback) => {
|
||||||
|
@@ -64,11 +64,11 @@ const CreateGroup = (props) => {
|
|||||||
className="btn btn-primary"
|
className="btn btn-primary"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
createGroup(groupName)
|
createGroup(groupName)
|
||||||
.then((data) =>
|
.then((data) => {
|
||||||
data.status < 300
|
return data.status < 300
|
||||||
? updateGroups(0, limit)
|
? updateGroups(0, limit)
|
||||||
.then((data) => dispatchPageUpdate(data, 0))
|
.then((data) => dispatchPageUpdate(data, 0))
|
||||||
.then((data) => history.push("/groups"))
|
.then(() => history.push("/groups"))
|
||||||
.catch((err) => console.log(err))
|
.catch((err) => console.log(err))
|
||||||
: setErrorAlert(
|
: setErrorAlert(
|
||||||
`[${data.status}] Failed to create group. ${
|
`[${data.status}] Failed to create group. ${
|
||||||
@@ -76,8 +76,8 @@ const CreateGroup = (props) => {
|
|||||||
? "Group already exists."
|
? "Group already exists."
|
||||||
: ""
|
: ""
|
||||||
}`
|
}`
|
||||||
)
|
);
|
||||||
)
|
})
|
||||||
.catch((err) => console.log(err));
|
.catch((err) => console.log(err));
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@@ -5,6 +5,7 @@ import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
|||||||
import { Provider, useDispatch, useSelector } from "react-redux";
|
import { Provider, useDispatch, useSelector } from "react-redux";
|
||||||
import { createStore } from "redux";
|
import { createStore } from "redux";
|
||||||
import { HashRouter } from "react-router-dom";
|
import { HashRouter } from "react-router-dom";
|
||||||
|
import regeneratorRuntime from "regenerator-runtime"; // eslint-disable-line
|
||||||
|
|
||||||
Enzyme.configure({ adapter: new Adapter() });
|
Enzyme.configure({ adapter: new Adapter() });
|
||||||
|
|
||||||
@@ -15,8 +16,8 @@ jest.mock("react-redux", () => ({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
describe("CreateGroup Component: ", () => {
|
describe("CreateGroup Component: ", () => {
|
||||||
var mockAsync = () =>
|
var mockAsync = (result) =>
|
||||||
jest.fn().mockImplementation(() => Promise.resolve({ key: "value" }));
|
jest.fn().mockImplementation(() => Promise.resolve(result));
|
||||||
|
|
||||||
var createGroupJsx = (callbackSpy) => (
|
var createGroupJsx = (callbackSpy) => (
|
||||||
<Provider store={createStore(() => {}, {})}>
|
<Provider store={createStore(() => {}, {})}>
|
||||||
@@ -35,7 +36,7 @@ describe("CreateGroup Component: ", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
useDispatch.mockImplementation((callback) => {
|
useDispatch.mockImplementation(() => {
|
||||||
return () => () => {};
|
return () => () => {};
|
||||||
});
|
});
|
||||||
useSelector.mockImplementation((callback) => {
|
useSelector.mockImplementation((callback) => {
|
||||||
@@ -52,14 +53,14 @@ describe("CreateGroup Component: ", () => {
|
|||||||
expect(component.find(".container").length).toBe(1);
|
expect(component.find(".container").length).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Calls createGroup and refreshGroupsData on submit", () => {
|
it("Calls createGroup on submit", () => {
|
||||||
let callbackSpy = mockAsync(),
|
let callbackSpy = mockAsync({ status: 200 }),
|
||||||
component = mount(createGroupJsx(callbackSpy)),
|
component = mount(createGroupJsx(callbackSpy)),
|
||||||
input = component.find("input").first(),
|
input = component.find("input").first(),
|
||||||
submit = component.find("#submit").first();
|
submit = component.find("#submit").first();
|
||||||
input.simulate("change", { target: { value: "" } });
|
input.simulate("change", { target: { value: "" } });
|
||||||
submit.simulate("click");
|
submit.simulate("click");
|
||||||
expect(callbackSpy).toHaveBeenNthCalledWith(1, "");
|
expect(callbackSpy).toHaveBeenNthCalledWith(1, "");
|
||||||
expect(callbackSpy).toHaveBeenNthCalledWith(2, 0, 3);
|
expect(component.find(".alert.alert-danger").length).toBe(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -4,7 +4,8 @@ import PropTypes from "prop-types";
|
|||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
|
||||||
const EditUser = (props) => {
|
const EditUser = (props) => {
|
||||||
var limit = useSelector((state) => state.limit);
|
var limit = useSelector((state) => state.limit),
|
||||||
|
[errorAlert, setErrorAlert] = useState(null);
|
||||||
|
|
||||||
var dispatch = useDispatch();
|
var dispatch = useDispatch();
|
||||||
|
|
||||||
@@ -40,6 +41,15 @@ const EditUser = (props) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="container">
|
<div className="container">
|
||||||
|
{errorAlert != null ? (
|
||||||
|
<div className="row">
|
||||||
|
<div className="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
|
||||||
|
<div className="alert alert-danger">{errorAlert}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
|
<div className="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
|
||||||
<div className="panel panel-default">
|
<div className="panel panel-default">
|
||||||
@@ -64,7 +74,7 @@ const EditUser = (props) => {
|
|||||||
checked={admin}
|
checked={admin}
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
id="admin-check"
|
id="admin-check"
|
||||||
onChange={(e) => setAdmin(!admin)}
|
onChange={() => setAdmin(!admin)}
|
||||||
/>
|
/>
|
||||||
<span> </span>
|
<span> </span>
|
||||||
<label className="form-check-label">Admin</label>
|
<label className="form-check-label">Admin</label>
|
||||||
@@ -75,10 +85,14 @@ const EditUser = (props) => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
deleteUser(username)
|
deleteUser(username)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
updateUsers(0, limit)
|
data.status < 300
|
||||||
.then((data) => dispatchPageChange(data, 0))
|
? updateUsers(0, limit)
|
||||||
.then(() => history.push("/"))
|
.then((data) => dispatchPageChange(data, 0))
|
||||||
.catch((err) => console.log(err));
|
.then(() => history.push("/"))
|
||||||
|
.catch((err) => console.log(err))
|
||||||
|
: setErrorAlert(
|
||||||
|
`[${data.status}] Failed to edit user.`
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.catch((err) => console.log(err));
|
.catch((err) => console.log(err));
|
||||||
}}
|
}}
|
||||||
@@ -111,12 +125,18 @@ const EditUser = (props) => {
|
|||||||
admin
|
admin
|
||||||
)
|
)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
updateUsers(0, limit)
|
data.status < 300
|
||||||
.then((data) => dispatchPageChange(data, 0))
|
? updateUsers(0, limit)
|
||||||
.then(() => history.push("/"))
|
.then((data) => dispatchPageChange(data, 0))
|
||||||
.catch((err) => console.log(err));
|
.then(() => history.push("/"))
|
||||||
|
.catch((err) => console.log(err))
|
||||||
|
: setErrorAlert(
|
||||||
|
`[${data.status}] Failed to edit user.`
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.catch((err) => {});
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
setUpdatedUsername("");
|
setUpdatedUsername("");
|
||||||
failRegexEvent();
|
failRegexEvent();
|
||||||
@@ -124,12 +144,18 @@ const EditUser = (props) => {
|
|||||||
} else {
|
} else {
|
||||||
editUser(username, username, admin)
|
editUser(username, username, admin)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
updateUsers(0, limit)
|
data.status < 300
|
||||||
.then((data) => dispatchPageChange(data, 0))
|
? updateUsers(0, limit)
|
||||||
.then(() => history.push("/"))
|
.then((data) => dispatchPageChange(data, 0))
|
||||||
.catch((err) => console.log(err));
|
.then(() => history.push("/"))
|
||||||
|
.catch((err) => console.log(err))
|
||||||
|
: setErrorAlert(
|
||||||
|
`[${data.status}] Failed to edit user.`
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.catch((err) => {});
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@@ -16,7 +16,9 @@ jest.mock("react-redux", () => ({
|
|||||||
|
|
||||||
describe("EditUser Component: ", () => {
|
describe("EditUser Component: ", () => {
|
||||||
var mockAsync = () =>
|
var mockAsync = () =>
|
||||||
jest.fn().mockImplementation(() => Promise.resolve({ key: "value" }));
|
jest
|
||||||
|
.fn()
|
||||||
|
.mockImplementation(() => Promise.resolve({ key: "value", status: 200 }));
|
||||||
var mockSync = () => jest.fn();
|
var mockSync = () => jest.fn();
|
||||||
|
|
||||||
var editUserJsx = (callbackSpy, empty) => (
|
var editUserJsx = (callbackSpy, empty) => (
|
||||||
@@ -29,7 +31,7 @@ describe("EditUser Component: ", () => {
|
|||||||
deleteUser={callbackSpy}
|
deleteUser={callbackSpy}
|
||||||
editUser={callbackSpy}
|
editUser={callbackSpy}
|
||||||
updateUsers={callbackSpy}
|
updateUsers={callbackSpy}
|
||||||
history={{ push: (a) => {} }}
|
history={{ push: () => {} }}
|
||||||
failRegexEvent={callbackSpy}
|
failRegexEvent={callbackSpy}
|
||||||
noChangeEvent={callbackSpy}
|
noChangeEvent={callbackSpy}
|
||||||
/>
|
/>
|
||||||
@@ -42,7 +44,7 @@ describe("EditUser Component: ", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
useDispatch.mockImplementation((callback) => {
|
useDispatch.mockImplementation(() => {
|
||||||
return () => {};
|
return () => {};
|
||||||
});
|
});
|
||||||
useSelector.mockImplementation((callback) => {
|
useSelector.mockImplementation((callback) => {
|
||||||
|
@@ -2,14 +2,11 @@ import React, { useState } from "react";
|
|||||||
import { useSelector, useDispatch } from "react-redux";
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import regeneratorRuntime from "regenerator-runtime";
|
|
||||||
import GroupSelect from "../GroupSelect/GroupSelect";
|
import GroupSelect from "../GroupSelect/GroupSelect";
|
||||||
|
|
||||||
const GroupEdit = (props) => {
|
const GroupEdit = (props) => {
|
||||||
var [selected, setSelected] = useState([]),
|
var [selected, setSelected] = useState([]),
|
||||||
[changed, setChanged] = useState(false),
|
[changed, setChanged] = useState(false),
|
||||||
[added, setAdded] = useState(undefined),
|
|
||||||
[removed, setRemoved] = useState(undefined),
|
|
||||||
limit = useSelector((state) => state.limit);
|
limit = useSelector((state) => state.limit);
|
||||||
|
|
||||||
var dispatch = useDispatch();
|
var dispatch = useDispatch();
|
||||||
@@ -39,7 +36,7 @@ const GroupEdit = (props) => {
|
|||||||
return <></>;
|
return <></>;
|
||||||
}
|
}
|
||||||
|
|
||||||
var { group_data, callback } = location.state;
|
var { group_data } = location.state;
|
||||||
|
|
||||||
if (!group_data) return <div></div>;
|
if (!group_data) return <div></div>;
|
||||||
|
|
||||||
@@ -83,9 +80,6 @@ const GroupEdit = (props) => {
|
|||||||
(e) => !selected.includes(e)
|
(e) => !selected.includes(e)
|
||||||
);
|
);
|
||||||
|
|
||||||
setAdded(new_users);
|
|
||||||
setRemoved(removed_users);
|
|
||||||
|
|
||||||
let promiseQueue = [];
|
let promiseQueue = [];
|
||||||
if (new_users.length > 0)
|
if (new_users.length > 0)
|
||||||
promiseQueue.push(addToGroup(new_users, group_data.name));
|
promiseQueue.push(addToGroup(new_users, group_data.name));
|
||||||
@@ -95,7 +89,7 @@ const GroupEdit = (props) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Promise.all(promiseQueue)
|
Promise.all(promiseQueue)
|
||||||
.then((e) => {
|
.then(() => {
|
||||||
updateGroups(0, limit)
|
updateGroups(0, limit)
|
||||||
.then((data) => dispatchPageUpdate(data, 0))
|
.then((data) => dispatchPageUpdate(data, 0))
|
||||||
.then(() => history.push("/groups"));
|
.then(() => history.push("/groups"));
|
||||||
@@ -112,7 +106,7 @@ const GroupEdit = (props) => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
var groupName = group_data.name;
|
var groupName = group_data.name;
|
||||||
deleteGroup(groupName)
|
deleteGroup(groupName)
|
||||||
.then((e) => {
|
.then(() => {
|
||||||
updateGroups(0, limit)
|
updateGroups(0, limit)
|
||||||
.then((data) => dispatchPageUpdate(data, 0))
|
.then((data) => dispatchPageUpdate(data, 0))
|
||||||
.then(() => history.push("/groups"));
|
.then(() => history.push("/groups"));
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import Enzyme, { mount, shallow } from "enzyme";
|
import Enzyme, { mount } from "enzyme";
|
||||||
import GroupEdit from "./GroupEdit";
|
import GroupEdit from "./GroupEdit";
|
||||||
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
import Adapter from "@wojtekmaj/enzyme-adapter-react-17";
|
||||||
import { Provider, useSelector } from "react-redux";
|
import { Provider, useSelector } from "react-redux";
|
||||||
import { createStore } from "redux";
|
import { createStore } from "redux";
|
||||||
import { HashRouter } from "react-router-dom";
|
import { HashRouter } from "react-router-dom";
|
||||||
import ReactDOM from "react-dom";
|
|
||||||
import { act } from "react-dom/test-utils";
|
import { act } from "react-dom/test-utils";
|
||||||
|
import regeneratorRuntime from "regenerator-runtime"; // eslint-disable-line
|
||||||
|
|
||||||
Enzyme.configure({ adapter: new Adapter() });
|
Enzyme.configure({ adapter: new Adapter() });
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ describe("GroupEdit Component: ", () => {
|
|||||||
addToGroup={callbackSpy}
|
addToGroup={callbackSpy}
|
||||||
removeFromGroup={callbackSpy}
|
removeFromGroup={callbackSpy}
|
||||||
deleteGroup={callbackSpy}
|
deleteGroup={callbackSpy}
|
||||||
history={{ push: (a) => callbackSpy }}
|
history={{ push: () => callbackSpy }}
|
||||||
updateGroups={callbackSpy}
|
updateGroups={callbackSpy}
|
||||||
validateUser={jest.fn().mockImplementation(() => okPacket)}
|
validateUser={jest.fn().mockImplementation(() => okPacket)}
|
||||||
/>
|
/>
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { useSelector, useDispatch } from "react-redux";
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
import { compose, withProps } from "recompose";
|
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
@@ -10,7 +9,6 @@ const Groups = (props) => {
|
|||||||
var user_data = useSelector((state) => state.user_data),
|
var user_data = useSelector((state) => state.user_data),
|
||||||
groups_data = useSelector((state) => state.groups_data),
|
groups_data = useSelector((state) => state.groups_data),
|
||||||
groups_page = useSelector((state) => state.groups_page),
|
groups_page = useSelector((state) => state.groups_page),
|
||||||
user_page = useSelector((state) => state.user_page),
|
|
||||||
limit = useSelector((state) => state.limit),
|
limit = useSelector((state) => state.limit),
|
||||||
dispatch = useDispatch(),
|
dispatch = useDispatch(),
|
||||||
page = parseInt(new URLSearchParams(props.location.search).get("page"));
|
page = parseInt(new URLSearchParams(props.location.search).get("page"));
|
||||||
|
@@ -39,7 +39,7 @@ describe("Groups Component: ", () => {
|
|||||||
useSelector.mockImplementation((callback) => {
|
useSelector.mockImplementation((callback) => {
|
||||||
return callback(mockAppState());
|
return callback(mockAppState());
|
||||||
});
|
});
|
||||||
useDispatch.mockImplementation((callback) => {
|
useDispatch.mockImplementation(() => {
|
||||||
return () => {};
|
return () => {};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { compose, withProps } from "recompose";
|
|
||||||
import { useSelector, useDispatch } from "react-redux";
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
|
|
||||||
@@ -9,7 +8,6 @@ import { FaSort, FaSortUp, FaSortDown } from "react-icons/fa";
|
|||||||
|
|
||||||
import "./server-dashboard.css";
|
import "./server-dashboard.css";
|
||||||
import { timeSince } from "../../util/timeSince";
|
import { timeSince } from "../../util/timeSince";
|
||||||
import { jhapiRequest } from "../../util/jhapiUtil";
|
|
||||||
import PaginationFooter from "../PaginationFooter/PaginationFooter";
|
import PaginationFooter from "../PaginationFooter/PaginationFooter";
|
||||||
|
|
||||||
const ServerDashboard = (props) => {
|
const ServerDashboard = (props) => {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import Enzyme, { shallow, mount } from "enzyme";
|
import Enzyme, { mount } from "enzyme";
|
||||||
import ServerDashboard from "./ServerDashboard";
|
import ServerDashboard from "./ServerDashboard";
|
||||||
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";
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { withProps } from "recompose";
|
import { withProps } from "recompose";
|
||||||
import { jhapiRequest } from "./jhapiUtil";
|
import { jhapiRequest } from "./jhapiUtil";
|
||||||
|
|
||||||
const withAPI = withProps((props) => ({
|
const withAPI = withProps(() => ({
|
||||||
updateUsers: (offset, limit) =>
|
updateUsers: (offset, limit) =>
|
||||||
jhapiRequest(`/users?offset=${offset}&limit=${limit}`, "GET").then((data) =>
|
jhapiRequest(`/users?offset=${offset}&limit=${limit}`, "GET").then((data) =>
|
||||||
data.json()
|
data.json()
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user