diff options
author | sebdet <sebastien.determe@intl.att.com> | 2019-07-10 12:32:36 +0200 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2019-07-12 00:25:30 +0200 |
commit | 4946e5b7d80fa1a7baa1c6042100fa1dee24ee31 (patch) | |
tree | ad8df0658a57188e45130b864f58bb6a206c74d5 /ui-react/src/components/backend_communication/LoopCache.js | |
parent | 7c7323d8ec54e65ac7a9a5e8c7cd8bdc755ea70a (diff) |
Introduce modal
Test Modal for Operational policy and use react-router to show it
Issue-ID: CLAMP-415
Change-Id: Ie0df5f1085925224076062c7d331dc2f4c72d032
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'ui-react/src/components/backend_communication/LoopCache.js')
-rw-r--r-- | ui-react/src/components/backend_communication/LoopCache.js | 162 |
1 files changed, 81 insertions, 81 deletions
diff --git a/ui-react/src/components/backend_communication/LoopCache.js b/ui-react/src/components/backend_communication/LoopCache.js index 7fd20596..2ef83962 100644 --- a/ui-react/src/components/backend_communication/LoopCache.js +++ b/ui-react/src/components/backend_communication/LoopCache.js @@ -20,95 +20,95 @@ * =================================================================== * */ -class LoopCache -{ - constructor(loopJson) { - this.loopJsonCache=loopJson; +class LoopCache { + constructor() { + //this.loopJsonCache=loopJson; + this.loopJsonCache = require('./example.json'); //(with path) } - + updateMsProperties(type, newMsProperties) { - if (newMsProperties["name"] == type) { - for (p in this.loopJsonCache["microServicePolicies"]) { - if (this.loopJsonCache["microServicePolicies"][p]["name"] == type) { - this.loopJsonCache["microServicePolicies"][p] = newMsProperties; - } - } - } - } - - updateGlobalProperties(newGlobalProperties) { - this.loopJsonCache["globalPropertiesJson"] = newGlobalProperties; - } - - updateOpPolicyProperties(newOpProperties) { - this.loopJsonCache["operationalPolicies"] = newOpProperties; - } - - getLoopName() { - return this.loopJsonCache["name"]; - } - - getOperationalPolicyProperty() { - return JSON.parse(JSON.stringify(this.loopJsonCache["operationalPolicies"]["0"]["configurationsJson"])); - } - - getOperationalPolicies() { - return JSON.parse(JSON.stringify(this.loopJsonCache["operationalPolicies"])); - } - - getGlobalProperty() { - return JSON.parse(JSON.stringify(this.loopJsonCache["globalPropertiesJson"])); - } - - getDeploymentProperties() { - return JSON.parse(JSON.stringify(this.loopJsonCache["globalPropertiesJson"]["dcaeDeployParameters"])); - } - - getMsJson(type) { - var msProperties = this.loopJsonCache["microServicePolicies"]; - for (p in msProperties) { - if (msProperties[p]["name"] == type) { - return JSON.parse(JSON.stringify(msProperties[p])); - } - } - return null; - } - - getMsProperty(type) { - var msProperties = this.loopJsonCache["microServicePolicies"]; - for (p in msProperties) { - if (msProperties[p]["name"] == type) { - if (msProperties[p]["properties"] !== null && msProperties[p]["properties"] !== undefined) { - return JSON.parse(JSON.stringify(msProperties[p]["properties"])); - } - } - } - return null; - } - - getMsUI(type) { - var msProperties = this.loopJsonCache["microServicePolicies"]; - for (p in msProperties) { - if (msProperties[p]["name"] == type) { - return JSON.parse(JSON.stringify(msProperties[p]["jsonRepresentation"])); - } - } - return null; - } - - getResourceDetailsVfProperty() { + if (newMsProperties["name"] == type) { + for (var policy in this.loopJsonCache["microServicePolicies"]) { + if (this.loopJsonCache["microServicePolicies"][policy]["name"] == type) { + this.loopJsonCache["microServicePolicies"][policy] = newMsProperties; + } + } + } + } + + updateGlobalProperties(newGlobalProperties) { + this.loopJsonCache["globalPropertiesJson"] = newGlobalProperties; + } + + updateOpPolicyProperties(newOpProperties) { + this.loopJsonCache["operationalPolicies"] = newOpProperties; + } + + getLoopName() { + return this.loopJsonCache["name"]; + } + + getOperationalPolicyProperty() { + return JSON.parse(JSON.stringify(this.loopJsonCache["operationalPolicies"]["0"]["configurationsJson"])); + } + + getOperationalPolicies() { + return JSON.parse(JSON.stringify(this.loopJsonCache["operationalPolicies"])); + } + + getGlobalProperty() { + return JSON.parse(JSON.stringify(this.loopJsonCache["globalPropertiesJson"])); + } + + getDeploymentProperties() { + return JSON.parse(JSON.stringify(this.loopJsonCache["globalPropertiesJson"]["dcaeDeployParameters"])); + } + + getMsJson(type) { + var msProperties = this.loopJsonCache["microServicePolicies"]; + for (var policy in msProperties) { + if (msProperties[policy]["name"] == type) { + return JSON.parse(JSON.stringify(msProperties[policy])); + } + } + return null; + } + + getMsProperty(type) { + var msProperties = this.loopJsonCache["microServicePolicies"]; + for (var policy in msProperties) { + if (msProperties[policy]["name"] == type) { + if (msProperties[policy]["properties"] !== null && msProperties[policy]["properties"] !== undefined) { + return JSON.parse(JSON.stringify(msProperties[policy]["properties"])); + } + } + } + return null; + } + + getMsUI(type) { + var msProperties = this.loopJsonCache["microServicePolicies"]; + for (var policy in msProperties) { + if (msProperties[policy]["name"] == type) { + return JSON.parse(JSON.stringify(msProperties[policy]["jsonRepresentation"])); + } + } + return null; + } + + getResourceDetailsVfProperty() { return this.loopJsonCache["modelPropertiesJson"]["resourceDetails"]["VF"]; } - - getResourceDetailsVfModuleProperty() { + + getResourceDetailsVfModuleProperty() { return this.loopJsonCache["modelPropertiesJson"]["resourceDetails"]["VFModule"]; } - - getLoopLogsArray() { + + getLoopLogsArray() { return this.loopJsonCache.loopLogs; } - - getComponentStates() { + + getComponentStates() { return this.loopJsonCache.components; } |