Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⬆️ Bump decode-uri-component from 0.2.0 to 0.2.2 #157

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
9376110
:arrow_up: Bump follow-redirects from 1.14.1 to 1.14.7
dependabot[bot] Jan 14, 2022
e329901
⬆️ Bump follow-redirects from 1.14.1 to 1.14.7 (#135)
shnizzedy Jan 14, 2022
b3cb23e
:arrow_up: Bump nanoid from 3.1.23 to 3.2.0
dependabot[bot] Jan 22, 2022
2993125
⬆️ Bump nanoid from 3.1.23 to 3.2.0 (#136)
shnizzedy Jan 24, 2022
008cb15
:arrow_up: Bump follow-redirects from 1.14.7 to 1.14.8
dependabot[bot] Feb 13, 2022
80b335d
⬆️ Bump follow-redirects from 1.14.7 to 1.14.8 (#137)
shnizzedy Feb 14, 2022
0eadc3b
:arrow_up: Bump url-parse from 1.5.3 to 1.5.7
dependabot[bot] Feb 19, 2022
7ef9f31
⬆️ Bump url-parse from 1.5.3 to 1.5.7 (#138)
shnizzedy Feb 21, 2022
ac4e3ea
:arrow_up: Bump url-parse from 1.5.7 to 1.5.10
dependabot[bot] Feb 28, 2022
4445f95
⬆️ Bump url-parse from 1.5.7 to 1.5.10 (#139)
shnizzedy Feb 28, 2022
b5dcc71
:arrow_up: Bump plist from 3.0.2 to 3.0.4
dependabot[bot] Mar 2, 2022
e983ad1
⬆️ Bump plist from 3.0.2 to 3.0.4 (#140)
shnizzedy Mar 2, 2022
54fab6a
:arrow_up: Bump minimist from 1.2.5 to 1.2.6 in /c-pac
dependabot[bot] Mar 26, 2022
2a99428
:arrow_up: Bump minimist from 1.2.5 to 1.2.6
dependabot[bot] Mar 26, 2022
9384225
⬆️ Bump minimist from 1.2.5 to 1.2.6 in /c-pac (#142)
shnizzedy Mar 28, 2022
602e6fe
⬆️ Bump minimist from 1.2.5 to 1.2.6 (#143)
shnizzedy Mar 28, 2022
70ac39c
:arrow_up: Bump plist from 3.0.4 to 3.0.5
dependabot[bot] Mar 28, 2022
2eadc9f
⬆️ Bump plist from 3.0.4 to 3.0.5 (#144)
shnizzedy Mar 28, 2022
5ad6968
:bug: Strip '.dev' before checking semver
shnizzedy Aug 30, 2022
c736d17
:arrow_up: Bump decode-uri-component from 0.2.0 to 0.2.2
dependabot[bot] Dec 5, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
189 changes: 75 additions & 114 deletions app/components/PipelineCard.jsx
Original file line number Diff line number Diff line change
@@ -1,62 +1,50 @@
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { withRouter, Link } from 'react-router-dom';
import { withRouter } from 'react-router-dom';
import Immutable from 'immutable';
import PropTypes from 'prop-types';
import semver from 'semver';

import clsx from 'clsx'
import { formatMs, withStyles } from '@material-ui/core/styles';
import { withStyles } from '@material-ui/core/styles';

import { Map } from 'immutable';

import Grid from '@material-ui/core/Grid';

import Card from '@material-ui/core/Card';
import CardHeader from '@material-ui/core/CardHeader';
import CardMedia from '@material-ui/core/CardMedia';
import CardContent from '@material-ui/core/CardContent';
import CardActions from '@material-ui/core/CardActions';

import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
import ListItemIcon from '@material-ui/core/ListItemIcon';
import ListItemText from '@material-ui/core/ListItemText';
import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';

import Typography from '@material-ui/core/Typography';
import Avatar from '@material-ui/core/Avatar';
import IconButton from '@material-ui/core/IconButton';
import Button from '@material-ui/core/Button';
import Tooltip from '@material-ui/core/Tooltip';

import {
EnvironmentIcon,
PipelineIcon,
PipelineStepIcon,
PipelineExecutionTimeIcon,
SubjectIcon,
RunIcon,
LaunchIcon,
SettingsIcon,
NavigateNextIcon,
PlayArrowIcon,
TimerIcon,
LogIcon,
BrainIcon,
DeleteIcon,
DeprecatedIcon,
DownloadIcon,
DuplicateIcon
} from './icons';
import { formatLabel } from '../containers/pipeline/parts/PipelinePart';
import { isADefault } from '../containers/PipelinePage';
import PipelineStep from './PipelineStep';

import cpac from '@internal/c-pac';

const cardSteps = ['anatomical_preproc', 'functional_preproc', 'surface_analysis'];

/** A card component to show a pipeline configuration available to view/edit, duplicate, and/or delete. */
function stripDevSuffix(version) {
return version.endsWith('.dev') ? version.slice(0, -4) : version;
}

/** A card component to show a pipeline configuration available to view/edit, duplicate, and/or
* delete. */
class PipelineCard extends Component {
static propTypes = {
/** Inherited style */
Expand Down Expand Up @@ -100,36 +88,36 @@ class PipelineCard extends Component {
const configuration = pipeline.getIn(['versions', version, 'configuration']);
const cpacVersion = pipeline.getIn(['versions', version, 'version']);

var blob = new Blob(
const blob = new Blob(
[cpac.pipeline.dump(
configuration.toJS(), pipelineName, version, cpacVersion
)],
{ type: "text/yaml;charset=utf-8" }
{ type: 'text/yaml;charset=utf-8' }
);

var anchor = document.createElement('a');
const anchor = document.createElement('a');
anchor.href = window.URL.createObjectURL(blob);
anchor.target = '_blank';
anchor.download = pipelineName + '.yml'
anchor.download = `${pipelineName}.yml`;
anchor.click();
}

handleOpen = (pipeline) => {
this.props.history.push(`/pipelines/${pipeline}`)
this.props.history.push(`/pipelines/${pipeline}`);
}

render() {
const { classes, pipeline } = this.props
const { classes, pipeline } = this.props;

const pipelineIsADefault = isADefault(pipeline.get('id'));
let versionId = '0'
const versions = pipeline.get('versions')
if (!versions.has("0")) {
versionId = versions.keySeq().max()
let versionId = '0';
const versions = pipeline.get('versions');
if (!versions.has('0')) {
versionId = versions.keySeq().max();
}

const version = versions.get(versionId)
const configuration = version.getIn(['configuration', ]);
const version = versions.get(versionId);
const configuration = version.getIn(['configuration']);

let derivatives = [];
Object.keys(configuration.toJS()).forEach(step => {
Expand All @@ -138,59 +126,59 @@ class PipelineCard extends Component {
} else {
const tabStep = configuration.getIn([step]);
if (Map.isMap(tabStep)) {
let [...stepKeys] = tabStep.keys();
const [...stepKeys] = tabStep.keys();
if (stepKeys.includes('run')) {
const runswitch = configuration.getIn([step, 'run']);
if (
!cardSteps.includes(step) &&
runswitch &&
(
typeof(runswitch) === 'boolean' ||
(Array.isArray(runswitch) && runswitch.includes(true))
!cardSteps.includes(step)
&& runswitch
&& (
typeof runswitch === 'boolean'
|| (Array.isArray(runswitch) && runswitch.includes(true))
)
) { derivatives.push(step); }
}
} else {
console.warn(`Tab "${step}" seems to be malformed in pipeline "${pipeline.get('name')}"`);
}
}
})
});
derivatives = Array.from(derivatives);
derivatives = derivatives ? derivatives.length : 0;
let cardSubheader = `C-PAC ${version.get('version')}`;
if (configuration.hasOwnProperty('importedPipeline')) {
cardSubheader = `FROM '${configuration.importedPipeline}' (${cardSubheader})`
if (Object.prototype.hasOwnProperty.call(configuration, 'importedPipeline')) {
cardSubheader = `FROM '${configuration.importedPipeline}' (${cardSubheader})`;
}
if (semver.gte(version.get('version'), '1.8.0')) {
if (semver.gte(stripDevSuffix(version.get('version')), '1.8.0')) {
return (
<Card className={classes.card}>
<CardHeader
avatar={
avatar={(
<Avatar className={classes.avatar}>
<PipelineIcon />
</Avatar>
}
)}
title={pipeline.get('name')}
subheader={cardSubheader}
/>
<CardContent className={classes.info}>
<List>
{cardSteps.map(step =>{
{cardSteps.map(step => {
const runKey = 'run';
return (
<PipelineStep
{...{classes}}
{...{ classes }}
stepKey={configuration.getIn([step, runKey], true)}
label={formatLabel(step)}
key={step}
/>
)
);
})}
<PipelineStep
{...{classes}}
{...{ classes }}
stepKey={Boolean(derivatives)}
label={`${derivatives} derivative${derivatives === 1 ? '' : 's'}`}
key='derivatives'
key="derivatives"
/>
</List>
</CardContent>
Expand All @@ -202,14 +190,13 @@ class PipelineCard extends Component {
</IconButton>
</Tooltip>

{ !pipelineIsADefault ?
{ !pipelineIsADefault ? (
<Tooltip title="Delete">
<IconButton onClick={() => this.props.onDelete(pipeline.get('id'))}>
<DeleteIcon />
</IconButton>
</Tooltip>
: null
}
) : null }

<Tooltip title={pipelineIsADefault ? 'View' : 'View / Edit'}>
<IconButton className={classes.expand} onClick={() => this.handleOpen(pipeline.get('id'))}>
Expand All @@ -218,74 +205,48 @@ class PipelineCard extends Component {
</Tooltip>
</CardActions>
</Card>
)
} else {
return (
<Card className={classes.card}>
<CardHeader
avatar={
<Avatar className={classes.avatar}>
<PipelineIcon />
</Avatar>
}
title={pipeline.get('name')}
subheader={cardSubheader}
/>
<CardContent className={classes.info}>
);
}
return (
<Card className={classes.card}>
<CardHeader
avatar={(
<Avatar className={classes.avatar}>
<PipelineIcon />
</Avatar>
)}
title={pipeline.get('name')}
subheader={cardSubheader}
/>
<CardContent className={classes.info}>
<List>
<ListItem key='deprecated'>
<ListItem key="deprecated">
<ListItemIcon>
<DeprecatedIcon />
</ListItemIcon>
<ListItemText primary='Deprecated' secondary='Please upgrade your pipeline configuration' />
<ListItemText primary="Deprecated" secondary="Please upgrade your pipeline configuration" />
</ListItem>
</List>
</CardContent>
<CardActions className={classes.actions}>

<Tooltip title="Download config file">
<IconButton onClick={() => this.handleDownload(pipeline.get('id'))}>
<DownloadIcon />
</IconButton>
</Tooltip>

<Tooltip title="Delete">
<IconButton onClick={() => this.props.onDelete(pipeline.get('id'))}>
<DeleteIcon />
</IconButton>
</Tooltip>

</CardActions>
</Card>
)
};
}
}

/** A row to indicate s broad pipeline step on a pipeline card */
class PipelineStep extends Component {
static propTypes = {
/** Whether the step is On in the pipeline configuration */
stepKey: PropTypes.bool.isRequired,
/** Text to display for step */
label: PropTypes.string,
/** Inherited style */
classes: PropTypes.object
}

render() {
const { stepKey, label, classes } = this.props;
const enabledStyle = {root: stepKey ? classes.featEnabled : classes.featDisabled};
return (
<ListItem key={`step-${label}`}>
<ListItemIcon>
<PipelineStepIcon classes={enabledStyle} />
</ListItemIcon>
<ListItemText classes={enabledStyle} primary={label} />
</ListItem>
)
</CardContent>
<CardActions className={classes.actions}>

<Tooltip title="Download config file">
<IconButton onClick={() => this.handleDownload(pipeline.get('id'))}>
<DownloadIcon />
</IconButton>
</Tooltip>

<Tooltip title="Delete">
<IconButton onClick={() => this.props.onDelete(pipeline.get('id'))}>
<DeleteIcon />
</IconButton>
</Tooltip>

</CardActions>
</Card>
);
}
}

export default withRouter(withStyles(PipelineCard.styles)(PipelineCard));
export { cardSteps };
export { cardSteps };
32 changes: 32 additions & 0 deletions app/components/PipelineStep.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/** A row to indicate a broad pipeline step on a pipeline card */
import React, { Component } from 'react';
import PropTypes from 'prop-types';

import { ListItem, ListItemIcon, ListItemText } from '@material-ui/core';
import { PipelineStepIcon } from './icons';

class PipelineStep extends Component {
static propTypes = {
/** Whether the step is On in the pipeline configuration */
stepKey: PropTypes.bool.isRequired,
/** Text to display for step */
label: PropTypes.string,
/** Inherited style */
classes: PropTypes.object
}

render() {
const { stepKey, label, classes } = this.props;
const enabledStyle = {root: stepKey ? classes.featEnabled : classes.featDisabled};
return (
<ListItem key={`step-${label}`}>
<ListItemIcon>
<PipelineStepIcon classes={enabledStyle} />
</ListItemIcon>
<ListItemText classes={enabledStyle} primary={label} />
</ListItem>
);
}
}

export default PipelineStep;
6 changes: 3 additions & 3 deletions c-pac/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1905,9 +1905,9 @@ mime-types@^2.1.27:
mime-db "1.47.0"

minimist@^1.2.0, minimist@^1.2.5:
version "1.2.5"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602"
integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==
version "1.2.6"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==

[email protected]:
version "2.0.0"
Expand Down
Loading