Commit 0c12d10d authored by Alejandro De Maria Antolinos's avatar Alejandro De Maria Antolinos
Browse files

Merge branch 'issue_519' into 'master'

Add link to jupyter

Closes #519

See merge request !537
parents ac453f01 08fb2f45
Pipeline #51177 passed with stage
in 3 minutes and 31 seconds
......@@ -2,6 +2,7 @@ import React from 'react';
import { Glyphicon, Button } from 'react-bootstrap';
import DayPickerInput from 'react-day-picker/DayPickerInput';
import { formatDate, parseDate } from 'react-day-picker/moment';
import UI from '../../config/ui';
import { INVESTIGATION_DATE_FORMAT } from '../../constants';
import styles from './InvestigationDateFilter.module.css';
......@@ -25,6 +26,7 @@ function InvestigationDateFilter(props) {
onClear,
instrumentName,
showStatisticsMenu,
withJupyter,
} = props;
return (
......@@ -51,11 +53,26 @@ function InvestigationDateFilter(props) {
</Button>
{showStatisticsMenu && (
<Button href={getHrefByInstrument(instrumentName)} bsStyle="default">
<Button href={getHrefByInstrument(instrumentName)} bsStyle="primary">
<Glyphicon glyph="signal" style={{ margin: 5 }} />
Data Statistics
</Button>
)}
{withJupyter && (
<Button
style={{ width: 200, textAlign: 'left', margin: 5 }}
bsSize="default"
>
<a
href={UI.analysis.jupyter.link}
target="_blank"
rel="noopener noreferrer"
>
<Glyphicon glyph="play-circle" style={{ margin: 5 }} />
<span style={{ marginLeft: 2 }}>Open Jupyter Notebook</span>
</a>
</Button>
)}
</div>
);
}
......
......@@ -20,6 +20,7 @@ import { useHistory, useLocation } from 'react-router';
import { useQuery } from '../../helpers/hooks';
import { useSelector } from 'react-redux';
import { INVESTIGATION_DATE_FORMAT } from '../../constants';
import UI from '../../config/ui';
function getLgHeaderStyle(width, hidden) {
return {
......@@ -170,6 +171,7 @@ function InvestigationTable(props) {
showStatisticsMenu = false,
instrumentName,
withUserPortalLink = false,
withJupyter = false,
} = props;
const user = useSelector((state) => state.user);
......@@ -258,6 +260,7 @@ function InvestigationTable(props) {
onClear={handleDateClear}
showStatisticsMenu={showStatisticsMenu}
instrumentName={instrumentName}
withJupyter={withJupyter}
/>
</div>
<ResponsiveTable
......@@ -274,7 +277,9 @@ function InvestigationTable(props) {
showProposalLinks: withProposalLinks || isAdministrator,
showInvestigationStats: withInvestigationStats || isAdministrator,
showFiles: isAdministrator,
withUserPortalLink: withUserPortalLink || isAdministrator,
withUserPortalLink:
withUserPortalLink ||
(UI.userPortal.isLinkEnabled && isAdministrator),
})}
expandRow={expandRow}
/>
......
......@@ -123,7 +123,11 @@ export function nameFormatter(investigation, showLink, section = 'datasets') {
return (
<Link to={`/investigation/${id}/${section}`}>
<Button bsSize="xsmall" style={{ width: 120, textAlign: 'left' }}>
<Button
bsSize="xsmall"
style={{ width: 120, textAlign: 'left' }}
bsStyle="primary"
>
<Glyphicon glyph="circle-arrow-right" />
<span style={{ marginLeft: 10 }}>{name}</span>
</Button>
......
......@@ -30,6 +30,12 @@ const UI = {
link:
'https://smis.esrf.fr/misapps/SMISWebClient/protected/aform/manageAForm.do?action=view&expSessionVO.pk=',
},
analysis: {
jupyter: {
isLinkEnabled: true,
link: 'https://jupyter-slurm.esrf.fr/hub/spawn?partition=jupyter-nice',
},
},
investigationContainer: {
isDatasetListVisible: true,
},
......
......@@ -3,6 +3,7 @@ import InvestigationTable from '../../components/Investigation/InvestigationTabl
import { useResource } from 'rest-hooks';
import InvestigationResource from '../../resources/investigation';
import { useParams } from 'react-router';
import UI from '../../config/ui';
function BeamlineDataTable(props) {
const { name } = useParams();
......@@ -19,6 +20,7 @@ function BeamlineDataTable(props) {
showStatisticsMenu={showStatisticsMenu}
instrumentName={name}
withUserPortalLink={true}
withJupyter={UI.analysis.jupyter.isLinkEnabled}
/>
);
}
......
......@@ -2,6 +2,7 @@ import React from 'react';
import { useResource } from 'rest-hooks';
import InvestigationResource from '../../resources/investigation';
import InvestigationTable from '../../components/Investigation/InvestigationTable';
import UI from '../../config/ui';
function MyInvestigationsTable() {
const myInvestigations = useResource(InvestigationResource.listShape(), {
......@@ -18,7 +19,8 @@ function MyInvestigationsTable() {
investigations={mySessions}
withInvestigationStats
withProposalLinks
withUserPortalLink={true}
withUserPortalLink={UI.userPortal.isLinkEnabled}
withJupyter={UI.analysis.jupyter.isLinkEnabled}
/>
);
}
......
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