diff options
Diffstat (limited to 'src/editAttributes')
-rw-r--r-- | src/editAttributes/AppStore.js | 51 | ||||
-rw-r--r-- | src/editAttributes/Application.jsx | 37 | ||||
-rw-r--r-- | src/editAttributes/EditAttributeActions.js | 92 | ||||
-rw-r--r-- | src/editAttributes/EditAttributeConstants.js | 45 | ||||
-rw-r--r-- | src/editAttributes/EditAttributeReducer.js | 51 | ||||
-rw-r--r-- | src/editAttributes/EditAttributes.jsx | 111 | ||||
-rw-r--r-- | src/editAttributes/changeAttributeForm/ChangeAttributeForm.jsx | 156 | ||||
-rw-r--r-- | src/editAttributes/changeAttributeForm/ChangeAttributeFormConstants.js | 41 | ||||
-rw-r--r-- | src/editAttributes/changeAttributeForm/ChangeAttributeFormReducer.js | 33 | ||||
-rw-r--r-- | src/editAttributes/changeAttributeForm/validate.js | 46 | ||||
-rw-r--r-- | src/editAttributes/index.html | 34 | ||||
-rw-r--r-- | src/editAttributes/main.app.jsx | 33 | ||||
-rw-r--r-- | src/editAttributes/networking/NetworkCalls.js | 32 | ||||
-rw-r--r-- | src/editAttributes/networking/NetworkConstants.js | 34 | ||||
-rw-r--r-- | src/editAttributes/networking/NetworkUtils.js | 28 |
15 files changed, 0 insertions, 824 deletions
diff --git a/src/editAttributes/AppStore.js b/src/editAttributes/AppStore.js deleted file mode 100644 index 888c659..0000000 --- a/src/editAttributes/AppStore.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -import {combineReducers, createStore, compose, applyMiddleware} from 'redux'; -import thunkMiddleware from 'redux-thunk'; -import {reducer as formReducer} from 'redux-form'; - -import SetAttributeReducer from './EditAttributeReducer.js'; - -function createCompose() { - if (window.devToolsExtension) { - return compose( - applyMiddleware(thunkMiddleware), - window.devToolsExtension()); - } - else { - return applyMiddleware(thunkMiddleware); - } -} - -export const storeCreator = (initialState) => createStore( - combineReducers({ - setAttributes: SetAttributeReducer, - form: formReducer - }), - initialState, - createCompose() -); - - -const store = storeCreator(); - -export default store; - diff --git a/src/editAttributes/Application.jsx b/src/editAttributes/Application.jsx deleted file mode 100644 index 0817795..0000000 --- a/src/editAttributes/Application.jsx +++ /dev/null @@ -1,37 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -import React, {Component} from 'react'; -import {Provider} from 'react-redux'; -import store from 'editAttributes/AppStore.js'; - - -class Application extends Component { - - render() { - return ( - <Provider store={store}> - {this.props.children} - </Provider> - ); - } -} - -export default Application; diff --git a/src/editAttributes/EditAttributeActions.js b/src/editAttributes/EditAttributeActions.js deleted file mode 100644 index 468d7f4..0000000 --- a/src/editAttributes/EditAttributeActions.js +++ /dev/null @@ -1,92 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -import NetworkCalls from './networking/NetworkCalls.js'; -import { - POST, - BACKEND_POST_HEADER, - CREDENTIALS -} from './networking/NetworkConstants.js'; -import { - createEditEntityAttributeRequestObject -} from './networking/NetworkUtils.js'; -import { - setAttributesActionTypes, - EDIT_ENTITY_ATTRIBUTES_URL, - RESPONSE_CODE_SUCCESS, - RESPONSE_CODE_NOT_AUTHORIZED, - RESPONSE_MESSAGE_SUCCESS, - RESPONSE_MESSAGE_NOT_AUTHORIZED, - RESPONSE_MESSAGE_FAILURE, - RESPONSE_MESSAGE_NETWORK_ERROR -} from './EditAttributeConstants.js'; - -function errorReturnedEvent(errorMsg) { - return { - type: setAttributesActionTypes.SET_ATTRIBUTE_ERROR, - data: {errorMsg: errorMsg} - }; -} - -function successReturnedEvent() { - return { - type: setAttributesActionTypes.SET_ATTRIBUTE_SUCCESS, - data: {successMsg: RESPONSE_MESSAGE_SUCCESS} - }; -} - -function clearFeedbackMessageEvent() { - return { - type: setAttributesActionTypes.CLEAR_FEEDBACK_MESSAGE, - data: {} - }; -} - -export function clearFeebackMessage() { - return dispatch => { - dispatch(clearFeedbackMessageEvent()); - }; -} - -export function requestEditEntityAttributes(entityURI, entityAttributes) { - - let postBody = JSON.stringify( - createEditEntityAttributeRequestObject(entityURI, entityAttributes)); - return dispatch => { - return NetworkCalls.fetchRequest(EDIT_ENTITY_ATTRIBUTES_URL, - CREDENTIALS, POST, BACKEND_POST_HEADER, postBody).then( - (responseJson) => { - if (responseJson) { - if (responseJson.resultCode === RESPONSE_CODE_SUCCESS) { - dispatch(successReturnedEvent()); - } else if (responseJson.resultCode === RESPONSE_CODE_NOT_AUTHORIZED) { - dispatch(errorReturnedEvent(RESPONSE_MESSAGE_NOT_AUTHORIZED)); - } else { - dispatch(errorReturnedEvent(RESPONSE_MESSAGE_FAILURE)); - } - } - } - ).catch( - () => { - dispatch(errorReturnedEvent(RESPONSE_MESSAGE_NETWORK_ERROR)); - } - ); - }; -} diff --git a/src/editAttributes/EditAttributeConstants.js b/src/editAttributes/EditAttributeConstants.js deleted file mode 100644 index c0a35ed..0000000 --- a/src/editAttributes/EditAttributeConstants.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -import keyMirror from 'utils/KeyMirror.js'; -import { - BASE_URL -} from './networking/NetworkConstants.js'; - -export const SET_ATTRIBUTE_TITLE = 'A&AI'; -export const ATTRIBUTE_MODIFICATION = 'ATTRIBUTE MODIFICATION'; - - - -export const EDIT_ENTITY_ATTRIBUTES_URL = BASE_URL + '/editEntity/editAttributes'; - -export const RESPONSE_CODE_SUCCESS = 200; -export const RESPONSE_CODE_NOT_AUTHORIZED = 403; - -export const RESPONSE_MESSAGE_SUCCESS = 'Success'; -export const RESPONSE_MESSAGE_NOT_AUTHORIZED = 'User not authorized'; -export const RESPONSE_MESSAGE_FAILURE = 'Failed to update entity'; -export const RESPONSE_MESSAGE_NETWORK_ERROR = 'Network error'; - -export const setAttributesActionTypes = keyMirror({ - SET_ATTRIBUTE_ERROR: null, - SET_ATTRIBUTE_SUCCESS: null, - CLEAR_FEEDBACK_MESSAGE: null -}); diff --git a/src/editAttributes/EditAttributeReducer.js b/src/editAttributes/EditAttributeReducer.js deleted file mode 100644 index 90c959d..0000000 --- a/src/editAttributes/EditAttributeReducer.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -import {setAttributesActionTypes} from './EditAttributeConstants.js'; -import { - MESSAGE_LEVEL_SUCCESS, - MESSAGE_LEVEL_DANGER -} from 'utils/GlobalConstants.js'; - -export default (state = {}, action) => { - switch (action.type) { - case setAttributesActionTypes.SET_ATTRIBUTE_ERROR: - return { - ...state, - feedbackMsgText: action.data.errorMsg, - feedbackMsgSeverity: MESSAGE_LEVEL_DANGER - }; - - case setAttributesActionTypes.SET_ATTRIBUTE_SUCCESS: - return { - ...state, - feedbackMsgText: action.data.successMsg, - feedbackMsgSeverity: MESSAGE_LEVEL_SUCCESS - }; - - case setAttributesActionTypes.CLEAR_FEEDBACK_MESSAGE: - return { - ...state, - feedbackMsgText: '', - feedbackMsgSeverity: '' - }; - } - return state; -}; diff --git a/src/editAttributes/EditAttributes.jsx b/src/editAttributes/EditAttributes.jsx deleted file mode 100644 index 6aa390f..0000000 --- a/src/editAttributes/EditAttributes.jsx +++ /dev/null @@ -1,111 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -import React, {Component} from 'react'; -import {connect} from 'react-redux'; -import i18n from 'utils/i18n/i18n'; - -import InlineMessage from 'generic-components/InlineMessage/InlineMessage.jsx'; -import { - clearFeebackMessage, - requestEditEntityAttributes -} from './EditAttributeActions.js'; -import { - SET_ATTRIBUTE_TITLE, - ATTRIBUTE_MODIFICATION -} from './EditAttributeConstants.js'; -import ChangeAttributeForm from 'editAttributes/changeAttributeForm/ChangeAttributeForm.jsx'; -import {NO_VALUE_SELECTED} from 'editAttributes/changeAttributeForm/ChangeAttributeFormConstants.js'; - -let mapStateToProps = ({setAttributes}) => { - let { - feedbackMsgText = '', - feedbackMsgSeverity = '' - } = setAttributes; - - return { - feedbackMsgText, - feedbackMsgSeverity - }; -}; - -let mapActionToProps = (dispatch) => { - return { - handleSubmit: (values) => { - let uri = values.uri; - let attrMap = new Map(); - attrMap.set('provStatus', 'prov-status'); - attrMap.set('inMaint', 'in-maint'); - attrMap.set('isClosedLoopDisabled', 'is-closed-loop-disabled'); - - let attributes = {}; - let valueString = JSON.stringify(values); - JSON.parse(valueString, (key, value) => { - if(value !== NO_VALUE_SELECTED) { - let formattedKey = attrMap.get(key); - if(formattedKey !== undefined) { - attributes = { - ...attributes, [formattedKey]: value - }; - } - return value; - } - }); - - dispatch(requestEditEntityAttributes(uri, attributes)); - }, - clearFeedbackMessage: () => { - dispatch(clearFeebackMessage()); - } - }; -}; - -class SetAttribute extends Component { - render() { - let { - feedbackMsgText, - feedbackMsgSeverity, - handleSubmit, - clearFeedbackMessage} = this.props; - return ( - <div> - <div className='header'> - <div className='application-title'>{i18n(SET_ATTRIBUTE_TITLE)}</div> - </div> - <div className='secondary-header'> - <span - className='secondary-title'>{i18n(ATTRIBUTE_MODIFICATION)}</span> - <InlineMessage level={feedbackMsgSeverity} - messageTxt={feedbackMsgText}/> - </div> - - <ChangeAttributeForm - onSubmit={(values) => { - handleSubmit(values); - }} - buttonSelected={() => { - clearFeedbackMessage(); - }}/> - </div> - ); - } -} - -export default connect(mapStateToProps, mapActionToProps)(SetAttribute); diff --git a/src/editAttributes/changeAttributeForm/ChangeAttributeForm.jsx b/src/editAttributes/changeAttributeForm/ChangeAttributeForm.jsx deleted file mode 100644 index b97d6bd..0000000 --- a/src/editAttributes/changeAttributeForm/ChangeAttributeForm.jsx +++ /dev/null @@ -1,156 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -import React, {Component} from 'react'; -import {Field, Fields, reduxForm, propTypes} from 'redux-form'; -import i18n from 'utils/i18n/i18n'; - -import { - LABEL_NODE_URI, - LABEL_PROV_STATUS, - LABEL_ATTRIBUTES, - LABEL_IN_MAINT, - LABEL_IS_CLOSED_LOOP, - BUTTON_SUBMIT, - BUTTON_CLEAR, - NO_VALUE_SELECTED, - PREPROV, - NVTPROV, - DECOM, - PROV, - CAPPED, - RETIRED, - TRUE, - FALSE -} from './ChangeAttributeFormConstants.js'; -import validate from './validate.js'; - -class ChangeAttributeForm extends Component { - - static propTypes = { - ...propTypes - }; - - renderTextField = ({input, label, type, meta: {touched, error}}) => ( - <div className='attribute-field'> - <label>{label}</label> - <div> - <input {...input} placeholder={label} type={type} - onBlur={() => input.value === '' ? input.onBlur(' ') : input.onBlur()}/> - {touched && ((error && <span className='error-message'>{error}</span>))} - </div> - </div> - ); - - - booleanOptions = [ - <option value={NO_VALUE_SELECTED}>{i18n(NO_VALUE_SELECTED)}</option>, - <option value='true'>{i18n(TRUE)}</option>, - <option value='false'>{i18n(FALSE)}</option> - ]; - - provStatusOptions = [ - <option value={NO_VALUE_SELECTED}>{i18n(NO_VALUE_SELECTED)}</option>, - <option value={PREPROV}>{PREPROV}</option>, - <option value={NVTPROV}>{NVTPROV}</option>, - <option value={PROV}>{PROV}</option>, - <option value={CAPPED}>{CAPPED}</option>, - <option value={DECOM}>{DECOM}</option>, - <option value={RETIRED}>{RETIRED}</option> - ]; - - renderAttributeFields = (fields) => ( - <div> - <div className='centre'> - {(fields.provStatus.meta.touched || - fields.inMaint.meta.touched || - fields.isClosedLoopDisabled.meta.touched) && - fields.provStatus.meta.error && - <span className='error-message'>{fields.provStatus.meta.error}</span>} - </div> - <div className='attribute-field'> - <label>{LABEL_PROV_STATUS}</label> - <div> - <select {...fields.provStatus.input}> - {this.provStatusOptions} - </select> - </div> - </div> - <div className='attribute-field'> - <label>{LABEL_IN_MAINT}</label> - <div> - <select {...fields.inMaint.input}> - {this.booleanOptions} - </select> - </div> - </div> - <div className='attribute-field'> - <label>{LABEL_IS_CLOSED_LOOP}</label> - <div> - <select {...fields.isClosedLoopDisabled.input}> - {this.booleanOptions} - </select> - </div> - </div> - </div> - ); - - render() { - const { - handleSubmit, - buttonSelected, - pristine, - reset, - submitting} = this.props; - - return ( - <form onSubmit={handleSubmit}> - <Field name='uri' type='text' component={this.renderTextField} - label={i18n(LABEL_NODE_URI)}/> - <div className='centre'><h2>{i18n(LABEL_ATTRIBUTES)}</h2></div> - <Fields names={['provStatus', 'inMaint', 'isClosedLoopDisabled']} - component={this.renderAttributeFields}/> - <div className='centre'> - <button type='submit' - disabled={pristine || submitting} - onClick={() => { - buttonSelected(); - }}> - {i18n(BUTTON_SUBMIT)} - </button> - <button type='button' - disabled={pristine || submitting} - onClick={() => { - reset(); - buttonSelected(); - }}> - {i18n(BUTTON_CLEAR)} - </button> - </div> - </form> - ); - } -} - -export default reduxForm({ - form: 'changeAttributeForm', - validate -})(ChangeAttributeForm); - diff --git a/src/editAttributes/changeAttributeForm/ChangeAttributeFormConstants.js b/src/editAttributes/changeAttributeForm/ChangeAttributeFormConstants.js deleted file mode 100644 index ae6eee5..0000000 --- a/src/editAttributes/changeAttributeForm/ChangeAttributeFormConstants.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -export const LABEL_NODE_URI = 'Target Entity URI'; -export const LABEL_PROV_STATUS = 'prov-status'; -export const LABEL_IN_MAINT = 'in-maint'; -export const LABEL_IS_CLOSED_LOOP = 'is-closed-loop-disabled'; -export const LABEL_ATTRIBUTES = 'ATTRIBUTES'; - -export const BUTTON_SUBMIT = 'Submit'; -export const BUTTON_CLEAR = 'Clear'; - -export const NO_VALUE_SELECTED = 'No Value Selected'; -export const PREPROV = 'PREPROV'; -export const NVTPROV = 'NVTPROV'; -export const PROV = 'PROV'; -export const CAPPED = 'CAPPED'; -export const DECOM = 'DECOM'; -export const RETIRED = 'RETIRED'; -export const TRUE = 'TRUE'; -export const FALSE = 'FALSE'; - -export const ERROR_MISSING_ATTR = 'At least one attribute must be set'; -export const ERROR_REQUIRED = 'Required'; diff --git a/src/editAttributes/changeAttributeForm/ChangeAttributeFormReducer.js b/src/editAttributes/changeAttributeForm/ChangeAttributeFormReducer.js deleted file mode 100644 index 4edd1eb..0000000 --- a/src/editAttributes/changeAttributeForm/ChangeAttributeFormReducer.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -/*import { combineReducers } from 'redux' - import { reducer as formReducer } from 'redux-form' - - - - const reducer = combineReducers({ - form: formReducer.validation({ - changeAttributeForm: validate - }) - }); - - export default reducer; - */ diff --git a/src/editAttributes/changeAttributeForm/validate.js b/src/editAttributes/changeAttributeForm/validate.js deleted file mode 100644 index 450bb02..0000000 --- a/src/editAttributes/changeAttributeForm/validate.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -import i18n from 'utils/i18n/i18n'; - -import { - ERROR_MISSING_ATTR, - ERROR_REQUIRED, - NO_VALUE_SELECTED -} from './ChangeAttributeFormConstants.js'; - -const validate = (values) => { - const errors = {}; - - if (!values.uri || values.uri.replace(/\s/g, '') === '') { - errors.uri = i18n(ERROR_REQUIRED); - } - if ((!values.provStatus || values.provStatus === NO_VALUE_SELECTED) && - (!values.inMaint || values.inMaint === NO_VALUE_SELECTED) && - (!values.isClosedLoopDisabled || - values.isClosedLoopDisabled === - NO_VALUE_SELECTED)) { - errors.provStatus = i18n(ERROR_MISSING_ATTR); - } - - return errors; -}; - -export default validate; diff --git a/src/editAttributes/index.html b/src/editAttributes/index.html deleted file mode 100644 index afd9a22..0000000 --- a/src/editAttributes/index.html +++ /dev/null @@ -1,34 +0,0 @@ -<!-- - - ============LICENSE_START======================================================= - org.onap.aai - ================================================================================ - Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - Copyright © 2017-2018 Amdocs - ================================================================================ - 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. - See the License for the specific language governing permissions and - limitations under the License. - ============LICENSE_END========================================================= - ---> -<html> -<head> - <meta charset="utf-8"> - <title>Edit Attributes</title> -</head> - -<body> -<div id="set-attribute-app"></div> -</body> - -<script src="editAttributesBundle.js"></script> -</html> diff --git a/src/editAttributes/main.app.jsx b/src/editAttributes/main.app.jsx deleted file mode 100644 index 17a4b18..0000000 --- a/src/editAttributes/main.app.jsx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -import React from 'react'; -import ReactDOM from 'react-dom'; - -import 'resources/scss/bootstrap.scss'; -import 'resources/css/font-awesome.min.css'; -import 'resources/scss/style.scss'; - -import Application from './Application.jsx'; -import SetAttribute from './EditAttributes.jsx'; - -ReactDOM.render( - <Application><SetAttribute /></Application>, - document.getElementById('set-attribute-app')); diff --git a/src/editAttributes/networking/NetworkCalls.js b/src/editAttributes/networking/NetworkCalls.js deleted file mode 100644 index 7038e5e..0000000 --- a/src/editAttributes/networking/NetworkCalls.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -export default { - fetchRequest(URL, CREDENTIALS, METHOD, HEADER, BODY) { - return fetch(URL, { - credentials: CREDENTIALS, - method: METHOD, - headers: HEADER, - body: BODY - }).then( - (response) => response.json() - ); - } -}; diff --git a/src/editAttributes/networking/NetworkConstants.js b/src/editAttributes/networking/NetworkConstants.js deleted file mode 100644 index 09629fc..0000000 --- a/src/editAttributes/networking/NetworkConstants.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -export const POST = 'POST'; -export const POST_HEADER = { - 'Accept': 'application/json' -}; -export const BACKEND_POST_HEADER = { - 'Accept': 'application/json', - 'Content-Type': 'application/json' -}; -export const CREDENTIALS = 'same-origin'; -export const ERROR_RETRIEVING_DATA = 'Error fetching data from server'; -const BACKEND_IP_ADDRESS = document.location.hostname; -const BACKEND_PORT_NUMBER = window.location.port; -const PROTOCOL = window.location.protocol; -export const BASE_URL = PROTOCOL + '//' + BACKEND_IP_ADDRESS + ':' + BACKEND_PORT_NUMBER; diff --git a/src/editAttributes/networking/NetworkUtils.js b/src/editAttributes/networking/NetworkUtils.js deleted file mode 100644 index c8e65cb..0000000 --- a/src/editAttributes/networking/NetworkUtils.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * org.onap.aai - * ================================================================================ - * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. - * Copyright © 2017-2018 Amdocs - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ -export function createEditEntityAttributeRequestObject(uri, attributes) { - return { - 'entity-uri': uri, - 'attributes': { - ...attributes - } - }; -} |