mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-12 20:43:02 +00:00
Fix bug with umwarranted error messages
This commit is contained in:
@@ -110,13 +110,21 @@ const GroupEdit = (props) => {
|
|||||||
|
|
||||||
Promise.all(promiseQueue)
|
Promise.all(promiseQueue)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
data.status < 300
|
// ensure status of all requests are < 300
|
||||||
|
let allPassed =
|
||||||
|
data.map((e) => e.status).filter((e) => e >= 300).length ==
|
||||||
|
0;
|
||||||
|
|
||||||
|
allPassed
|
||||||
? updateGroups(0, limit)
|
? updateGroups(0, limit)
|
||||||
.then((data) => dispatchPageUpdate(data, 0))
|
.then((data) => dispatchPageUpdate(data, 0))
|
||||||
.then(() => history.push("/groups"))
|
.then(() => history.push("/groups"))
|
||||||
: setErrorAlert(`Failed to edit group.`);
|
: setErrorAlert(`Failed to edit group.`);
|
||||||
})
|
})
|
||||||
.catch(() => setErrorAlert(`Failed to edit group.`));
|
.catch(() => {
|
||||||
|
console.log("outer");
|
||||||
|
setErrorAlert(`Failed to edit group.`);
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Apply
|
Apply
|
||||||
|
@@ -242,17 +242,17 @@ const ServerDashboard = (props) => {
|
|||||||
onClick={() =>
|
onClick={() =>
|
||||||
stopServer(e.name)
|
stopServer(e.name)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
data < 300
|
if (res.status < 300) {
|
||||||
? updateUsers(...slice)
|
updateUsers(...slice)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
dispatchPageUpdate(data, page);
|
dispatchPageUpdate(data, page);
|
||||||
})
|
})
|
||||||
.catch(() =>
|
.catch(() =>
|
||||||
setErrorAlert(
|
setErrorAlert(`Failed to update users list.`)
|
||||||
`Failed to update users list.`
|
);
|
||||||
)
|
} else {
|
||||||
)
|
setErrorAlert(`Failed to stop server.`);
|
||||||
: setErrorAlert(`Failed to stop server`);
|
}
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch(() => setErrorAlert(`Failed to stop server.`))
|
.catch(() => setErrorAlert(`Failed to stop server.`))
|
||||||
@@ -267,17 +267,17 @@ const ServerDashboard = (props) => {
|
|||||||
onClick={() =>
|
onClick={() =>
|
||||||
startServer(e.name)
|
startServer(e.name)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
data < 300
|
if (res.status < 300) {
|
||||||
? updateUsers(...slice)
|
updateUsers(...slice)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
dispatchPageUpdate(data, page);
|
dispatchPageUpdate(data, page);
|
||||||
})
|
})
|
||||||
.catch(() =>
|
.catch(() =>
|
||||||
setErrorAlert(
|
setErrorAlert(`Failed to update users list.`)
|
||||||
`Failed to update users list.`
|
);
|
||||||
)
|
} else {
|
||||||
)
|
setErrorAlert(`Failed to start server.`);
|
||||||
: setErrorAlert(`Failed to start server`);
|
}
|
||||||
return res;
|
return res;
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
@@ -33,11 +33,7 @@ var serverDashboardJsx = (spy) => (
|
|||||||
);
|
);
|
||||||
|
|
||||||
var mockAsync = (data) =>
|
var mockAsync = (data) =>
|
||||||
jest
|
jest.fn().mockImplementation(() => Promise.resolve(data ? data : { k: "v" }));
|
||||||
.fn()
|
|
||||||
.mockImplementation(() =>
|
|
||||||
Promise.resolve({ json: () => Promise.resolve(data ? data : { k: "v" }) })
|
|
||||||
);
|
|
||||||
|
|
||||||
var mockAsyncRejection = () =>
|
var mockAsyncRejection = () =>
|
||||||
jest.fn().mockImplementation(() => Promise.reject());
|
jest.fn().mockImplementation(() => Promise.reject());
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user