-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The pipeline edit page was cleft in twain (metadata and structure).
- Loading branch information
1 parent
ce36e76
commit 27d4f1d
Showing
10 changed files
with
178 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
src/pages/EditPipelineStructure/EditPipelineStructure.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import ImmutablePropTypes from 'react-immutable-proptypes'; | ||
import { FormattedMessage } from 'react-intl'; | ||
import { Row, Col } from 'react-bootstrap'; | ||
import { connect } from 'react-redux'; | ||
|
||
import Page from '../../components/layout/Page'; | ||
import { PipelineNavigation } from '../../components/layout/Navigation'; | ||
import Callout from '../../components/widgets/Callout'; | ||
import { PipelineStructureIcon } from '../../components/icons'; | ||
import PipelineFilesTableContainer from '../../containers/PipelineFilesTableContainer'; | ||
import PipelineEditContainer from '../../containers/PipelineEditContainer'; | ||
|
||
import { fetchPipelineIfNeeded } from '../../redux/modules/pipelines'; | ||
import { fetchBoxTypes } from '../../redux/modules/boxes'; | ||
import { fetchRuntimeEnvironments } from '../../redux/modules/runtimeEnvironments'; | ||
import { getPipeline } from '../../redux/selectors/pipelines'; | ||
|
||
import { hasPermissions } from '../../helpers/common'; | ||
|
||
class EditPipeline extends Component { | ||
componentDidMount = () => this.props.loadAsync(); | ||
|
||
componentDidUpdate(prevProps) { | ||
if (this.props.match.params.pipelineId !== prevProps.match.params.pipelineId) { | ||
this.props.loadAsync(); | ||
} | ||
} | ||
|
||
static loadAsync = ({ pipelineId }, dispatch) => | ||
Promise.all([ | ||
dispatch(fetchPipelineIfNeeded(pipelineId)), | ||
dispatch(fetchRuntimeEnvironments()), | ||
dispatch(fetchBoxTypes()), | ||
]); | ||
|
||
render() { | ||
const { pipeline } = this.props; | ||
|
||
return ( | ||
<Page | ||
resource={pipeline} | ||
icon={<PipelineStructureIcon />} | ||
title={<FormattedMessage id="app.editPipelineStructure.title" defaultMessage="Modify Pipeline Structure" />}> | ||
{pipeline => ( | ||
<> | ||
<PipelineNavigation | ||
pipelineId={pipeline.id} | ||
canViewDetail={hasPermissions(pipeline, 'viewDetail')} | ||
canEdit={hasPermissions(pipeline, 'update')} | ||
/> | ||
|
||
<Row> | ||
<Col lg={12}> | ||
<Callout variant="warning"> | ||
<h4> | ||
<FormattedMessage id="app.editPipeline.disclaimer" defaultMessage="Disclaimer" /> | ||
</h4> | ||
<p> | ||
<FormattedMessage | ||
id="app.editPipeline.disclaimerWarning" | ||
defaultMessage="Modifying the pipeline might break all exercises using the pipeline!" | ||
/> | ||
</p> | ||
</Callout> | ||
</Col> | ||
</Row> | ||
|
||
<Row> | ||
<Col lg={12}> | ||
<PipelineEditContainer pipeline={pipeline} /> | ||
</Col> | ||
</Row> | ||
|
||
<Row> | ||
<Col xl={6}> | ||
<PipelineFilesTableContainer pipeline={pipeline} /> | ||
</Col> | ||
</Row> | ||
</> | ||
)} | ||
</Page> | ||
); | ||
} | ||
} | ||
|
||
EditPipeline.propTypes = { | ||
pipeline: ImmutablePropTypes.map, | ||
loadAsync: PropTypes.func.isRequired, | ||
match: PropTypes.shape({ | ||
params: PropTypes.shape({ | ||
pipelineId: PropTypes.string.isRequired, | ||
}).isRequired, | ||
}).isRequired, | ||
}; | ||
|
||
export default connect( | ||
( | ||
state, | ||
{ | ||
match: { | ||
params: { pipelineId }, | ||
}, | ||
} | ||
) => { | ||
return { | ||
pipeline: getPipeline(pipelineId)(state), | ||
}; | ||
}, | ||
( | ||
dispatch, | ||
{ | ||
match: { | ||
params: { pipelineId }, | ||
}, | ||
} | ||
) => ({ | ||
loadAsync: () => EditPipeline.loadAsync({ pipelineId }, dispatch), | ||
}) | ||
)(EditPipeline); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import EditPipelineStructure from './EditPipelineStructure'; | ||
export default EditPipelineStructure; |
Oops, something went wrong.