Skip to content
Snippets Groups Projects
Commit dc48f329 authored by Larbi Gharib's avatar Larbi Gharib
Browse files

Edit click card fix search

Change-Id: I4ff060e75ee34d108fbd3709e5216e2127302901
parent 49a30345
No related branches found
No related tags found
No related merge requests found
...@@ -63,6 +63,15 @@ const styles = { ...@@ -63,6 +63,15 @@ const styles = {
fontFamily: "'Roboto', 'Helvetica', 'Arial', sans-serif", fontFamily: "'Roboto', 'Helvetica', 'Arial', sans-serif",
marginBottom: "3px", marginBottom: "3px",
textDecoration: "none" textDecoration: "none"
},
deleteIcon : {
float: "right"
},
search : {
width: "90%"
},
loading: {
width: '100%',
} }
}; };
...@@ -122,9 +131,6 @@ export default function Groups() { ...@@ -122,9 +131,6 @@ export default function Groups() {
setZeroGroup(true); setZeroGroup(true);
else{ else{
setZeroGroup(false); setZeroGroup(false);
allGroups.map((group) => {
group.display = ""
})
} }
setGroups(allGroups) setGroups(allGroups)
setLoading(false) setLoading(false)
...@@ -161,12 +167,6 @@ export default function Groups() { ...@@ -161,12 +167,6 @@ export default function Groups() {
setSelectedGroupName(name) setSelectedGroupName(name)
} }
const redirectToGroupList = (e) => {
e.preventDefault()
setSelectedGroup(false);
history.push('/admin/groups')
}
const handleCheckGroupNameExists = (searchGroupNameValue) => { const handleCheckGroupNameExists = (searchGroupNameValue) => {
axios(configApiCall(api_path_get_list_group+"?groupName="+searchGroupNameValue, 'GET', null, null)).then((response)=>{ axios(configApiCall(api_path_get_list_group+"?groupName="+searchGroupNameValue, 'GET', null, null)).then((response)=>{
if(response.data === "[]"){ if(response.data === "[]"){
...@@ -353,40 +353,41 @@ export default function Groups() { ...@@ -353,40 +353,41 @@ export default function Groups() {
? ?
groups.filter((data)=>{ groups.filter((data)=>{
if(searchValue === null){ if(searchValue === null){
return data return data;
} } else {
else if((data.name != null ) && data.name.toLowerCase().includes(searchValue.toLowerCase()) return data.name.toLowerCase().includes(searchValue.toLowerCase());
){
return data
} }
}).map(group => }).map(group =>
<GridItem xs={12} sm={12} md={2} key={group.name} style={{display: group.display}}> <GridItem xs={12} sm={12} md={2} key={group.name} >
<Card profile> <Card profile>
<CardBody profile> <CardBody profile>
<h3 className={classes.cardTitle}>{group.name}</h3> <a href="#" onClick={(e) => redirectToGroup(e, group.name)}>
<ul> <h3 className={classes.cardTitle}>{group.name}</h3>
<li><PersonIcon fontSize='small' style={{ marginRight: "10px"}}/><strong style={{ marginRight: "5px"}}>{group.groupMembers.length}</strong>users</li> <ul>
<li><MailOutlineIcon fontSize='small' style={{ marginRight: "10px"}}/><strong style={{ marginRight: "5px"}}>Blueprint</strong>{group.blueprint}</li> <li><PersonIcon fontSize='small' style={{ marginRight: "10px"}}/><strong style={{ marginRight: "5px"}}>{group.groupMembers.length}</strong>users</li>
</ul> <li><MailOutlineIcon fontSize='small' style={{ marginRight: "10px"}}/><strong style={{ marginRight: "5px"}}>Blueprint</strong>{group.blueprint}</li>
</ul>
</a>
</CardBody> </CardBody>
<CardFooter> <CardFooter>
<IconButton color="primary" onClick={ (e) => redirectToGroup(e, group.name)}><EditOutlinedIcon /></IconButton>
<IconButton color="secondary" onClick={ () => {handleRemoveGroup(group.name)}}><DeleteOutlineIcon /></IconButton> <IconButton color="secondary" onClick={ () => {handleRemoveGroup(group.name)}}><DeleteOutlineIcon /></IconButton>
</CardFooter> </CardFooter>
</Card> </Card>
</GridItem>) </GridItem>)
: :
<GridItem xs={12} sm={12} md={2} key={groups.name} style={{display: groups.display}}> <GridItem xs={12} sm={12} md={2} key={groups.name}>
<Card profile> <Card profile>
<CardBody profile> <CardBody profile>
<h3 className={classes.cardTitle}>{groups.name}</h3> <a href="#" onClick={(e) => redirectToGroup(e, groups.name)}>
<ul> <h3 className={classes.cardTitle}>{groups.name}</h3>
<li><PersonIcon fontSize='small' style={{ marginRight: "10px"}}/><strong style={{ marginRight: "5px"}}>{typeof groups.groupMembers !== 'undefined' ? groups.groupMembers : 0 }</strong>users</li> <ul>
<li><MailOutlineIcon fontSize='small' style={{ marginRight: "10px"}}/><strong style={{ marginRight: "5px"}}>Blueprint</strong>{selectedBlueprint.label}</li> <li><PersonIcon fontSize='small' style={{ marginRight: "10px"}}/><strong style={{ marginRight: "5px"}}>{typeof groups.groupMembers !== 'undefined' ? groups.groupMembers : 0 }</strong>users</li>
</ul> <li><MailOutlineIcon fontSize='small' style={{ marginRight: "10px"}}/><strong style={{ marginRight: "5px"}}>Blueprint</strong>{selectedBlueprint.label}</li>
</ul>
</a>
</CardBody> </CardBody>
<CardFooter> <CardFooter>
<IconButton color="primary" onClick={ (e) => redirectToGroup(e, groups.name)}><EditOutlinedIcon /></IconButton>
<IconButton color="secondary" onClick={ () => {handleRemoveGroup(groups.name)}}><DeleteOutlineIcon /></IconButton> <IconButton color="secondary" onClick={ () => {handleRemoveGroup(groups.name)}}><DeleteOutlineIcon /></IconButton>
</CardFooter> </CardFooter>
</Card> </Card>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment