aboutsummaryrefslogtreecommitdiffstats
path: root/ui-react/src/components/dialogs/Loop/DeployLoopModal.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui-react/src/components/dialogs/Loop/DeployLoopModal.js')
-rw-r--r--ui-react/src/components/dialogs/Loop/DeployLoopModal.js35
1 files changed, 27 insertions, 8 deletions
diff --git a/ui-react/src/components/dialogs/Loop/DeployLoopModal.js b/ui-react/src/components/dialogs/Loop/DeployLoopModal.js
index 34304d61..9c9a16fe 100644
--- a/ui-react/src/components/dialogs/Loop/DeployLoopModal.js
+++ b/ui-react/src/components/dialogs/Loop/DeployLoopModal.js
@@ -26,6 +26,8 @@ import LoopService from '../../../api/LoopService';
import Button from 'react-bootstrap/Button';
import Modal from 'react-bootstrap/Modal';
import Form from 'react-bootstrap/Form';
+import Tabs from 'react-bootstrap/Tabs';
+import Tab from 'react-bootstrap/Tab';
import styled from 'styled-components';
const ModalStyled = styled(Modal)`
@@ -55,6 +57,14 @@ export default class DeployLoopModal extends React.Component {
show: true
});
}
+ componentDidMount() {
+ const deployJsonList = this.state.temporaryPropertiesJson["dcaeDeployParameters"];
+ Object.keys(deployJsonList)
+ .filter((obj) => Object.keys(deployJsonList).indexOf(obj) === 0)
+ .map(obj =>
+ this.setState({key: obj})
+ );
+ }
handleClose(){
this.props.history.push('/');
}
@@ -89,34 +99,43 @@ export default class DeployLoopModal extends React.Component {
}
handleChange(event) {
let deploymentParam = this.state.temporaryPropertiesJson["dcaeDeployParameters"];
- deploymentParam[event.target.name] = event.target.value;
+ deploymentParam[this.state.key][event.target.name] = event.target.value;
this.setState({temporaryPropertiesJson:{dcaeDeployParameters: deploymentParam}});
}
- renderDeployParam() {
+ renderDeployParamTabs() {
if (typeof (this.state.temporaryPropertiesJson) === "undefined") {
return "";
}
- const deployJson = this.state.temporaryPropertiesJson["dcaeDeployParameters"];
+ const deployJsonList = this.state.temporaryPropertiesJson["dcaeDeployParameters"];
+ var indents = [];
+ Object.keys(deployJsonList).map((item,key) =>
+ indents.push(<Tab eventKey={item} title={item}>
+ {this.renderDeployParam(deployJsonList[item])}
+ </Tab>)
+ );
+ return indents;
+ }
+
+ renderDeployParam(deployJson) {
var indents = [];
Object.keys(deployJson).map((item,key) =>
indents.push(<FormStyled>
<Form.Label>{item}</Form.Label>
<Form.Control type="text" name={item} onChange={this.handleChange} defaultValue={deployJson[item]}></Form.Control>
</FormStyled>));
-
- return indents;
+ return indents;
}
-
-
render() {
return (
<ModalStyled size="lg" show={this.state.show} onHide={this.handleClose} >
<Modal.Header closeButton>
<Modal.Title>Deployment parameters</Modal.Title>
</Modal.Header>
- {this.renderDeployParam()}
+ <Tabs id="controlled-tab-example" activeKey={this.state.key} onSelect={key => this.setState({ key })}>
+ {this.renderDeployParamTabs()}
+ </Tabs>
<Modal.Footer>
<Button variant="secondary" type="null" onClick={this.handleClose}>Cancel</Button>
<Button variant="primary" type="submit" onClick={this.handleSave}>Deploy</Button>