From b0f2f345cc2d1cc3812ad8a06fc1898daf5842d0 Mon Sep 17 00:00:00 2001 From: Adam Wudzinski Date: Tue, 26 Mar 2019 16:47:06 +0100 Subject: [PATCH] Remove unused code Remove unsed code from generic-components and change tests directory structure to reflect src structure Change-Id: Iada2efb0f7cfb05557eb7cd709b8a0ed75976b03 Issue-ID: AAI-1618 Signed-off-by: awudzins --- resources/scss/_components.scss | 3 - .../componentManager/ComponentManager.jsx | 306 --------------------- .../componentManager/ComponentManagerConstants.js | 28 -- .../componentManager/ComponentManagerContainer.jsx | 111 -------- .../confirmations/ConfirmationModalView.jsx | 76 ----- .../dynamicViewLoader/DynamicViewLoaderActions.js | 33 --- .../DynamicViewLoaderConstants.js | 27 -- .../dynamicViewLoader/DynamicViewLoaderReducer.js | 37 --- .../dynamicViewLoader/dynamicViewLoader.jsx | 94 ------- src/generic-components/graph/SVGShape.jsx | 61 ---- src/generic-components/input/SelectInput.jsx | 77 ------ src/generic-components/input/ToggleInput.jsx | 76 ----- .../input/inputOptions/InputOptions.jsx | 241 ---------------- .../notifications/NotificationConstants.js | 29 -- .../notifications/NotificationModal.jsx | 121 -------- .../notifications/NotificationReducer.js | 48 ---- src/generic-components/panel/SlidePanel.jsx | 137 --------- .../toggleButtonGroup/ToggleButtonGroup.jsx | 76 ----- .../toggleButtonGroup/ToggleButtonGroupActions.js | 27 -- .../ToggleButtonGroupConstants.js | 26 -- .../toggleButtonGroup/ToggleButtonGroupReducer.js | 34 --- src/generic-components/treeNode/TreeNode.jsx | 74 ----- test/{ => app}/MainScreenWrapperReducer.test.js | 0 .../ConfigurableViewActions.test.js | 0 .../ConfigurableViewReducer.test.js | 0 .../GlobalAutoCompleteSearchBar.test.js | 0 .../GlobalAutoCompleteSearchBarReducer.test.js | 0 .../GlobalInlineMessageBar.test.js | 0 .../GlobalInlineMessageBarAction.test.js | 0 .../GlobalInlineMessageBarReducer.test.js | 0 test/{ => app}/networking/NetworkCalls.test.js | 0 test/{ => app}/networking/NetworkUtil.test.js | 0 .../tierSupport/SelectedNodeDetails.test.js | 0 .../tierSupport/SelectedNodeDetailsReducer.test.js | 0 .../tierSupport/TierSupportActions.test.js | 0 .../tierSupport/TierSupportReducer.test.js | 0 test/{ => app}/vnfSearch/VnfSearch.test.js | 0 test/{ => app}/vnfSearch/VnfSearchActions.test.js | 0 .../vnfSearch/VnfSearchNfRoleVisualization.test.js | 0 .../vnfSearch/VnfSearchNfTypeVisualization.test.js | 0 ...nfSearchOrchestratedStatusVisualization.test.js | 0 .../VnfSearchProvStatusVisualization.test.js | 0 test/{ => app}/vnfSearch/VnfSearchReducer.test.js | 0 .../VnfSearchTotalCountVisualization.test.js | 0 .../AutoCompleteSearchBar.test.js | 0 .../notifications/NotificationReducer.test.js | 197 ------------- test/generic-components/treeNode/TreeNode.test.js | 41 --- test/input/SelectInput.test.js | 13 - test/input/ToggleInput.test.js | 12 - 49 files changed, 2005 deletions(-) delete mode 100644 src/generic-components/componentManager/ComponentManager.jsx delete mode 100644 src/generic-components/componentManager/ComponentManagerConstants.js delete mode 100644 src/generic-components/componentManager/ComponentManagerContainer.jsx delete mode 100644 src/generic-components/confirmations/ConfirmationModalView.jsx delete mode 100644 src/generic-components/dynamicViewLoader/DynamicViewLoaderActions.js delete mode 100644 src/generic-components/dynamicViewLoader/DynamicViewLoaderConstants.js delete mode 100644 src/generic-components/dynamicViewLoader/DynamicViewLoaderReducer.js delete mode 100644 src/generic-components/dynamicViewLoader/dynamicViewLoader.jsx delete mode 100644 src/generic-components/graph/SVGShape.jsx delete mode 100644 src/generic-components/input/SelectInput.jsx delete mode 100644 src/generic-components/input/ToggleInput.jsx delete mode 100644 src/generic-components/input/inputOptions/InputOptions.jsx delete mode 100644 src/generic-components/notifications/NotificationConstants.js delete mode 100644 src/generic-components/notifications/NotificationModal.jsx delete mode 100644 src/generic-components/notifications/NotificationReducer.js delete mode 100644 src/generic-components/panel/SlidePanel.jsx delete mode 100644 src/generic-components/toggleButtonGroup/ToggleButtonGroup.jsx delete mode 100644 src/generic-components/toggleButtonGroup/ToggleButtonGroupActions.js delete mode 100644 src/generic-components/toggleButtonGroup/ToggleButtonGroupConstants.js delete mode 100644 src/generic-components/toggleButtonGroup/ToggleButtonGroupReducer.js delete mode 100644 src/generic-components/treeNode/TreeNode.jsx rename test/{ => app}/MainScreenWrapperReducer.test.js (100%) rename test/{ => app}/configurableViews/ConfigurableViewActions.test.js (100%) rename test/{ => app}/configurableViews/ConfigurableViewReducer.test.js (100%) rename test/{ => app}/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBar.test.js (100%) rename test/{ => app}/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarReducer.test.js (100%) rename test/{ => app}/globalInlineMessageBar/GlobalInlineMessageBar.test.js (100%) rename test/{ => app}/globalInlineMessageBar/GlobalInlineMessageBarAction.test.js (100%) rename test/{ => app}/globalInlineMessageBar/GlobalInlineMessageBarReducer.test.js (100%) rename test/{ => app}/networking/NetworkCalls.test.js (100%) rename test/{ => app}/networking/NetworkUtil.test.js (100%) rename test/{ => app}/tierSupport/SelectedNodeDetails.test.js (100%) rename test/{ => app}/tierSupport/SelectedNodeDetailsReducer.test.js (100%) rename test/{ => app}/tierSupport/TierSupportActions.test.js (100%) rename test/{ => app}/tierSupport/TierSupportReducer.test.js (100%) rename test/{ => app}/vnfSearch/VnfSearch.test.js (100%) rename test/{ => app}/vnfSearch/VnfSearchActions.test.js (100%) rename test/{ => app}/vnfSearch/VnfSearchNfRoleVisualization.test.js (100%) rename test/{ => app}/vnfSearch/VnfSearchNfTypeVisualization.test.js (100%) rename test/{ => app}/vnfSearch/VnfSearchOrchestratedStatusVisualization.test.js (100%) rename test/{ => app}/vnfSearch/VnfSearchProvStatusVisualization.test.js (100%) rename test/{ => app}/vnfSearch/VnfSearchReducer.test.js (100%) rename test/{ => app}/vnfSearch/VnfSearchTotalCountVisualization.test.js (100%) rename test/{ => generic-components}/autoCompleteSearchBar/AutoCompleteSearchBar.test.js (100%) delete mode 100644 test/generic-components/notifications/NotificationReducer.test.js delete mode 100644 test/generic-components/treeNode/TreeNode.test.js delete mode 100644 test/input/SelectInput.test.js delete mode 100644 test/input/ToggleInput.test.js diff --git a/resources/scss/_components.scss b/resources/scss/_components.scss index ca926f0..2f696cc 100644 --- a/resources/scss/_components.scss +++ b/resources/scss/_components.scss @@ -20,12 +20,9 @@ */ @import "components/validationForm"; -@import "components/slidePanel"; -@import "components/toggleInput"; @import "components/notifications"; @import "components/dropdownMultiSelect"; @import "components/inlineMessage"; -@import "components/toggleButtonGroup"; @import "components/titledComponent"; @import "components/containerPanel"; @import "components/filterBar"; diff --git a/src/generic-components/componentManager/ComponentManager.jsx b/src/generic-components/componentManager/ComponentManager.jsx deleted file mode 100644 index 7b94279..0000000 --- a/src/generic-components/componentManager/ComponentManager.jsx +++ /dev/null @@ -1,306 +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 ComponentManagerContainer from - 'generic-components/componentManager/ComponentManagerContainer.jsx'; -import { - MIN_PANEL_WIDTH, - MIN_PANEL_HEIGHT, - MAX_PANEL_WIDTH, - EDIT_ICON, - LAYOUT_STATIC -} from 'generic-components/componentManager/ComponentManagerConstants.js'; - -var widthProvider = require('react-grid-layout').WidthProvider; -var ReactGridLayout = require('react-grid-layout'); -ReactGridLayout = widthProvider(ReactGridLayout); - -export default class ComponentManager extends Component { - constructor(props) { - super(props); - - if (props.layoutType === LAYOUT_STATIC && - Object.keys(props.layoutFormat).length > 0) { - this.state = { - layout: props.layoutFormat.layout, - panels: props.layoutFormat.panels, - containers: props.layoutFormat.containers - }; - } else { - this.state = { - layout: [], - panels: [], - containers: [] - }; - } - this.onLayoutChange = this.onLayoutChange.bind(this); - } - - createContainer( - containerId, xPos, yPos, width, height, staticLayout = false) { - if (staticLayout) { - return { - id: containerId, - properties: { - x: xPos, - y: yPos, - w: width, - h: height, - isDraggable: false, - isResizable: false - } - }; - } else { - return { - id: containerId, - properties: { - x: xPos, - y: yPos, - w: width, - h: height, - minW: MIN_PANEL_WIDTH, - maxW: MAX_PANEL_WIDTH, - minH: MIN_PANEL_HEIGHT - } - }; - } - } - - createPanel(id, title, panelSource, panelProps, actionList) { - return { - id: id, - title: title, - source: panelSource, - props: panelProps, - actions: actionList - }; - } - - addNewComponent(compProps, containingContainerId) { - let containerId = containingContainerId; - let actionsList = []; - - if (typeof containerId === 'undefined' || containerId === null) { - // new component being added isn't associated with a - // container yet, so create one - containerId = 'container:' + (new Date).getTime(); - let updatedContainerProps = []; - this.state.containers.forEach((containerProps) => { - updatedContainerProps.push(containerProps); - }); - updatedContainerProps.push( - this.createContainer(containerId, 0, Infinity, 12, 2)); - this.setState({containers: updatedContainerProps}); - - actionsList = [ - { - type: 'close', id: containerId, callback: () => { - this.removeExistingComponent(containerId); - } - } - ]; - } else { - // we are updating a static container with a new panel, add the edit - // action so it can be updated moving forward - actionsList = [ - { - type: 'custom', - id: containingContainerId, - icon: EDIT_ICON, - callback: () => { - this.props.addPanelCallback(containingContainerId); - } - } - ]; - } - - let updatedPanelProps = []; - this.state.panels.forEach((panelProp) => { - if (panelProp.id !== containingContainerId) { - // add all existing panels except the one with a - // matching id (this is an edit scenario, will replace - // with new panel below - updatedPanelProps.push(panelProp); - } - }); - updatedPanelProps.push( - this.createPanel( - containerId, - compProps.title, - compProps.visualizationSource, - compProps.visualizationProps, - actionsList)); - this.setState({panels: updatedPanelProps}); - } - - removeExistingComponent(id) { - let updatedPanelProps = this.state.panels.filter((panelProp) => { - return id !== panelProp.id; - }); - this.setState({panels: updatedPanelProps}); - - let updatedContainerProps = this.state.containers.filter( - (containerProp) => { - return id !== containerProp.id; - }); - this.setState({containers: updatedContainerProps}); - } - - getLayoutProperties() { - return { - layout: this.state.layout, - containers: this.state.containers, - panels: this.state.panels - }; - } - - setLayoutProperties(layoutProperties) { - this.setState({ - layout: layoutProperties.layout, - containers: layoutProperties.containers, - panels: layoutProperties.panels - }); - } - - fetchMatchingPanel(containerId) { - let actionsList = []; - let matchingPanel = ( - - {'Please select a visualization'} - - ); - this.state.panels.forEach((panel) => { - if (panel.id === containerId) { - let GeneratedComponent = - this.props.componentPropertiesProvider[panel.source].component.class; - let visProps = panel.props; - matchingPanel = ( - - - - ); - } - }); - return matchingPanel; - } - - preparedContainers() { - let containersToRender = []; - - this.state.containers.forEach((container) => { - let matchingPanel = this.fetchMatchingPanel(container.id); - - containersToRender.push(
- {matchingPanel} -
); - }); - - return containersToRender; - } - - onLayoutChange(layout) { - this.setState({layout: layout}); - this.props.onLayoutChange(layout); - } - - buildStaticContainers(layoutFormat) { - let staticContainers = []; - let nextRowIndex = 0; - - layoutFormat.layout.forEach((row) => { - let nextColIndex = 0; - let currentTallestContainer = 0; - - row.forEach((col) => { - let containerId = 'container:' + nextRowIndex + '-' + nextColIndex; - let xPos = nextColIndex; - let yPos = nextRowIndex; - let width = 12 * col.width; - let height = col.height; - - nextColIndex = nextColIndex + width; - currentTallestContainer = Math.max(currentTallestContainer, col.height); - - staticContainers.push( - this.createContainer( - containerId, - xPos, - yPos, - width, - height, - true - ) - ); - }); - - nextRowIndex = currentTallestContainer; - }); - - return staticContainers; - } - - componentWillReceiveProps(nextProps) { - if (nextProps.layoutFormat !== this.props.layoutFormat) { - // layout format being passed in are the containers, panels and layout - // for the newly view - this.setState({ - layout: nextProps.layoutFormat.layout, - panels: nextProps.layoutFormat.panels, - containers: nextProps.layoutFormat.containers - }); - } - } - - render() { - - return ( -
- - {this.preparedContainers()} - -
- ); - } -} -ComponentManager.defaultProps = { - cols: 12, - rewHeight: 100, - onLayoutChange: function () { - }, - showHeader: true, - showTitle: true, - showBorder: true -}; diff --git a/src/generic-components/componentManager/ComponentManagerConstants.js b/src/generic-components/componentManager/ComponentManagerConstants.js deleted file mode 100644 index c2f5616..0000000 --- a/src/generic-components/componentManager/ComponentManagerConstants.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 const MIN_PANEL_WIDTH = 1; -export const MIN_PANEL_HEIGHT = 1; -export const MAX_PANEL_WIDTH = 12; - -export const EDIT_ICON = 'fa-pencil'; - -export const LAYOUT_STATIC = 'static'; -export const LAYOUT_DYNAMIC = 'dynamic'; diff --git a/src/generic-components/componentManager/ComponentManagerContainer.jsx b/src/generic-components/componentManager/ComponentManagerContainer.jsx deleted file mode 100644 index cd51d37..0000000 --- a/src/generic-components/componentManager/ComponentManagerContainer.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 { PropTypes } from 'prop-types'; -import ButtonGroup from 'react-bootstrap/lib/ButtonGroup'; -import Button from 'react-bootstrap/lib/Button'; - -import i18n from 'utils/i18n/i18n'; - -const ICON_CLASS_CLOSE = 'fa fa-times'; - -export default class ComponentManagerContainer extends Component { - - static propType = { - id: PropTypes.string, - title: PropTypes.string, - actions: PropTypes.array, - showHeader: PropTypes.bool, - showTitle: PropTypes.bool, - showBorder: PropTypes.bool, - }; - - static defaultProps = { - id: '', - title: 'Some Title', - actions: [], - showHeader: true, - showTitle: true, - showBorder: true - }; - - constructor(props) { - super(props); - } - - render() { - let { - title, - actions, - children, - showHeader, - showTitle, - showBorder - } = this.props; - let buttons = []; - actions.forEach((action) => { - switch (action.type) { - case 'close': - buttons.push( - - ); - break; - case 'custom': - buttons.push( - - ); - break; - } - }); - - let containerClass = showBorder - ? 'titled-container titled-container-boarders' - : 'titled-container'; - let headerClass = showHeader ? 'titled-container-header' : 'hidden'; - let titleClass = showTitle ? '' : 'hidden'; - - return ( -
- {buttons} -
- {i18n(title)} -
-
- {children} -
-
- ); - } -} diff --git a/src/generic-components/confirmations/ConfirmationModalView.jsx b/src/generic-components/confirmations/ConfirmationModalView.jsx deleted file mode 100644 index 39fea97..0000000 --- a/src/generic-components/confirmations/ConfirmationModalView.jsx +++ /dev/null @@ -1,76 +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 { PropTypes } from 'prop-types'; -import Button from 'react-bootstrap/lib/Button.js'; - -import i18n from 'utils/i18n/i18n.js'; -import Modal from 'generic-components/modal/Modal.jsx'; - -let typeClass = { - 'default': 'primary', - error: 'danger', - warning: 'warning', - success: 'success' -}; - - -class ConfirmationModalView extends React.Component { - - static propTypes = { - show: PropTypes.bool, - type: PropTypes.oneOf(['default', 'error', 'warning', 'success']), - msg: PropTypes.node, - title: PropTypes.string, - confirmationDetails: PropTypes.object - }; - - static defaultProps = { - show: false, - type: 'warning', - title: 'Warning', - msg: '' - }; - - render() { - let {title, type, msg, show} = this.props; - - return ( - - - {title} - - {msg} - - - - - - ); - }; -} - -export default ConfirmationModalView; diff --git a/src/generic-components/dynamicViewLoader/DynamicViewLoaderActions.js b/src/generic-components/dynamicViewLoader/DynamicViewLoaderActions.js deleted file mode 100644 index 1d6a401..0000000 --- a/src/generic-components/dynamicViewLoader/DynamicViewLoaderActions.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 { - dynamicViewLoaderActionTypes -} - from 'generic-components/dynamicViewLoader/DynamicViewLoaderConstants.js'; - -export function processLayoutSourceChange(layoutSource) { - return { - type: dynamicViewLoaderActionTypes.DVL_LAYOUT_SOURCE_CHANGE, - data: { - layoutSource: layoutSource - } - }; -} diff --git a/src/generic-components/dynamicViewLoader/DynamicViewLoaderConstants.js b/src/generic-components/dynamicViewLoader/DynamicViewLoaderConstants.js deleted file mode 100644 index 2afe167..0000000 --- a/src/generic-components/dynamicViewLoader/DynamicViewLoaderConstants.js +++ /dev/null @@ -1,27 +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'; - -export const dynamicViewLoaderActionTypes = keyMirror({ - DVL_LAYOUT_SOURCE_CHANGE: null -}); - -export const DYNAMIC_VIEW_LOADER_TITLE = 'Dynamic View'; diff --git a/src/generic-components/dynamicViewLoader/DynamicViewLoaderReducer.js b/src/generic-components/dynamicViewLoader/DynamicViewLoaderReducer.js deleted file mode 100644 index 390856a..0000000 --- a/src/generic-components/dynamicViewLoader/DynamicViewLoaderReducer.js +++ /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 {combineReducers} from 'redux'; - -import {dynamicViewLoaderActionTypes} from 'generic-components/dynamicViewLoader/DynamicViewLoaderConstants.js'; - -export default combineReducers({ - dynamicViewLoadData: (state = {}, action) => { - switch (action.type) { - case dynamicViewLoaderActionTypes.DVL_LAYOUT_SOURCE_CHANGE: - return { - ...state, - layoutSource: action.data.layoutSource - }; - } - - return state; - } -}); diff --git a/src/generic-components/dynamicViewLoader/dynamicViewLoader.jsx b/src/generic-components/dynamicViewLoader/dynamicViewLoader.jsx deleted file mode 100644 index 7732951..0000000 --- a/src/generic-components/dynamicViewLoader/dynamicViewLoader.jsx +++ /dev/null @@ -1,94 +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 { PropTypes } from 'prop-types'; -import {connect} from 'react-redux'; - -import DateRangeSelector from 'generic-components/dateRangeSelector/DateRangeSelector.jsx'; -import ComponentManager from 'generic-components/componentManager/ComponentManager.jsx'; -import {DYNAMIC_VIEW_LOADER_TITLE} from 'generic-components/dynamicViewLoader/DynamicViewLoaderConstants.js'; -import {processLayoutSourceChange} from 'generic-components/dynamicViewLoader/DynamicViewLoaderActions.js'; -import {visualizationProviderProperties} from 'generic-components/dynamicViewLoader/VisualizationProvider.js'; -import {LAYOUT_STATIC} from 'generic-components/componentManager/ComponentManagerConstants.js'; - -import i18n from 'utils/i18n/i18n'; -import customViews from 'resources/views/customViews.json'; - -const mapStateToProps = - ({dynamicViewReducer: {dynamicViewLoadData}}) => { - let { - viewTitle = i18n(DYNAMIC_VIEW_LOADER_TITLE), - layoutSource = {} - } = dynamicViewLoadData; - - return { - viewTitle, - layoutSource - }; - }; - -let mapActionToProps = (dispatch) => { - return { - onLayoutSourceChange: (layoutSource) => { - dispatch(processLayoutSourceChange(layoutSource)); - } - }; -}; - -class DynamicViewLoader extends Component { - static propTypes = { - viewTitle: PropTypes.string, - layoutSource: PropTypes.object - }; - - componentWillMount() { - let viewName = this.props.location.pathname.split('/'); - - for (let view in customViews) { - if (customViews[view]['viewName'] === viewName[1]) { - this.props.onLayoutSourceChange(customViews[view]['layoutProperties']); - } - } - } - - render() { - let {viewTitle, layoutSource} = this.props; - - return ( -
-
- - {viewTitle} - - -
- -
- ); - } -} -export default connect(mapStateToProps, mapActionToProps)(DynamicViewLoader); diff --git a/src/generic-components/graph/SVGShape.jsx b/src/generic-components/graph/SVGShape.jsx deleted file mode 100644 index 8b33598..0000000 --- a/src/generic-components/graph/SVGShape.jsx +++ /dev/null @@ -1,61 +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 { PropTypes } from 'prop-types'; -import NodeVisualElementConstants from './NodeVisualElementConstants'; - -class SVGShape extends Component { - - static propTypes = { - shapeType: PropTypes.string.isRequired, - shapeAttributes: PropTypes.object.isRequired, - shapeClass: PropTypes.object.isRequired, - textValue: PropTypes.string - }; - - static defaultProps = { - shapeType: '', - shapeAttributes: {}, - shapeClass: {}, - textValue: '' - }; - - render() { - let {shapeType, shapeAttributes, shapeClass, textValue} = this.props; - - switch (shapeType) { - case NodeVisualElementConstants.SVG_CIRCLE: - return ; - - case NodeVisualElementConstants.SVG_LINELINE: - return ; - - case NodeVisualElementConstants.TEXT: - return {textValue}; - - default: - return undefined; - } - } -} - -export default SVGShape; diff --git a/src/generic-components/input/SelectInput.jsx b/src/generic-components/input/SelectInput.jsx deleted file mode 100644 index dbe6a20..0000000 --- a/src/generic-components/input/SelectInput.jsx +++ /dev/null @@ -1,77 +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========================================================= - */ -/** - * The HTML structure here is aligned with bootstrap HTML structure for form - * elements. In this way we have proper styling and it is aligned with other - * form elements on screen. - * - * Select and MultiSelect options: - * - * label - the label to be shown which paired with the input - * - * all other "react-select" props - as documented on - * http://jedwatson.github.io/react-select/ - * or - * https://github.com/JedWatson/react-select - */ -import React, {Component} from 'react'; -import Select from 'react-select'; -import 'react-select/dist/react-select.css'; - -class SelectInput extends Component { - - inputValue = []; - - render() { - let {label, value, ...other} = this.props; - return ( -
-
- {label && } - - -
-
- ); - } - - click = () => { - let value = !this.state.value; - this.setState({value}); - - let onChange = this.props.onChange; - if (onChange) { - onChange(value); - } - } - - getValue() { - return this.state.value; - } -} diff --git a/src/generic-components/input/inputOptions/InputOptions.jsx b/src/generic-components/input/inputOptions/InputOptions.jsx deleted file mode 100644 index bf17df1..0000000 --- a/src/generic-components/input/inputOptions/InputOptions.jsx +++ /dev/null @@ -1,241 +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 { PropTypes } from 'prop-types'; -import i18n from 'utils/i18n/i18n.js'; -import classNames from 'classnames'; -import Select from 'generic-components/input/SelectInput.jsx'; - -export const other = {OTHER: 'Other'}; - -class InputOptions extends React.Component { - - static propTypes = { - values: PropTypes.arrayOf(PropTypes.shape({ - enum: PropTypes.string, - title: PropTypes.string - })), - isEnabledOther: PropTypes.bool, - title: PropTypes.string, - selectedValue: PropTypes.string, - multiSelectedEnum: PropTypes.array, - selectedEnum: PropTypes.string, - otherValue: PropTypes.string, - onEnumChange: PropTypes.func, - onOtherChange: PropTypes.func, - isRequired: PropTypes.bool, - isMultiSelect: PropTypes.bool - }; - - - static contextTypes = { - isReadOnlyMode: PropTypes.bool - }; - - state = { - otherInputDisabled: !this.props.otherValue - }; - - oldProps = { - selectedEnum: '', - otherValue: '', - multiSelectedEnum: [] - }; - - render() { - let {label, isRequired, values, otherValue, onOtherChange, isMultiSelect, onBlur, multiSelectedEnum, selectedEnum, hasError, validations, children} = this.props; - - let currentMultiSelectedEnum = []; - let currentSelectedEnum = ''; - let {otherInputDisabled} = this.state; - if (isMultiSelect) { - currentMultiSelectedEnum = multiSelectedEnum; - if (!otherInputDisabled) { - currentSelectedEnum = - multiSelectedEnum ? multiSelectedEnum.toString() : undefined; - } - } - else { - currentSelectedEnum = selectedEnum; - } - - let isReadOnlyMode = this.context.isReadOnlyMode; - - return ( -
- - {isMultiSelect && otherInputDisabled ? - onBlur()} - disabled={isReadOnlyMode || Boolean(this.props.disabled)} - onChange={ value => this.enumChanged(value)} - type='select'> - {values && - values.length && - values.map(val => this.renderOptions(val))} - {onOtherChange && } - {children} - - - {!otherInputDisabled &&
} - onBlur()} - onChange={() => this.changedOtherInput()}/> -
- } -
- ); - } - - renderOptions(val) { - return ( - - ); - } - - - renderMultiSelectOptions(values) { - let {onOtherChange} = this.props; - let optionsList = []; - if (onOtherChange) { - optionsList = values.map(option => { - return { - label: option.title, - value: option.enum, - }; - }).concat([{ - label: i18n(other.OTHER), - value: i18n(other.OTHER), - }]); - } - else { - optionsList = values.map(option => { - return { - label: option.title, - value: option.enum, - }; - }); - } - if (optionsList.length > 0 && optionsList[0].value === '') { - optionsList.shift(); - } - return optionsList; - } - - getValue() { - let res = ''; - let {isMultiSelect} = this.props; - let {otherInputDisabled} = this.state; - - if (otherInputDisabled) { - res = - isMultiSelect - ? this.refs._myInput.getValue() - : this.refs._myInput.value; - } else { - res = this.refs._otherValue.value; - } - return res; - } - - enumChanged() { - let enumValue = this.refs._myInput.value; - let {onEnumChange, isMultiSelect, onChange} = this.props; - this.setState({ - otherInputDisabled: enumValue !== other.OTHER - }); - if (onEnumChange) { - onEnumChange(isMultiSelect ? [enumValue] : enumValue); - } - - if (onChange) { - onChange(enumValue); - } - - } - - multiSelectEnumChanged(enumValue) { - let {onEnumChange} = this.props; - let selectedValues = enumValue.map(enumVal => { - return enumVal.value; - }); - - if (this.state.otherInputDisabled === false) { - selectedValues.shift(); - } - else if (selectedValues.includes(i18n(other.OTHER))) { - selectedValues = [i18n(other.OTHER)]; - } - - this.setState({ - otherInputDisabled: !selectedValues.includes(i18n(other.OTHER)) - }); - onEnumChange(selectedValues); - } - - changedOtherInput() { - let {onOtherChange} = this.props; - onOtherChange(this.refs._otherValue.value); - } - - componentDidUpdate() { - let {otherValue, selectedEnum, onInputChange, multiSelectedEnum} = this.props; - if (this.oldProps.otherValue !== otherValue - || this.oldProps.selectedEnum !== selectedEnum - || this.oldProps.multiSelectedEnum !== multiSelectedEnum) { - this.oldProps = { - otherValue, - selectedEnum, - multiSelectedEnum - }; - onInputChange(); - } - } - -} - -export default InputOptions; diff --git a/src/generic-components/notifications/NotificationConstants.js b/src/generic-components/notifications/NotificationConstants.js deleted file mode 100644 index 299ddaa..0000000 --- a/src/generic-components/notifications/NotificationConstants.js +++ /dev/null @@ -1,29 +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'; - -export default keyMirror({ - NOTIFY_ERROR: null, - NOTIFY_SUCCESS: null, - NOTIFY_WARNING: null, - NOTIFY_INFO: null, - NOTIFY_CLOSE: null -}); diff --git a/src/generic-components/notifications/NotificationModal.jsx b/src/generic-components/notifications/NotificationModal.jsx deleted file mode 100644 index 0e747d5..0000000 --- a/src/generic-components/notifications/NotificationModal.jsx +++ /dev/null @@ -1,121 +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========================================================= - */ -/** - * NotificationModal options: - * - * show: whether to show notification or not, - * type: the type of the notification. valid values are: 'default', 'error', - * 'warning', 'success' msg: the notification content. could be a string or - * node (React component) title: the notification title timeout: timeout for - * the notification to fade out. if timeout == 0 then the notification is - * rendered until the user closes it - * - */ -import React, {Component} from 'react'; -import { PropTypes } from 'prop-types'; -import {connect} from 'react-redux'; -import Button from 'react-bootstrap/lib/Button.js'; - -import i18n from 'utils/i18n/i18n.js'; -import Modal from 'generic-components/modal/Modal.jsx'; -import NotificationConstants from './NotificationConstants.js'; - -let typeClass = { - 'default': 'primary', - error: 'danger', - warning: 'warning', - success: 'success' -}; - -const mapActionsToProps = (dispatch) => { - return { - onCloseClick: () => dispatch({type: NotificationConstants.NOTIFY_CLOSE}) - }; -}; - -const mapStateToProps = ({notification}) => { - - let show = notification !== null && notification.title !== 'Conflict'; - let mapResult = {show}; - if (show) { - mapResult = {show, ...notification}; - } - - return mapResult; -}; - -class NotificationModal extends Component { - - static propTypes = { - show: PropTypes.bool, - type: PropTypes.oneOf(['default', 'error', 'warning', 'success']), - msg: PropTypes.node, - title: PropTypes.string, - timeout: PropTypes.number - }; - - static defaultProps = { - show: false, - type: 'default', - title: '', - msg: '', - timeout: 0 - }; - - state = {type: undefined}; - - componentWillReceiveProps(nextProps) { - if (this.props.show !== nextProps.show && nextProps.show === false) { - this.setState({type: this.props.type}); - } - else { - this.setState({type: undefined}); - } - } - - componentDidUpdate() { - if (this.props.timeout) { - setTimeout(this.props.onCloseClick, this.props.timeout); - } - } - - render() { - let {title, type, msg, show} = this.props; - if (!show) { - type = this.state.type; - } - return ( - - - {title} - - {msg} - - - - - ); - } -} - -export default connect(mapStateToProps, mapActionsToProps)(NotificationModal); diff --git a/src/generic-components/notifications/NotificationReducer.js b/src/generic-components/notifications/NotificationReducer.js deleted file mode 100644 index 1f5122c..0000000 --- a/src/generic-components/notifications/NotificationReducer.js +++ /dev/null @@ -1,48 +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 NotificationConstants from './NotificationConstants.js'; - -export default (state = null, action) => { - switch (action.type) { - case NotificationConstants.NOTIFY_INFO: - return createStatus('default', action); - case NotificationConstants.NOTIFY_ERROR: - return createStatus('error', action); - case NotificationConstants.NOTIFY_WARNING: - return createStatus('warning', action); - case NotificationConstants.NOTIFY_SUCCESS: - return createStatus('success', action); - case NotificationConstants.NOTIFY_CLOSE: - return null; - default: - return state; - } - -}; - -function createStatus(type, action) { - return { - type: type, - title: action.data.title, - msg: action.data.msg, - timeout: action.data.timeout - }; -} diff --git a/src/generic-components/panel/SlidePanel.jsx b/src/generic-components/panel/SlidePanel.jsx deleted file mode 100644 index 1550cee..0000000 --- a/src/generic-components/panel/SlidePanel.jsx +++ /dev/null @@ -1,137 +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 { PropTypes } from 'prop-types'; -import FontAwesome from 'react-fontawesome'; -import ReactDOM from 'react-dom'; - -class SlidePanel extends React.Component { - - static PropTypes = { - direction: PropTypes.string.isRequired, - className: PropTypes.string, - title: PropTypes.string, - isOpen: PropTypes.bool - }; - - static defaultProps = { - title: '', - className: '', - isOpen: true - }; - - state = { - isOpen: this.props.isOpen, - direction: this.props.direction, - width: 0, - arrowWidth: 0 - }; - - componentDidMount() { - this.setSliderPosition(); - } - - componentDidUpdate() { - this.setSliderPosition(); - } - - render() { - - let {children, className} = this.props; - let {isOpen} = this.state; - - return ( -
- {this.renderHeader(isOpen)} -
{children}
-
- ); - } - - renderHeader(isOpen) { - let {direction: initialDirection, title} = this.props; - let {direction: currentDirection} = this.state; - - let iconName = currentDirection === - 'right' - ? 'angle-double-right collapse-double-icon' - : 'angle-double-left collapse-double-icon'; - - let awestyle = {padding: '5px'}; - - if (!isOpen && initialDirection === 'right') { - awestyle.marginLeft = '-1px'; - } - return ( -
- { initialDirection === 'left' && - {title}} - - { initialDirection === 'right' && - {title}} -
- ); - } - - handleClick = () => { - this.setState({ - isOpen: !this.state.isOpen, - direction: this.state.direction === 'left' ? 'right' : 'left' - }); - } - - setSliderPosition = () => { - - let el = ReactDOM.findDOMNode(this); - let {style} = el; - - let {direction: initialDirection} = this.props; - let arrowIconSize = Math.floor(ReactDOM.findDOMNode(this.refs.arrowIcon) - .getBoundingClientRect().width) * 2; - if (!this.state.isOpen) { - if (this.props.direction === 'left') { - style.left = arrowIconSize - el.getBoundingClientRect().width + 'px'; - } - if (initialDirection === 'right') { - style.right = arrowIconSize - el.getBoundingClientRect().width + 'px'; - } - } - else { - if (initialDirection === 'left') { - style.left = '0px'; - } - - if (this.props.direction === 'right') { - style.right = '0px'; - } - } - } - -} - -export default SlidePanel; diff --git a/src/generic-components/toggleButtonGroup/ToggleButtonGroup.jsx b/src/generic-components/toggleButtonGroup/ToggleButtonGroup.jsx deleted file mode 100644 index 0fe8939..0000000 --- a/src/generic-components/toggleButtonGroup/ToggleButtonGroup.jsx +++ /dev/null @@ -1,76 +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 { PropTypes } from 'prop-types'; -import {connect} from 'react-redux'; - -import ButtonGroup from 'react-bootstrap/lib/ButtonGroup.js'; -import Button from 'react-bootstrap/lib/Button.js'; - -import ToggleButtonGroupActions from 'generic-components/toggleButtonGroup/ToggleButtonGroupActions.js'; - -let mapActionToProps = (dispatch) => { - return { - onButtonToggle: (buttonName) => { - dispatch(ToggleButtonGroupActions.onToggle({button: buttonName})); - } - }; -}; - -let mapStateToProps = ({toggleButtonGroupData}) => { - - let {selectedButton} = toggleButtonGroupData; - - return { - selectedButton - }; -}; - -class ToggleButtonGroup extends Component { - - static propTypes = { - buttonDefinitions: PropTypes.object.isRequired - }; - - onButtonSelect(buttonName) { - this.props.onButtonToggle(buttonName); - } - - render() { - let {selectedButton, buttonDefinitions} = this.props; - let buttonListElements = []; - Object.keys(buttonDefinitions).map(function (item) { - buttonListElements.push( - - ); - }.bind(this)); - - return ( - - {buttonListElements} - - ); - } -} -export default connect(mapStateToProps, mapActionToProps)(ToggleButtonGroup); diff --git a/src/generic-components/toggleButtonGroup/ToggleButtonGroupActions.js b/src/generic-components/toggleButtonGroup/ToggleButtonGroupActions.js deleted file mode 100644 index a04d127..0000000 --- a/src/generic-components/toggleButtonGroup/ToggleButtonGroupActions.js +++ /dev/null @@ -1,27 +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 ToggleButtonGroupConstants from './ToggleButtonGroupConstants.js'; - -export default { - onToggle(buttonName) { - return {type: ToggleButtonGroupConstants.BUTTON_TOGGLED, data: buttonName}; - } -}; diff --git a/src/generic-components/toggleButtonGroup/ToggleButtonGroupConstants.js b/src/generic-components/toggleButtonGroup/ToggleButtonGroupConstants.js deleted file mode 100644 index 47c458a..0000000 --- a/src/generic-components/toggleButtonGroup/ToggleButtonGroupConstants.js +++ /dev/null @@ -1,26 +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========================================================= - */ -// events -const BUTTON_TOGGLED = 'BUTTON_TOGGLED'; - -module.exports = { - BUTTON_TOGGLED: BUTTON_TOGGLED -}; diff --git a/src/generic-components/toggleButtonGroup/ToggleButtonGroupReducer.js b/src/generic-components/toggleButtonGroup/ToggleButtonGroupReducer.js deleted file mode 100644 index e5a069b..0000000 --- a/src/generic-components/toggleButtonGroup/ToggleButtonGroupReducer.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========================================================= - */ -import {BUTTON_TOGGLED} from 'generic-components/toggleButtonGroup/ToggleButtonGroupConstants.js'; - -export default (state = {}, action) => { - - switch (action.type) { - - case BUTTON_TOGGLED: - return { - ...state, - selectedButton: action.data.button - }; - } - return state; -}; diff --git a/src/generic-components/treeNode/TreeNode.jsx b/src/generic-components/treeNode/TreeNode.jsx deleted file mode 100644 index 2807ca4..0000000 --- a/src/generic-components/treeNode/TreeNode.jsx +++ /dev/null @@ -1,74 +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 classNames from 'classnames'; - - - - -class TreeNode extends Component { - - - constructor(props) { - super(props); - this.state = { - visible: false, - }; - } - - toggle = () => { - this.setState({visible: !this.state.visible}); - }; - - render() { - var childNodes; - var classObj; - if (this.props.node !== undefined && this.props.node.childNodes !== undefined) { - childNodes = this.props.node.childNodes.map(function (node, index) { - return
  • ; - }); - - classObj = { - togglable: true, - 'togglable-down': this.state.visible, - 'togglable-up': !this.state.visible - }; - } - - var style; - if (!this.state.visible) { - style = {display: 'none'}; - } - - return ( -
    - - {this.props.node.title} - -
      - {childNodes} -
    -
    - ); - } -} - -export default TreeNode; diff --git a/test/MainScreenWrapperReducer.test.js b/test/app/MainScreenWrapperReducer.test.js similarity index 100% rename from test/MainScreenWrapperReducer.test.js rename to test/app/MainScreenWrapperReducer.test.js diff --git a/test/configurableViews/ConfigurableViewActions.test.js b/test/app/configurableViews/ConfigurableViewActions.test.js similarity index 100% rename from test/configurableViews/ConfigurableViewActions.test.js rename to test/app/configurableViews/ConfigurableViewActions.test.js diff --git a/test/configurableViews/ConfigurableViewReducer.test.js b/test/app/configurableViews/ConfigurableViewReducer.test.js similarity index 100% rename from test/configurableViews/ConfigurableViewReducer.test.js rename to test/app/configurableViews/ConfigurableViewReducer.test.js diff --git a/test/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBar.test.js b/test/app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBar.test.js similarity index 100% rename from test/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBar.test.js rename to test/app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBar.test.js diff --git a/test/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarReducer.test.js b/test/app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarReducer.test.js similarity index 100% rename from test/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarReducer.test.js rename to test/app/globalAutoCompleteSearchBar/GlobalAutoCompleteSearchBarReducer.test.js diff --git a/test/globalInlineMessageBar/GlobalInlineMessageBar.test.js b/test/app/globalInlineMessageBar/GlobalInlineMessageBar.test.js similarity index 100% rename from test/globalInlineMessageBar/GlobalInlineMessageBar.test.js rename to test/app/globalInlineMessageBar/GlobalInlineMessageBar.test.js diff --git a/test/globalInlineMessageBar/GlobalInlineMessageBarAction.test.js b/test/app/globalInlineMessageBar/GlobalInlineMessageBarAction.test.js similarity index 100% rename from test/globalInlineMessageBar/GlobalInlineMessageBarAction.test.js rename to test/app/globalInlineMessageBar/GlobalInlineMessageBarAction.test.js diff --git a/test/globalInlineMessageBar/GlobalInlineMessageBarReducer.test.js b/test/app/globalInlineMessageBar/GlobalInlineMessageBarReducer.test.js similarity index 100% rename from test/globalInlineMessageBar/GlobalInlineMessageBarReducer.test.js rename to test/app/globalInlineMessageBar/GlobalInlineMessageBarReducer.test.js diff --git a/test/networking/NetworkCalls.test.js b/test/app/networking/NetworkCalls.test.js similarity index 100% rename from test/networking/NetworkCalls.test.js rename to test/app/networking/NetworkCalls.test.js diff --git a/test/networking/NetworkUtil.test.js b/test/app/networking/NetworkUtil.test.js similarity index 100% rename from test/networking/NetworkUtil.test.js rename to test/app/networking/NetworkUtil.test.js diff --git a/test/tierSupport/SelectedNodeDetails.test.js b/test/app/tierSupport/SelectedNodeDetails.test.js similarity index 100% rename from test/tierSupport/SelectedNodeDetails.test.js rename to test/app/tierSupport/SelectedNodeDetails.test.js diff --git a/test/tierSupport/SelectedNodeDetailsReducer.test.js b/test/app/tierSupport/SelectedNodeDetailsReducer.test.js similarity index 100% rename from test/tierSupport/SelectedNodeDetailsReducer.test.js rename to test/app/tierSupport/SelectedNodeDetailsReducer.test.js diff --git a/test/tierSupport/TierSupportActions.test.js b/test/app/tierSupport/TierSupportActions.test.js similarity index 100% rename from test/tierSupport/TierSupportActions.test.js rename to test/app/tierSupport/TierSupportActions.test.js diff --git a/test/tierSupport/TierSupportReducer.test.js b/test/app/tierSupport/TierSupportReducer.test.js similarity index 100% rename from test/tierSupport/TierSupportReducer.test.js rename to test/app/tierSupport/TierSupportReducer.test.js diff --git a/test/vnfSearch/VnfSearch.test.js b/test/app/vnfSearch/VnfSearch.test.js similarity index 100% rename from test/vnfSearch/VnfSearch.test.js rename to test/app/vnfSearch/VnfSearch.test.js diff --git a/test/vnfSearch/VnfSearchActions.test.js b/test/app/vnfSearch/VnfSearchActions.test.js similarity index 100% rename from test/vnfSearch/VnfSearchActions.test.js rename to test/app/vnfSearch/VnfSearchActions.test.js diff --git a/test/vnfSearch/VnfSearchNfRoleVisualization.test.js b/test/app/vnfSearch/VnfSearchNfRoleVisualization.test.js similarity index 100% rename from test/vnfSearch/VnfSearchNfRoleVisualization.test.js rename to test/app/vnfSearch/VnfSearchNfRoleVisualization.test.js diff --git a/test/vnfSearch/VnfSearchNfTypeVisualization.test.js b/test/app/vnfSearch/VnfSearchNfTypeVisualization.test.js similarity index 100% rename from test/vnfSearch/VnfSearchNfTypeVisualization.test.js rename to test/app/vnfSearch/VnfSearchNfTypeVisualization.test.js diff --git a/test/vnfSearch/VnfSearchOrchestratedStatusVisualization.test.js b/test/app/vnfSearch/VnfSearchOrchestratedStatusVisualization.test.js similarity index 100% rename from test/vnfSearch/VnfSearchOrchestratedStatusVisualization.test.js rename to test/app/vnfSearch/VnfSearchOrchestratedStatusVisualization.test.js diff --git a/test/vnfSearch/VnfSearchProvStatusVisualization.test.js b/test/app/vnfSearch/VnfSearchProvStatusVisualization.test.js similarity index 100% rename from test/vnfSearch/VnfSearchProvStatusVisualization.test.js rename to test/app/vnfSearch/VnfSearchProvStatusVisualization.test.js diff --git a/test/vnfSearch/VnfSearchReducer.test.js b/test/app/vnfSearch/VnfSearchReducer.test.js similarity index 100% rename from test/vnfSearch/VnfSearchReducer.test.js rename to test/app/vnfSearch/VnfSearchReducer.test.js diff --git a/test/vnfSearch/VnfSearchTotalCountVisualization.test.js b/test/app/vnfSearch/VnfSearchTotalCountVisualization.test.js similarity index 100% rename from test/vnfSearch/VnfSearchTotalCountVisualization.test.js rename to test/app/vnfSearch/VnfSearchTotalCountVisualization.test.js diff --git a/test/autoCompleteSearchBar/AutoCompleteSearchBar.test.js b/test/generic-components/autoCompleteSearchBar/AutoCompleteSearchBar.test.js similarity index 100% rename from test/autoCompleteSearchBar/AutoCompleteSearchBar.test.js rename to test/generic-components/autoCompleteSearchBar/AutoCompleteSearchBar.test.js diff --git a/test/generic-components/notifications/NotificationReducer.test.js b/test/generic-components/notifications/NotificationReducer.test.js deleted file mode 100644 index 40d6b05..0000000 --- a/test/generic-components/notifications/NotificationReducer.test.js +++ /dev/null @@ -1,197 +0,0 @@ -import NotificationReducer from 'generic-components/notifications/NotificationReducer'; -import NotificationConstants from "generic-components/notifications/NotificationConstants"; - - -describe('NotificationReducer', () => { - const defaultState = { - type: 'default', - title: 'some default title', - msg: 'some default message', - timeout: 1 - }; - - it('Should return default state when action type is not supported', () => { - // given - const unsupportedAction = { - type: undefined - }; - - // when - const actualState = NotificationReducer(defaultState, unsupportedAction); - - // then - expect(actualState).toEqual(defaultState); - }); - - it('Should return state with type default when action type is info', () => { - // given - const expectedState = { - type: 'default', - title: 'some title', - msg: 'some message', - timeout: 5 - }; - - const infoAction = { - type: NotificationConstants.NOTIFY_INFO, - data: { - title: "some title", - msg: "some message", - timeout: 5 - } - }; - - // when - const actualState = NotificationReducer(defaultState, infoAction); - - // then - expect(actualState).toEqual(expectedState); - }); - - - it('Should return status with type success when action type is success', () => { - // given - const expectedState = { - type: 'success', - title: 'some title', - msg: 'some message', - timeout: 2 - }; - - const infoAction = { - type: NotificationConstants.NOTIFY_SUCCESS, - data: { - title: "some title", - msg: "some message", - timeout: 2 - } - }; - - // when - const actualState = NotificationReducer(defaultState, infoAction); - - // then - expect(actualState).toEqual(expectedState); - }); - - it('Should return status with type success when action type is success', () => { - // given - const expectedState = { - type: 'success', - title: 'some title', - msg: 'some message', - timeout: 2 - }; - - const infoAction = { - type: NotificationConstants.NOTIFY_SUCCESS, - data: { - title: "some title", - msg: "some message", - timeout: 2 - } - }; - - // when - const actualState = NotificationReducer(defaultState, infoAction); - - // then - expect(actualState).toEqual(expectedState); - }); - - it('Should return status with type error when action type is error', () => { - // given - const expectedState = { - type: 'error', - title: 'some title', - msg: 'some message', - timeout: 2 - }; - - const infoAction = { - type: NotificationConstants.NOTIFY_ERROR, - data: { - title: "some title", - msg: "some message", - timeout: 2 - } - }; - - // when - const actualState = NotificationReducer(defaultState, infoAction); - - // then - expect(actualState).toEqual(expectedState); - }); - - it('Should return status with type error when action type is error', () => { - // given - const expectedState = { - type: 'error', - title: 'some title', - msg: 'some message', - timeout: 2 - }; - - const infoAction = { - type: NotificationConstants.NOTIFY_ERROR, - data: { - title: "some title", - msg: "some message", - timeout: 2 - } - }; - - // when - const actualState = NotificationReducer(defaultState, infoAction); - - // then - expect(actualState).toEqual(expectedState); - }); - - it('Should return status with type warning when action type is warning', () => { - // given - const expectedState = { - type: 'warning', - title: 'some title', - msg: 'some message', - timeout: 2 - }; - - const infoAction = { - type: NotificationConstants.NOTIFY_WARNING, - data: { - title: "some title", - msg: "some message", - timeout: 2 - } - }; - - // when - const actualState = NotificationReducer(defaultState, infoAction); - - // then - expect(actualState).toEqual(expectedState); - }); - - it('Should return null when action type is close', () => { - // given - const expectedState = null; - - const infoAction = { - type: NotificationConstants.NOTIFY_CLOSE, - data: { - title: "some title", - msg: "some message", - timeout: 2 - } - }; - - // when - const actualState = NotificationReducer(defaultState, infoAction); - - // then - expect(actualState).toEqual(expectedState); - }); - -}); diff --git a/test/generic-components/treeNode/TreeNode.test.js b/test/generic-components/treeNode/TreeNode.test.js deleted file mode 100644 index 1c669e6..0000000 --- a/test/generic-components/treeNode/TreeNode.test.js +++ /dev/null @@ -1,41 +0,0 @@ -import TreeNode from 'generic-components/treeNode/TreeNode'; -import React from 'react'; -import { mount } from 'enzyme'; - -describe('TreeNode', () => { - let treeNode; - - beforeEach(() => { - treeNode = mount().instance(); - }); - - - it('Should be invisible when created', () => { - // then - expect(treeNode.state['visible']).toEqual(false) - }); - - it('Should be visible when toggled', () => { - // given - expect(treeNode.state['visible']).toEqual(false) - - // when - treeNode.toggle(); - - // then - expect(treeNode.state['visible']).toEqual(true) - }); - - it('Should be invisible when double toggled', () => { - // given - expect(treeNode.state['visible']).toEqual(false); - - // when - treeNode.toggle(); - treeNode.toggle(); - - // then - expect(treeNode.state['visible']).toEqual(false); - }); - -}); diff --git a/test/input/SelectInput.test.js b/test/input/SelectInput.test.js deleted file mode 100644 index a669361..0000000 --- a/test/input/SelectInput.test.js +++ /dev/null @@ -1,13 +0,0 @@ -import React from 'react'; -import { mount } from 'enzyme'; -import Select from 'react-select'; - -import SelectInput from 'generic-components/input/SelectInput.jsx'; - -describe('SelectInput Tests', () => { - it('render select input - visible', () => { - const select = mount( ); - expect(select).toHaveLength(1); // ensure the message bar is mounted - expect(select.find(Select)).toHaveLength(1); // ensure the InlineMessage is mounted - }); -}) diff --git a/test/input/ToggleInput.test.js b/test/input/ToggleInput.test.js deleted file mode 100644 index 80f0345..0000000 --- a/test/input/ToggleInput.test.js +++ /dev/null @@ -1,12 +0,0 @@ -import React from 'react'; -import { mount } from 'enzyme'; - -import ToggleInput from 'generic-components/input/ToggleInput.jsx'; - -describe('ToggleInput Tests', () => { - it('render toggle input - visible', () => { - const toggle = mount( ); - expect(toggle).toHaveLength(1); // ensure the message bar is mounted - expect(toggle.find('input')).toHaveLength(1); // ensure the InlineMessage is mounted - }); -}) -- 2.16.6