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

Add link to volumes to docker settings #660

Merged
merged 5 commits into from
Mar 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 10 additions & 0 deletions src/css/layout/base.less
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,13 @@ h3 {
margin: @base-spacing-unit 0;
}
}

.soft-link{
text-decoration: underline;
cursor: pointer;

&:hover {
text-decoration: underline;
color: @alto;
}
}
21 changes: 18 additions & 3 deletions src/js/components/AppConfigEditFormComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ var AppConfigEditFormComponent = React.createClass({
return {
fields: AppFormStore.fields,
errorIndices: AppFormStore.validationErrorIndices,
responseErrorMessages: AppFormStore.responseErrors
responseErrorMessages: AppFormStore.responseErrors,
isVolumesOpen: false
};
},

Expand Down Expand Up @@ -108,6 +109,12 @@ var AppConfigEditFormComponent = React.createClass({
});
},

setViewVolumes: function (isVolumesOpen = true) {
this.setState({
isVolumesOpen: !!isVolumesOpen
});
},

onFormChange: function () {
this.setState({
fields: AppFormStore.fields,
Expand Down Expand Up @@ -150,6 +157,12 @@ var AppConfigEditFormComponent = React.createClass({
render: function () {
var state = this.state;

var volumesIsOpen = this.fieldsHaveError({volumes: "volumes"});

if (state.isVolumesOpen) {
volumesIsOpen = state.isVolumesOpen;
}

return (
<div>
<FormGroupComponent
Expand Down Expand Up @@ -221,7 +234,8 @@ var AppConfigEditFormComponent = React.createClass({
<ContainerSettingsComponent
errorIndices={state.errorIndices}
fields={state.fields}
getErrorMessage={this.getErrorMessage} />
getErrorMessage={this.getErrorMessage}
openVolumes={this.setViewVolumes}/>
</CollapsiblePanelComponent>
</div>
<div className="row full-bleed">
Expand Down Expand Up @@ -269,7 +283,8 @@ var AppConfigEditFormComponent = React.createClass({
</div>
<div className="row full-bleed">
<CollapsiblePanelComponent
isOpen={this.fieldsHaveError({volumes: "volumes"})}
isOpen={volumesIsOpen}
togglePanel={this.setViewVolumes}
title="Volumes">
<OptionalVolumesComponent
errorIndices={state.errorIndices}
Expand Down
9 changes: 7 additions & 2 deletions src/js/components/CollapsiblePanelComponent.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import classNames from "classnames";
import React from "react";
import Util from "../helpers/Util";

var CollapsiblePanelComponent = React.createClass({
displayName: "CollapsiblePanelComponent",

propTypes: {
children: React.PropTypes.node,
isOpen: React.PropTypes.bool,
title: React.PropTypes.string.isRequired
title: React.PropTypes.string.isRequired,
togglePanel: React.PropTypes.func
},

getDefaultProps: function () {
return {
isOpen: false
isOpen: false,
togglePanel: Util.noop
};
},

Expand All @@ -27,10 +30,12 @@ var CollapsiblePanelComponent = React.createClass({
this.setState({
isOpen: nextProps.isOpen
});
this.props.togglePanel(false);
}
},

handleToggle: function () {
this.props.togglePanel(!this.state.isOpen);
this.setState({isOpen: !this.state.isOpen});
},

Expand Down
10 changes: 8 additions & 2 deletions src/js/components/ContainerSettingsComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ var ContainerSettingsComponent = React.createClass({

propTypes: {
fields: React.PropTypes.object.isRequired,
getErrorMessage: React.PropTypes.func.isRequired
getErrorMessage: React.PropTypes.func.isRequired,
openVolumes: React.PropTypes.func
},

handleAddRow: function (fieldId, position, event) {
Expand Down Expand Up @@ -169,7 +170,12 @@ var ContainerSettingsComponent = React.createClass({
</FormGroupComponent>
<h4>Parameters</h4>
<div className="duplicable-list">{this.getParametersRows()}</div>
<div>You can set your Docker volume settings below.</div>
<div>
You can configure your Docker
volume <a className="soft-link" onClick={this.props.openVolumes}>
below
</a>.
</div>
</div>
);
}
Expand Down