Skip to content
Snippets Groups Projects
Commit 340e599c authored by Ndèye Anna Ndiaye's avatar Ndèye Anna Ndiaye
Browse files

Remove back button

Change-Id: Ic5ae5aba256f0cef15cdb274ff20e9c8bd638046
parent 9f4abaa8
No related branches found
No related tags found
No related merge requests found
......@@ -95,7 +95,7 @@ export default function ServerParameters(props) {
auth.authenticated = true
auth.admin = true
auth.checkDirectoryType(() => {
history.push('/admin');
history.push('/admin/users');
})
}
......
......@@ -31,6 +31,11 @@ export default function Sidebar(props) {
const handleCloseProfile = () => {
auth.logout(() => { history.push("/") })
};
const handleListItemClick = (e, layout, path) => {
e.preventDefault();
history.push(layout+path.substring(0, 2))
};
// verifies if routeName is the one active (in browser input)
function activeRoute(routeName) {
......@@ -62,7 +67,7 @@ export default function Sidebar(props) {
activeClassName="active"
key={key}
>
<ListItem button className={classes.itemLink + listItemClasses}>
<ListItem button className={classes.itemLink + listItemClasses} onClick={e => handleListItemClick(e, prop.layout, prop.path)}>
{typeof prop.icon === "string" ? (
<Icon
className={classNames(classes.itemIcon, whiteFontClasses, {
......@@ -179,12 +184,12 @@ export default function Sidebar(props) {
}
Sidebar.propTypes = {
rtlActive: PropTypes.bool,
handleDrawerToggle: PropTypes.func,
bgColor: PropTypes.oneOf(["purple", "blue", "green", "orange", "red"]),
logo: PropTypes.string,
image: PropTypes.string,
logoText: PropTypes.string,
routes: PropTypes.arrayOf(PropTypes.object),
open: PropTypes.bool
rtlActive: PropTypes.bool,
handleDrawerToggle: PropTypes.func,
bgColor: PropTypes.oneOf(["purple", "blue", "green", "orange", "red"]),
logo: PropTypes.string,
image: PropTypes.string,
logoText: PropTypes.string,
routes: PropTypes.arrayOf(PropTypes.object),
open: PropTypes.bool
};
......@@ -34,7 +34,10 @@ const switchRoutes = (
}
return null;
})}
<Redirect from="/admin" to="/admin/users" />
<Redirect from="/admin/u" to="/admin/users" />
<Redirect from="/admin/g" to="/admin/groups" />
<Redirect from="/admin/b" to="/admin/blueprints" />
</Switch>
);
......
......@@ -77,7 +77,7 @@ export default function SignIn(props) {
React.useEffect(() => {
if(auth.isAuthenticated() && auth.isInstalled()) {
history.push('/admin');
history.push('/admin/users');
}
})
......@@ -91,7 +91,7 @@ export default function SignIn(props) {
auth.checkLastKnowStep(() => {
auth.checkDirectoryType(() => {
if(auth.isInstalled){
history.push('/admin');
history.push('/admin/users');
}
else{
history.push('/');
......
......@@ -131,11 +131,6 @@ export default function Blueprints() {
setSelectedBlueprint(true)
setSelectedBlueprintName(blueprintNameRedirect)
}
function redirectToBlueprints(e) {
e.preventDefault()
setSelectedBlueprint(false);
history.push('/admin/blueprints')
}
const handleCheckBlueprintNameExists = (searchBlueprintNameValue) => {
axios(configApiCall(api_path_blueprints+"?name="+searchBlueprintNameValue, 'GET', null, null)).then((response)=>{
......@@ -185,16 +180,6 @@ export default function Blueprints() {
<h4>You are not allowed to access this section. Please contact your administrator to get administrator privileges.</h4>
</div>
)
} else if(selectedBlueprint && auth.hasAdminScope()){
return (
<div>
<Button variant="contained" color="info" href="#contained-buttons" onClick={redirectToBlueprints} style={{color: "white"}}>
<KeyboardReturnIcon /> return to blueprints
</Button>
<h3>{selectedBlueprintName}</h3>
<Blueprint blueprintName={selectedBlueprintName}/>
</div>
)
}
else {
return (
......
......@@ -160,12 +160,6 @@ export default function Groups() {
setSelectedGroupName(name)
}
const redirectToGroupList = (e) => {
e.preventDefault()
setSelectedGroup(false);
history.push('/admin/groups')
}
const handleCheckGroupNameExists = (searchGroupNameValue) => {
axios(configApiCall(api_path_get_list_group+"?groupName="+searchGroupNameValue, 'GET', null, null)).then((response)=>{
if(response.data === "[]"){
......@@ -220,12 +214,9 @@ export default function Groups() {
if(selectedGroup && auth.hasAdminScope()){
return(
<div>
<Button variant="contained" color="info" href="#contained-buttons" onClick={redirectToGroupList}>
<KeyboardReturnIcon />
</Button>
<EditGroup
groupName={selectedGroupName}
initCheckGroupNameExists={initCheckGroupNameExists}
groupName={selectedGroupName}
initCheckGroupNameExists={initCheckGroupNameExists}
groupNameExits={groupNameExits}
blueprintsOptionsItems={blueprintsOptionsItems}
selectedBlueprint={selectedBlueprint}
......
......@@ -183,7 +183,7 @@ export default function EditCreateUserProfile(props) {
}
const handleCancel = () => {
history.push('/admin');
history.push('/admin/users');
}
const handleCancelUpdate = () => {
......@@ -291,7 +291,7 @@ export default function EditCreateUserProfile(props) {
const handleClosePassword = () => {
setOpenPassword(false);
history.push('/admin');
history.push('/admin/users');
}
/**
......
......@@ -115,11 +115,6 @@ export default function Users() {
setSelectedProfile(true);
setSelectedUsername(username)
}
const redirectToUsers = (e) => {
e.preventDefault()
setSelectedProfile(false);
history.push('/admin')
}
const searchUsers = (value) => {
axios(configApiCall(api_path_get_user_directory_search, 'GET', {"queryString": value ? value : "*"}, null)).then((response)=>{
......@@ -151,9 +146,6 @@ export default function Users() {
} else if(selectedProfile && auth.hasAdminScope()){
return (
<div>
<Button variant="contained" color="info" href="#contained-buttons" onClick={redirectToUsers}>
<KeyboardReturnIcon />
</Button>
<UserProfile username={selectedUsername}/>
</div>
)
......
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