Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-jams
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-jams
Commits
0c270920
Commit
0c270920
authored
4 years ago
by
Ndèye Anna Ndiaye
Committed by
Larbi Gharib
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Correcting error on first group creation
Change-Id: I0751c72db00fdacadf260b8e9263a0dad9621528
parent
6309ffce
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jams-react-client/src/views/Groups/Groups.js
+97
-80
97 additions, 80 deletions
jams-react-client/src/views/Groups/Groups.js
with
97 additions
and
80 deletions
jams-react-client/src/views/Groups/Groups.js
+
97
−
80
View file @
0c270920
...
...
@@ -74,7 +74,7 @@ export default function Groups() {
const
[
groups
,
setGroups
]
=
React
.
useState
([])
const
[
selectedGroupName
,
setSelectedGroupName
]
=
React
.
useState
(
""
)
const
[
loading
,
setLoading
]
=
React
.
useState
(
false
)
const
[
zeroGroup
,
setZeroGroup
]
=
React
.
useState
(
fals
e
)
const
[
zeroGroup
,
setZeroGroup
]
=
React
.
useState
(
tru
e
)
const
[
progress
,
setProgress
]
=
React
.
useState
(
0
);
const
[
searchValue
,
setSearchValue
]
=
React
.
useState
(
null
)
...
...
@@ -211,7 +211,7 @@ export default function Groups() {
const
blueprintsOptionsItems
=
tool
.
buildSelectMenuItems
(
getGroupsOptions
());
const
[
selectedBlueprint
,
setSelectedBlueprint
]
=
useState
({
value
:
0
,
label
:
""
})
const
[
selectedBlueprint
,
setSelectedBlueprint
]
=
useState
({
value
:
0
,
label
:
"
No blueprint
"
})
const
handleBlueprintsChange
=
(
e
)
=>
{
setSelectedBlueprint
(
getGroupsOptions
()[
e
.
target
.
value
])
...
...
@@ -223,9 +223,9 @@ export default function Groups() {
<
Button
variant
=
"
contained
"
color
=
"
info
"
href
=
"
#contained-buttons
"
onClick
=
{
redirectToGroupList
}
>
<
KeyboardReturnIcon
/>
<
/Button
>
<
EditGroup
groupName
=
{
selectedGroupName
}
initCheckGroupNameExists
=
{
initCheckGroupNameExists
}
<
EditGroup
groupName
=
{
selectedGroupName
}
initCheckGroupNameExists
=
{
initCheckGroupNameExists
}
groupNameExits
=
{
groupNameExits
}
blueprintsOptionsItems
=
{
blueprintsOptionsItems
}
selectedBlueprint
=
{
selectedBlueprint
}
...
...
@@ -236,7 +236,7 @@ export default function Groups() {
}
else
{
return
(
<
div
>
<
Dialog
<
Dialog
open
=
{
openCreate
}
onClose
=
{
handleCloseCreate
}
aria
-
labelledby
=
"
alert-dialog-title
"
...
...
@@ -244,47 +244,47 @@ export default function Groups() {
>
<
DialogTitle
id
=
"
alert-dialog-title
"
>
{
"
Create group
"
}
<
/DialogTitle
>
<
DialogContent
>
<
DialogContentText
id
=
"
alert-dialog-description
"
>
<
Grid
container
spacing
=
{
2
}
>
<
Grid
item
xs
=
{
12
}
sm
=
{
12
}
md
=
{
12
}
>
<
FormControl
className
=
{
classes
.
margin
}
size
=
"
medium
"
error
=
{
groupNameExits
}
>
<
DialogContentText
id
=
"
alert-dialog-description
"
>
<
Grid
container
spacing
=
{
2
}
>
<
Grid
item
xs
=
{
12
}
sm
=
{
12
}
md
=
{
12
}
>
<
FormControl
className
=
{
classes
.
margin
}
size
=
"
medium
"
error
=
{
groupNameExits
}
>
<
InputLabel
htmlFor
=
"
groupName
"
>
Group
name
<
/InputLabel
>
<
Input
id
=
"
groupName
"
placeholder
=
{
groupName
}
startAdornment
=
{
<
InputAdornment
position
=
"
start
"
>
<
PeopleOutlineIcon
/>
<
/InputAdornment>
}
onChange
=
{
e
=>
{
const
searchGroupNameValue
=
e
.
target
.
value
;
setGroupName
(
searchGroupNameValue
);
initCheckGroupNameExists
(
groupName
);
}}
id
=
"
groupName
"
placeholder
=
{
groupName
}
startAdornment
=
{
<
InputAdornment
position
=
"
start
"
>
<
PeopleOutlineIcon
/>
<
/InputAdornment
>
}
onChange
=
{
e
=>
{
const
searchGroupNameValue
=
e
.
target
.
value
;
setGroupName
(
searchGroupNameValue
);
initCheckGroupNameExists
(
groupName
);
}}
/
>
<
/FormControl
>
<
/Grid
>
<
Grid
item
xs
=
{
12
}
sm
=
{
12
}
md
=
{
12
}
>
<
Select
labelId
=
"
demo-simple-select-label
"
fullWidth
value
=
{
selectedBlueprint
.
value
}
onChange
=
{
handleBlueprintsChange
}
variant
=
"
outlined
"
children
=
{
blueprintsOptionsItems
}
/
>
<
/FormControl
>
<
/Grid
>
<
Grid
item
xs
=
{
12
}
sm
=
{
12
}
md
=
{
12
}
>
<
Select
labelId
=
"
demo-simple-select-label
"
fullWidth
value
=
{
selectedBlueprint
.
value
}
onChange
=
{
handleBlueprintsChange
}
variant
=
"
outlined
"
children
=
{
blueprintsOptionsItems
}
/
>
<
/Grid
>
<
/Grid
>
<
/Grid
>
<
/DialogContentText
>
<
/DialogContentText
>
<
/DialogContent
>
<
DialogActions
>
<
Button
onClick
=
{
handleCloseCreate
}
color
=
"
danger
"
>
Cancel
<
/Button
>
<
Button
onClick
=
{
handleCreateGroup
}
color
=
"
primary
"
autoFocus
>
Create
<
/Button
>
<
Button
onClick
=
{
handleCloseCreate
}
color
=
"
danger
"
>
Cancel
<
/Button
>
<
Button
onClick
=
{
handleCreateGroup
}
color
=
"
primary
"
autoFocus
>
Create
<
/Button
>
<
/DialogActions
>
<
/Dialog
>
<
Dialog
...
...
@@ -295,17 +295,17 @@ export default function Groups() {
>
<
DialogTitle
id
=
"
alert-dialog-title
"
>
{
"
Remove group
"
}
<
/DialogTitle
>
<
DialogContent
>
<
DialogContentText
id
=
"
alert-dialog-description
"
>
Are
you
sure
you
want
to
delete
<
strong
>
{
removedGroup
}
<
/strong>
?
<
/DialogContentText
>
<
DialogContentText
id
=
"
alert-dialog-description
"
>
Are
you
sure
you
want
to
delete
<
strong
>
{
removedGroup
}
<
/strong>
?
<
/DialogContentText
>
<
/DialogContent
>
<
DialogActions
>
<
Button
onClick
=
{()
=>
setOpenRemoveDialog
(
false
)}
color
=
"
primary
"
>
Cancel
<
/Button
>
<
Button
onClick
=
{
removeGroup
}
color
=
"
danger
"
autoFocus
>
Remove
<
/Button
>
<
Button
onClick
=
{()
=>
setOpenRemoveDialog
(
false
)}
color
=
"
primary
"
>
Cancel
<
/Button
>
<
Button
onClick
=
{
removeGroup
}
color
=
"
danger
"
autoFocus
>
Remove
<
/Button
>
<
/DialogActions
>
<
/Dialog
>
<
GridContainer
>
...
...
@@ -316,53 +316,70 @@ export default function Groups() {
<
/Button
>
}
<
div
className
=
{
classes
.
searchWrapper
}
>
<
CustomInput
formControlProps
=
{{
className
:
classes
.
margin
+
"
"
+
classes
.
search
}}
inputProps
=
{{
placeholder
:
"
Search groups ...
"
,
inputProps
:
{
"
aria-label
"
:
"
Search groups
"
},
onKeyUp
:
(
e
)
=>
setSearchValue
(
e
.
target
.
value
),
}}
<
CustomInput
formControlProps
=
{{
className
:
classes
.
margin
+
"
"
+
classes
.
search
}}
inputProps
=
{{
placeholder
:
"
Search groups ...
"
,
inputProps
:
{
"
aria-label
"
:
"
Search groups
"
},
onKeyUp
:
(
e
)
=>
setSearchValue
(
e
.
target
.
value
),
}}
/
>
<
Search
/>
<
div
className
=
{
classes
.
loading
}
>
{
loading
&&
<
LinearProgress
variant
=
"
determinate
"
value
=
{
progress
}
/>
}
<
/div>
<
/div
>
<
/div
>
<
/GridItem
>
{
zeroGroup
?
<
span
>
No
Group
Found
<
/span
>
<
span
>
No
Group
Found
<
/span
>
:
groups
.
filter
((
data
)
=>
{
if
(
searchValue
===
null
){
return
data
}
else
if
((
data
.
name
!=
null
)
&&
data
.
name
.
toLowerCase
().
includes
(
searchValue
.
toLowerCase
())
){
return
data
}
}).
map
(
group
=>
<
GridItem
xs
=
{
12
}
sm
=
{
12
}
md
=
{
2
}
key
=
{
group
.
username
}
style
=
{{
display
:
group
.
display
}}
>
groups
.
length
>=
1
?
groups
.
filter
((
data
)
=>
{
if
(
searchValue
===
null
){
return
data
}
else
if
((
data
.
name
!=
null
)
&&
data
.
name
.
toLowerCase
().
includes
(
searchValue
.
toLowerCase
())
){
return
data
}
}).
map
(
group
=>
<
GridItem
xs
=
{
12
}
sm
=
{
12
}
md
=
{
2
}
key
=
{
group
.
name
}
style
=
{{
display
:
group
.
display
}}
>
<
Card
profile
>
<
CardBody
profile
>
<
h3
className
=
{
classes
.
cardTitle
}
>
{
group
.
name
}
<
/h3
>
<
ul
>
<
li
><
PersonIcon
fontSize
=
'
small
'
style
=
{{
marginRight
:
"
10px
"
}}
/><strong style={{ marginRight: "5px"}}>{group.groupMembers.length}</
strong
>
users
<
/li
>
<
li
><
MailOutlineIcon
fontSize
=
'
small
'
style
=
{{
marginRight
:
"
10px
"
}}
/><strong style={{ marginRight: "5px"}}>Blueprint</
strong
>
{
selectedBlueprint
.
label
}
<
/li
>
<
/ul
>
<
/CardBody
>
<
CardFooter
>
<
IconButton
color
=
"
primary
"
onClick
=
{
(
e
)
=>
redirectToGroup
(
e
,
group
.
name
)}
><
EditOutlinedIcon
/><
/IconButton
>
<
IconButton
color
=
"
secondary
"
onClick
=
{
()
=>
{
handleRemoveGroup
(
group
.
name
)}}
><
DeleteOutlineIcon
/><
/IconButton
>
<
/CardFooter
>
<
/Card
>
<
/GridItem>
)
:
<
GridItem
xs
=
{
12
}
sm
=
{
12
}
md
=
{
2
}
key
=
{
groups
.
name
}
style
=
{{
display
:
groups
.
display
}}
>
<
Card
profile
>
<
CardBody
profile
>
<
h3
className
=
{
classes
.
cardTitle
}
>
{
group
.
name
}
<
/h3
>
<
h3
className
=
{
classes
.
cardTitle
}
>
{
group
s
.
name
}
<
/h3
>
<
ul
>
<
li
><
PersonIcon
fontSize
=
'
small
'
style
=
{{
marginRight
:
"
10px
"
}}
/><strong style={{ marginRight: "5px"}}>{group.groupMembers
.length
}</
strong
>
users
<
/li
>
<
li
><
MailOutlineIcon
fontSize
=
'
small
'
style
=
{{
marginRight
:
"
10px
"
}}
/><strong style={{ marginRight: "5px"}}>Blueprint</
strong
>
{
group
.
b
lueprint
}
<
/li
>
<
li
><
PersonIcon
fontSize
=
'
small
'
style
=
{{
marginRight
:
"
10px
"
}}
/><strong style={{ marginRight: "5px"}}>{
typeof
group
s
.groupMembers
!== 'undefined'
?
groups.groupMembers : 0
}</
strong
>
users
<
/li
>
<
li
><
MailOutlineIcon
fontSize
=
'
small
'
style
=
{{
marginRight
:
"
10px
"
}}
/><strong style={{ marginRight: "5px"}}>Blueprint</
strong
>
{
selectedB
lueprint
.
label
}
<
/li
>
<
/ul
>
<
/CardBody
>
<
CardFooter
>
<
IconButton
color
=
"
primary
"
onClick
=
{
(
e
)
=>
redirectToGroup
(
e
,
group
.
name
)}
><
EditOutlinedIcon
/><
/IconButton
>
<
IconButton
color
=
"
secondary
"
onClick
=
{
()
=>
{
handleRemoveGroup
(
group
.
name
)}}
><
DeleteOutlineIcon
/><
/IconButton
>
<
IconButton
color
=
"
primary
"
onClick
=
{
(
e
)
=>
redirectToGroup
(
e
,
group
s
.
name
)}
><
EditOutlinedIcon
/><
/IconButton
>
<
IconButton
color
=
"
secondary
"
onClick
=
{
()
=>
{
handleRemoveGroup
(
group
s
.
name
)}}
><
DeleteOutlineIcon
/><
/IconButton
>
<
/CardFooter
>
<
/Card
>
<
/GridItem>
)
<
/GridItem
>
}
<
/GridContainer
>
<
/div
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment