2 * ============LICENSE_START===================================================
3 * SPARKY (AAI UI service)
4 * ============================================================================
5 * Copyright © 2017 AT&T Intellectual Property.
6 * Copyright © 2017 Amdocs
8 * ============================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=====================================================
22 * ECOMP and OpenECOMP are trademarks
23 * and service marks of AT&T Intellectual Property.
26 import React, {Component} from 'react';
27 import {connect} from 'react-redux';
28 import i18n from 'utils/i18n/i18n';
30 import InlineMessage from 'generic-components/InlineMessage/InlineMessage.jsx';
33 requestEditEntityAttributes
34 } from './EditAttributeActions.js';
37 ATTRIBUTE_MODIFICATION
38 } from './EditAttributeConstants.js';
39 import ChangeAttributeForm from 'editAttributes/changeAttributeForm/ChangeAttributeForm.jsx';
40 import {NO_VALUE_SELECTED} from 'editAttributes/changeAttributeForm/ChangeAttributeFormConstants.js';
42 let mapStateToProps = ({setAttributes}) => {
45 feedbackMsgSeverity = ''
54 let mapActionToProps = (dispatch) => {
56 handleSubmit: (values) => {
58 let attrMap = new Map();
59 attrMap.set('provStatus', 'prov-status');
60 attrMap.set('inMaint', 'in-maint');
61 attrMap.set('isClosedLoopDisabled', 'is-closed-loop-disabled');
64 let valueString = JSON.stringify(values);
65 JSON.parse(valueString, (key, value) => {
66 if(value !== NO_VALUE_SELECTED) {
67 let formattedKey = attrMap.get(key);
68 if(formattedKey !== undefined) {
70 ...attributes, [formattedKey]: value
77 dispatch(requestEditEntityAttributes(uri, attributes));
79 clearFeedbackMessage: () => {
80 dispatch(clearFeebackMessage());
85 class SetAttribute extends Component {
91 clearFeedbackMessage} = this.props;
94 <div className='header'>
95 <div className='application-title'>{i18n(SET_ATTRIBUTE_TITLE)}</div>
97 <div className='secondary-header'>
99 className='secondary-title'>{i18n(ATTRIBUTE_MODIFICATION)}</span>
100 <InlineMessage level={feedbackMsgSeverity}
101 messageTxt={feedbackMsgText}/>
105 onSubmit={(values) => {
106 handleSubmit(values);
108 buttonSelected={() => {
109 clearFeedbackMessage();
116 export default connect(mapStateToProps, mapActionToProps)(SetAttribute);