diff options
author | James Forsyth <jf2512@att.com> | 2019-04-09 20:41:31 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-04-09 20:41:31 +0000 |
commit | cae868635ebe867b85223b056a5243c128192cbe (patch) | |
tree | 13db7f35d15a5463dfe3512e849ab4275a2ba346 /src/generic-components | |
parent | 5b062c1f5005e14b6f18563ee875a06f5c1bc299 (diff) | |
parent | b0f2f345cc2d1cc3812ad8a06fc1898daf5842d0 (diff) |
Merge "Remove unused code"
Diffstat (limited to 'src/generic-components')
21 files changed, 0 insertions, 1739 deletions
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 = ( - <ComponentManagerContainer - showHeader={this.props.showHeader} - showTitle={this.props.showTitle} - showBorder={this.props.showBorder} - actions={actionsList}> - {'Please select a visualization'} - </ComponentManagerContainer> - ); - this.state.panels.forEach((panel) => { - if (panel.id === containerId) { - let GeneratedComponent = - this.props.componentPropertiesProvider[panel.source].component.class; - let visProps = panel.props; - matchingPanel = ( - <ComponentManagerContainer - showHeader={this.props.showHeader} - showTitle={this.props.showTitle} - showBorder={this.props.showBorder} - title={panel.title} - actions={panel.actions}> - <GeneratedComponent {...visProps}/> - </ComponentManagerContainer> - ); - } - }); - return matchingPanel; - } - - preparedContainers() { - let containersToRender = []; - - this.state.containers.forEach((container) => { - let matchingPanel = this.fetchMatchingPanel(container.id); - - containersToRender.push(<div key={container.id} - data-grid={{...(container.properties)}}> - {matchingPanel} - </div>); - }); - - 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 ( - <div className='component-manager'> - <ReactGridLayout - className='content app-components' - {...this.props} - onLayoutChange={this.onLayoutChange} - layout={this.state.layout}> - {this.preparedContainers()} - </ReactGridLayout> - </div> - ); - } -} -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( - <Button - type='submit' - key={action.type} - className='close-button' - onClick={ () => { - action.callback(action.id); - }}> - <i className={ICON_CLASS_CLOSE} aria-hidden='true'></i> - </Button> - ); - break; - case 'custom': - buttons.push( - <Button - type='submit' - key={action.type} - className='custom-button' - onClick={action.callback}> - <i className={'fa ' + action.icon} aria-hidden='true'></i> - </Button> - ); - break; - } - }); - - let containerClass = showBorder - ? 'titled-container titled-container-boarders' - : 'titled-container'; - let headerClass = showHeader ? 'titled-container-header' : 'hidden'; - let titleClass = showTitle ? '' : 'hidden'; - - return ( - <div className={containerClass}> - <ButtonGroup>{buttons}</ButtonGroup> - <div className={headerClass}> - <span className={titleClass}>{i18n(title)}</span> - </div> - <div className='contents'> - {children} - </div> - </div> - ); - } -} 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 ( - <Modal show={show} className={`notification-modal ${typeClass[type]}`} - bsSize='small'> - <Modal.Header> - <Modal.Title>{title}</Modal.Title> - </Modal.Header> - <Modal.Body>{msg}</Modal.Body> - <Modal.Footer> - <Button bsStyle={typeClass[type]} - onClick={() => this.props.onDeclined(this.props.confirmationDetails)}>{i18n( - 'Cancel')}</Button> - <Button bsStyle={typeClass[type]} - onClick={() => this.props.onConfirmed(this.props.confirmationDetails)}>{i18n( - 'Delete')}</Button> - </Modal.Footer> - </Modal> - ); - }; -} - -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 ( - <div> - <div className='secondary-header'> - <span className='secondary-title'> - {viewTitle} - </span> - <DateRangeSelector /> - </div> - <ComponentManager - componentPropertiesProvider={visualizationProviderProperties} - layoutType={LAYOUT_STATIC} - layoutFormat={layoutSource} - showHeader={true} - showTitle={true} - showBorder={false}/> - </div> - ); - } -} -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 <circle {...shapeAttributes} className={shapeClass}/>; - - case NodeVisualElementConstants.SVG_LINELINE: - return <line {...shapeAttributes} className={shapeClass}/>; - - case NodeVisualElementConstants.TEXT: - return <text {...shapeAttributes} - className={shapeClass}>{textValue}</text>; - - 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 ( - <div className='validation-input-wrapper dropdown-multi-select'> - <div className='form-group'> - {label && <label className='control-label'>{label}</label>} - <Select ref='_myInput' - onChange={value => this.onSelectChanged(value)} {...other} - value={value}/> - </div> - </div> - ); - } - - getValue() { - return this.inputValue && this.inputValue.length ? this.inputValue : ''; - } - - onSelectChanged(value) { - this.props.onMultiSelectChanged(value); - } - - componentDidMount() { - let {value} = this.props; - this.inputValue = value ? value : []; - } - - componentDidUpdate() { - if (this.inputValue !== this.props.value) { - this.inputValue = this.props.value; - } - } -} - -export default SelectInput; diff --git a/src/generic-components/input/ToggleInput.jsx b/src/generic-components/input/ToggleInput.jsx deleted file mode 100644 index f68758a..0000000 --- a/src/generic-components/input/ToggleInput.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'; - -export default -class ToggleInput extends React.Component { - - static propTypes = { - label: PropTypes.node, - value: PropTypes.bool, - onChange: PropTypes.func, - disabled: PropTypes.bool - } - - static defaultProps = { - value: false, - label: '' - } - - state = { - value: this.props.value - } - - status() { - return this.state.value ? 'on' : 'off'; - } - - render() { - let {label, disabled} = this.props; - let checked = this.status() === 'on'; - return ( - <div className='toggle-input-wrapper form-group' - onClick={!disabled && this.click}> - <div className='toggle-input-label'>{label}</div> - <div className='toggle-switch'> - <input className='toggle toggle-round-flat' type='checkbox' - checked={checked} readOnly/> - <label></label> - </div> - </div> - ); - } - - 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 ( - <div - className={classNames('form-group', {'required' : validations.required , 'has-error' : hasError})}> - <label className='control-label'>{label}</label> - {isMultiSelect && otherInputDisabled ? - <Select - ref='_myInput' - value={currentMultiSelectedEnum} - className='options-input' - clearable={false} - required={isRequired} - disabled={isReadOnlyMode || Boolean(this.props.disabled)} - onBlur={() => onBlur()} - onMultiSelectChanged={value => this.multiSelectEnumChanged(value)} - options={this.renderMultiSelectOptions(values)} - multi/> : - <div className={classNames('input-options',{'has-error' : hasError})}> - <select - ref={'_myInput'} - label={label} - className='form-control input-options-select' - value={currentSelectedEnum} - style={{'width' : otherInputDisabled ? '100%' : '95px'}} - onBlur={() => onBlur()} - disabled={isReadOnlyMode || Boolean(this.props.disabled)} - onChange={ value => this.enumChanged(value)} - type='select'> - {values && - values.length && - values.map(val => this.renderOptions(val))} - {onOtherChange && <option key='other' - value={other.OTHER}>{i18n( - other.OTHER)}</option>} - {children} - </select> - - {!otherInputDisabled && <div className='input-options-separator'/>} - <input - className='form-control input-options-other' - placeholder={i18n('other')} - ref='_otherValue' - style={{'display' : otherInputDisabled ? 'none' : 'block'}} - disabled={isReadOnlyMode || Boolean(this.props.disabled)} - value={otherValue || ''} - onBlur={() => onBlur()} - onChange={() => this.changedOtherInput()}/> - </div> - } - </div> - ); - } - - renderOptions(val) { - return ( - <option key={val.enum} value={val.enum}>{val.title}</option> - ); - } - - - 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 ( - <Modal show={this.props.show} - className={`notification-modal ${typeClass[type]}`}> - <Modal.Header> - <Modal.Title>{title}</Modal.Title> - </Modal.Header> - <Modal.Body>{msg}</Modal.Body> - <Modal.Footer> - <Button bsStyle={typeClass[type]} - onClick={this.props.onCloseClick}>{i18n('OK')}</Button> - </Modal.Footer> - </Modal> - ); - } -} - -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 ( - <div className={ `slide-panel ${className}`}> - {this.renderHeader(isOpen)} - <div - className={'slide-panel-content ' + (isOpen ? 'opened' : 'closed')}>{children}</div> - </div> - ); - } - - 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 ( - <div className='slide-panel-header'> - { initialDirection === 'left' && - <span className='slide-panel-header-title'>{title}</span>} - <FontAwesome - ref='arrowIcon' - style={awestyle} - onClick={this.handleClick} - className='pull-right' - name={iconName} - size='2x'/> - { initialDirection === 'right' && - <span className='slide-panel-header-title'>{title}</span>} - </div> - ); - } - - 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( - <Button id={item} active={selectedButton === item ? true : false} - onClick={() => this.onButtonSelect(item)}> - <i className={buttonDefinitions[item]} aria-hidden='true'></i> - </Button> - ); - }.bind(this)); - - return ( - <ButtonGroup bsClass='btn-group displayOptionButtons'> - {buttonListElements} - </ButtonGroup> - ); - } -} -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 <li key={index}><TreeNode node={node}/></li>; - }); - - classObj = { - togglable: true, - 'togglable-down': this.state.visible, - 'togglable-up': !this.state.visible - }; - } - - var style; - if (!this.state.visible) { - style = {display: 'none'}; - } - - return ( - <div> - <h7 onClick={this.toggle} className={classNames(classObj)}> - {this.props.node.title} - </h7> - <ul style={style} className='node-tree'> - {childNodes} - </ul> - </div> - ); - } -} - -export default TreeNode; |