-
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.
Refactoring pipeline edit page and related forms. Pipeline structure …
…removed from basic edit form (will be placed into separate component).
- Loading branch information
1 parent
63cc585
commit f5cfaad
Showing
9 changed files
with
348 additions
and
163 deletions.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
src/components/forms/EditPipelineEnvironmentsForm/EditPipelineEnvironmentsForm.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,70 @@ | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { reduxForm } from 'redux-form'; | ||
import { FormattedMessage } from 'react-intl'; | ||
|
||
import EditEnvironmentList from '../EditEnvironmentSimpleForm/EditEnvironmentList'; | ||
import { SaveIcon } from '../../icons'; | ||
import Callout from '../../widgets/Callout'; | ||
import FormBox from '../../widgets/FormBox'; | ||
import SubmitButton from '../SubmitButton'; | ||
|
||
class EditPipelineEnvironmentsForm extends Component { | ||
render() { | ||
const { runtimeEnvironments, dirty, submitting, handleSubmit, submitFailed, submitSucceeded, invalid } = this.props; | ||
return ( | ||
<FormBox | ||
title={ | ||
<FormattedMessage | ||
id="app.editPipelineEnvironmentsForm.title" | ||
defaultMessage="Pipeline Runtime Environments" | ||
/> | ||
} | ||
succeeded={submitSucceeded} | ||
dirty={dirty} | ||
footer={ | ||
<div className="text-center"> | ||
<SubmitButton | ||
id="editPipelineEnvironments" | ||
invalid={invalid} | ||
submitting={submitting} | ||
dirty={dirty} | ||
hasSucceeded={submitSucceeded} | ||
hasFailed={submitFailed} | ||
handleSubmit={handleSubmit} | ||
defaultIcon={<SaveIcon gapRight />} | ||
messages={{ | ||
submit: <FormattedMessage id="generic.save" defaultMessage="Save" />, | ||
submitting: <FormattedMessage id="generic.saving" defaultMessage="Saving..." />, | ||
success: <FormattedMessage id="generic.saved" defaultMessage="Saved" />, | ||
}} | ||
/> | ||
</div> | ||
}> | ||
{submitFailed && ( | ||
<Callout variant="danger"> | ||
<FormattedMessage id="generic.savingFailed" defaultMessage="Saving failed. Please try again later." /> | ||
</Callout> | ||
)} | ||
|
||
<EditEnvironmentList runtimeEnvironments={runtimeEnvironments} /> | ||
</FormBox> | ||
); | ||
} | ||
} | ||
|
||
EditPipelineEnvironmentsForm.propTypes = { | ||
runtimeEnvironments: PropTypes.array.isRequired, | ||
handleSubmit: PropTypes.func.isRequired, | ||
dirty: PropTypes.bool, | ||
submitting: PropTypes.bool, | ||
submitFailed: PropTypes.bool, | ||
submitSucceeded: PropTypes.bool, | ||
invalid: PropTypes.bool, | ||
}; | ||
|
||
export default reduxForm({ | ||
form: 'editPipelineEnvironments', | ||
enableReinitialize: true, | ||
keepDirtyOnReinitialize: false, | ||
})(EditPipelineEnvironmentsForm); |
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 EditPipelineEnvironmentsForm from './EditPipelineEnvironmentsForm'; | ||
export default EditPipelineEnvironmentsForm; |
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
Oops, something went wrong.