aboutsummaryrefslogtreecommitdiffstats
path: root/gui-clamp/ui-react/src/components/dialogs
diff options
context:
space:
mode:
authorsaul.gill <saul.gill@est.tech>2021-07-02 17:10:54 +0100
committersaul.gill <saul.gill@est.tech>2021-07-02 17:10:59 +0100
commit6687b48b58bf1248532de48f3e375b1f663f4015 (patch)
tree6582070c8db251b85695bcdc902ea98aac573003 /gui-clamp/ui-react/src/components/dialogs
parentb908988c81db910d4e2bea3e569e468f5f2c8f85 (diff)
Changed components to be service-centric
Moved endpoints to ControlLoopService.js Refactored components and tests Issue-ID: POLICY-3424 Change-Id: I70d48750250eecd651b845ef0c726617983f75f5 Signed-off-by: saul.gill <saul.gill@est.tech>
Diffstat (limited to 'gui-clamp/ui-react/src/components/dialogs')
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetLocalToscaFileForUpload.js (renamed from gui-clamp/ui-react/src/components/dialogs/GetLocalToscaFileForUpload.js)43
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetLocalToscaFileForUpload.test.js (renamed from gui-clamp/ui-react/src/components/dialogs/GetLocalToscaFileForUpload.test.js)34
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.js50
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.test.js53
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/ReadAndConvertYaml.js96
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/ReadAndConvertYaml.test.js (renamed from gui-clamp/ui-react/src/components/dialogs/ReadAndConvertYaml.test.js)34
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.js54
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.test.js61
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/GetLocalToscaFileForUpload.test.js.snap (renamed from gui-clamp/ui-react/src/components/dialogs/__snapshots__/GetLocalToscaFileForUpload.test.js.snap)0
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/GetToscaTemplate.test.js.snap15
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/ReadAndConvertYaml.test.js.snap (renamed from gui-clamp/ui-react/src/components/dialogs/__snapshots__/ReadAndConvertYaml.test.js.snap)9
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/UploadToscaFile.test.js.snap16
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ReadAndConvertYaml.js87
13 files changed, 405 insertions, 147 deletions
diff --git a/gui-clamp/ui-react/src/components/dialogs/GetLocalToscaFileForUpload.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetLocalToscaFileForUpload.js
index bac9953..013dd89 100644
--- a/gui-clamp/ui-react/src/components/dialogs/GetLocalToscaFileForUpload.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetLocalToscaFileForUpload.js
@@ -1,23 +1,20 @@
/*
- * -
- * * ============LICENSE_START=======================================================
- * * Copyright (C) 2021 Nordix Foundation.
- * * ================================================================================
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *
- * * SPDX-License-Identifier: Apache-2.0
- * * ============LICENSE_END=========================================================
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
*/
import React, { useState } from 'react';
@@ -28,7 +25,7 @@ import Row from 'react-bootstrap/Row';
import styled from 'styled-components';
import Alert from 'react-bootstrap/Alert';
import * as yaml from "js-yaml";
-import UploadToscaFile from "../../api/UploadToscaFile";
+import UploadToscaFile from "./UploadToscaFile";
const ModalStyled = styled(Modal)`
background-color: transparent;
@@ -82,9 +79,9 @@ const GetLocalToscaFileForUpload = (props) => {
}
};
- const receiveResponseFromUpload = (response, responseMessage) => {
+ const receiveResponseFromUpload = async (response) => {
- if (response.ok) {
+ if (await response.ok) {
setAlertMessages(<Alert variant="success">
<Alert.Heading>Upload Success</Alert.Heading>
<p>Tosca Service Template from { selectedFile.name } was Successfully Uploaded</p>
@@ -96,8 +93,8 @@ const GetLocalToscaFileForUpload = (props) => {
setAlertMessages(<Alert variant="danger">
<Alert.Heading>Upload Failure</Alert.Heading>
<p>Tosca Service Template from { selectedFile.name } failed to upload</p>
- <p>Status code: { response.status }: { response.statusText }</p>
- <p>Response from CLAMP: { responseMessage }</p>
+ <p>Status code: { await response.status }: { response.statusText }</p>
+ <p>Response Text: { await response.text() }</p>
<hr/>
<p>Type: { selectedFile.type }</p><p>Size: { +selectedFile.size / 1000 }Kb</p>
</Alert>);
diff --git a/gui-clamp/ui-react/src/components/dialogs/GetLocalToscaFileForUpload.test.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetLocalToscaFileForUpload.test.js
index dfd3b9e..9b885c6 100644
--- a/gui-clamp/ui-react/src/components/dialogs/GetLocalToscaFileForUpload.test.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetLocalToscaFileForUpload.test.js
@@ -1,24 +1,22 @@
/*
- * -
- * * ============LICENSE_START=======================================================
- * * Copyright (C) 2021 Nordix Foundation.
- * * ================================================================================
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *
- * * SPDX-License-Identifier: Apache-2.0
- * * ============LICENSE_END=========================================================
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
*/
+
import React from 'react';
import { mount, shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.js
new file mode 100644
index 0000000..7da8c13
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.js
@@ -0,0 +1,50 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+import React, { useState } from "react";
+import Button from "react-bootstrap/Button";
+import ControlLoopService from "../../../api/ControlLoopService";
+
+const GetToscaTemplate = (props) => {
+
+ const [windowLocationPathName, setWindowLocationPathname] = useState('');
+
+ const getTemplateHandler = async () => {
+ console.log('getTemplateHandler called')
+ setWindowLocationPathname(window.location.pathname);
+
+ const response = await ControlLoopService.getToscaTemplate(props.templateName, props.templateVersion, windowLocationPathName)
+ .catch(error => error.message);
+
+ props.onGetToscaServiceTemplate(response);
+
+ }
+
+ return (
+ <React.Fragment>
+ <Button variant="primary"
+ type="submit"
+ onClick={ getTemplateHandler }>Get Tosca Service Template</Button>
+ </React.Fragment>
+ );
+
+
+}
+
+export default GetToscaTemplate;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.test.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.test.js
new file mode 100644
index 0000000..ce2a398
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.test.js
@@ -0,0 +1,53 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+import React from 'react';
+import { mount, shallow } from 'enzyme';
+import GetToscaTemplate from './GetToscaTemplate';
+import toJson from "enzyme-to-json";
+
+describe('Verify GetToscaTemplate', () => {
+
+ it("renders without crashing", () => {
+ shallow(<GetToscaTemplate/>);
+ });
+
+ it("renders correctly", () => {
+ const tree = shallow(<GetToscaTemplate/>);
+ expect(toJson(tree)).toMatchSnapshot();
+ });
+
+ it('should have a Button element', () => {
+ const container = shallow(<GetToscaTemplate/>)
+ expect(container.find('Button').length).toEqual(1);
+ });
+
+ it('button should call getTemplateHandler when clicked', async () => {
+ const component = mount(<GetToscaTemplate/>)
+ const logSpy = jest.spyOn(console, 'log');
+
+ component.find('[variant="primary"]').simulate('click');
+ expect(logSpy).toHaveBeenCalledWith('getTemplateHandler called');
+ });
+
+ it('should have a Button element with specified text', () => {
+ const container = shallow(<GetToscaTemplate/>)
+ expect(container.find('Button').text()).toBe('Get Tosca Service Template');
+ });
+});
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ReadAndConvertYaml.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ReadAndConvertYaml.js
new file mode 100644
index 0000000..53b541c
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ReadAndConvertYaml.js
@@ -0,0 +1,96 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+import React, { useState } from "react";
+import GetToscaTemplate from "./GetToscaTemplate";
+import Modal from "react-bootstrap/Modal";
+import Button from "react-bootstrap/Button";
+import { Alert } from "react-bootstrap";
+
+import styled from 'styled-components';
+
+const ModalStyled = styled(Modal)`
+ background-color: transparent;
+`
+
+const AlertStyled = styled(Alert)`
+ margin-top: 10px;
+`
+
+const PreStyled = styled.pre`
+ color: #7F0055;
+ overflow: auto;
+ max-height: 70vh;
+ margin-top: 10px;
+`
+
+const ReadAndConvertYaml = (props) => {
+ const [show, setShow] = useState(true);
+ const [toscaTemplateData, setToscaTemplateData] = useState();
+ const [responeOk, setResponseOk] = useState(true);
+ const name = 'ToscaServiceTemplateSimple';
+ const version = '1.0.0';
+
+ const handleClose = () => {
+ console.log('handleClose called');
+ setShow(false);
+ props.history.push('/');
+ }
+
+ const getToscaServiceTemplateHandler = async (toscaServiceTemplateResponse) => {
+ // console.log('getToscaServiceTemplateHandler called: ' + toscaServiceTemplate);
+
+ if (!toscaServiceTemplateResponse.ok) {
+ setResponseOk(false);
+ const toscaData = await toscaServiceTemplateResponse;
+ setToscaTemplateData(toscaData);
+ } else {
+ setResponseOk(true);
+ const toscaData = await toscaServiceTemplateResponse.json();
+ setToscaTemplateData(toscaData);
+ }
+ }
+
+ return (
+ <ModalStyled size="xl"
+ show={ show }
+ onHide={ handleClose }
+ backdrop="static"
+ keyboard={ false }>
+ <Modal.Header closeButton>
+ <Modal.Title>View Tosca Template</Modal.Title>
+ </Modal.Header>
+ <Modal.Body>
+ <GetToscaTemplate templateName={ name }
+ templateVersion={ version }
+ onGetToscaServiceTemplate={ getToscaServiceTemplateHandler }/>
+ { responeOk && <PreStyled> { JSON.stringify(toscaTemplateData, null, 2) } </PreStyled> }
+ <AlertStyled show={ !responeOk }
+ variant="danger">{ toscaTemplateData }</AlertStyled>
+ </Modal.Body>
+ <Modal.Footer>
+ <Button variant="secondary"
+ type="null"
+ onClick={ handleClose }>Cancel</Button>
+ </Modal.Footer>
+ </ModalStyled>
+ );
+};
+
+export default ReadAndConvertYaml;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ReadAndConvertYaml.test.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ReadAndConvertYaml.test.js
index daec619..90d7185 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ReadAndConvertYaml.test.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ReadAndConvertYaml.test.js
@@ -1,24 +1,22 @@
/*
- * -
- * * ============LICENSE_START=======================================================
- * * Copyright (C) 2021 Nordix Foundation.
- * * ================================================================================
- * * Licensed under the Apache License, Version 2.0 (the "License");
- * * you may not use this file except in compliance with the License.
- * * You may obtain a copy of the License at
- * *
- * * http://www.apache.org/licenses/LICENSE-2.0
- * *
- * * Unless required by applicable law or agreed to in writing, software
- * * distributed under the License is distributed on an "AS IS" BASIS,
- * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * * See the License for the specific language governing permissions and
- * * limitations under the License.
- * *
- * * SPDX-License-Identifier: Apache-2.0
- * * ============LICENSE_END=========================================================
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
*
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
*/
+
import React from 'react';
import { mount, shallow } from 'enzyme';
import ReadAndConvertYaml from './ReadAndConvertYaml';
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.js
new file mode 100644
index 0000000..6ee6a43
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.js
@@ -0,0 +1,54 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+import Button from "react-bootstrap/Button";
+import React, { useState } from "react";
+import ControlLoopService from "../../../api/ControlLoopService";
+
+const UploadToscaFile = (props) => {
+ const [windowLocationPathName, setWindowLocationPathname] = useState('');
+
+ const postServiceTemplateHandler = async (event) => {
+ event.preventDefault();
+ console.log('postServiceTemplateHandler called');
+ setWindowLocationPathname(window.location.pathname);
+
+ const response = await ControlLoopService.uploadToscaFile(props.toscaObject, windowLocationPathName)
+ .catch(error => error.message);
+
+ // const responseMessage = await response.text();
+
+ props.onResponseReceived(response);
+
+ }
+
+ return (
+ <React.Fragment>
+ <Button variant="primary"
+ block={ true }
+ type="submit"
+ onClick={ postServiceTemplateHandler }>
+ Upload Tosca Service Template
+ </Button>
+ </React.Fragment>
+ );
+
+};
+
+export default UploadToscaFile;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.test.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.test.js
new file mode 100644
index 0000000..94d9038
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.test.js
@@ -0,0 +1,61 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2021 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+import React from 'react';
+import { mount, shallow } from 'enzyme';
+import UploadToscaFile from './UploadToscaFile';
+import toJson from "enzyme-to-json";
+import { act } from "react-dom/test-utils";
+
+describe('Verify UploadToscaFile', () => {
+
+ it("renders without crashing", () => {
+ shallow(<UploadToscaFile/>);
+ });
+
+ it("renders correctly", () => {
+ const tree = shallow(<UploadToscaFile/>);
+ expect(toJson(tree)).toMatchSnapshot();
+ });
+
+ it('should have a Button element', () => {
+ const container = shallow(<UploadToscaFile/>)
+ expect(container.find('Button').length).toEqual(1);
+ });
+
+ it('button should call postServiceTemplateHandler when clicked', async () => {
+ const component = mount(<UploadToscaFile/>)
+ const logSpy = jest.spyOn(console, 'log');
+ const event = {
+ preventDefault() {
+ }
+ };
+
+ act(async () => {
+ component.find('[variant="primary"]').get(0).props.onClick(event);
+ expect(logSpy).toHaveBeenCalledWith('postServiceTemplateHandler called');
+ })
+
+ });
+
+ it('should have a Button element with specified text', () => {
+ const container = shallow(<UploadToscaFile/>)
+ expect(container.find('Button').text()).toBe('Upload Tosca Service Template');
+ });
+});
diff --git a/gui-clamp/ui-react/src/components/dialogs/__snapshots__/GetLocalToscaFileForUpload.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/GetLocalToscaFileForUpload.test.js.snap
index 84168fd..84168fd 100644
--- a/gui-clamp/ui-react/src/components/dialogs/__snapshots__/GetLocalToscaFileForUpload.test.js.snap
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/GetLocalToscaFileForUpload.test.js.snap
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/GetToscaTemplate.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/GetToscaTemplate.test.js.snap
new file mode 100644
index 0000000..2c591d9
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/GetToscaTemplate.test.js.snap
@@ -0,0 +1,15 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Verify GetToscaTemplate renders correctly 1`] = `
+<Fragment>
+ <Button
+ active={false}
+ disabled={false}
+ onClick={[Function]}
+ type="submit"
+ variant="primary"
+ >
+ Get Tosca Service Template
+ </Button>
+</Fragment>
+`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/__snapshots__/ReadAndConvertYaml.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/ReadAndConvertYaml.test.js.snap
index cbead03..fab7801 100644
--- a/gui-clamp/ui-react/src/components/dialogs/__snapshots__/ReadAndConvertYaml.test.js.snap
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/ReadAndConvertYaml.test.js.snap
@@ -22,7 +22,14 @@ exports[`Verify ReadAndConvertYaml renders correctly 1`] = `
templateName="ToscaServiceTemplateSimple"
templateVersion="1.0.0"
/>
- <styled.pre />
+ <styled.pre>
+
+
+ </styled.pre>
+ <Styled(Alert)
+ show={false}
+ variant="danger"
+ />
</ModalBody>
<ModalFooter>
<Button
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/UploadToscaFile.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/UploadToscaFile.test.js.snap
new file mode 100644
index 0000000..a1ae439
--- /dev/null
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/UploadToscaFile.test.js.snap
@@ -0,0 +1,16 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Verify UploadToscaFile renders correctly 1`] = `
+<Fragment>
+ <Button
+ active={false}
+ block={true}
+ disabled={false}
+ onClick={[Function]}
+ type="submit"
+ variant="primary"
+ >
+ Upload Tosca Service Template
+ </Button>
+</Fragment>
+`;
diff --git a/gui-clamp/ui-react/src/components/dialogs/ReadAndConvertYaml.js b/gui-clamp/ui-react/src/components/dialogs/ReadAndConvertYaml.js
deleted file mode 100644
index 3a02588..0000000
--- a/gui-clamp/ui-react/src/components/dialogs/ReadAndConvertYaml.js
+++ /dev/null
@@ -1,87 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-import React, { useState } from "react";
-import GetToscaTemplate from "../../api/GetToscaTemplate";
-import Modal from "react-bootstrap/Modal";
-import Button from "react-bootstrap/Button";
-
-import styled from 'styled-components';
-
-const ModalStyled = styled(Modal)`
- background-color: transparent;
-`
-
-const ErrMsgStyled = styled.div`
- color: red;
-`
-
-const PreStyled = styled.pre`
- color: #7F0055;
- overflow: auto;
- max-height: 70vh;
-`
-
-const ReadAndConvertYaml = (props) => {
- const [show, setShow] = useState(true);
- const [toscaTemplateData, setToscaTemplateData] = useState();
- const name = 'ToscaServiceTemplateSimple';
- const version = '1.0.0';
-
- const handleClose = () => {
- console.log('handleClose called');
- setShow(false);
- props.history.push('/');
- }
-
- const getToscaServiceTemplateHandler = async (toscaServiceTemplate) => {
- console.log('getToscaServiceTemplateHandler called');
- const toscaData = {
- ...toscaServiceTemplate,
- id: Math.random().toString()
- };
- // console.log(toscaData);
- setToscaTemplateData(toscaData);
- }
-
- return (
- <ModalStyled size="xl"
- show={ show }
- onHide={ handleClose }
- backdrop="static"
- keyboard={ false }>
- <Modal.Header closeButton>
- <Modal.Title>View Tosca Template</Modal.Title>
- </Modal.Header>
- <Modal.Body>
- <GetToscaTemplate templateName={ name }
- templateVersion={ version }
- onGetToscaServiceTemplate={ getToscaServiceTemplateHandler }/>
- <PreStyled>{ JSON.stringify(toscaTemplateData, null, 2) }</PreStyled>
- </Modal.Body>
- <Modal.Footer>
- <Button variant="secondary"
- type="null"
- onClick={ handleClose }>Cancel</Button>
- </Modal.Footer>
- </ModalStyled>
- );
-}
-
-export default ReadAndConvertYaml;