2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END============================================
20 * ===================================================================
23 import React from 'react';
24 import Table from 'react-bootstrap/Table';
25 import LoopCache from '../../../api/LoopCache';
26 import styled from 'styled-components';
28 const TableRow = ({ logRow }) => (
30 <td>{logRow.logInstant}</td>
31 <td>{logRow.logType}</td>
32 <td>{logRow.logComponent}</td>
33 <td>{logRow.message}</td>
38 const LoopLogsHeaderDivStyled = styled.div`
39 background-color: ${props => props.theme.loopViewerHeaderBackgroundColor};
41 color: ${props => props.theme.loopViewerHeaderFontColor};
45 export default class LoopLogs extends React.Component {
48 loopCache: new LoopCache({}),
52 this.renderLogs = this.renderLogs.bind(this);
53 this.state.loopCache=props.loopCache;
56 shouldComponentUpdate(nextProps, nextState) {
57 return this.state.loopCache !== nextState.loopCache;
60 componentWillReceiveProps(newProps) {
62 loopCache: newProps.loopCache,
67 if (this.state.loopCache.getLoopLogsArray() != null) {
69 this.state.loopCache.getLoopLogsArray().map(row => <TableRow logRow={row} />)
76 <LoopLogsHeaderDivStyled>
77 <label>Loop Logs</label>
78 <Table striped hover bordeless variant responsive>
81 <th><span align="left">Date</span></th>
82 <th><span align="left">Type</span></th>
83 <th><span align="left">Component</span></th>
84 <th><span align="right">Log</span></th>
91 </LoopLogsHeaderDivStyled>