Add data-provider
[ccsdk/features.git] / sdnr / wt / odlux / apps / mediatorApp / src / components / editMediatorConfigDialog.tsx
index c1167c4..20ece4c 100644 (file)
@@ -1,3 +1,20 @@
+/**
+ * ============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 { Theme, createStyles, WithStyles, withStyles, Typography, FormControlLabel, Checkbox } from '@material-ui/core';
 
@@ -78,7 +95,7 @@ export enum EditMediatorConfigDialogMode {
 }
 
 const mapProps = (state: IApplicationStoreState) => ({
-  supportedDevices: state.mediatorApp.mediatorServerState.supportedDevices
+  supportedDevices: state.mediator.mediatorServerState.supportedDevices
 });
 
 const mapDispatch = (dispatcher: IDispatcher) => ({
@@ -182,7 +199,7 @@ class EditMediatorConfigDialogComponent extends React.Component<EditMediatorConf
             <Tab label="Config" />
             <Tab label="ODL AutoConnect" />
           </Tabs>
-          { this.state.activeTab === 0 ? <TabContainer >
+          {this.state.activeTab === 0 ? <TabContainer >
             <TextField disabled={setting.readonly || setting.readonlyName} spellCheck={false} autoFocus margin="dense" id="name" label="Name" type="text" fullWidth value={this.state.Name} onChange={(event) => { this.setState({ Name: event.target.value }); }} />
             <FormControl fullWidth disabled={setting.readonly}>
               <InputLabel htmlFor="deviceType">Device</InputLabel>
@@ -204,15 +221,15 @@ class EditMediatorConfigDialogComponent extends React.Component<EditMediatorConf
                 {this.props.supportedDevices.map(device => (<MenuItem key={device.id} value={device.id} >{`${device.vendor} - ${device.device} (${device.version || '0.0.0'}) `}</MenuItem>))}
               </Select>
             </FormControl>
-            <TextField disabled={setting.readonly} spellCheck={false} autoFocus margin="dense" id="ipAddress" label="IP Address" type="text" fullWidth value={this.state.DeviceIp} onChange={(event) => { this.setState({ DeviceIp: event.target.value }); }} />
-            <TextField disabled={setting.readonly} spellCheck={false} autoFocus margin="dense" id="devicePort" label="Port" type="number" fullWidth value={this.state.DevicePort || ""} onChange={(event) => { this.setState({ DevicePort: +event.target.value }); }} />
+            <TextField disabled={setting.readonly} spellCheck={false} autoFocus margin="dense" id="ipAddress" label="Device IP" type="text" fullWidth value={this.state.DeviceIp} onChange={(event) => { this.setState({ DeviceIp: event.target.value }); }} />
+            <TextField disabled={setting.readonly} spellCheck={false} autoFocus margin="dense" id="devicePort" label="Device SNMP Port" type="number" fullWidth value={this.state.DevicePort || ""} onChange={(event) => { this.setState({ DevicePort: +event.target.value }); }} />
             <TextField disabled={setting.readonly} spellCheck={false} autoFocus margin="dense" id="trapsPort" label="TrapsPort" type="number" fullWidth value={this.state.TrapPort || ""} onChange={(event) => { this.setState({ TrapPort: +event.target.value }); }} />
             <TextField disabled={setting.readonly} spellCheck={false} autoFocus margin="dense" id="ncUser" label="Netconf User" type="text" fullWidth value={this.state.NcUsername} onChange={(event) => { this.setState({ NcUsername: event.target.value }); }} />
             <TextField disabled={setting.readonly} spellCheck={false} autoFocus margin="dense" id="ncPassword" label="Netconf Password" type="password" fullWidth value={this.state.NcPassword} onChange={(event) => { this.setState({ NcPassword: event.target.value }); }} />
             <TextField disabled={setting.readonly} spellCheck={false} autoFocus margin="dense" id="ncPort" label="Netconf Port" type="number" fullWidth value={this.state.NcPort || ""} onChange={(event) => { this.setState({ NcPort: +event.target.value }); }} />
           </TabContainer> : null}
-          { this.state.activeTab === 1 ? <TabContainer >
-            { this.state.ODLConfig && this.state.ODLConfig.length > 0
+          {this.state.activeTab === 1 ? <TabContainer >
+            {this.state.ODLConfig && this.state.ODLConfig.length > 0
               ? this.state.ODLConfig.map((cfg, ind) => {
                 const panelId = `panel-${ind}`;
                 const deleteButton = (<IconButton onClick={() => {
@@ -227,15 +244,15 @@ class EditMediatorConfigDialogComponent extends React.Component<EditMediatorConf
                   <Panel title={cfg.Server && `${cfg.User ? `${cfg.User}@` : ''}${cfg.Protocol}://${cfg.Server}:${cfg.Port}` || "new odl config"} key={panelId} panelId={panelId} activePanel={this.state.activeOdlConfig} customActionButtons={[deleteButton]}
                     onToggle={(id) => this.setState({ activeOdlConfig: (this.state.activeOdlConfig === id) ? "" : (id || "") })} >
                     <div className={classes.alignInOneLine}>
-                    <FormControl className={classes.left} margin={"dense"} >
+                      <FormControl className={classes.left} margin={"dense"} >
                         <InputLabel htmlFor={`protocol-${ind}`}>Protocoll</InputLabel>
-                        <Select value={cfg.Protocol} onChange={ this.odlConfigValueChangeHandlerCreator(ind, "Protocol", e => (e.target.value)) } inputProps={{ name: `protocol-${ind}`, id: `protocol-${ind}` }} fullWidth >
+                        <Select value={cfg.Protocol} onChange={this.odlConfigValueChangeHandlerCreator(ind, "Protocol", e => (e.target.value))} inputProps={{ name: `protocol-${ind}`, id: `protocol-${ind}` }} fullWidth >
                           <MenuItem value={"http"}>http</MenuItem>
                           <MenuItem value={"https"}>https</MenuItem>
                         </Select>
                       </FormControl>
                       <TextField className={classes.left} spellCheck={false} margin="dense" id="hostname" label="Hostname" type="text" value={cfg.Server} onChange={this.odlConfigValueChangeHandlerCreator(ind, "Server", e => e.target.value)} />
-                      <TextField className={classes.right} style={{ maxWidth: "65px"}} spellCheck={false} margin="dense" id="port" label="Port" type="number" value={cfg.Port|| ""} onChange={this.odlConfigValueChangeHandlerCreator(ind, "Port", e => +e.target.value)} />
+                      <TextField className={classes.right} style={{ maxWidth: "65px" }} spellCheck={false} margin="dense" id="port" label="Port" type="number" value={cfg.Port || ""} onChange={this.odlConfigValueChangeHandlerCreator(ind, "Port", e => +e.target.value)} />
                     </div>
                     <div className={classes.alignInOneLine}>
                       <TextField className={classes.left} spellCheck={false} margin="dense" id="username" label="Username" type="text" value={cfg.User} onChange={this.odlConfigValueChangeHandlerCreator(ind, "User", e => e.target.value)} />
@@ -310,6 +327,4 @@ class EditMediatorConfigDialogComponent extends React.Component<EditMediatorConf
 }
 
 export const EditMediatorConfigDialog = withStyles(styles)(connect(mapProps, mapDispatch)(EditMediatorConfigDialogComponent));
-export default EditMediatorConfigDialog;
-
-
+export default EditMediatorConfigDialog;
\ No newline at end of file