mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-17 06:52:59 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
@@ -98,13 +98,13 @@ const AddUser = (props) => {
|
||||
.then((data) => dispatchPageChange(data, 0))
|
||||
.then(() => history.push("/"))
|
||||
.catch(() =>
|
||||
setErrorAlert(`Failed to update users.`)
|
||||
setErrorAlert(`Failed to update users.`),
|
||||
)
|
||||
: setErrorAlert(
|
||||
`Failed to create user. ${
|
||||
data.status == 409 ? "User already exists." : ""
|
||||
}`
|
||||
)
|
||||
}`,
|
||||
),
|
||||
)
|
||||
.catch(() => setErrorAlert(`Failed to create user.`));
|
||||
}}
|
||||
|
@@ -131,7 +131,7 @@ test("Shows a more specific UI error dialogue when user creation returns an impr
|
||||
});
|
||||
|
||||
let errorDialog = screen.getByText(
|
||||
"Failed to create user. User already exists."
|
||||
"Failed to create user. User already exists.",
|
||||
);
|
||||
|
||||
expect(errorDialog).toBeVisible();
|
||||
|
@@ -81,14 +81,14 @@ const CreateGroup = (props) => {
|
||||
.then((data) => dispatchPageUpdate(data, 0))
|
||||
.then(() => history.push("/groups"))
|
||||
.catch(() =>
|
||||
setErrorAlert(`Could not update groups list.`)
|
||||
setErrorAlert(`Could not update groups list.`),
|
||||
)
|
||||
: setErrorAlert(
|
||||
`Failed to create group. ${
|
||||
data.status == 409
|
||||
? "Group already exists."
|
||||
: ""
|
||||
}`
|
||||
}`,
|
||||
);
|
||||
})
|
||||
.catch(() => setErrorAlert(`Failed to create group.`));
|
||||
|
@@ -107,7 +107,7 @@ test("Shows a more specific UI error dialogue when user creation returns an impr
|
||||
});
|
||||
|
||||
let errorDialog = screen.getByText(
|
||||
"Failed to create group. Group already exists."
|
||||
"Failed to create group. Group already exists.",
|
||||
);
|
||||
|
||||
expect(errorDialog).toBeVisible();
|
||||
|
@@ -96,8 +96,8 @@ const EditUser = (props) => {
|
||||
.then(() => history.push("/"))
|
||||
.catch(() =>
|
||||
setErrorAlert(
|
||||
`Could not update users list.`
|
||||
)
|
||||
`Could not update users list.`,
|
||||
),
|
||||
)
|
||||
: setErrorAlert(`Failed to edit user.`);
|
||||
})
|
||||
@@ -129,7 +129,7 @@ const EditUser = (props) => {
|
||||
editUser(
|
||||
username,
|
||||
updatedUsername != "" ? updatedUsername : username,
|
||||
admin
|
||||
admin,
|
||||
)
|
||||
.then((data) => {
|
||||
data.status < 300
|
||||
@@ -137,7 +137,7 @@ const EditUser = (props) => {
|
||||
.then((data) => dispatchPageChange(data, 0))
|
||||
.then(() => history.push("/"))
|
||||
.catch(() =>
|
||||
setErrorAlert(`Could not update users list.`)
|
||||
setErrorAlert(`Could not update users list.`),
|
||||
)
|
||||
: setErrorAlert(`Failed to edit user.`);
|
||||
})
|
||||
|
@@ -94,10 +94,10 @@ const GroupEdit = (props) => {
|
||||
}
|
||||
|
||||
let new_users = selected.filter(
|
||||
(e) => !group_data.users.includes(e)
|
||||
(e) => !group_data.users.includes(e),
|
||||
);
|
||||
let removed_users = group_data.users.filter(
|
||||
(e) => !selected.includes(e)
|
||||
(e) => !selected.includes(e),
|
||||
);
|
||||
|
||||
let promiseQueue = [];
|
||||
@@ -105,7 +105,7 @@ const GroupEdit = (props) => {
|
||||
promiseQueue.push(addToGroup(new_users, group_data.name));
|
||||
if (removed_users.length > 0)
|
||||
promiseQueue.push(
|
||||
removeFromGroup(removed_users, group_data.name)
|
||||
removeFromGroup(removed_users, group_data.name),
|
||||
);
|
||||
|
||||
Promise.all(promiseQueue)
|
||||
|
@@ -90,7 +90,7 @@ const GroupSelect = (props) => {
|
||||
>
|
||||
{e}
|
||||
</div>
|
||||
)
|
||||
),
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -37,7 +37,7 @@ const Groups = (props) => {
|
||||
|
||||
useEffect(() => {
|
||||
updateGroups(offset, limit).then((data) =>
|
||||
dispatchPageUpdate(data.items, data._pagination)
|
||||
dispatchPageUpdate(data.items, data._pagination),
|
||||
);
|
||||
}, [offset, limit]);
|
||||
|
||||
|
@@ -38,11 +38,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));
|
||||
@@ -136,7 +136,7 @@ const ServerDashboard = (props) => {
|
||||
dispatchPageUpdate(
|
||||
data.items,
|
||||
data._pagination,
|
||||
name_filter
|
||||
name_filter,
|
||||
);
|
||||
})
|
||||
.catch(() => {
|
||||
@@ -176,7 +176,7 @@ const ServerDashboard = (props) => {
|
||||
dispatchPageUpdate(
|
||||
data.items,
|
||||
data._pagination,
|
||||
name_filter
|
||||
name_filter,
|
||||
);
|
||||
})
|
||||
.catch(() => {
|
||||
@@ -471,7 +471,7 @@ const ServerDashboard = (props) => {
|
||||
failedServers.length > 1 ? "servers" : "server"
|
||||
}. ${
|
||||
failedServers.length > 1 ? "Are they " : "Is it "
|
||||
} already running?`
|
||||
} already running?`,
|
||||
);
|
||||
}
|
||||
return res;
|
||||
@@ -482,11 +482,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;
|
||||
})
|
||||
@@ -511,7 +511,7 @@ const ServerDashboard = (props) => {
|
||||
failedServers.length > 1 ? "servers" : "server"
|
||||
}. ${
|
||||
failedServers.length > 1 ? "Are they " : "Is it "
|
||||
} already stopped?`
|
||||
} already stopped?`,
|
||||
);
|
||||
}
|
||||
return res;
|
||||
@@ -522,11 +522,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;
|
||||
})
|
||||
|
@@ -369,7 +369,7 @@ test("Shows a UI error dialogue when start all servers fails", async () => {
|
||||
/>
|
||||
</Switch>
|
||||
</HashRouter>
|
||||
</Provider>
|
||||
</Provider>,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -403,7 +403,7 @@ test("Shows a UI error dialogue when stop all servers fails", async () => {
|
||||
/>
|
||||
</Switch>
|
||||
</HashRouter>
|
||||
</Provider>
|
||||
</Provider>,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -437,7 +437,7 @@ test("Shows a UI error dialogue when start user server fails", async () => {
|
||||
/>
|
||||
</Switch>
|
||||
</HashRouter>
|
||||
</Provider>
|
||||
</Provider>,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -471,7 +471,7 @@ test("Shows a UI error dialogue when start user server returns an improper statu
|
||||
/>
|
||||
</Switch>
|
||||
</HashRouter>
|
||||
</Provider>
|
||||
</Provider>,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -505,7 +505,7 @@ test("Shows a UI error dialogue when stop user servers fails", async () => {
|
||||
/>
|
||||
</Switch>
|
||||
</HashRouter>
|
||||
</Provider>
|
||||
</Provider>,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -539,7 +539,7 @@ test("Shows a UI error dialogue when stop user server returns an improper status
|
||||
/>
|
||||
</Switch>
|
||||
</HashRouter>
|
||||
</Provider>
|
||||
</Provider>,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -585,7 +585,7 @@ test("Search for user calls updateUsers with name filter", async () => {
|
||||
/>
|
||||
</Switch>
|
||||
</HashRouter>
|
||||
</Provider>
|
||||
</Provider>,
|
||||
);
|
||||
});
|
||||
|
||||
|
@@ -7,11 +7,11 @@ 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 = "") =>
|
||||
|
@@ -41,10 +41,10 @@ module.exports = {
|
||||
const app = devServer.app;
|
||||
|
||||
var user_data = JSON.parse(
|
||||
'[{"kind":"user","name":"foo","admin":true,"groups":[],"server":"/user/foo/","pending":null,"created":"2020-12-07T18:46:27.112695Z","last_activity":"2020-12-07T21:00:33.336354Z","servers":{"":{"name":"","last_activity":"2020-12-07T20:58:02.437408Z","started":"2020-12-07T20:58:01.508266Z","pending":null,"ready":true,"state":{"pid":28085},"url":"/user/foo/","user_options":{},"progress_url":"/hub/api/users/foo/server/progress"}}},{"kind":"user","name":"bar","admin":false,"groups":[],"server":null,"pending":null,"created":"2020-12-07T18:46:27.115528Z","last_activity":"2020-12-07T20:43:51.013613Z","servers":{}}]'
|
||||
'[{"kind":"user","name":"foo","admin":true,"groups":[],"server":"/user/foo/","pending":null,"created":"2020-12-07T18:46:27.112695Z","last_activity":"2020-12-07T21:00:33.336354Z","servers":{"":{"name":"","last_activity":"2020-12-07T20:58:02.437408Z","started":"2020-12-07T20:58:01.508266Z","pending":null,"ready":true,"state":{"pid":28085},"url":"/user/foo/","user_options":{},"progress_url":"/hub/api/users/foo/server/progress"}}},{"kind":"user","name":"bar","admin":false,"groups":[],"server":null,"pending":null,"created":"2020-12-07T18:46:27.115528Z","last_activity":"2020-12-07T20:43:51.013613Z","servers":{}}]',
|
||||
);
|
||||
var group_data = JSON.parse(
|
||||
'[{"kind":"group","name":"testgroup","users":[]}, {"kind":"group","name":"testgroup2","users":["foo", "bar"]}]'
|
||||
'[{"kind":"group","name":"testgroup","users":[]}, {"kind":"group","name":"testgroup2","users":["foo", "bar"]}]',
|
||||
);
|
||||
|
||||
// get user_data
|
||||
|
@@ -5,7 +5,7 @@ require(["jquery", "moment", "jhapi", "utils"], function (
|
||||
$,
|
||||
moment,
|
||||
JHAPI,
|
||||
utils
|
||||
utils,
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
@@ -113,7 +113,7 @@ require(["jquery", "moment", "jhapi", "utils"], function (
|
||||
var serverName = row.data("server-name");
|
||||
el.attr(
|
||||
"href",
|
||||
utils.url_path_join(prefix, "user", user, serverName) + "/"
|
||||
utils.url_path_join(prefix, "user", user, serverName) + "/",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -127,7 +127,7 @@ require(["jquery", "moment", "jhapi", "utils"], function (
|
||||
var serverName = row.data("server-name");
|
||||
el.attr(
|
||||
"href",
|
||||
utils.url_path_join(prefix, "hub/spawn", user, serverName)
|
||||
utils.url_path_join(prefix, "hub/spawn", user, serverName),
|
||||
);
|
||||
});
|
||||
// cannot start all servers in this case
|
||||
@@ -187,7 +187,7 @@ require(["jquery", "moment", "jhapi", "utils"], function (
|
||||
success: function () {
|
||||
window.location.reload();
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
@@ -241,7 +241,7 @@ require(["jquery", "moment", "jhapi", "utils"], function (
|
||||
success: function () {
|
||||
window.location.reload();
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
|
@@ -38,7 +38,7 @@ define(["jquery", "utils"], function ($, utils) {
|
||||
var url = utils.url_path_join(
|
||||
this.base_url,
|
||||
"api",
|
||||
utils.encode_uri_components(path)
|
||||
utils.encode_uri_components(path),
|
||||
);
|
||||
$.ajax(url, options);
|
||||
};
|
||||
@@ -54,7 +54,7 @@ define(["jquery", "utils"], function ($, utils) {
|
||||
options = update(options, { type: "POST", dataType: null });
|
||||
this.api_request(
|
||||
utils.url_path_join("users", user, "servers", server_name),
|
||||
options
|
||||
options,
|
||||
);
|
||||
};
|
||||
|
||||
@@ -69,7 +69,7 @@ define(["jquery", "utils"], function ($, utils) {
|
||||
options = update(options, { type: "DELETE", dataType: null });
|
||||
this.api_request(
|
||||
utils.url_path_join("users", user, "servers", server_name),
|
||||
options
|
||||
options,
|
||||
);
|
||||
};
|
||||
|
||||
@@ -119,7 +119,7 @@ define(["jquery", "utils"], function ($, utils) {
|
||||
|
||||
this.api_request(
|
||||
utils.url_path_join("users", user, "admin-access"),
|
||||
options
|
||||
options,
|
||||
);
|
||||
};
|
||||
|
||||
@@ -143,7 +143,7 @@ define(["jquery", "utils"], function ($, utils) {
|
||||
options = update(options, { type: "DELETE" });
|
||||
this.api_request(
|
||||
utils.url_path_join("users", user, "tokens", token_id),
|
||||
options
|
||||
options,
|
||||
);
|
||||
};
|
||||
|
||||
|
@@ -33,7 +33,7 @@ require(["jquery", "jhapi", "moment"], function ($, JHAPI, moment) {
|
||||
$("#token-result").text(reply.token);
|
||||
$("#token-area").show();
|
||||
},
|
||||
}
|
||||
},
|
||||
);
|
||||
return false;
|
||||
});
|
||||
|
@@ -73,7 +73,7 @@ define(["jquery"], function ($) {
|
||||
ua = navigator.userAgent,
|
||||
tem;
|
||||
var M = ua.match(
|
||||
/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i
|
||||
/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i,
|
||||
);
|
||||
if (M && (tem = ua.match(/version\/([\.\d]+)/i)) !== null) M[2] = tem[1];
|
||||
M = M ? [M[1], M[2]] : [N, navigator.appVersion, "-?"];
|
||||
|
Reference in New Issue
Block a user