summaryrefslogtreecommitdiffstats
path: root/gui-clamp/ui-react/src/components/dialogs/ControlLoop
diff options
context:
space:
mode:
authordanielhanrahan <daniel.hanrahan@est.tech>2021-09-08 12:34:22 +0100
committerdanielhanrahan <daniel.hanrahan@est.tech>2021-09-10 11:46:48 +0100
commit426fa90230fc6732bd2a74e4c202e697ecd4c11b (patch)
treed696ba8aaaba2f556cb82d651cd1c380486a7c77 /gui-clamp/ui-react/src/components/dialogs/ControlLoop
parent4ee6cfe3c0c507370118348d782b14a09e1b3c53 (diff)
Make gui-clamp work in Docker image
Change package.json to generate URLs relative to current pathname Change REST URLs to use window.location.pathname Remove broken React state variables for window.location.pathname Issue-ID: POLICY-3600 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I6951a0a6b3f3bef15d262242df13cc2d20a198c8
Diffstat (limited to 'gui-clamp/ui-react/src/components/dialogs/ControlLoop')
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/ChangeOrderStateModal.js11
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/CommissioningModal.js10
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/DeleteToscaTemplate.js5
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.js5
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstancePropertiesModal.js12
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationManagementModal.js11
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/MonitorInstantiation.js5
-rw-r--r--gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.js4
8 files changed, 19 insertions, 44 deletions
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ChangeOrderStateModal.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ChangeOrderStateModal.js
index 2c6d9aa..d8efd3a 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ChangeOrderStateModal.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/ChangeOrderStateModal.js
@@ -48,8 +48,6 @@ const AlertStyled = styled(Alert)`
const ChangeOrderStateModal = (props) => {
const [show, setShow] = useState(true);
- const [windowLocationPathnameGet, setWindowLocationPathnameGet] = useState('');
- const [windowLocationPathNameSave, setWindowLocationPathNameSave] = useState('');
const [controlLoopIdentifierList, setControlLoopIdentifierList] = useState([]);
const [orderedState, setOrderedState] = useState('');
const [toscaOrderStateObject, setToscaOrderStateObject] = useState({});
@@ -58,11 +56,10 @@ const ChangeOrderStateModal = (props) => {
const [alertMessage, setAlertMessage] = useState(null);
useEffect(async () => {
- setWindowLocationPathnameGet(window.location.pathname);
const instantiationOrderState = await ControlLoopService.getInstanceOrderState(
props.location.instantiationName,
- props.location.instantiationVersion, windowLocationPathnameGet)
+ props.location.instantiationVersion)
.catch(error => error.message);
const orderStateJson = await instantiationOrderState.json();
@@ -91,11 +88,9 @@ const ChangeOrderStateModal = (props) => {
const handleSave = async () => {
console.log("handleSave called");
- setWindowLocationPathNameSave(window.location.pathname);
- const response = await ControlLoopService.changeInstanceOrderState(
- toscaOrderStateObject,
- windowLocationPathNameSave).catch(error => error.message);
+ const response = await ControlLoopService.changeInstanceOrderState(toscaOrderStateObject)
+ .catch(error => error.message);
if (response.ok) {
successAlert();
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/CommissioningModal.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/CommissioningModal.js
index 9a615d0..fc150ef 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/CommissioningModal.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/CommissioningModal.js
@@ -47,7 +47,6 @@ const AlertStyled = styled(Alert)`
`
const CommissioningModal = (props) => {
- const [windowLocationPathName, setWindowLocationPathName] = useState('');
const [fullToscaTemplate, setFullToscaTemplate] = useState({});
const [toscaInitialValues, setToscaInitialValues] = useState({});
const [commonProperties, setCommonProperties] = useState({})
@@ -62,9 +61,9 @@ const CommissioningModal = (props) => {
let editorTemp = null
useEffect(async () => {
- const toscaTemplateResponse = await ControlLoopService.getToscaTemplate(name, version, windowLocationPathName)
+ const toscaTemplateResponse = await ControlLoopService.getToscaTemplate(name, version)
.catch(error => error.message);
- const toscaCommonProperties = await ControlLoopService.getCommonOrInstanceProperties(name, version, windowLocationPathName, true)
+ const toscaCommonProperties = await ControlLoopService.getCommonOrInstanceProperties(name, version, true)
.catch(error => error.message);
if (!toscaCommonProperties.ok) {
@@ -100,12 +99,11 @@ const CommissioningModal = (props) => {
const handleCommission = async () => {
- setWindowLocationPathName(window.location.pathname);
- await ControlLoopService.deleteToscaTemplate('ToscaServiceTemplateSimple', "1.0.0", windowLocationPathName)
+ await ControlLoopService.deleteToscaTemplate('ToscaServiceTemplateSimple', "1.0.0")
.catch(error => error.message)
- const recommissioningResponse = await ControlLoopService.uploadToscaFile(fullToscaTemplate, windowLocationPathName)
+ const recommissioningResponse = await ControlLoopService.uploadToscaFile(fullToscaTemplate)
.catch(error => error.message)
await receiveResponseFromCommissioning(recommissioningResponse)
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/DeleteToscaTemplate.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/DeleteToscaTemplate.js
index c641272..7968fe2 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/DeleteToscaTemplate.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/DeleteToscaTemplate.js
@@ -24,13 +24,10 @@ import ControlLoopService from "../../../api/ControlLoopService";
const DeleteToscaTemplate = props => {
- const [windowLocationPathName, setWindowLocationPathname] = useState('');
-
const deleteTemplateHandler = async () => {
console.log('deleteTemplateHandler called');
- setWindowLocationPathname(window.location.pathname);
- const response = await ControlLoopService.deleteToscaTemplate(props.templateName, props.templateVersion, windowLocationPathName)
+ const response = await ControlLoopService.deleteToscaTemplate(props.templateName, props.templateVersion)
.catch(error => error.message);
console.log('Response is ok: ' + response.ok);
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.js
index 273957f..ba78b80 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/GetToscaTemplate.js
@@ -23,13 +23,10 @@ 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)
+ const response = await ControlLoopService.getToscaTemplate(props.templateName, props.templateVersion)
.catch(error => error.message);
props.onGetToscaServiceTemplate(response);
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstancePropertiesModal.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstancePropertiesModal.js
index 8343237..8ad855e 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstancePropertiesModal.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstancePropertiesModal.js
@@ -60,7 +60,6 @@ function Fragment(props) {
Fragment.propTypes = { children: PropTypes.node };
const InstancePropertiesModal = (props) => {
const [show, setShow] = useState(true);
- const [windowLocationPathname, setWindowLocationPathname] = useState('');
const [toscaFullTemplate, setToscaFullTemplate] = useState({});
const [jsonEditor, setJsonEditor] = useState(null);
const [alertMessage, setAlertMessage] = useState(null);
@@ -71,9 +70,11 @@ const InstancePropertiesModal = (props) => {
const [isLoading, setIsLoading] = useState(true);
useEffect(async () => {
- const toscaInstanceProperties = await ControlLoopService.getCommonOrInstanceProperties(templateName, templateVersion, windowLocationPathname, false).catch(error => error.message);
+ const toscaInstanceProperties = await ControlLoopService.getCommonOrInstanceProperties(templateName, templateVersion, false)
+ .catch(error => error.message);
- const toscaTemplateResponse = await ControlLoopService.getToscaTemplate(templateName, templateVersion, windowLocationPathname).catch(error => error.message);
+ const toscaTemplateResponse = await ControlLoopService.getToscaTemplate(templateName, templateVersion)
+ .catch(error => error.message);
if (!toscaInstanceProperties.ok) {
const errorResponse = await toscaInstanceProperties.json()
@@ -238,11 +239,10 @@ const InstancePropertiesModal = (props) => {
console.log("instanceName to be saved is: " + instanceName)
- setWindowLocationPathname(window.location.pathname);
-
updateTemplate(jsonEditor.getValue());
- const response = await ControlLoopService.createInstanceProperties(instanceName, toscaFullTemplate, windowLocationPathname).catch(error => error.message);
+ const response = await ControlLoopService.createInstanceProperties(instanceName, toscaFullTemplate)
+ .catch(error => error.message);
if (response.ok) {
successAlert();
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationManagementModal.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationManagementModal.js
index a0a849c..6a435e4 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationManagementModal.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/InstantiationManagementModal.js
@@ -46,16 +46,12 @@ const DivWhiteSpaceStyled = styled.div`
`
const InstantiationManagementModal = (props) => {
const [show, setShow] = useState(true);
- const [windowLocationPathName, setWindowLocationPathName] = useState('');
- const [windowLocationPathNameDelete, setWindowLocationPathNameDelete] = useState('');
-
const [instantiationList, setInstantiationList] = useState([]);
const [alertMessage, setAlertMessage] = useState(null);
useEffect(async () => {
- setWindowLocationPathName(window.location.pathname);
- const response = await ControlLoopService.getControlLoopInstantiation(windowLocationPathName);
+ const response = await ControlLoopService.getControlLoopInstantiation();
const instantiationListJson = await response.json();
@@ -83,14 +79,11 @@ const InstantiationManagementModal = (props) => {
const deleteInstantiationHandler = async (instantiation, index) => {
console.log("deleteInstantiationHandler called");
- setWindowLocationPathNameDelete(window.location.pathname);
const name = instantiation.name;
const version = instantiation.version;
- console.log(window.location.pathname);
-
- const response = await ControlLoopService.deleteInstantiation(name, version, windowLocationPathNameDelete);
+ const response = await ControlLoopService.deleteInstantiation(name, version);
updateList(index);
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/MonitorInstantiation.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/MonitorInstantiation.js
index 6c589b8..dad4185 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/MonitorInstantiation.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/MonitorInstantiation.js
@@ -36,14 +36,11 @@ const AlertStyled = styled(Alert)`
const MonitorInstantiation = (props) => {
const [show, setShow] = useState(true);
const [controlLoopList, setControlLoopList] = useState([]);
- const [windowLocationPathname, setWindowLocationPathname] = useState('');
const [controlLoopInstantiationOk, setControlLoopInstantiationOk] = useState(true);
const [controlLoopInstantiationError, setControlLoopInstantiationError] = useState({});
useEffect(async () => {
- setWindowLocationPathname(window.location.pathname);
-
- const controlLoopInstantiation = await ControlLoopService.getControlLoopInstantiation(windowLocationPathname)
+ const controlLoopInstantiation = await ControlLoopService.getControlLoopInstantiation()
.catch(error => error.message);
const controlLoopInstantiationJson = await controlLoopInstantiation.json()
diff --git a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.js b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.js
index 6ee6a43..380838e 100644
--- a/gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.js
+++ b/gui-clamp/ui-react/src/components/dialogs/ControlLoop/UploadToscaFile.js
@@ -22,14 +22,12 @@ 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)
+ const response = await ControlLoopService.uploadToscaFile(props.toscaObject)
.catch(error => error.message);
// const responseMessage = await response.text();