2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017 Amdocs
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 import React, {Component} from 'react';
24 import {connect} from 'react-redux';
25 import i18n from 'utils/i18n/i18n';
27 import InlineMessage from 'generic-components/InlineMessage/InlineMessage.jsx';
30 requestEditEntityAttributes
31 } from './EditAttributeActions.js';
34 ATTRIBUTE_MODIFICATION
35 } from './EditAttributeConstants.js';
36 import ChangeAttributeForm from 'editAttributes/changeAttributeForm/ChangeAttributeForm.jsx';
37 import {NO_VALUE_SELECTED} from 'editAttributes/changeAttributeForm/ChangeAttributeFormConstants.js';
39 let mapStateToProps = ({setAttributes}) => {
42 feedbackMsgSeverity = ''
51 let mapActionToProps = (dispatch) => {
53 handleSubmit: (values) => {
55 let attrMap = new Map();
56 attrMap.set('provStatus', 'prov-status');
57 attrMap.set('inMaint', 'in-maint');
58 attrMap.set('isClosedLoopDisabled', 'is-closed-loop-disabled');
61 let valueString = JSON.stringify(values);
62 JSON.parse(valueString, (key, value) => {
63 if(value !== NO_VALUE_SELECTED) {
64 let formattedKey = attrMap.get(key);
65 if(formattedKey !== undefined) {
67 ...attributes, [formattedKey]: value
74 dispatch(requestEditEntityAttributes(uri, attributes));
76 clearFeedbackMessage: () => {
77 dispatch(clearFeebackMessage());
82 class SetAttribute extends Component {
88 clearFeedbackMessage} = this.props;
91 <div className='header'>
92 <div className='application-title'>{i18n(SET_ATTRIBUTE_TITLE)}</div>
94 <div className='secondary-header'>
96 className='secondary-title'>{i18n(ATTRIBUTE_MODIFICATION)}</span>
97 <InlineMessage level={feedbackMsgSeverity}
98 messageTxt={feedbackMsgText}/>
102 onSubmit={(values) => {
103 handleSubmit(values);
105 buttonSelected={() => {
106 clearFeedbackMessage();
113 export default connect(mapStateToProps, mapActionToProps)(SetAttribute);