const ModalStyled = styled(Modal)`
background-color: transparent;
`
+const LoopViewSvgDivStyled = styled.div`
+ overflow: hidden;
+ background-color: ${props => (props.theme.loopViewerBackgroundColor)};
+ border-color: ${props => (props.theme.loopViewerHeaderColor)};
+ margin-left: auto;
+ margin-right:auto;
+ text-align: center;
+`
export default class CreateLoopModal extends React.Component {
constructor(props, context) {
this.handleDropdownListChange = this.handleDropdownListChange.bind(this);
this.state = {
show: true,
+ content: '',
chosenTemplateName: '',
modelName: '',
templateNames: []
handleDropdownListChange(e) {
this.setState({ chosenTemplateName: e.value });
+ TemplateService.getBlueprintMicroServiceTemplates(e.value).then(svgXml => {
+ if (svgXml.length !== 0) {
+ this.setState({ content: svgXml })
+ } else {
+ this.setState({ content: 'Error1' })
+ }
+ })
}
getTemplateNames() {
alert("A model name is required");
return;
}
- console.info("Create Model " + this.state.modelName + ", Template " + this.state.chosenTemplateName + " is chosen");
+ console.debug("Create Model " + this.state.modelName + ", Template " + this.state.chosenTemplateName + " is chosen");
this.setState({ show: false });
LoopService.createLoop("LOOP_" + this.state.modelName, this.state.chosenTemplateName).then(text => {
console.debug("CreateLoop response received: ", text);
.catch(error => {
console.debug("Create Loop failed");
});
-
}
handleModelName = event => {
- this.setState({
- modelName: event.target.value
- })
+ this.setState({
+ modelName: event.target.value
+ })
}
render() {
return (
- <ModalStyled size="lg" show={this.state.show} onHide={this.handleClose}>
+ <ModalStyled size="xl" show={this.state.show} onHide={this.handleClose}>
<Modal.Header closeButton>
<Modal.Title>Create Model</Modal.Title>
</Modal.Header>
<Select onChange={this.handleDropdownListChange} options={this.state.templateNames} />
</Col>
</Form.Group>
+ <Form.Group controlId="formPlaintextEmail">
+ <LoopViewSvgDivStyled dangerouslySetInnerHTML={{ __html: this.state.content }} value={this.state.content} >
+ </LoopViewSvgDivStyled>
+ </Form.Group>
<Form.Group controlId="formPlaintextEmail">
<Form.Label column sm="2">Model Name:</Form.Label>
<input type="text" style={{width: '50%'}}
<Button variant="primary" type="submit" onClick={this.handleCreate}>Create</Button>
</Modal.Footer>
</ModalStyled>
-
);
}
}
\ No newline at end of file