aboutsummaryrefslogtreecommitdiffstats
path: root/ui-react/src/components/dialogs/Policy/PolicyEditor.js
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2021-03-12 19:30:22 +0100
committerS�bastien Determe <sebastien.determe@intl.att.com>2021-03-15 16:41:08 +0000
commitb8831e5199aa0fe2bb1de531069d376182b3571d (patch)
tree9a5eb6ba206300a3ec43ba099c42302ac3707010 /ui-react/src/components/dialogs/Policy/PolicyEditor.js
parent396cb9b814626a0383ee49a928f4e534264170aa (diff)
Add refresh & update libs
Add refresh features to the policy list when changing it + update materials-Ui + update Json-editor libs to solve big lag in UI + Remove useless link in the menu + fix issue with build due to mariadb not started yet Issue-ID: POLICY-3131 Signed-off-by: sebdet <sebastien.determe@intl.att.com> Change-Id: I9bcb9558f213731a4ea8e20e186fb91c9db1b6f3
Diffstat (limited to 'ui-react/src/components/dialogs/Policy/PolicyEditor.js')
-rw-r--r--ui-react/src/components/dialogs/Policy/PolicyEditor.js19
1 files changed, 13 insertions, 6 deletions
diff --git a/ui-react/src/components/dialogs/Policy/PolicyEditor.js b/ui-react/src/components/dialogs/Policy/PolicyEditor.js
index e329e0c32..f20650e26 100644
--- a/ui-react/src/components/dialogs/Policy/PolicyEditor.js
+++ b/ui-react/src/components/dialogs/Policy/PolicyEditor.js
@@ -23,7 +23,8 @@
import React from 'react'
import PolicyToscaService from '../../../api/PolicyToscaService';
-import JSONEditor from '@json-editor/json-editor';
+import { JSONEditor } from '@json-editor/json-editor/dist/nonmin/jsoneditor.js';
+import "@fortawesome/fontawesome-free/css/all.css"
import styled from 'styled-components';
import Button from 'react-bootstrap/Button';
import TextField from '@material-ui/core/TextField';
@@ -32,6 +33,7 @@ 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;
`
@@ -41,6 +43,7 @@ const JsonEditorDiv = styled.div`
background-color: ${props => props.theme.loopViewerBackgroundColor};
text-align: justify;
font-size: ${props => props.theme.policyEditorFontSize};
+ border: 1px solid #C0C0C0;
`
const PanelDiv = styled.div`
margin-top: 20px;
@@ -98,7 +101,7 @@ export default class PolicyEditor extends React.Component {
console.info("NO validation errors found in policy data");
PolicyService.createNewPolicy(this.state.policyModelType, this.state.policyModelTypeVersion,
this.state.policyName, this.state.policyVersion, editorData).then(respPolicyCreation => {
- if (respPolicyCreation === "") {
+ if (typeof(respPolicyCreation) === "undefined") {
//it indicates a failure
this.setState({
showFailAlert: true,
@@ -109,6 +112,7 @@ export default class PolicyEditor extends React.Component {
showSuccessAlert: true,
showMessage: 'Policy '+ this.state.policyName + '/' + this.state.policyVersion + ' created successfully'
});
+ this.props.policyUpdateFunction();
}
})
}
@@ -135,7 +139,7 @@ export default class PolicyEditor extends React.Component {
}
createJsonEditor(toscaModel, editorData) {
- JSONEditor.defaults.themes.myBootstrap4 = JSONEditor.defaults.themes.bootstrap4.extend({
+ /*JSONEditor.defaults.themes.myBootstrap4 = JSONEditor.defaults.themes.bootstrap4.extend({
getTab: function(text,tabId) {
var liel = document.createElement('li');
liel.classList.add('nav-item');
@@ -149,12 +153,15 @@ export default class PolicyEditor extends React.Component {
liel.appendChild(ael);
return liel;
}
- });
+ });*/
+
return new JSONEditor(document.getElementById(this.state.jsonEditorDivId),
{
schema: toscaModel,
startval: editorData,
- theme: 'myBootstrap4',
+ //theme: 'myBootstrap4',
+ theme: 'bootstrap4',
+ iconlib: 'fontawesome5',
object_layout: 'grid',
disable_properties: false,
disable_edit_json: false,
@@ -163,7 +170,7 @@ export default class PolicyEditor extends React.Component {
disable_array_delete_all_rows: false,
array_controls_top: true,
keep_oneof_values: false,
- collapsed:true,
+ collapsed: true,
show_errors: 'always',
display_required_only: false,
show_opt_in: false,