2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt odlux
4 * =================================================================================================
5 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
6 * =================================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8 * in compliance with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software distributed under the License
13 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14 * or implied. See the License for the specific language governing permissions and limitations under
16 * ============LICENSE_END==========================================================================
19 import React from 'react';
20 import { RouteComponentProps, withRouter } from 'react-router-dom';
22 import { connect, IDispatcher, Connect } from '../../../../framework/src/flux/connect';
23 import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore';
24 import { MaterialTable, MaterialTableCtorType, ColumnType } from '../../../../framework/src/components/material-table';
26 import { NetworkElementConnection } from '../models/networkElementConnection';
27 import { createConnectedNetworkElementsProperties, createConnectedNetworkElementsActions } from '../../../configurationApp/src/handlers/connectedNetworkElementsHandler';
30 const mapProps = (state: IApplicationStoreState) => ({
31 connectedNetworkElementsProperties: createConnectedNetworkElementsProperties(state),
34 const mapDispatch = (dispatcher: IDispatcher) => ({
35 connectedNetworkElementsActions: createConnectedNetworkElementsActions(dispatcher.dispatch),
38 const ConnectedElementTable = MaterialTable as MaterialTableCtorType<NetworkElementConnection>;
40 type NetworkElementSelectorComponentProps = RouteComponentProps & Connect<typeof mapProps, typeof mapDispatch>;
42 let initialSorted = false;
44 class NetworkElementSelectorComponent extends React.Component<NetworkElementSelectorComponentProps> {
50 this.props.connectedNetworkElementsActions.onHandleRequestSort('node-id');
52 this.props.connectedNetworkElementsActions.onRefresh();
57 <ConnectedElementTable stickyHeader tableId="configurable-elements-table" onHandleClick={(e, row) => { this.props.history.push(`${this.props.match.path}/${row.nodeId}`); }} columns={[
58 { property: 'nodeId', title: 'Node Name', type: ColumnType.text },
59 { property: 'isRequired', title: 'Required', type: ColumnType.boolean },
60 { property: 'host', title: 'Host', type: ColumnType.text },
61 { property: 'port', title: 'Port', type: ColumnType.numeric },
62 { property: 'coreModelCapability', title: 'Core Model', type: ColumnType.text },
63 { property: 'deviceType', title: 'Type', type: ColumnType.text },
64 ]} idProperty="id" {...this.props.connectedNetworkElementsActions} {...this.props.connectedNetworkElementsProperties} asynchronus >
65 </ConnectedElementTable>
70 export const NetworkElementSelector = withRouter(connect(mapProps, mapDispatch)(NetworkElementSelectorComponent));
71 export default NetworkElementSelector;