From 393bbb59b975747723c6801da2a5b151c542a0b5 Mon Sep 17 00:00:00 2001 From: Ashwin Sharma Date: Thu, 27 Feb 2020 17:24:52 +0000 Subject: Upload Tosca Model changes to remove policy model type parsing from UI. Dictionary API fix to allow bulk create or update of dictionary elements. Issue-ID: CLAMP-656 Change-Id: I6a0a36a6be40a098d917c45462872d31b7f47dd2 Signed-off-by: Ashwin Sharma --- .../dialogs/Tosca/UploadToscaPolicyModal.js | 20 +--- .../dialogs/Tosca/UploadToscaPolicyModal.test.js | 16 --- .../UploadToscaPolicyModal.test.js.snap | 111 --------------------- 3 files changed, 3 insertions(+), 144 deletions(-) delete mode 100644 ui-react/src/components/dialogs/Tosca/__snapshots__/UploadToscaPolicyModal.test.js.snap (limited to 'ui-react/src/components') diff --git a/ui-react/src/components/dialogs/Tosca/UploadToscaPolicyModal.js b/ui-react/src/components/dialogs/Tosca/UploadToscaPolicyModal.js index 2e0460f61..1937485b0 100644 --- a/ui-react/src/components/dialogs/Tosca/UploadToscaPolicyModal.js +++ b/ui-react/src/components/dialogs/Tosca/UploadToscaPolicyModal.js @@ -39,12 +39,10 @@ export default class UploadToscaPolicyModal extends React.Component { this.handleCreateFromToscaPolicyModel = this.handleCreateFromToscaPolicyModel.bind(this); this.handleClose = this.handleClose.bind(this); - this.handlePolicyModelType = this.handlePolicyModelType.bind(this); this.fileSelectedHandler = this.fileSelectedHandler.bind(this); this.state = { show: true, selectedFile: '', - policyModelType: '', policyModelTosca: [], apiResponseStatus: '', apiResponseMessage: '', @@ -56,7 +54,7 @@ export default class UploadToscaPolicyModal extends React.Component { if (event.target.files && event.target.files[0]) { const scope = this; let reader = new FileReader(); - this.setState({policyModelType: '', policyModelTosca: '' }); + this.setState({policyModelTosca: '' }); reader.onload = function(e) { scope.setState({ policyModelTosca: reader.result}); }; @@ -73,9 +71,8 @@ export default class UploadToscaPolicyModal extends React.Component { handleCreateFromToscaPolicyModel(e) { e.preventDefault(); - console.log("Policy Model Type is", this.state.policyModelType); - if(this.state.policyModelType && this.state.policyModelTosca) { - PolicyToscaService.createPolicyModelFromToscaModel(this.state.policyModelType, this.state.policyModelTosca).then(resp => { + if(this.state.policyModelTosca) { + PolicyToscaService.createPolicyModelFromToscaModel(this.state.policyModelTosca).then(resp => { if(resp.status === 200) { this.setState({apiResponseStatus: resp.status, apiResponseMessage: resp.message, upldBtnClicked: true}); } else { @@ -87,12 +84,6 @@ export default class UploadToscaPolicyModal extends React.Component { } } - handlePolicyModelType = event => { - this.setState({ - policyModelType: event.target.value - }) - } - render() { return ( @@ -108,11 +99,6 @@ export default class UploadToscaPolicyModal extends React.Component {

{this.state.selectedFile.name}

- Policy Model Type: - diff --git a/ui-react/src/components/dialogs/Tosca/UploadToscaPolicyModal.test.js b/ui-react/src/components/dialogs/Tosca/UploadToscaPolicyModal.test.js index dac8ac920..e4842062a 100644 --- a/ui-react/src/components/dialogs/Tosca/UploadToscaPolicyModal.test.js +++ b/ui-react/src/components/dialogs/Tosca/UploadToscaPolicyModal.test.js @@ -27,22 +27,6 @@ import UploadToscaPolicyModal from './UploadToscaPolicyModal'; describe('Test Upload Tosca Policy Model', () => { - it('Test handleMicroServiceName', () => { - - const component = shallow(); - - const inputValue = 'TCA' - - const button = component.find('input').at(1); - - button.simulate('change', { target: { value: inputValue }}); - - expect(component.state('policyModelType')).toEqual(inputValue); - - expect(component).toMatchSnapshot(); - - }); - it('Test handleUploadToscaPolicyModel for Tosca Model', () => { const component = shallow(); diff --git a/ui-react/src/components/dialogs/Tosca/__snapshots__/UploadToscaPolicyModal.test.js.snap b/ui-react/src/components/dialogs/Tosca/__snapshots__/UploadToscaPolicyModal.test.js.snap deleted file mode 100644 index 8e801367b..000000000 --- a/ui-react/src/components/dialogs/Tosca/__snapshots__/UploadToscaPolicyModal.test.js.snap +++ /dev/null @@ -1,111 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Test Upload Tosca Policy Model Test handleMicroServiceName 1`] = ` - - - - Upload Tosca Model - - - - - - - - -

- - - Policy Model Type: - - - - - - - - - - -`; -- cgit 1.2.3-korg