mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-12 20:43:02 +00:00
Fixed bug where users where deleted when changing group properties
This commit is contained in:
@@ -1,18 +1,6 @@
|
||||
import React, { useState } from "react";
|
||||
import "./table-select.css";
|
||||
|
||||
function hasDuplicates(array) {
|
||||
var valuesSoFar = Object.create(null);
|
||||
for (var i = 0; i < array.length; ++i) {
|
||||
var value = array[i];
|
||||
if (value in valuesSoFar) {
|
||||
return true;
|
||||
}
|
||||
valuesSoFar[value] = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export default class DynamicTable extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
@@ -86,7 +86,7 @@ const GroupEdit = (props) => {
|
||||
setProp={setProp}
|
||||
setPropKeys={setPropKeys}
|
||||
setPropValues={setPropValues}
|
||||
setChanged={setChanged}
|
||||
|
||||
//Add keys
|
||||
/>
|
||||
</div>
|
||||
@@ -102,12 +102,6 @@ const GroupEdit = (props) => {
|
||||
id="submit"
|
||||
className="btn btn-primary"
|
||||
onClick={() => {
|
||||
// check for changes
|
||||
//if (!changed) {
|
||||
// history.push("/groups");
|
||||
// return;
|
||||
//}
|
||||
|
||||
let new_users = selected.filter(
|
||||
(e) => !group_data.users.includes(e)
|
||||
);
|
||||
@@ -115,12 +109,16 @@ const GroupEdit = (props) => {
|
||||
(e) => !selected.includes(e)
|
||||
);
|
||||
let promiseQueue = [];
|
||||
// check for changes
|
||||
if (changed) {
|
||||
if (new_users.length > 0)
|
||||
promiseQueue.push(addToGroup(new_users, group_data.name));
|
||||
if (removed_users.length > 0)
|
||||
promiseQueue.push(
|
||||
removeFromGroup(removed_users, group_data.name)
|
||||
);
|
||||
}
|
||||
|
||||
if (hasDuplicates(propkeys) == true) {
|
||||
error.textContent = "Duplicate key found!";
|
||||
error.style.color = "red";
|
||||
|
Reference in New Issue
Block a user