diff --git a/jsx/src/components/ServerDashboard/ServerDashboard.jsx b/jsx/src/components/ServerDashboard/ServerDashboard.jsx
index d177fb98..616f5a68 100644
--- a/jsx/src/components/ServerDashboard/ServerDashboard.jsx
+++ b/jsx/src/components/ServerDashboard/ServerDashboard.jsx
@@ -45,11 +45,11 @@ const ServerDashboard = (props) => {
adminAsc = (e) => e.sort((a) => (a.admin ? 1 : -1)),
dateDesc = (e) =>
e.sort((a, b) =>
- new Date(a.last_activity) - new Date(b.last_activity) > 0 ? -1 : 1,
+ new Date(a.last_activity) - new Date(b.last_activity) > 0 ? -1 : 1
),
dateAsc = (e) =>
e.sort((a, b) =>
- new Date(a.last_activity) - new Date(b.last_activity) > 0 ? 1 : -1,
+ new Date(a.last_activity) - new Date(b.last_activity) > 0 ? 1 : -1
),
runningAsc = (e) => e.sort((a) => (a.server == null ? -1 : 1)),
runningDesc = (e) => e.sort((a) => (a.server == null ? 1 : -1));
@@ -74,6 +74,7 @@ const ServerDashboard = (props) => {
shutdownHub,
startServer,
stopServer,
+ deleteServer,
startAll,
stopAll,
history,
@@ -143,7 +144,7 @@ const ServerDashboard = (props) => {
dispatchPageUpdate(
data.items,
data._pagination,
- name_filter,
+ name_filter
);
})
.catch(() => {
@@ -167,6 +168,50 @@ const ServerDashboard = (props) => {
);
};
+ const DeleteServerButton = ({ serverName, userName }) => {
+ if (serverName === "") {
+ return null;
+ }
+ var [isDisabled, setIsDisabled] = useState(false);
+ return (
+
+ );
+ };
+
const StartServerButton = ({ serverName, userName }) => {
var [isDisabled, setIsDisabled] = useState(false);
return (
@@ -183,7 +228,7 @@ const ServerDashboard = (props) => {
dispatchPageUpdate(
data.items,
data._pagination,
- name_filter,
+ name_filter
);
})
.catch(() => {
@@ -324,6 +369,10 @@ const ServerDashboard = (props) => {
userName={user.name}
style={{ marginRight: 20 }}
/>
+
{
failedServers.length > 1 ? "servers" : "server"
}. ${
failedServers.length > 1 ? "Are they " : "Is it "
- } already running?`,
+ } already running?`
);
}
return res;
@@ -494,11 +543,11 @@ const ServerDashboard = (props) => {
dispatchPageUpdate(
data.items,
data._pagination,
- name_filter,
+ name_filter
);
})
.catch(() =>
- setErrorAlert(`Failed to update users list.`),
+ setErrorAlert(`Failed to update users list.`)
);
return res;
})
@@ -523,7 +572,7 @@ const ServerDashboard = (props) => {
failedServers.length > 1 ? "servers" : "server"
}. ${
failedServers.length > 1 ? "Are they " : "Is it "
- } already stopped?`,
+ } already stopped?`
);
}
return res;
@@ -534,11 +583,11 @@ const ServerDashboard = (props) => {
dispatchPageUpdate(
data.items,
data._pagination,
- name_filter,
+ name_filter
);
})
.catch(() =>
- setErrorAlert(`Failed to update users list.`),
+ setErrorAlert(`Failed to update users list.`)
);
return res;
})
@@ -582,6 +631,7 @@ ServerDashboard.propTypes = {
shutdownHub: PropTypes.func,
startServer: PropTypes.func,
stopServer: PropTypes.func,
+ deleteServer: PropTypes.func,
startAll: PropTypes.func,
stopAll: PropTypes.func,
dispatch: PropTypes.func,
diff --git a/jsx/src/util/withAPI.js b/jsx/src/util/withAPI.js
index 28cb25d8..abce6a5f 100644
--- a/jsx/src/util/withAPI.js
+++ b/jsx/src/util/withAPI.js
@@ -7,17 +7,23 @@ const withAPI = withProps(() => ({
`/users?include_stopped_servers&offset=${offset}&limit=${limit}&name_filter=${
name_filter || ""
}`,
- "GET",
+ "GET"
).then((data) => data.json()),
updateGroups: (offset, limit) =>
jhapiRequest(`/groups?offset=${offset}&limit=${limit}`, "GET").then(
- (data) => data.json(),
+ (data) => data.json()
),
shutdownHub: () => jhapiRequest("/shutdown", "POST"),
startServer: (name, serverName = "") =>
jhapiRequest("/users/" + name + "/servers/" + (serverName || ""), "POST"),
stopServer: (name, serverName = "") =>
jhapiRequest("/users/" + name + "/servers/" + (serverName || ""), "DELETE"),
+ deleteServer: (name, serverName = "") =>
+ jhapiRequest(
+ "/users/" + name + "/servers/" + (serverName || ""),
+ "DELETE",
+ { remove: true }
+ ),
startAll: (names) =>
names.map((e) => jhapiRequest("/users/" + e + "/server", "POST")),
stopAll: (names) =>