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==========================================================================
18 import * as React from "react";
20 import { Connect, connect, IDispatcher } from '../../../../framework/src/flux/connect';
21 import { MaterialTable, MaterialTableCtorType } from '../../../../framework/src/components/material-table';
23 import { EventLogType } from '../models/eventLogType';
24 import { IApplicationStoreState } from "../../../../framework/src/store/applicationStore";
25 import { createEventLogProperties, createEventLogActions } from "../handlers/eventLogHandler";
27 const EventLogTable = MaterialTable as MaterialTableCtorType<EventLogType & { _id: string }>;
29 const mapProps = (state: IApplicationStoreState) => ({
30 eventLogProperties: createEventLogProperties(state),
31 eventLog: state.eventLog.logEntries
34 const mapDispatch = (dispatcher: IDispatcher) => ({
35 eventLogActions: createEventLogActions(dispatcher.dispatch)
38 let initalSorted = false;
40 class EventLogComponent extends React.Component<Connect<typeof mapProps, typeof mapDispatch>> {
42 return <EventLogTable stickyHeader title="Event Log" idProperty="_id" columns={[
43 { property: "nodeId", title: "Node Name" },
44 { property: "counter", title: "Counter" },
45 { property: "timestamp", title: "Timestamp" },
46 { property: "objectId", title: "Object ID" },
47 { property: "attributeName", title: "Attribute Name" },
48 { property: "newValue", title: "Message" },
49 { property: "sourceType", title: "Source" }
50 ]} {...this.props.eventLogActions} {...this.props.eventLogProperties} >
58 this.props.eventLogActions.onHandleExplicitRequestSort("timestamp", "desc");
60 this.props.eventLogActions.onRefresh();
65 export const EventLog = connect(mapProps, mapDispatch)(EventLogComponent);
66 export default EventLog;