diff options
Diffstat (limited to 'openecomp-ui/src/nfvo-components/input/validation')
3 files changed, 33 insertions, 20 deletions
diff --git a/openecomp-ui/src/nfvo-components/input/validation/Form.jsx b/openecomp-ui/src/nfvo-components/input/validation/Form.jsx index b5db67c027..027920c423 100644 --- a/openecomp-ui/src/nfvo-components/input/validation/Form.jsx +++ b/openecomp-ui/src/nfvo-components/input/validation/Form.jsx @@ -1,17 +1,17 @@ -/*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +/* + * Copyright © 2016-2018 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing - * permissions and limitations under the License. + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ import React from 'react'; @@ -42,7 +42,8 @@ class Form extends React.Component { cancelButtonText: PropTypes.string, onValidChange: PropTypes.func, onValidityChanged: PropTypes.func, - onValidateForm: PropTypes.func + onValidateForm: PropTypes.func, + btnClassName: PropTypes.string }; constructor(props) { @@ -64,6 +65,7 @@ class Form extends React.Component { submitButtonText, cancelButtonText, children, + btnClassName, ...formProps } = this.props; /* eslint-enable no-unused-vars */ @@ -82,6 +84,7 @@ class Form extends React.Component { cancelButtonText={cancelButtonText} ref={this.setButtonsRef} isReadOnlyMode={isReadOnlyMode} + className={btnClassName} /> )} </form> @@ -159,6 +162,7 @@ export class TabsForm extends Form { onValidChange, onValidityChanged, onDataChanged, + btnClassName, children, ...formProps } = this.props; @@ -176,6 +180,7 @@ export class TabsForm extends Form { cancelButtonText={cancelButtonText} ref={buttons => (this.buttons = buttons)} isReadOnlyMode={isReadOnlyMode} + className={btnClassName} /> )} </form> diff --git a/openecomp-ui/src/nfvo-components/input/validation/Input.jsx b/openecomp-ui/src/nfvo-components/input/validation/Input.jsx index c54d4b660f..f3279b0b6d 100644 --- a/openecomp-ui/src/nfvo-components/input/validation/Input.jsx +++ b/openecomp-ui/src/nfvo-components/input/validation/Input.jsx @@ -4,9 +4,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -197,11 +197,15 @@ class Input extends React.Component { selectedValues }); } - componentWillReceiveProps(nextProps) { - this.setState({ - value: nextProps.value - }); + + static getDerivedStateFromProps(props, state) { + if (state.value === props.value) { + return null; + } else { + return { value: props.value, ...state }; + } } + onChange(e) { const { onChange, type } = this.props; let value = e.target.value; diff --git a/openecomp-ui/src/nfvo-components/input/validation/ValidationButtons.jsx b/openecomp-ui/src/nfvo-components/input/validation/ValidationButtons.jsx index 550989688e..a4397114a0 100644 --- a/openecomp-ui/src/nfvo-components/input/validation/ValidationButtons.jsx +++ b/openecomp-ui/src/nfvo-components/input/validation/ValidationButtons.jsx @@ -1,17 +1,17 @@ -/*! - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. +/* + * Copyright © 2016-2018 European Support Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing - * permissions and limitations under the License. + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ /** * Holds the buttons for save/reset for forms. @@ -57,8 +57,12 @@ class ValidationButtons extends React.Component { ) : ( <SVGIcon className="close" name="close" /> ); + let className = 'validation-buttons'; + if (this.props.className) { + className += ' ' + this.props.className; + } return ( - <div className="validation-buttons"> + <div className={className}> {!this.props.isReadOnlyMode ? ( <div> <Button |