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