From da4fd6169717cfa04d644d0af0d23dd089a6e373 Mon Sep 17 00:00:00 2001 From: herbert Date: Sat, 14 Dec 2019 00:06:42 +0100 Subject: remove old version of devicemodel devicemanager oldux featureaggregator Issue-ID: SDNC-1004 Signed-off-by: herbert Change-Id: I5337643181e2398e5a8097e4ee14fa4ac96d0d4c --- .../src/components/editNetworkElementDialog.tsx | 246 --------------------- 1 file changed, 246 deletions(-) delete mode 100644 sdnr/wt/odlux/apps/connectApp/src/components/editNetworkElementDialog.tsx (limited to 'sdnr/wt/odlux/apps/connectApp/src/components/editNetworkElementDialog.tsx') diff --git a/sdnr/wt/odlux/apps/connectApp/src/components/editNetworkElementDialog.tsx b/sdnr/wt/odlux/apps/connectApp/src/components/editNetworkElementDialog.tsx deleted file mode 100644 index 32b23a41e..000000000 --- a/sdnr/wt/odlux/apps/connectApp/src/components/editNetworkElementDialog.tsx +++ /dev/null @@ -1,246 +0,0 @@ -/** - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt odlux - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * 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 * as React from 'react'; - -import Button from '@material-ui/core/Button'; -import TextField from '@material-ui/core/TextField'; -import Dialog from '@material-ui/core/Dialog'; -import DialogActions from '@material-ui/core/DialogActions'; -import DialogContent from '@material-ui/core/DialogContent'; -import DialogContentText from '@material-ui/core/DialogContentText'; -import DialogTitle from '@material-ui/core/DialogTitle'; - -import { IDispatcher, connect, Connect } from '../../../../framework/src/flux/connect'; - -import { - addToRequiredNetworkElementsAsyncActionCreator, - removeFromRequiredNetworkElementsAsyncActionCreator -} from '../actions/requiredNetworkElementsActions'; - -import { unmountNetworkElementAsyncActionCreator, mountNetworkElementAsyncActionCreator } from '../actions/mountedNetworkElementsActions'; -import { RequiredNetworkElementType } from '../models/requiredNetworkElements'; - -export enum EditNetworkElementDialogMode { - None = "none", - UnknownNetworkElementToRequiredNetworkElements = "unknownNetworkElementToRequiredNetworkElements", - RequiredNetworkElementToUnknownNetworkElements = "requiredNetworkElementToUnknownNetworkElements", - MountNetworkElementToRequiredNetworkElements = "mountNetworkElementToRequiredNetworkElements", - MountNetworkElementToUnknonwNetworkElements = "mountNetworkElementToRequiredUnknownElements", - MountNetworkElement = "mountNetworkElement", - UnmountNetworkElement = "unmountNetworkElement", -} - -const mapDispatch = (dispatcher: IDispatcher) => ({ - addToRequiredNetworkElements: (element: RequiredNetworkElementType) => { - dispatcher.dispatch(addToRequiredNetworkElementsAsyncActionCreator(element)); - }, - removeFromRequiredNetworkElements: (element: RequiredNetworkElementType) => { - dispatcher.dispatch(removeFromRequiredNetworkElementsAsyncActionCreator(element)); - }, - mountNetworkElement: (element: RequiredNetworkElementType) => { - dispatcher.dispatch(mountNetworkElementAsyncActionCreator(element)); - }, - mountAndRquireNetworkElement: (element: RequiredNetworkElementType) => { - dispatcher.dispatch(addToRequiredNetworkElementsAsyncActionCreator(element)); - dispatcher.dispatch(mountNetworkElementAsyncActionCreator(element)); - }, - unmountNetworkElement: (element: RequiredNetworkElementType) => { - dispatcher.dispatch(unmountNetworkElementAsyncActionCreator(element && element.mountId)); - } -} -); - -type DialogSettings = { - dialogTitle: string, - dialogDescription: string, - applyButtonText: string, - cancelButtonText: string, - enableMountIdEditor: boolean, - enableUsernameEditor: boolean, - enableExtendedEditor: boolean, -} - -const settings: { [key: string]: DialogSettings } = { - [EditNetworkElementDialogMode.None]: { - dialogTitle: "", - dialogDescription: "", - applyButtonText: "", - cancelButtonText: "", - enableMountIdEditor: false, - enableUsernameEditor: false, - enableExtendedEditor: false, - }, - [EditNetworkElementDialogMode.UnknownNetworkElementToRequiredNetworkElements] : { - dialogTitle: "Add to required network elements" , - dialogDescription: "Create a new NetworkElement in planning database as clone of existing real NetworkElement." , - applyButtonText: "Add to required network elements" , - cancelButtonText: "Cancel", - enableMountIdEditor: false, - enableUsernameEditor: true, - enableExtendedEditor: false, - }, - [EditNetworkElementDialogMode.RequiredNetworkElementToUnknownNetworkElements]: { - dialogTitle: "Remove from required network elements", - dialogDescription: "Do you really want to remove the required element:", - applyButtonText: "Remove network element", - cancelButtonText: "Cancel", - enableMountIdEditor: false, - enableUsernameEditor: false, - enableExtendedEditor: false, - }, - [EditNetworkElementDialogMode.MountNetworkElementToUnknonwNetworkElements]: { - dialogTitle: "Mount to unknown network elements", - dialogDescription: "Mount this network element:", - applyButtonText: "Mount network element", - cancelButtonText: "Cancel", - enableMountIdEditor: true, - enableUsernameEditor: true, - enableExtendedEditor: true, - }, - [EditNetworkElementDialogMode.MountNetworkElementToRequiredNetworkElements]: { - dialogTitle: "Mount to required network elements", - dialogDescription: "Mount this network element:", - applyButtonText: "Mount network element", - cancelButtonText: "Cancel", - enableMountIdEditor: true, - enableUsernameEditor: true, - enableExtendedEditor: true, - }, - [EditNetworkElementDialogMode.MountNetworkElement]: { - dialogTitle: "Mount network element", - dialogDescription: "mount this network element:", - applyButtonText: "mount network element", - cancelButtonText: "Cancel", - enableMountIdEditor: false, - enableUsernameEditor: false, - enableExtendedEditor: false, - }, - [EditNetworkElementDialogMode.UnmountNetworkElement]: { - dialogTitle: "Unmount network element", - dialogDescription: "unmount this network element:", - applyButtonText: "Unmount network element", - cancelButtonText: "Cancel", - enableMountIdEditor: false, - enableUsernameEditor: false, - enableExtendedEditor: false, - }, -} - -type EditNetworkElementDialogComponentProps = Connect & { - mode: EditNetworkElementDialogMode; - initialNetworkElement: RequiredNetworkElementType; - onClose: () => void; -}; - -type EditNetworkElementDialogComponentState = RequiredNetworkElementType & { - required: boolean; -}; - -class EditNetworkElementDialogComponent extends React.Component { - constructor(props: EditNetworkElementDialogComponentProps) { - super(props); - - this.state = { - mountId: this.props.initialNetworkElement.mountId, - host: this.props.initialNetworkElement.host, - port: this.props.initialNetworkElement.port, - password: this.props.initialNetworkElement.password, - username: this.props.initialNetworkElement.username, - required: false - }; - } - - render(): JSX.Element { - const setting = settings[this.props.mode]; - return ( - - { setting.dialogTitle } - - - { setting.dialogDescription } - - { this.setState({mountId: event.target.value}); } } /> - { this.setState({host: event.target.value}); } }/> - { this.setState({port: +event.target.value}); } }/> - { setting.enableUsernameEditor && { this.setState({ username: event.target.value }); } } /> || null } - { setting.enableUsernameEditor && { this.setState({ password: event.target.value }); } } /> || null } - - - - - - - ) - } - - private onApply = (element: RequiredNetworkElementType) => { - this.props.onClose && this.props.onClose(); - switch (this.props.mode) { - case EditNetworkElementDialogMode.UnknownNetworkElementToRequiredNetworkElements: - element && this.props.addToRequiredNetworkElements(element); - break; - case EditNetworkElementDialogMode.RequiredNetworkElementToUnknownNetworkElements: - element && this.props.removeFromRequiredNetworkElements(element); - break; - case EditNetworkElementDialogMode.MountNetworkElementToUnknonwNetworkElements: - element && this.props.mountNetworkElement(element); - break; - case EditNetworkElementDialogMode.MountNetworkElementToRequiredNetworkElements: - element && this.props.mountAndRquireNetworkElement(element); - break; - case EditNetworkElementDialogMode.MountNetworkElement: - element && this.props.mountNetworkElement(element); - break; - case EditNetworkElementDialogMode.UnmountNetworkElement: - element && this.props.unmountNetworkElement(element); - break; - } - }; - - private onCancel = () => { - this.props.onClose && this.props.onClose(); - } - - static getDerivedStateFromProps(props: EditNetworkElementDialogComponentProps, state: EditNetworkElementDialogComponentState & { _initialNetworkElement: RequiredNetworkElementType }): EditNetworkElementDialogComponentState & { _initialNetworkElement: RequiredNetworkElementType } { - if (props.initialNetworkElement !== state._initialNetworkElement) { - state = { - ...state, - ...props.initialNetworkElement, - _initialNetworkElement: props.initialNetworkElement, - }; - } - return state; - } -} - -export const EditNetworkElementDialog = connect(undefined, mapDispatch)(EditNetworkElementDialogComponent); -export default EditNetworkElementDialog; \ No newline at end of file -- cgit 1.2.3-korg