From: saul.gill Date: Fri, 2 Jul 2021 16:10:54 +0000 (+0100) Subject: Changed components to be service-centric X-Git-Tag: 2.1.0~25 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=6687b48b58bf1248532de48f3e375b1f663f4015;p=policy%2Fgui.git 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 --- diff --git a/gui-clamp/ui-react-lib/libIndex.js b/gui-clamp/ui-react-lib/libIndex.js index 21decbc..179b882 100644 --- a/gui-clamp/ui-react-lib/libIndex.js +++ b/gui-clamp/ui-react-lib/libIndex.js @@ -57,7 +57,7 @@ export { default as PoliciesTreeViewer } from '../ui-react/src/components/dialog export { default as PolicyToscaFileSelector } from '../ui-react/src/components/dialogs/Policy/PolicyToscaFileSelector'; export { default as MonitoringControlLoopModal } from '../ui-react/src/components/dialogs/ControlLoop/MonitoringControlLoopModal'; export { default as ControlLoopService } from '../ui-react/src/api/ControlLoopService'; -export { default as GetLocalToscaFileForUpload } from '../ui-react/src/components/dialogs/GetLocalToscaFileForUpload'; -export { default as ReadAndConvertYaml } from '../ui-react/src/components/dialogs/ReadAndConvertYaml'; -export { default as UploadToscaFile } from '../ui-react/src/api/UploadToscaFile'; -export { default as GetToscaTemplate } from '../ui-react/src/api/GetToscaTemplate'; +export { default as GetLocalToscaFileForUpload } from '../ui-react/src/components/dialogs/ControlLoop/GetLocalToscaFileForUpload'; +export { default as ReadAndConvertYaml } from '../ui-react/src/components/dialogs/ControlLoop/ReadAndConvertYaml'; +export { default as UploadToscaFile } from '../ui-react/src/components/dialogs/ControlLoop/UploadToscaFile'; +export { default as GetToscaTemplate } from '../ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate'; diff --git a/gui-clamp/ui-react/src/LoopUI.js b/gui-clamp/ui-react/src/LoopUI.js index 4009bf1..752c89d 100644 --- a/gui-clamp/ui-react/src/LoopUI.js +++ b/gui-clamp/ui-react/src/LoopUI.js @@ -51,9 +51,9 @@ import Alert from 'react-bootstrap/Alert'; import Spinner from 'react-bootstrap/Spinner'; import { Link } from 'react-router-dom'; -import ReadAndConvertYaml from "./components/dialogs/ReadAndConvertYaml"; +import ReadAndConvertYaml from "./components/dialogs/ControlLoop/ReadAndConvertYaml"; import MonitoringControlLoopModal from "./components/dialogs/ControlLoop/MonitoringControlLoopModal"; -import GetLocalToscaFileForUpload from "./components/dialogs/GetLocalToscaFileForUpload"; +import GetLocalToscaFileForUpload from "./components/dialogs/ControlLoop/GetLocalToscaFileForUpload"; const StyledMainDiv = styled.div` background-color: ${ props => props.theme.backgroundColor }; diff --git a/gui-clamp/ui-react/src/api/ControlLoopService.js b/gui-clamp/ui-react/src/api/ControlLoopService.js index 5ef7529..1882f78 100644 --- a/gui-clamp/ui-react/src/api/ControlLoopService.js +++ b/gui-clamp/ui-react/src/api/ControlLoopService.js @@ -44,4 +44,38 @@ export default class ControlLoopService { return undefined; }); } + + static async getToscaTemplate(name, version, windowLocationPathname) { + const params = { + name: name, + version: version + } + + const response = await fetch(windowLocationPathname + + '/restservices/clds/v2/toscaControlLoop/getToscaTemplate' + '?' + (new URLSearchParams(params))); + + if (!response.ok) { + const message = `An error has occurred: ${response.status}`; + throw new Error(message); + } + + const data = await response; + + return data; + } + + static async uploadToscaFile(toscaObject, windowLocationPathName) { + const response = await fetch(windowLocationPathName + + '/restservices/clds/v2/toscaControlLoop/commissionToscaTemplate', { + method: 'POST', + headers: { + "Content-Type": "application/json" + }, + credentials: 'same-origin', + body: JSON.stringify(toscaObject), + }); + + return response + + } } diff --git a/gui-clamp/ui-react/src/api/GetToscaTemplate.js b/gui-clamp/ui-react/src/api/GetToscaTemplate.js deleted file mode 100644 index d428491..0000000 --- a/gui-clamp/ui-react/src/api/GetToscaTemplate.js +++ /dev/null @@ -1,56 +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 Button from "react-bootstrap/Button"; - -const GetToscaTemplate = (props) => { - - const [windowLocationPathName, setWindowLocationPathname] = useState(''); - - const getTemplateHandler = async () => { - console.log('getTemplateHandler called') - setWindowLocationPathname(window.location.pathname); - - const params = { - name: props.templateName, - version: props.templateVersion - } - - const response = await fetch(windowLocationPathName + - '/restservices/clds/v2/toscaControlLoop/getToscaTemplate' + '?' + (new URLSearchParams(params))); - - const data = await response.json(); - - props.onGetToscaServiceTemplate(data); - - } - - return ( - - - - ); - - -} - -export default GetToscaTemplate; diff --git a/gui-clamp/ui-react/src/api/UploadToscaFile.js b/gui-clamp/ui-react/src/api/UploadToscaFile.js deleted file mode 100644 index 4173e0d..0000000 --- a/gui-clamp/ui-react/src/api/UploadToscaFile.js +++ /dev/null @@ -1,63 +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 Button from "react-bootstrap/Button"; -import React, { useState } from "react"; - -const UploadToscaFile = (props) => { - const [windowLocationPathName, setWindowLocationPathname] = useState(''); - - const postServiceTemplateHandler = async (event) => { - event.preventDefault(); - console.log('postServiceTemplateHandler called'); - setWindowLocationPathname(window.location.pathname); - - const response = await fetch(windowLocationPathName + - '/restservices/clds/v2/toscaControlLoop/commissionToscaTemplate', { - method: 'POST', - headers: { - "Content-Type": "application/json" - }, - credentials: 'same-origin', - body: JSON.stringify(props.toscaObject), - }); - - const responseObj = await response; - const responseMessage = await response.text(); - - props.onResponseReceived(responseObj, responseMessage); - - } - - return ( - - - - ); - -}; - -export default UploadToscaFile; diff --git a/gui-clamp/ui-react/src/components/dialogs/GetLocalToscaFileForUpload.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetLocalToscaFileForUpload.js similarity index 75% rename from gui-clamp/ui-react/src/components/dialogs/GetLocalToscaFileForUpload.js rename to 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( Upload Success

