aboutsummaryrefslogtreecommitdiffstats
path: root/ui-react/src/components/dialogs/Loop/DeployLoopModal.js
diff options
context:
space:
mode:
authorxuegao <xg353y@intl.att.com>2019-12-13 11:50:24 +0100
committerxuegao <xg353y@intl.att.com>2019-12-16 13:00:03 +0100
commit9047defa7549ebd9a84cef3e10bbfd90f068097b (patch)
tree4cb5d0f32ca599d6a8ae7d3490f331af1e40383b /ui-react/src/components/dialogs/Loop/DeployLoopModal.js
parent4d8c1ab21a3f5baf82a91a3cc9ab2af8823e6e34 (diff)
Update deploymentParameters
Update deploymentParameters to allow a map of <msName, deploymentParams> instead of a single deploymentParam Issue-ID: CLAMP-569, CLAMP-570 Change-Id: I6abc4fe193157644bd6abe1c893a1416cadec988 Signed-off-by: xuegao <xg353y@intl.att.com>
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>