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
diff --git a/ui-react/src/components/dialogs/Policy/ViewAllPolicies.js b/ui-react/src/components/dialogs/Policy/ViewAllPolicies.js
index 1e71bb8..d699f78 100644
--- a/ui-react/src/components/dialogs/Policy/ViewAllPolicies.js
+++ b/ui-react/src/components/dialogs/Policy/ViewAllPolicies.js
@@ -40,9 +40,9 @@
import SaveAlt from '@material-ui/icons/SaveAlt';
import Search from '@material-ui/icons/Search';
import ViewColumn from '@material-ui/icons/ViewColumn';
-import DescriptionIcon from '@material-ui/icons/Description';
-import SettingsEthernetIcon from '@material-ui/icons/SettingsEthernet';
-import NoteAddIcon from '@material-ui/icons/NoteAdd';
+import DehazeIcon from '@material-ui/icons/Dehaze';
+import ArrowForwardIosIcon from '@material-ui/icons/ArrowForwardIos';
+import AddIcon from '@material-ui/icons/Add';
import FormControlLabel from '@material-ui/core/FormControlLabel';
import Switch from '@material-ui/core/Switch';
import MaterialTable from "material-table";
@@ -188,6 +188,8 @@
this.handlePrefixGrouping = this.handlePrefixGrouping.bind(this);
this.handleDeletePolicy = this.handleDeletePolicy.bind(this);
this.disableAlert = this.disableAlert.bind(this);
+ this.getAllPolicies = this.getAllPolicies.bind(this);
+ this.getAllToscaModels = this.getAllToscaModels.bind(this);
this.getAllPolicies();
this.getAllToscaModels();
}
@@ -247,7 +249,7 @@
handleDeletePolicy(event, rowData) {
PolicyService.deletePolicy(rowData["type"], rowData["type_version"], rowData["name"],rowData["version"]).then(
respPolicyDeletion => {
- if (respPolicyDeletion === "") {
+ if (typeof(respPolicyDeletion) === "undefined") {
//it indicates a failure
this.setState({
showFailAlert: true,
@@ -259,6 +261,7 @@
showMessage: 'Policy successfully Deleted'
});
}
+ this.getAllPolicies();
}
)
}
@@ -292,18 +295,18 @@
}}
detailPanel={[
{
- icon: SettingsEthernetIcon,
+ icon: ArrowForwardIosIcon,
tooltip: 'Show Configuration',
render: rowData => {
return (
<DetailedRow>
- <PolicyEditor policyModelType={rowData["type"]} policyModelTypeVersion={rowData["type_version"]} policyName={rowData["name"]} policyVersion={rowData["version"]} policyProperties={rowData["properties"]} />
+ <PolicyEditor policyModelType={rowData["type"]} policyModelTypeVersion={rowData["type_version"]} policyName={rowData["name"]} policyVersion={rowData["version"]} policyProperties={rowData["properties"]} policyUpdateFunction={this.getAllPolicies} />
</DetailedRow>
)
},
},
{
- icon: DescriptionIcon,
+ icon: DehazeIcon,
tooltip: 'Show Raw Data',
render: rowData => {
return (
@@ -352,7 +355,7 @@
}}
detailPanel={[
{
- icon: SettingsEthernetIcon,
+ icon: ArrowForwardIosIcon,
tooltip: 'Show Tosca',
render: rowData => {
return (
@@ -363,7 +366,7 @@
},
},
{
- icon: DescriptionIcon,
+ icon: DehazeIcon,
tooltip: 'Show Raw Data',
render: rowData => {
return (
@@ -374,24 +377,17 @@
},
},
{
- icon: NoteAddIcon,
+ icon: AddIcon,
tooltip: 'Create a policy from this model',
render: rowData => {
return (
<DetailedRow>
- <PolicyEditor policyModelType={rowData["policyModelType"]} policyModelTypeVersion={rowData["version"]} policyProperties={{}} />
+ <PolicyEditor policyModelType={rowData["policyModelType"]} policyModelTypeVersion={rowData["version"]} policyProperties={{}} policyUpdateFunction={this.getAllPolicies} />
</DetailedRow>
)
},
},
]}
- actions={[
- {
- icon: forwardRef((props, ref) => <DeleteRoundedIcon {...props} ref={ref} />),
- tooltip: 'Delete Tosca Model',
- onClick: (event, rowData) => this.handleDeletePolicy(event, rowData)
- }
- ]}
/>
</Modal.Body>
</Tab>