Tosca Service Template from { selectedFile.name } was Successfully Uploaded

@@ -96,8 +93,8 @@ const GetLocalToscaFileForUpload = (props) => { setAlertMessages( Upload Failure

Tosca Service Template from { selectedFile.name } failed to upload

-

Status code: { response.status }: { response.statusText }

-

Response from CLAMP: { responseMessage }

+

Status code: { await response.status }: { response.statusText }

+

Response Text: { await response.text() }


Type: { selectedFile.type }

Size: { +selectedFile.size / 1000 }Kb

); 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 similarity index 77% rename from gui-clamp/ui-react/src/components/dialogs/GetLocalToscaFileForUpload.test.js rename to 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 ( + + + + ); + + +} + +export default GetToscaTemplate; diff --git a/gui-clamp/ui-react/src/api/GetToscaTemplate.test.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.test.js similarity index 53% rename from gui-clamp/ui-react/src/api/GetToscaTemplate.test.js rename to gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.test.js index 338ee83..ce2a398 100644 --- a/gui-clamp/ui-react/src/api/GetToscaTemplate.test.js +++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.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 GetToscaTemplate from './GetToscaTemplate'; 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 ( + + + View Tosca Template + + + + { responeOk && { JSON.stringify(toscaTemplateData, null, 2) } } + { toscaTemplateData } + + + + + + ); +}; + +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 similarity index 71% rename from gui-clamp/ui-react/src/components/dialogs/ReadAndConvertYaml.test.js rename to 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 ( + + + + ); + +}; + +export default UploadToscaFile; diff --git a/gui-clamp/ui-react/src/api/UploadToscaFile.test.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.test.js similarity index 57% rename from gui-clamp/ui-react/src/api/UploadToscaFile.test.js rename to gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.test.js index 681acc7..94d9038 100644 --- a/gui-clamp/ui-react/src/api/UploadToscaFile.test.js +++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.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 UploadToscaFile from './UploadToscaFile'; 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 similarity index 100% rename from gui-clamp/ui-react/src/components/dialogs/__snapshots__/GetLocalToscaFileForUpload.test.js.snap rename to gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/GetLocalToscaFileForUpload.test.js.snap diff --git a/gui-clamp/ui-react/src/api/__snapshots__/GetToscaTemplate.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/GetToscaTemplate.test.js.snap similarity index 100% rename from gui-clamp/ui-react/src/api/__snapshots__/GetToscaTemplate.test.js.snap rename to gui-clamp/ui-react/src/components/dialogs/ControlLoop/__snapshots__/GetToscaTemplate.test.js.snap 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 similarity index 86% rename from gui-clamp/ui-react/src/components/dialogs/__snapshots__/ReadAndConvertYaml.test.js.snap rename to 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" /> - + + + + + - - - ); -} - -export default ReadAndConvertYaml; diff --git a/gui-clamp/ui-react/src/components/menu/MenuBar.js b/gui-clamp/ui-react/src/components/menu/MenuBar.js index d7784ef..4574a2a 100644 --- a/gui-clamp/ui-react/src/components/menu/MenuBar.js +++ b/gui-clamp/ui-react/src/components/menu/MenuBar.js @@ -87,10 +87,6 @@ export default class MenuBar extends React.Component { render() { return ( - - View Tosca Template - Upload Tosca to Commissioning - View All Policies @@ -119,6 +115,10 @@ export default class MenuBar extends React.Component { Monitoring Control Loop + + Commissioning + View Tosca Template + Upload Tosca to Commissioning Wiki diff --git a/gui-clamp/ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap b/gui-clamp/ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap index 416d62e..8bdfb09 100644 --- a/gui-clamp/ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap +++ b/gui-clamp/ui-react/src/components/menu/__snapshots__/MenuBar.test.js.snap @@ -3,7 +3,7 @@ exports[`Verify MenuBar Test the render method 1`] = ` - View Tosca Template + View All Policies + + - Upload Tosca to Commissioning + Tosca Metadata Dictionaries - - + - View All Policies + View All Loop Templates - Tosca Metadata Dictionaries + Create - - View All Loop Templates + Open - - - Create + Close - Open + Modify + - Close + Properties - Modify + Refresh Status - + + - Properties + Create and deploy to Policy Framework (SUBMIT) - Refresh Status + Undeploy from Policy Framework (STOP) - - - Create and deploy to Policy Framework (SUBMIT) + ReDeploy to Policy Framework (RESTART) - Undeploy from Policy Framework (STOP) + Delete loop instance (DELETE) + - ReDeploy to Policy Framework (RESTART) + Deploy to DCAE (DEPLOY) - Delete loop instance (DELETE) + UnDeploy to DCAE (UNDEPLOY) - + + - Deploy to DCAE (DEPLOY) + Monitoring Control Loop + + + Commissioning + - UnDeploy to DCAE (UNDEPLOY) + View Tosca Template - - - Monitoring Control Loop + Upload Tosca to Commissioning