diff options
author | 2021-02-23 15:00:22 +0000 | |
---|---|---|
committer | 2021-02-23 15:00:22 +0000 | |
commit | 19f16ce2d6c58e5b603dc99c760820341563bebe (patch) | |
tree | 1c91c6f8004e0d92120b1f93f5816d49b3c286f6 /ui-react/src | |
parent | 9359ac6c0f60cacc0a5820fdf33a17f596322e79 (diff) | |
parent | 44a539f0b8ac56494ce2100aab798f268526a127 (diff) |
Merge "Introduce a new endpoint to create policy" into tosca-poc
Diffstat (limited to 'ui-react/src')
-rw-r--r-- | ui-react/src/api/PolicyService.js | 2 | ||||
-rw-r--r-- | ui-react/src/components/dialogs/Policy/ViewAllPolicies.js | 26 |
2 files changed, 17 insertions, 11 deletions
diff --git a/ui-react/src/api/PolicyService.js b/ui-react/src/api/PolicyService.js index d591b093d..fdbb5d5ea 100644 --- a/ui-react/src/api/PolicyService.js +++ b/ui-react/src/api/PolicyService.js @@ -22,7 +22,7 @@ export default class PolicyService { static getPoliciesList() { - return fetch(window.location.pathname + 'restservices/clds/v2/policies/list', { + return fetch(window.location.pathname + 'restservices/clds/v2/policies', { method: 'GET', credentials: 'same-origin' }) diff --git a/ui-react/src/components/dialogs/Policy/ViewAllPolicies.js b/ui-react/src/components/dialogs/Policy/ViewAllPolicies.js index 625aeb341..a1cf9d5c1 100644 --- a/ui-react/src/components/dialogs/Policy/ViewAllPolicies.js +++ b/ui-react/src/components/dialogs/Policy/ViewAllPolicies.js @@ -146,8 +146,9 @@ export default class ViewAllPolicies extends React.Component { this.handlePdpGroupChange = this.handlePdpGroupChange.bind(this); this.createJsonEditor = this.createJsonEditor.bind(this); this.handlePrefixGrouping = this.handlePrefixGrouping.bind(this); - this.deletePolicy = this.deletePolicy.bind(this); + this.handleDeletePolicy = this.handleDeletePolicy.bind(this); this.handleUpdatePolicy = this.handleUpdatePolicy.bind(this); + this.handleCreateNewVersion = this.handleCreateNewVersion(this); this.getAllPolicies(); } @@ -233,11 +234,6 @@ export default class ViewAllPolicies extends React.Component { this.props.history.push('/') } - handleUpdatePolicy() { - this.setState({ show: false }); - this.props.history.push('/') - } - handleOnRowClick(rowData) { PolicyToscaService.getToscaPolicyModel(rowData["type"], rowData["type_version"]).then(respJsonPolicyTosca => { this.setState({ @@ -251,12 +247,21 @@ export default class ViewAllPolicies extends React.Component { handlePrefixGrouping(event) { this.setState({prefixGrouping: event.target.checked}); - }; + } - deletePolicy(event, rowData) { + handleDeletePolicy(event, rowData) { return null; } + handleCreateNewVersion(event,rowData) { + return null; + } + + handleUpdatePolicy() { + this.setState({ show: false }); + this.props.history.push('/') + } + render() { return ( <ModalStyled size="xl" show={this.state.show} onHide={this.handleClose} backdrop="static" keyboard={false}> @@ -285,7 +290,7 @@ export default class ViewAllPolicies extends React.Component { { icon: forwardRef((props, ref) => <DeleteOutline {...props} ref={ref} />), tooltip: 'Delete Policy', - onClick: (event, rowData) => this.deletePolicy(event, rowData) + onClick: (event, rowData) => this.handleDeletePolicy(event, rowData) } ]} @@ -293,7 +298,8 @@ export default class ViewAllPolicies extends React.Component { <JsonEditorDiv> <h5>Policy Properties Editor</h5> <div id="policy-editor" title="Policy Properties"/> - <Button variant="secondary" onClick={this.handleUpdatePolicy}>Update</Button> + <Button variant="secondary" title="Create a new policy version from the defined parameters" onClick={this.handleCreateNewVersion}>Create New Version</Button> + <Button variant="secondary" title="Update the current policy version, BE CAREFUL this will undeploy the policy from PDP, delete it and then recreate the policy" onClick={this.handleUpdatePolicy}>Update Current Version</Button> </JsonEditorDiv> </Modal.Body> <Modal.Footer> |