aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/ui-react/src/api
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2021-11-09 15:22:22 +0000
committerliamfallon <liam.fallon@est.tech>2021-11-10 08:57:23 +0000
commit2022e5ce5a03788a6edc5761c495cfadc5ded485 (patch)
tree2df93f088fb323440945ce93ce67be1f2208c9bf /runtime/ui-react/src/api
parent579085240812aa593ebafe787d97868e16fc3318 (diff)
Align ui-react file in policy-clamp and policy-gui
When the ui-react code was transferred to policy-gui, the white space was cleaned up and reformatted. This makes it difficult to track the real functional changes if any between ui-react in policy-clamp and policy-gui. This review brings the white space changes into ui-react in policy-clamp to make file comparisons easier. Issue-ID: POLICY-3358 Change-Id: Ic303e71b341e5c0f7ca0de0ed4c4962ebf2f988a Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'runtime/ui-react/src/api')
-rw-r--r--runtime/ui-react/src/api/LoopActionService.js92
-rw-r--r--runtime/ui-react/src/api/LoopCache.js454
-rw-r--r--runtime/ui-react/src/api/LoopCacheMockFile.json18
-rw-r--r--runtime/ui-react/src/api/LoopService.js424
-rw-r--r--runtime/ui-react/src/api/PoliciesListCacheMockFile.json2
-rw-r--r--runtime/ui-react/src/api/PolicyService.js224
-rw-r--r--runtime/ui-react/src/api/PolicyToscaService.js68
-rw-r--r--runtime/ui-react/src/api/TemplateService.js330
-rw-r--r--runtime/ui-react/src/api/UserService.js97
9 files changed, 862 insertions, 847 deletions
diff --git a/runtime/ui-react/src/api/LoopActionService.js b/runtime/ui-react/src/api/LoopActionService.js
index 18ae90eff..6f3b22fa2 100644
--- a/runtime/ui-react/src/api/LoopActionService.js
+++ b/runtime/ui-react/src/api/LoopActionService.js
@@ -21,54 +21,54 @@
*
*/
-export default class LoopActionService{
+export default class LoopActionService {
- static performAction(cl_name, uiAction) {
- console.info("LoopActionService perform action: " + uiAction + " closedloopName=" + cl_name);
- const svcAction = uiAction.toLowerCase();
- return fetch(window.location.pathname + "restservices/clds/v2/loop/" + svcAction + "/" + cl_name, {
- method: 'PUT',
- credentials: 'same-origin'
- })
- .then(function (response) {
- if (response.ok) {
- return response;
- } else {
- return Promise.reject("Perform action failed with code:" + response.status);
- }
- })
- .then(function (data) {
- console.info("Action Successful: " + uiAction);
- return data;
- })
- .catch(function(error) {
- console.info("Action Failure: " + uiAction);
- return Promise.reject(error);
- });
- }
+ static performAction(cl_name, uiAction) {
+ console.info("LoopActionService perform action: " + uiAction + " closedloopName=" + cl_name);
+ const svcAction = uiAction.toLowerCase();
+ return fetch(window.location.pathname + "restservices/clds/v2/loop/" + svcAction + "/" + cl_name, {
+ method: 'PUT',
+ credentials: 'same-origin'
+ })
+ .then(function (response) {
+ if (response.ok) {
+ return response;
+ } else {
+ return Promise.reject("Perform action failed with code:" + response.status);
+ }
+ })
+ .then(function (data) {
+ console.info("Action Successful: " + uiAction);
+ return data;
+ })
+ .catch(function (error) {
+ console.info("Action Failure: " + uiAction);
+ return Promise.reject(error);
+ });
+ }
- static refreshStatus(cl_name) {
- console.info("Refresh the status for closedloopName=" + cl_name);
+ static refreshStatus(cl_name) {
+ console.info("Refresh the status for closedloopName=" + cl_name);
- return fetch(window.location.pathname + "restservices/clds/v2/loop/getstatus/" + cl_name, {
- method: 'GET',
- credentials: 'same-origin'
- })
- .then(function (response) {
- if (response.ok) {
- return response.json();
- } else {
- return Promise.reject("Refresh status failed with code:" + response.status);
- }
- })
- .then(function (data) {
- console.info ("Refresh status Successful");
- return data;
- })
- .catch(function(error) {
- console.info ("Refresh status failed:", error);
- return Promise.reject(error);
- });
- }
+ return fetch(window.location.pathname + "restservices/clds/v2/loop/getstatus/" + cl_name, {
+ method: 'GET',
+ credentials: 'same-origin'
+ })
+ .then(function (response) {
+ if (response.ok) {
+ return response.json();
+ } else {
+ return Promise.reject("Refresh status failed with code:" + response.status);
+ }
+ })
+ .then(function (data) {
+ console.info("Refresh status Successful");
+ return data;
+ })
+ .catch(function (error) {
+ console.info("Refresh status failed:", error);
+ return Promise.reject(error);
+ });
+ }
}
diff --git a/runtime/ui-react/src/api/LoopCache.js b/runtime/ui-react/src/api/LoopCache.js
index 3e19b4fc7..ac2da07f2 100644
--- a/runtime/ui-react/src/api/LoopCache.js
+++ b/runtime/ui-react/src/api/LoopCache.js
@@ -22,231 +22,231 @@
*/
export default class LoopCache {
- loopJsonCache;
-
- constructor(loopJson) {
- this.loopJsonCache=loopJson;
- }
-
- updateMicroServiceProperties(name, newMsProperties) {
- for (var policy in this.loopJsonCache["microServicePolicies"]) {
- if (this.loopJsonCache["microServicePolicies"][policy]["name"] === name) {
- this.loopJsonCache["microServicePolicies"][policy]["configurationsJson"] = newMsProperties;
- }
- }
- }
-
- updateMicroServicePdpGroup(name, pdpGroup, pdpSubgroup) {
- for (var policy in this.loopJsonCache["microServicePolicies"]) {
- if (this.loopJsonCache["microServicePolicies"][policy]["name"] === name) {
- this.loopJsonCache["microServicePolicies"][policy]["pdpGroup"] = pdpGroup;
- this.loopJsonCache["microServicePolicies"][policy]["pdpSubgroup"] = pdpSubgroup;
- }
- }
- }
-
- updateGlobalProperties(newGlobalProperties) {
- this.loopJsonCache["globalPropertiesJson"] = newGlobalProperties;
- }
-
- updateOperationalPolicyProperties(name, newOpProperties) {
- for (var policy in this.loopJsonCache["operationalPolicies"]) {
- if (this.loopJsonCache["operationalPolicies"][policy]["name"] === name) {
- this.loopJsonCache["operationalPolicies"][policy]["configurationsJson"] = newOpProperties;
- }
- }
- }
-
- updateOperationalPolicyPdpGroup(name, pdpGroup, pdpSubgroup) {
- for (var policy in this.loopJsonCache["operationalPolicies"]) {
- if (this.loopJsonCache["operationalPolicies"][policy]["name"] === name) {
- this.loopJsonCache["operationalPolicies"][policy]["pdpGroup"] = pdpGroup;
- this.loopJsonCache["operationalPolicies"][policy]["pdpSubgroup"] = pdpSubgroup;
- }
- }
- }
-
- getLoopName() {
- return this.loopJsonCache["name"];
- }
-
- getOperationalPolicyJsonSchema() {
- return this.loopJsonCache["operationalPolicies"]["0"]["jsonRepresentation"];
- }
-
- getOperationalPolicies() {
- return this.loopJsonCache["operationalPolicies"];
- }
-
- getOperationalPoliciesNoJsonSchema() {
- var operationalPolicies = JSON.parse(JSON.stringify(this.loopJsonCache["operationalPolicies"]));
- delete operationalPolicies[0]["jsonRepresentation"];
- return operationalPolicies;
- }
-
- getGlobalProperties() {
- return this.loopJsonCache["globalPropertiesJson"];
- }
-
- getDcaeDeploymentProperties() {
- return this.loopJsonCache["globalPropertiesJson"]["dcaeDeployParameters"];
- }
-
- getMicroServicePolicies() {
- return this.loopJsonCache["microServicePolicies"];
- }
-
- getOperationalPolicyForName(name) {
- var opProperties=this.getOperationalPolicies();
- for (var policy in opProperties) {
- if (opProperties[policy]["name"] === name) {
- return opProperties[policy];
- }
- }
- return null;
- }
-
- getOperationalPolicyPropertiesForName(name) {
- var opConfig = this.getOperationalPolicyForName(name);
- if (opConfig !== null) {
- return opConfig["configurationsJson"];
- }
- return null;
- }
-
- getOperationalPolicyJsonRepresentationForName(name) {
- var opConfig = this.getOperationalPolicyForName(name);
- if (opConfig !== null) {
- return opConfig["jsonRepresentation"];
- }
- return null;
- }
-
- getOperationalPolicySupportedPdpGroup(name) {
- var opConfig=this.getOperationalPolicyForName(name);
- if (opConfig !== null) {
- if (opConfig["policyModel"]["policyPdpGroup"] !== undefined && opConfig["policyModel"]["policyPdpGroup"]["supportedPdpGroups"] !== undefined) {
- return opConfig["policyModel"]["policyPdpGroup"]["supportedPdpGroups"];
- }
- }
- return [];
- }
-
- getOperationalPolicyPdpGroup(name) {
- var opConfig=this.getOperationalPolicyForName(name);
- if (opConfig !== null) {
- return opConfig["pdpGroup"];
- }
- return null;
- }
-
- getOperationalPolicyPdpSubgroup(name) {
- var opConfig=this.getOperationalPolicyForName(name);
- if (opConfig !== null) {
- return opConfig["pdpSubgroup"];
- }
- return null;
- }
-
- getMicroServiceSupportedPdpGroup(name) {
- var microService=this.getMicroServiceForName(name);
- if (microService !== null) {
- if (microService["policyModel"]["policyPdpGroup"] !== undefined && microService["policyModel"]["policyPdpGroup"]["supportedPdpGroups"] !== undefined) {
- return microService["policyModel"]["policyPdpGroup"]["supportedPdpGroups"];
- }
- }
- return [];
- }
-
- getMicroServicePdpGroup(name) {
- var microService=this.getMicroServiceForName(name);
- if (microService !== null) {
- return microService["pdpGroup"];
- }
- return null;
- }
-
- getMicroServicePdpSubgroup(name) {
- var microService=this.getMicroServiceForName(name);
- if (microService !== null) {
- return microService["pdpSubgroup"];
- }
- return null;
- }
-
- getMicroServiceForName(name) {
- var msProperties=this.getMicroServicePolicies();
- for (var policy in msProperties) {
- if (msProperties[policy]["name"] === name) {
- return msProperties[policy];
- }
- }
- return null;
- }
-
- getMicroServicePropertiesForName(name) {
- var msConfig = this.getMicroServiceForName(name);
- if (msConfig !== null) {
- return msConfig["configurationsJson"];
- }
- return null;
- }
-
- getMicroServiceJsonRepresentationForName(name) {
- var msConfig = this.getMicroServiceForName(name);
- if (msConfig !== null) {
- return msConfig["jsonRepresentation"];
- }
- return null;
- }
-
- getResourceDetailsVfProperty() {
- return this.loopJsonCache["modelService"]["resourceDetails"]["VF"];
- }
-
- getResourceDetailsVfModuleProperty() {
- return this.loopJsonCache["modelService"]["resourceDetails"]["VFModule"];
- }
-
- getLoopLogsArray() {
- return this.loopJsonCache.loopLogs;
- }
-
- getComputedState() {
- return this.loopJsonCache.lastComputedState;
- }
-
- getComponentStates() {
- return this.loopJsonCache.components;
- }
-
- getTemplateName() {
- if (this.getLoopTemplate() !== undefined) {
- return this.getLoopTemplate().name;
- }
- return null;
- }
-
- getLoopTemplate() {
- return this.loopJsonCache["loopTemplate"];
- }
-
- isOpenLoopTemplate() {
- var loopTemplate = this.getLoopTemplate();
- if(loopTemplate != null && loopTemplate["allowedLoopType"] === "OPEN") {
- return true;
- }
- return false;
- }
-
- getAllLoopElementModels() {
- var loopTemplate = this.getLoopTemplate();
- var loopElementModels = [];
- if(loopTemplate != null) {
- for (var element of loopTemplate['loopElementModelsUsed']) {
- loopElementModels.push(element['loopElementModel'])
- }
- }
- return loopElementModels;
- }
+ loopJsonCache;
+
+ constructor(loopJson) {
+ this.loopJsonCache = loopJson;
+ }
+
+ updateMicroServiceProperties(name, newMsProperties) {
+ for (var policy in this.loopJsonCache["microServicePolicies"]) {
+ if (this.loopJsonCache["microServicePolicies"][policy]["name"] === name) {
+ this.loopJsonCache["microServicePolicies"][policy]["configurationsJson"] = newMsProperties;
+ }
+ }
+ }
+
+ updateMicroServicePdpGroup(name, pdpGroup, pdpSubgroup) {
+ for (var policy in this.loopJsonCache["microServicePolicies"]) {
+ if (this.loopJsonCache["microServicePolicies"][policy]["name"] === name) {
+ this.loopJsonCache["microServicePolicies"][policy]["pdpGroup"] = pdpGroup;
+ this.loopJsonCache["microServicePolicies"][policy]["pdpSubgroup"] = pdpSubgroup;
+ }
+ }
+ }
+
+ updateGlobalProperties(newGlobalProperties) {
+ this.loopJsonCache["globalPropertiesJson"] = newGlobalProperties;
+ }
+
+ updateOperationalPolicyProperties(name, newOpProperties) {
+ for (var policy in this.loopJsonCache["operationalPolicies"]) {
+ if (this.loopJsonCache["operationalPolicies"][policy]["name"] === name) {
+ this.loopJsonCache["operationalPolicies"][policy]["configurationsJson"] = newOpProperties;
+ }
+ }
+ }
+
+ updateOperationalPolicyPdpGroup(name, pdpGroup, pdpSubgroup) {
+ for (var policy in this.loopJsonCache["operationalPolicies"]) {
+ if (this.loopJsonCache["operationalPolicies"][policy]["name"] === name) {
+ this.loopJsonCache["operationalPolicies"][policy]["pdpGroup"] = pdpGroup;
+ this.loopJsonCache["operationalPolicies"][policy]["pdpSubgroup"] = pdpSubgroup;
+ }
+ }
+ }
+
+ getLoopName() {
+ return this.loopJsonCache["name"];
+ }
+
+ getOperationalPolicyJsonSchema() {
+ return this.loopJsonCache["operationalPolicies"]["0"]["jsonRepresentation"];
+ }
+
+ getOperationalPolicies() {
+ return this.loopJsonCache["operationalPolicies"];
+ }
+
+ getOperationalPoliciesNoJsonSchema() {
+ var operationalPolicies = JSON.parse(JSON.stringify(this.loopJsonCache["operationalPolicies"]));
+ delete operationalPolicies[0]["jsonRepresentation"];
+ return operationalPolicies;
+ }
+
+ getGlobalProperties() {
+ return this.loopJsonCache["globalPropertiesJson"];
+ }
+
+ getDcaeDeploymentProperties() {
+ return this.loopJsonCache["globalPropertiesJson"]["dcaeDeployParameters"];
+ }
+
+ getMicroServicePolicies() {
+ return this.loopJsonCache["microServicePolicies"];
+ }
+
+ getOperationalPolicyForName(name) {
+ var opProperties = this.getOperationalPolicies();
+ for (var policy in opProperties) {
+ if (opProperties[policy]["name"] === name) {
+ return opProperties[policy];
+ }
+ }
+ return null;
+ }
+
+ getOperationalPolicyPropertiesForName(name) {
+ var opConfig = this.getOperationalPolicyForName(name);
+ if (opConfig !== null) {
+ return opConfig["configurationsJson"];
+ }
+ return null;
+ }
+
+ getOperationalPolicyJsonRepresentationForName(name) {
+ var opConfig = this.getOperationalPolicyForName(name);
+ if (opConfig !== null) {
+ return opConfig["jsonRepresentation"];
+ }
+ return null;
+ }
+
+ getOperationalPolicySupportedPdpGroup(name) {
+ var opConfig = this.getOperationalPolicyForName(name);
+ if (opConfig !== null) {
+ if (opConfig["policyModel"]["policyPdpGroup"] !== undefined && opConfig["policyModel"]["policyPdpGroup"]["supportedPdpGroups"] !== undefined) {
+ return opConfig["policyModel"]["policyPdpGroup"]["supportedPdpGroups"];
+ }
+ }
+ return [];
+ }
+
+ getOperationalPolicyPdpGroup(name) {
+ var opConfig = this.getOperationalPolicyForName(name);
+ if (opConfig !== null) {
+ return opConfig["pdpGroup"];
+ }
+ return null;
+ }
+
+ getOperationalPolicyPdpSubgroup(name) {
+ var opConfig = this.getOperationalPolicyForName(name);
+ if (opConfig !== null) {
+ return opConfig["pdpSubgroup"];
+ }
+ return null;
+ }
+
+ getMicroServiceSupportedPdpGroup(name) {
+ var microService = this.getMicroServiceForName(name);
+ if (microService !== null) {
+ if (microService["policyModel"]["policyPdpGroup"] !== undefined && microService["policyModel"]["policyPdpGroup"]["supportedPdpGroups"] !== undefined) {
+ return microService["policyModel"]["policyPdpGroup"]["supportedPdpGroups"];
+ }
+ }
+ return [];
+ }
+
+ getMicroServicePdpGroup(name) {
+ var microService = this.getMicroServiceForName(name);
+ if (microService !== null) {
+ return microService["pdpGroup"];
+ }
+ return null;
+ }
+
+ getMicroServicePdpSubgroup(name) {
+ var microService = this.getMicroServiceForName(name);
+ if (microService !== null) {
+ return microService["pdpSubgroup"];
+ }
+ return null;
+ }
+
+ getMicroServiceForName(name) {
+ var msProperties = this.getMicroServicePolicies();
+ for (var policy in msProperties) {
+ if (msProperties[policy]["name"] === name) {
+ return msProperties[policy];
+ }
+ }
+ return null;
+ }
+
+ getMicroServicePropertiesForName(name) {
+ var msConfig = this.getMicroServiceForName(name);
+ if (msConfig !== null) {
+ return msConfig["configurationsJson"];
+ }
+ return null;
+ }
+
+ getMicroServiceJsonRepresentationForName(name) {
+ var msConfig = this.getMicroServiceForName(name);
+ if (msConfig !== null) {
+ return msConfig["jsonRepresentation"];
+ }
+ return null;
+ }
+
+ getResourceDetailsVfProperty() {
+ return this.loopJsonCache["modelService"]["resourceDetails"]["VF"];
+ }
+
+ getResourceDetailsVfModuleProperty() {
+ return this.loopJsonCache["modelService"]["resourceDetails"]["VFModule"];
+ }
+
+ getLoopLogsArray() {
+ return this.loopJsonCache.loopLogs;
+ }
+
+ getComputedState() {
+ return this.loopJsonCache.lastComputedState;
+ }
+
+ getComponentStates() {
+ return this.loopJsonCache.components;
+ }
+
+ getTemplateName() {
+ if (this.getLoopTemplate() !== undefined) {
+ return this.getLoopTemplate().name;
+ }
+ return null;
+ }
+
+ getLoopTemplate() {
+ return this.loopJsonCache["loopTemplate"];
+ }
+
+ isOpenLoopTemplate() {
+ var loopTemplate = this.getLoopTemplate();
+ if (loopTemplate != null && loopTemplate["allowedLoopType"] === "OPEN") {
+ return true;
+ }
+ return false;
+ }
+
+ getAllLoopElementModels() {
+ var loopTemplate = this.getLoopTemplate();
+ var loopElementModels = [];
+ if (loopTemplate != null) {
+ for (var element of loopTemplate['loopElementModelsUsed']) {
+ loopElementModels.push(element['loopElementModel'])
+ }
+ }
+ return loopElementModels;
+ }
}
diff --git a/runtime/ui-react/src/api/LoopCacheMockFile.json b/runtime/ui-react/src/api/LoopCacheMockFile.json
index cb9ed87b0..e5a670218 100644
--- a/runtime/ui-react/src/api/LoopCacheMockFile.json
+++ b/runtime/ui-react/src/api/LoopCacheMockFile.json
@@ -8,7 +8,9 @@
"policy_id": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca"
}
},
- "loopTemplate": {"name": "loopTemplateTest"},
+ "loopTemplate": {
+ "name": "loopTemplateTest"
+ },
"modelService": {
"serviceDetails": {
"serviceType": "",
@@ -105,12 +107,20 @@
{
"name": "TCA_h2NMX_v1_0_ResourceInstanceName1_tca",
"modelType": "onap.policies.monitoring.cdap.tca.hi.lo.app",
- "configurationsJson": {"domain": "measurementsForVfScaling"},
+ "configurationsJson": {
+ "domain": "measurementsForVfScaling"
+ },
"shared": false,
"pdpGroup": "pdpGroupTest",
"pdpSubgroup": "pdpSubgroupTest",
- "policyModel": {"policyPdpGroup": {"supportedPdpGroups": "supportedPdpGroupsTest"}},
- "jsonRepresentation": {"schema": {}}
+ "policyModel": {
+ "policyPdpGroup": {
+ "supportedPdpGroups": "supportedPdpGroupsTest"
+ }
+ },
+ "jsonRepresentation": {
+ "schema": {}
+ }
}
],
"loopLogs": [
diff --git a/runtime/ui-react/src/api/LoopService.js b/runtime/ui-react/src/api/LoopService.js
index 96bb8a0a7..16f1bec9e 100644
--- a/runtime/ui-react/src/api/LoopService.js
+++ b/runtime/ui-react/src/api/LoopService.js
@@ -21,224 +21,224 @@
*/
export default class LoopService {
- static getLoopNames() {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/getAllNames', { method: 'GET', credentials: 'same-origin' })
- .then(function (response) {
- console.debug("GetLoopNames response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("GetLoopNames query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("GetLoopNames error received", error);
- return {};
- });
- }
+ static getLoopNames() {
+ return fetch(window.location.pathname + 'restservices/clds/v2/loop/getAllNames', { method: 'GET', credentials: 'same-origin' })
+ .then(function (response) {
+ console.debug("GetLoopNames response received: ", response.status);
+ if (response.ok) {
+ return response.json();
+ } else {
+ console.error("GetLoopNames query failed");
+ return {};
+ }
+ })
+ .catch(function (error) {
+ console.error("GetLoopNames error received", error);
+ return {};
+ });
+ }
- static createLoop(loopName, templateName) {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/create/' + loopName + '?templateName=' + templateName, {
- method: 'POST',
- headers: {
- "Content-Type": "application/json"
- },
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("CreateLoop response received: ", response.status);
- return response.json();
- })
- .catch(function (error) {
- console.error("CreateLoop error received", error);
- return "";
- });
- }
+ static createLoop(loopName, templateName) {
+ return fetch(window.location.pathname + 'restservices/clds/v2/loop/create/' + loopName + '?templateName=' + templateName, {
+ method: 'POST',
+ headers: {
+ "Content-Type": "application/json"
+ },
+ credentials: 'same-origin'
+ })
+ .then(function (response) {
+ console.debug("CreateLoop response received: ", response.status);
+ return response.json();
+ })
+ .catch(function (error) {
+ console.error("CreateLoop error received", error);
+ return "";
+ });
+ }
- static getLoop(loopName) {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/' + loopName, {
- method: 'GET',
- headers: {
- "Content-Type": "application/json"
- },
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("GetLoop response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("GetLoop query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("GetLoop error received", error);
- return {};
- });
- }
+ static getLoop(loopName) {
+ return fetch(window.location.pathname + 'restservices/clds/v2/loop/' + loopName, {
+ method: 'GET',
+ headers: {
+ "Content-Type": "application/json"
+ },
+ credentials: 'same-origin'
+ })
+ .then(function (response) {
+ console.debug("GetLoop response received: ", response.status);
+ if (response.ok) {
+ return response.json();
+ } else {
+ console.error("GetLoop query failed");
+ return {};
+ }
+ })
+ .catch(function (error) {
+ console.error("GetLoop error received", error);
+ return {};
+ });
+ }
- static setMicroServiceProperties(loopName, jsonData) {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/updateMicroservicePolicy/' + loopName, {
- method: 'POST',
- credentials: 'same-origin',
- headers: {
- "Content-Type": "application/json"
- },
- body: JSON.stringify(jsonData)
- })
- .then(function (response) {
- console.debug("updateMicroservicePolicy response received: ", response.status);
- if (response.ok) {
- return response.text();
- } else {
- console.error("updateMicroservicePolicy query failed");
- return "";
- }
- })
- .catch(function (error) {
- console.error("updateMicroservicePolicy error received", error);
- return "";
- });
- }
-
- static setOperationalPolicyProperties(loopName, jsonData) {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/updateOperationalPolicies/' + loopName, {
- method: 'POST',
- credentials: 'same-origin',
- headers: {
- "Content-Type": "application/json"
- },
- body: JSON.stringify(jsonData)
- })
- .then(function (response) {
- console.debug("updateOperationalPolicies response received: ", response.status);
- if (response.ok) {
- return response.text();
- } else {
- console.error("updateOperationalPolicies query failed");
- return "";
- }
- })
- .catch(function (error) {
- console.error("updateOperationalPolicies error received", error);
- return "";
- });
- }
+ static setMicroServiceProperties(loopName, jsonData) {
+ return fetch(window.location.pathname + 'restservices/clds/v2/loop/updateMicroservicePolicy/' + loopName, {
+ method: 'POST',
+ credentials: 'same-origin',
+ headers: {
+ "Content-Type": "application/json"
+ },
+ body: JSON.stringify(jsonData)
+ })
+ .then(function (response) {
+ console.debug("updateMicroservicePolicy response received: ", response.status);
+ if (response.ok) {
+ return response.text();
+ } else {
+ console.error("updateMicroservicePolicy query failed");
+ return "";
+ }
+ })
+ .catch(function (error) {
+ console.error("updateMicroservicePolicy error received", error);
+ return "";
+ });
+ }
- static updateGlobalProperties(loopName, jsonData) {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/updateGlobalProperties/' + loopName, {
- method: 'POST',
- credentials: 'same-origin',
- headers: {
- "Content-Type": "application/json"
- },
- body: JSON.stringify(jsonData)
- })
- .then(function (response) {
- console.debug("updateGlobalProperties response received: ", response.status);
- if (response.ok) {
- return response.text();
- } else {
- console.error("updateGlobalProperties query failed");
- return "";
- }
- })
- .catch(function (error) {
- console.error("updateGlobalProperties error received", error);
- return "";
- });
- }
+ static setOperationalPolicyProperties(loopName, jsonData) {
+ return fetch(window.location.pathname + 'restservices/clds/v2/loop/updateOperationalPolicies/' + loopName, {
+ method: 'POST',
+ credentials: 'same-origin',
+ headers: {
+ "Content-Type": "application/json"
+ },
+ body: JSON.stringify(jsonData)
+ })
+ .then(function (response) {
+ console.debug("updateOperationalPolicies response received: ", response.status);
+ if (response.ok) {
+ return response.text();
+ } else {
+ console.error("updateOperationalPolicies query failed");
+ return "";
+ }
+ })
+ .catch(function (error) {
+ console.error("updateOperationalPolicies error received", error);
+ return "";
+ });
+ }
- static refreshOperationalPolicyJson(loopName,operationalPolicyName) {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/refreshOperationalPolicyJsonSchema/' + loopName + '/' + operationalPolicyName, {
- method: 'PUT',
- headers: {
- "Content-Type": "application/json"
- },
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("Refresh Operational Policy Json Schema response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("Refresh Operational Policy Json Schema query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("Refresh Operational Policy Json Schema error received", error);
- return {};
- });
- }
+ static updateGlobalProperties(loopName, jsonData) {
+ return fetch(window.location.pathname + 'restservices/clds/v2/loop/updateGlobalProperties/' + loopName, {
+ method: 'POST',
+ credentials: 'same-origin',
+ headers: {
+ "Content-Type": "application/json"
+ },
+ body: JSON.stringify(jsonData)
+ })
+ .then(function (response) {
+ console.debug("updateGlobalProperties response received: ", response.status);
+ if (response.ok) {
+ return response.text();
+ } else {
+ console.error("updateGlobalProperties query failed");
+ return "";
+ }
+ })
+ .catch(function (error) {
+ console.error("updateGlobalProperties error received", error);
+ return "";
+ });
+ }
- static refreshMicroServicePolicyJson(loopName,microServicePolicyName) {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/refreshMicroServicePolicyJsonSchema/' + loopName + '/' + microServicePolicyName, {
- method: 'PUT',
- headers: {
- "Content-Type": "application/json"
- },
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("Refresh Operational Policy Json Schema response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("Refresh Operational Policy Json Schema query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("Refresh Operational Policy Json Schema error received", error);
- return {};
- });
- }
+ static refreshOperationalPolicyJson(loopName, operationalPolicyName) {
+ return fetch(window.location.pathname + 'restservices/clds/v2/loop/refreshOperationalPolicyJsonSchema/' + loopName + '/' + operationalPolicyName, {
+ method: 'PUT',
+ headers: {
+ "Content-Type": "application/json"
+ },
+ credentials: 'same-origin'
+ })
+ .then(function (response) {
+ console.debug("Refresh Operational Policy Json Schema response received: ", response.status);
+ if (response.ok) {
+ return response.json();
+ } else {
+ console.error("Refresh Operational Policy Json Schema query failed");
+ return {};
+ }
+ })
+ .catch(function (error) {
+ console.error("Refresh Operational Policy Json Schema error received", error);
+ return {};
+ });
+ }
- static addOperationalPolicyType(loopName, policyType, policyVersion) {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/addOperationaPolicy/' + loopName + '/policyModel/' + policyType +'/' + policyVersion , {
- method: 'PUT',
- headers: {
- "Content-Type": "application/json"
- },
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("Add Operational Policy response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- return response.text();
- }
- })
- .catch(function (error) {
- console.error("Add Operational Policy query failed");
- throw new Error(error);
- })
- }
+ static refreshMicroServicePolicyJson(loopName, microServicePolicyName) {
+ return fetch(window.location.pathname + 'restservices/clds/v2/loop/refreshMicroServicePolicyJsonSchema/' + loopName + '/' + microServicePolicyName, {
+ method: 'PUT',
+ headers: {
+ "Content-Type": "application/json"
+ },
+ credentials: 'same-origin'
+ })
+ .then(function (response) {
+ console.debug("Refresh Operational Policy Json Schema response received: ", response.status);
+ if (response.ok) {
+ return response.json();
+ } else {
+ console.error("Refresh Operational Policy Json Schema query failed");
+ return {};
+ }
+ })
+ .catch(function (error) {
+ console.error("Refresh Operational Policy Json Schema error received", error);
+ return {};
+ });
+ }
- static removeOperationalPolicyType(loopName, policyType, policyVersion, policyName) {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/removeOperationaPolicy/' + loopName + '/policyModel/' + policyType +'/' + policyVersion + '/' + policyName , {
- method: 'PUT',
- headers: {
- "Content-Type": "application/json"
- },
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("Remove Operational Policy response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("Remove Operational Policy query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("Remove Operational Policy error received", error);
- return {};
- });
- }
+ static addOperationalPolicyType(loopName, policyType, policyVersion) {
+ return fetch(window.location.pathname + 'restservices/clds/v2/loop/addOperationaPolicy/' + loopName + '/policyModel/' + policyType + '/' + policyVersion, {
+ method: 'PUT',
+ headers: {
+ "Content-Type": "application/json"
+ },
+ credentials: 'same-origin'
+ })
+ .then(function (response) {
+ console.debug("Add Operational Policy response received: ", response.status);
+ if (response.ok) {
+ return response.json();
+ } else {
+ return response.text();
+ }
+ })
+ .catch(function (error) {
+ console.error("Add Operational Policy query failed");
+ throw new Error(error);
+ })
+ }
+
+ static removeOperationalPolicyType(loopName, policyType, policyVersion, policyName) {
+ return fetch(window.location.pathname + 'restservices/clds/v2/loop/removeOperationaPolicy/' + loopName + '/policyModel/' + policyType + '/' + policyVersion + '/' + policyName, {
+ method: 'PUT',
+ headers: {
+ "Content-Type": "application/json"
+ },
+ credentials: 'same-origin'
+ })
+ .then(function (response) {
+ console.debug("Remove Operational Policy response received: ", response.status);
+ if (response.ok) {
+ return response.json();
+ } else {
+ console.error("Remove Operational Policy query failed");
+ return {};
+ }
+ })
+ .catch(function (error) {
+ console.error("Remove Operational Policy error received", error);
+ return {};
+ });
+ }
}
diff --git a/runtime/ui-react/src/api/PoliciesListCacheMockFile.json b/runtime/ui-react/src/api/PoliciesListCacheMockFile.json
index 5c6bd5b6b..14d5cc653 100644
--- a/runtime/ui-react/src/api/PoliciesListCacheMockFile.json
+++ b/runtime/ui-react/src/api/PoliciesListCacheMockFile.json
@@ -212,4 +212,4 @@
}
}
]
-} \ No newline at end of file
+}
diff --git a/runtime/ui-react/src/api/PolicyService.js b/runtime/ui-react/src/api/PolicyService.js
index f2886b30a..cf4f0fdba 100644
--- a/runtime/ui-react/src/api/PolicyService.js
+++ b/runtime/ui-react/src/api/PolicyService.js
@@ -23,126 +23,130 @@
export default class PolicyService {
static getPoliciesList() {
return fetch(window.location.pathname + 'restservices/clds/v2/policies', {
- method: 'GET',
- credentials: 'same-origin'
- })
- .then(function(response) {
- console.debug("getPoliciesList response received: ", response.status);
- if (response.ok) {
- console.info("getPoliciesList query successful");
- return response.json();
- } else {
- return response.text().then(responseBody => {
- throw new Error("HTTP " + response.status + "," + responseBody);
- })
- }
- })
- .catch(function(error) {
- console.error("getPoliciesList error occurred ", error);
- alert("getPoliciesList error occurred " + error);
- return undefined;
- });
+ method: 'GET',
+ credentials: 'same-origin'
+ })
+ .then(function (response) {
+ console.debug("getPoliciesList response received: ", response.status);
+ if (response.ok) {
+ console.info("getPoliciesList query successful");
+ return response.json();
+ } else {
+ return response.text().then(responseBody => {
+ throw new Error("HTTP " + response.status + "," + responseBody);
+ })
+ }
+ })
+ .catch(function (error) {
+ console.error("getPoliciesList error occurred ", error);
+ alert("getPoliciesList error occurred " + error);
+ return undefined;
+ });
}
+
static createNewPolicy(policyModelType, policyModelVersion, policyName, policyVersion, policyJson) {
return fetch(window.location.pathname + 'restservices/clds/v2/policies/' + policyModelType + '/'
- + policyModelVersion + '/' + policyName + '/' + policyVersion, {
- method: 'POST',
- credentials: 'same-origin',
- headers: {
- "Content-Type": "application/json"
- },
- body: JSON.stringify(policyJson)
- })
- .then(function (response) {
- console.debug("createNewPolicy response received: ", response.status);
- if (response.ok) {
- console.info("createNewPolicy query successful");
- return response.text();
- } else {
- return response.text().then(responseBody => {
- throw new Error("HTTP " + response.status + "," + responseBody);
- })
- }
- })
- .catch(function (error) {
- console.error("createNewPolicy error occurred ", error);
- alert ("createNewPolicy error occurred " + error);
- return undefined;
- });
+ + policyModelVersion + '/' + policyName + '/' + policyVersion, {
+ method: 'POST',
+ credentials: 'same-origin',
+ headers: {
+ "Content-Type": "application/json"
+ },
+ body: JSON.stringify(policyJson)
+ })
+ .then(function (response) {
+ console.debug("createNewPolicy response received: ", response.status);
+ if (response.ok) {
+ console.info("createNewPolicy query successful");
+ return response.text();
+ } else {
+ return response.text().then(responseBody => {
+ throw new Error("HTTP " + response.status + "," + responseBody);
+ })
+ }
+ })
+ .catch(function (error) {
+ console.error("createNewPolicy error occurred ", error);
+ alert("createNewPolicy error occurred " + error);
+ return undefined;
+ });
}
+
static deletePolicy(policyModelType, policyModelVersion, policyName, policyVersion) {
return fetch(window.location.pathname + 'restservices/clds/v2/policies/' + policyModelType + '/'
- + policyModelVersion + '/' + policyName + '/' + policyVersion, {
- method: 'DELETE',
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("deletePolicy response received: ", response.status);
- if (response.ok) {
- console.info("deletePolicy query successful");
- return response.text();
- } else {
- return response.text().then(responseBody => {
- throw new Error("HTTP " + response.status + "," + responseBody);
- })
- }
- })
- .catch(function (error) {
- console.error("deletePolicy error occurred ", error);
- alert ("deletePolicy error occurred " + error);
- return undefined;
- });
+ + policyModelVersion + '/' + policyName + '/' + policyVersion, {
+ method: 'DELETE',
+ credentials: 'same-origin'
+ })
+ .then(function (response) {
+ console.debug("deletePolicy response received: ", response.status);
+ if (response.ok) {
+ console.info("deletePolicy query successful");
+ return response.text();
+ } else {
+ return response.text().then(responseBody => {
+ throw new Error("HTTP " + response.status + "," + responseBody);
+ })
+ }
+ })
+ .catch(function (error) {
+ console.error("deletePolicy error occurred ", error);
+ alert("deletePolicy error occurred " + error);
+ return undefined;
+ });
}
+
static updatePdpDeployment(pdpOperationsList) {
return fetch(window.location.pathname + 'restservices/clds/v2/policies/pdpDeployment', {
- method: 'PUT',
- credentials: 'same-origin',
- headers: {
- "Content-Type": "application/json"
- },
- body: JSON.stringify(pdpOperationsList)
- })
- .then(function (response) {
- console.debug("updatePdpDeployment response received: ", response.status);
- if (response.ok) {
- console.info("updatePdpDeployment query successful");
- return response.text();
- } else {
- return response.text().then(responseBody => {
- throw new Error("HTTP " + response.status + "," + responseBody);
- })
- }
- })
- .catch(function (error) {
- console.error("updatePdpDeployment error occurred ", error);
- alert ("updatePdpDeployment error occurred " + error);
- return undefined;
- });
+ method: 'PUT',
+ credentials: 'same-origin',
+ headers: {
+ "Content-Type": "application/json"
+ },
+ body: JSON.stringify(pdpOperationsList)
+ })
+ .then(function (response) {
+ console.debug("updatePdpDeployment response received: ", response.status);
+ if (response.ok) {
+ console.info("updatePdpDeployment query successful");
+ return response.text();
+ } else {
+ return response.text().then(responseBody => {
+ throw new Error("HTTP " + response.status + "," + responseBody);
+ })
+ }
+ })
+ .catch(function (error) {
+ console.error("updatePdpDeployment error occurred ", error);
+ alert("updatePdpDeployment error occurred " + error);
+ return undefined;
+ });
}
+
static sendNewPolicyModel(newPolicyModel) {
- return fetch(window.location.pathname + 'restservices/clds/v2/policies/policytype', {
- method: 'POST',
- credentials: 'same-origin',
- headers: {
- "Content-Type": "plain/text"
- },
- body: newPolicyModel
+ return fetch(window.location.pathname + 'restservices/clds/v2/policies/policytype', {
+ method: 'POST',
+ credentials: 'same-origin',
+ headers: {
+ "Content-Type": "plain/text"
+ },
+ body: newPolicyModel
+ })
+ .then(function (response) {
+ console.debug("sendNewPolicyModel response received: ", response.status);
+ if (response.ok) {
+ console.info("sendNewPolicyModel query successful");
+ return response.text();
+ } else {
+ return response.text().then(responseBody => {
+ throw new Error("HTTP " + response.status + "," + responseBody);
})
- .then(function (response) {
- console.debug("sendNewPolicyModel response received: ", response.status);
- if (response.ok) {
- console.info("sendNewPolicyModel query successful");
- return response.text();
- } else {
- return response.text().then(responseBody => {
- throw new Error("HTTP " + response.status + "," + responseBody);
- })
- }
- })
- .catch(function (error) {
- console.error("sendNewPolicyModel error occurred ", error);
- alert ("sendNewPolicyModel error occurred " + error);
- return undefined;
- });
- }
+ }
+ })
+ .catch(function (error) {
+ console.error("sendNewPolicyModel error occurred ", error);
+ alert("sendNewPolicyModel error occurred " + error);
+ return undefined;
+ });
+ }
}
diff --git a/runtime/ui-react/src/api/PolicyToscaService.js b/runtime/ui-react/src/api/PolicyToscaService.js
index e2a1f45e4..6c74149d9 100644
--- a/runtime/ui-react/src/api/PolicyToscaService.js
+++ b/runtime/ui-react/src/api/PolicyToscaService.js
@@ -39,42 +39,42 @@ export default class PolicyToscaService {
}
static getToscaPolicyModelYaml(policyModelType, policyModelVersion) {
- return fetch(window.location.pathname + 'restservices/clds/v2/policyToscaModels/yaml/' + policyModelType + "/" + policyModelVersion, {
- method: 'GET',
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("getToscaPolicyModelYaml response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("getToscaPolicyModelYaml query failed");
- return "";
- }
- })
- .catch(function (error) {
- console.error("getToscaPolicyModelYaml error received", error);
- return "";
- });
+ return fetch(window.location.pathname + 'restservices/clds/v2/policyToscaModels/yaml/' + policyModelType + "/" + policyModelVersion, {
+ method: 'GET',
+ credentials: 'same-origin'
+ })
+ .then(function (response) {
+ console.debug("getToscaPolicyModelYaml response received: ", response.status);
+ if (response.ok) {
+ return response.json();
+ } else {
+ console.error("getToscaPolicyModelYaml query failed");
+ return "";
+ }
+ })
+ .catch(function (error) {
+ console.error("getToscaPolicyModelYaml error received", error);
+ return "";
+ });
}
static getToscaPolicyModel(policyModelType, policyModelVersion) {
- return fetch(window.location.pathname + 'restservices/clds/v2/policyToscaModels/' + policyModelType + "/" + policyModelVersion, {
- method: 'GET',
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("getToscaPolicyModel response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("getToscaPolicyModel query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("getToscaPolicyModel error received", error);
- return {};
- });
+ return fetch(window.location.pathname + 'restservices/clds/v2/policyToscaModels/' + policyModelType + "/" + policyModelVersion, {
+ method: 'GET',
+ credentials: 'same-origin'
+ })
+ .then(function (response) {
+ console.debug("getToscaPolicyModel response received: ", response.status);
+ if (response.ok) {
+ return response.json();
+ } else {
+ console.error("getToscaPolicyModel query failed");
+ return {};
+ }
+ })
+ .catch(function (error) {
+ console.error("getToscaPolicyModel error received", error);
+ return {};
+ });
}
}
diff --git a/runtime/ui-react/src/api/TemplateService.js b/runtime/ui-react/src/api/TemplateService.js
index 08436f2b8..a6e386eac 100644
--- a/runtime/ui-react/src/api/TemplateService.js
+++ b/runtime/ui-react/src/api/TemplateService.js
@@ -22,176 +22,176 @@
export default class TemplateService {
- static getLoopNames() {
- return fetch(window.location.pathname + 'restservices/clds/v2/loop/getAllNames', { method: 'GET', credentials: 'same-origin' })
- .then(function (response) {
- console.debug("getLoopNames response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("getLoopNames query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("getLoopNames error received", error);
- return {};
- });
+ static getLoopNames() {
+ return fetch(window.location.pathname + 'restservices/clds/v2/loop/getAllNames', { method: 'GET', credentials: 'same-origin' })
+ .then(function (response) {
+ console.debug("getLoopNames response received: ", response.status);
+ if (response.ok) {
+ return response.json();
+ } else {
+ console.error("getLoopNames query failed");
+ return {};
}
+ })
+ .catch(function (error) {
+ console.error("getLoopNames error received", error);
+ return {};
+ });
+ }
- static getAllLoopTemplates() {
- return fetch(window.location.pathname + 'restservices/clds/v2/templates', { method: 'GET', credentials: 'same-origin', })
- .then(function (response) {
- console.debug("getAllLoopTemplates response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("getAllLoopTemplates query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("getAllLoopTemplates error received", error);
- return {};
- });
- }
+ static getAllLoopTemplates() {
+ return fetch(window.location.pathname + 'restservices/clds/v2/templates', { method: 'GET', credentials: 'same-origin', })
+ .then(function (response) {
+ console.debug("getAllLoopTemplates response received: ", response.status);
+ if (response.ok) {
+ return response.json();
+ } else {
+ console.error("getAllLoopTemplates query failed");
+ return {};
+ }
+ })
+ .catch(function (error) {
+ console.error("getAllLoopTemplates error received", error);
+ return {};
+ });
+ }
- static getDictionary() {
- return fetch(window.location.pathname + 'restservices/clds/v2/dictionary/', { method: 'GET', credentials: 'same-origin', })
- .then(function (response) {
- console.debug("getDictionary response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("getDictionary query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("getDictionary error received", error);
- return {};
- });
- }
+ static getDictionary() {
+ return fetch(window.location.pathname + 'restservices/clds/v2/dictionary/', { method: 'GET', credentials: 'same-origin', })
+ .then(function (response) {
+ console.debug("getDictionary response received: ", response.status);
+ if (response.ok) {
+ return response.json();
+ } else {
+ console.error("getDictionary query failed");
+ return {};
+ }
+ })
+ .catch(function (error) {
+ console.error("getDictionary error received", error);
+ return {};
+ });
+ }
- static getDictionaryElements(dictionaryName) {
- return fetch(window.location.pathname + 'restservices/clds/v2/dictionary/' + dictionaryName, {
- method: 'GET',
- headers: {
- "Content-Type": "application/json",
- },
- credentials: 'same-origin',
- })
- .then(function (response) {
- console.debug("getDictionaryElements response received: ", response.status);
- if (response.ok) {
- return response.json();
- } else {
- console.error("getDictionaryElements query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("getDictionaryElements error received", error);
- return {};
- });
- }
+ static getDictionaryElements(dictionaryName) {
+ return fetch(window.location.pathname + 'restservices/clds/v2/dictionary/' + dictionaryName, {
+ method: 'GET',
+ headers: {
+ "Content-Type": "application/json",
+ },
+ credentials: 'same-origin',
+ })
+ .then(function (response) {
+ console.debug("getDictionaryElements response received: ", response.status);
+ if (response.ok) {
+ return response.json();
+ } else {
+ console.error("getDictionaryElements query failed");
+ return {};
+ }
+ })
+ .catch(function (error) {
+ console.error("getDictionaryElements error received", error);
+ return {};
+ });
+ }
- static insDictionary(jsonData) {
- console.log("dictionaryName is", jsonData.name)
- return fetch(window.location.pathname + 'restservices/clds/v2/dictionary/', {
- method: 'PUT',
- credentials: 'same-origin',
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify(jsonData)
- })
- .then(function (response) {
- console.debug("insDictionary response received: ", response.status);
- if (response.ok) {
- return response.status;
- } else {
- var errorMessage = response.status;
- console.error("insDictionary query failed", response.status);
- return errorMessage;
- }
- })
- .catch(function (error) {
- console.error("insDictionary error received", error);
- return "";
- });
- }
+ static insDictionary(jsonData) {
+ console.log("dictionaryName is", jsonData.name)
+ return fetch(window.location.pathname + 'restservices/clds/v2/dictionary/', {
+ method: 'PUT',
+ credentials: 'same-origin',
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(jsonData)
+ })
+ .then(function (response) {
+ console.debug("insDictionary response received: ", response.status);
+ if (response.ok) {
+ return response.status;
+ } else {
+ var errorMessage = response.status;
+ console.error("insDictionary query failed", response.status);
+ return errorMessage;
+ }
+ })
+ .catch(function (error) {
+ console.error("insDictionary error received", error);
+ return "";
+ });
+ }
- static insDictionaryElements(jsonData) {
- console.log("dictionaryName is", jsonData.name)
- return fetch(window.location.pathname + 'restservices/clds/v2/dictionary/' + jsonData.name, {
- method: 'PUT',
- credentials: 'same-origin',
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify(jsonData)
- })
- .then(function (response) {
- console.debug("insDictionary response received: ", response.status);
- if (response.ok) {
- return response.status;
- } else {
- var errorMessage = response.status;
- console.error("insDictionary query failed", response.status);
- return errorMessage;
- }
- })
- .catch(function (error) {
- console.error("insDictionary error received", error);
- return "";
- });
- }
+ static insDictionaryElements(jsonData) {
+ console.log("dictionaryName is", jsonData.name)
+ return fetch(window.location.pathname + 'restservices/clds/v2/dictionary/' + jsonData.name, {
+ method: 'PUT',
+ credentials: 'same-origin',
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(jsonData)
+ })
+ .then(function (response) {
+ console.debug("insDictionary response received: ", response.status);
+ if (response.ok) {
+ return response.status;
+ } else {
+ var errorMessage = response.status;
+ console.error("insDictionary query failed", response.status);
+ return errorMessage;
+ }
+ })
+ .catch(function (error) {
+ console.error("insDictionary error received", error);
+ return "";
+ });
+ }
- static deleteDictionary(dictionaryName) {
- console.log("inside templaemenu service", dictionaryName)
- return fetch(window.location.pathname + 'restservices/clds/v2/dictionary/' + dictionaryName, {
- method: 'DELETE',
- headers: {
- "Content-Type": "application/json",
- },
- credentials: 'same-origin',
- })
- .then(function (response) {
- console.debug("deleteDictionary response received: ", response.status);
- if (response.ok) {
- return response.status;
- } else {
- console.error("deleteDictionary query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("deleteDictionary error received", error);
- return {};
- });
- }
+ static deleteDictionary(dictionaryName) {
+ console.log("inside templaemenu service", dictionaryName)
+ return fetch(window.location.pathname + 'restservices/clds/v2/dictionary/' + dictionaryName, {
+ method: 'DELETE',
+ headers: {
+ "Content-Type": "application/json",
+ },
+ credentials: 'same-origin',
+ })
+ .then(function (response) {
+ console.debug("deleteDictionary response received: ", response.status);
+ if (response.ok) {
+ return response.status;
+ } else {
+ console.error("deleteDictionary query failed");
+ return {};
+ }
+ })
+ .catch(function (error) {
+ console.error("deleteDictionary error received", error);
+ return {};
+ });
+ }
- static deleteDictionaryElements(dictionaryData) {
- return fetch(window.location.pathname + 'restservices/clds/v2/dictionary/' + dictionaryData.name + '/elements/' + dictionaryData.shortName , {
- method: 'DELETE',
- headers: {
- "Content-Type": "application/json",
- },
- credentials: 'same-origin',
- })
- .then(function (response) {
- console.debug("deleteDictionary response received: ", response.status);
- if (response.ok) {
- return response.status;
- } else {
- console.error("deleteDictionary query failed");
- return {};
- }
- })
- .catch(function (error) {
- console.error("deleteDictionary error received", error);
- return {};
- });
- }
- }
+ static deleteDictionaryElements(dictionaryData) {
+ return fetch(window.location.pathname + 'restservices/clds/v2/dictionary/' + dictionaryData.name + '/elements/' + dictionaryData.shortName, {
+ method: 'DELETE',
+ headers: {
+ "Content-Type": "application/json",
+ },
+ credentials: 'same-origin',
+ })
+ .then(function (response) {
+ console.debug("deleteDictionary response received: ", response.status);
+ if (response.ok) {
+ return response.status;
+ } else {
+ console.error("deleteDictionary query failed");
+ return {};
+ }
+ })
+ .catch(function (error) {
+ console.error("deleteDictionary error received", error);
+ return {};
+ });
+ }
+}
diff --git a/runtime/ui-react/src/api/UserService.js b/runtime/ui-react/src/api/UserService.js
index 5fb4aa6b4..bcf46ea64 100644
--- a/runtime/ui-react/src/api/UserService.js
+++ b/runtime/ui-react/src/api/UserService.js
@@ -22,53 +22,54 @@
*/
export default class UserService {
- static notLoggedUserName='Anonymous';
- static login() {
- return fetch(window.location.pathname + 'restservices/clds/v1/user/getUser', {
- method: 'GET',
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("getUser response received, status code:", response.status);
- if (response.ok) {
- return response.text();
- } else {
- console.error("getUser response is nok");
- return UserService.notLoggedUserName;
- }
- })
- .then(function (data) {
- console.info ("User connected:",data)
- return data;
- })
- .catch(function(error) {
- console.warn("getUser error received, user set to: ",UserService.notLoggedUserName);
- console.error("getUser error:",error);
- return UserService.notLoggedUserName;
- });
- }
+ static notLoggedUserName = 'Anonymous';
- static getUserInfo() {
- return fetch(window.location.pathname + 'restservices/clds/v2/clampInformation', {
- method: 'GET',
- credentials: 'same-origin'
- })
- .then(function (response) {
- console.debug("getUserInfo response received, status code:", response.status);
- if (response.ok) {
- return response.json();
- } else {
- return {}
- }
- })
- .then(function (data) {
- console.info ("User info received:",data)
- return data;
- })
- .catch(function(error) {
- console.warn("getUserInfo error received, user set to: ",UserService.notLoggedUserName);
- console.error("getUserInfo error:",error);
- return {};
- });
- }
+ static login() {
+ return fetch(window.location.pathname + 'restservices/clds/v1/user/getUser', {
+ method: 'GET',
+ credentials: 'same-origin'
+ })
+ .then(function (response) {
+ console.debug("getUser response received, status code:", response.status);
+ if (response.ok) {
+ return response.text();
+ } else {
+ console.error("getUser response is nok");
+ return UserService.notLoggedUserName;
+ }
+ })
+ .then(function (data) {
+ console.info("User connected:", data)
+ return data;
+ })
+ .catch(function (error) {
+ console.warn("getUser error received, user set to: ", UserService.notLoggedUserName);
+ console.error("getUser error:", error);
+ return UserService.notLoggedUserName;
+ });
+ }
+
+ static getUserInfo() {
+ return fetch(window.location.pathname + 'restservices/clds/v2/clampInformation', {
+ method: 'GET',
+ credentials: 'same-origin'
+ })
+ .then(function (response) {
+ console.debug("getUserInfo response received, status code:", response.status);
+ if (response.ok) {
+ return response.json();
+ } else {
+ return {}
+ }
+ })
+ .then(function (data) {
+ console.info("User info received:", data)
+ return data;
+ })
+ .catch(function (error) {
+ console.warn("getUserInfo error received, user set to: ", UserService.notLoggedUserName);
+ console.error("getUserInfo error:", error);
+ return {};
+ });
+ }
}