diff options
author | 2021-06-04 14:40:46 +0100 | |
---|---|---|
committer | 2021-06-04 16:06:28 +0100 | |
commit | 8c6beedc3d58420988c9e80d75aad96198e2962e (patch) | |
tree | 0d362d8cc43c84fa8974143ca2e3a4fc376d4b89 /gui-clamp/ui-react/src/components/dialogs/Policy/PolicyEditor.js | |
parent | 83022f8577c170df5a9816be90378bea4643f0af (diff) |
MERGE Clamp UI-React repo to Policy Gui Repo
According to a Diff differences from one repo to the other, there was some missing changes from the original clamp repo to the policy gui repo.
Issue-ID: POLICY-3267
Change-Id: I9a71841732dc5c3d9623bca9c1384866f4c826a6
Signed-off-by: brunomilitzer <bruno.militzer@est.tech>
Diffstat (limited to 'gui-clamp/ui-react/src/components/dialogs/Policy/PolicyEditor.js')
-rw-r--r-- | gui-clamp/ui-react/src/components/dialogs/Policy/PolicyEditor.js | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyEditor.js b/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyEditor.js index 525d66b..1e27541 100644 --- a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyEditor.js +++ b/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyEditor.js @@ -31,9 +31,7 @@ import TextField from '@material-ui/core/TextField'; import Alert from 'react-bootstrap/Alert'; import PolicyService from '../../../api/PolicyService'; import OnapUtils from '../../../utils/OnapUtils'; -import uuid from 'react-uuid'; -//const JSONEditor = require("@json-editor/json-editor").JSONEditor; const DivWhiteSpaceStyled = styled.div` white-space: pre; ` @@ -46,7 +44,6 @@ const JsonEditorDiv = styled.div` border: 1px solid #C0C0C0; ` const PanelDiv = styled.div` - margin-top: 20px; text-align: justify; font-size: ${ props => props.theme.policyEditorFontSize }; background-color: ${ props => props.theme.loopViewerBackgroundColor }; @@ -63,7 +60,7 @@ export default class PolicyEditor extends React.Component { showSuccessAlert: false, showFailAlert: false, jsonEditor: null, - jsonEditorDivId: uuid(), + jsonEditorDivId: this.props.policyModelType + "_" + this.props.policyModelTypeVersion + "_" + this.props.policyName + "_" + this.props.policyVersion, } constructor(props, context) { @@ -112,17 +109,12 @@ export default class PolicyEditor extends React.Component { showSuccessAlert: true, showMessage: 'Policy ' + this.state.policyName + '/' + this.state.policyVersion + ' created successfully' }); - this.props.policyUpdateFunction(); + this.props.policiesTableUpdateFunction(); } }) } } - bumpVersion(versionToBump) { - let semVer = versionToBump.split("."); - return parseInt(semVer[0]) + 1 + "." + semVer[1] + "." + semVer[2]; - } - getToscaModelForPolicy() { PolicyToscaService.getToscaPolicyModel(this.state.policyModelType, this.state.policyModelTypeVersion).then(respJsonPolicyTosca => { if (respJsonPolicyTosca !== {}) { @@ -139,27 +131,10 @@ export default class PolicyEditor extends React.Component { } createJsonEditor(toscaModel, editorData) { - /*JSONEditor.defaults.themes.myBootstrap4 = JSONEditor.defaults.themes.bootstrap4.extend({ - getTab: function(text,tabId) { - var liel = document.createElement('li'); - liel.classList.add('nav-item'); - var ael = document.createElement("a"); - ael.classList.add("nav-link"); - ael.setAttribute("style",'padding:10px;max-width:160px;'); - ael.setAttribute("href", "#" + tabId); - ael.setAttribute('data-toggle', 'tab'); - text.setAttribute("style",'word-wrap:break-word;'); - ael.appendChild(text); - liel.appendChild(ael); - return liel; - } - });*/ - return new JSONEditor(document.getElementById(this.state.jsonEditorDivId), { schema: toscaModel, startval: editorData, - //theme: 'myBootstrap4', theme: 'bootstrap4', iconlib: 'fontawesome5', object_layout: 'grid', |