#62

parent 02eee59a
......@@ -12,16 +12,17 @@ export class BreadCrumbs extends React.Component {
}
/** breadCrumbsSize is used to mark as active the latest item in the list */
var breadCrumbsSize = items.length;
return (<Breadcrumb style={{ backgroundColor: '#bfbfbf', marginTop: -20, borderBotton: '1px solid #f2f2f2', fontSize: '15px' }}>
{items.map(function (breadcrumb, i) {
if (i === 0) {
return <Breadcrumb.Item key={i} style={{ marginLeft: '40px' }} href={breadcrumb.link}> {breadcrumb.name} </Breadcrumb.Item>;
}
if (breadCrumbsSize === (i + 1)) {
return <Breadcrumb.Item key={i} active href={breadcrumb.link}>
<Label style={{ fontSize: '12px' }}>{breadcrumb.badge}</Label> {breadcrumb.name} </Breadcrumb.Item>;
<Label style={{ fontSize: '15px' }}>{breadcrumb.badge}</Label> <span style={{ color:'black'}}>{breadcrumb.name}</span> </Breadcrumb.Item>;
}
return <Breadcrumb.Item key={i} href={breadcrumb.link}> {breadcrumb.name} </Breadcrumb.Item>;
......
......@@ -22,7 +22,7 @@ class DataCollectionsContainer extends Component {
</div>);
}
componentDidMount() {
componentDidMount() {
this.props.setBreadCrumbs([
{ name: 'Open Data', link: '/public' },
{ name: 'Investigations', link: '/public' },
......
......@@ -30,15 +30,14 @@ class InvestigationContainer extends Component {
loadDatasetsByInvestigationId() {
let { investigationId } = this.props;
if (investigationId) {
if (this.props.user.sessionId) {
this.props.fetchDatasetsByInvestigationId(this.props.user.sessionId, investigationId);
let investigation = _.find(this.props.myInvestigations, (investigation) => { return investigation.id === Number(investigationId) });
if (investigation) {
// investigation was found in my Data
this.props.setBreadCrumbs([
{ name: 'My Data', link: '/investigations' },
......@@ -48,13 +47,13 @@ class InvestigationContainer extends Component {
} else {
// investion not found in my data, it can be among closed data
investigation = _.find(this.props.investigations, (investigation) => { return investigation.id === Number(investigationId) });
debugger
if (investigation) {
// investigation was found in my Data
this.props.setBreadCrumbs([
{ name: 'Closed Data', link: '/closed' },
{ name: investigation.visitId.toUpperCase(), link: '/investigations' },
{ badge: investigation.name, name: investigation.summary, link: '/investigation/' + investigation.id + '/datasets' }
{ name: investigation.name + ": " + investigation.summary, link: '/investigation/' + investigation.id + '/datasets' }
]);
}
......@@ -64,21 +63,29 @@ class InvestigationContainer extends Component {
}
}
setDOIBreadCrumbs(doi){
this.props.setBreadCrumbs([{ name: 'Open Data', link: '/public' }, { badge: doi, name: '', link: '/public/' + doi }]);
}
componentWillReceiveProps(nextProps) {
/** If component was mounted when sessionId was still not ready */
/** If component was mounted when sessionId was still not ready */
if (!this.props.user.sessionId) {
if (nextProps.user.sessionId) {
if (nextProps.user.sessionId !== this.props.user.sessionId) {
this.fetchData(nextProps.user.sessionId);
this.props.setBreadCrumbs([{ badge: this.props.doi, name: '', link: '/public/' + this.props.doi }]);
this.setDOIBreadCrumbs( this.props.doi);
}
}
}
if (this.props.doi){
this.setDOIBreadCrumbs( this.props.doi);
}
}
fetchData(sessionId) {
if (this.props.doi != null) {
if (sessionId) {
if (sessionId) {
this.props.fetchDatasetsByDOI(sessionId, this.props.doi);
}
}
......
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