Fix bug with investigations and added link

parent 8a0b08e8
......@@ -40,8 +40,8 @@ export function doSignIn(plugin, username, password) {
},
success: function( data ) {
if (data){
if (data.sessionId){
dispatch({type: LOGGED_IN, fullName: data.fullName, name : data.name, username: username, sessionId: data.sessionId});
if (data.sessionId){
dispatch({type: LOGGED_IN, fullName: data.fullName, lifeTimeMinutes : data.lifeTimeMinutes, name : data.name, username: username, isAdministrator: data.isAdministrator, sessionId: data.sessionId});
dispatch(fetchInvestigations(data.sessionId));
dispatch(fetchMyInvestigations(data.sessionId));
dispatch(fetchDataCollections(data.sessionId));
......
......@@ -25,8 +25,8 @@ class InvestigationTable extends React.Component {
return cell.toUpperCase();
}
nameFormatter(cell, investigation, extraData) {
if (extraData.props.linkProposal){
nameFormatter(cell, investigation, extraData) {
if (extraData.props.linkProposal || extraData.props.user.isAdministrator){
return <Link to={`/investigation/${investigation.id}/datasets`}>
<span className="glyphicon glyphicon-circle-arrow-right"> {cell} </span>
</Link>;
......
......@@ -24,7 +24,12 @@ class InvestigationsContainer extends Component {
return (
<div>
<Loader show={this.props.investigations.fetching} >
<InvestigationTable linkProposal={this.props.linkProposal} openData={this.props.openData} fetching={this.props.investigations.fetching} investigations={this.props.investigations.data}></InvestigationTable>
<InvestigationTable user={this.props.user}
linkProposal={this.props.linkProposal}
openData={this.props.openData}
fetching={this.props.investigations.fetching}
investigations={this.props.investigations.data}>
</InvestigationTable>
</Loader>
</div>);
}
......
......@@ -7,7 +7,7 @@ import {
} from '../constants/ActionTypes'
const initialState = {username: null, fullName:null, name:null, "sessionId": null, "isAuthenticating":false, "error": null, "expirationTime":null}
const initialState = {username: null, fullName:null, name:null, isAdministrator:false, "sessionId": null, "isAuthenticating":false, "error": null, "expirationTime":null}
const user = (state = initialState, action) => {
......@@ -16,8 +16,16 @@ const user = (state = initialState, action) => {
state = {...state, username: action.username, isAuthenticating : true, error : null, expirationTime : null};
break;
}
case LOGGED_IN:{
state = {...state, username: action.username, fullName:action.fullName, name:action.name, sessionId: action.sessionId, isAuthenticating : false, error : null, expirationTime : Moment().add(12, 'hours').format("MMMM Do YYYY, h:mm:ss a")}
case LOGGED_IN:{
state = {...state,
username: action.username,
isAdministrator:action.isAdministrator,
fullName:action.fullName,
name:action.name,
sessionId: action.sessionId,
isAuthenticating : false,
error : null,
expirationTime : Moment().add(action.lifeTimeMinutes, 'minutes').format("MMMM Do YYYY, h:mm:ss a")}
break;
}
case LOG_OUT: {
......@@ -25,7 +33,7 @@ const user = (state = initialState, action) => {
break;
}
case LOGIN_ERROR: {
state = {...state, username: null, fullName:null, name:null, sessionId: null, isAuthenticating : false, error : action.error, expirationTime : null}
state = {...state, username: null, fullName:null, name:null, isAdministrator:false, "sessionId": null, "isAuthenticating":false, "error": null, "expirationTime":null}
break;
}
default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment