It builds

This commit is contained in:
Gabe Kangas
2020-11-01 00:01:37 -07:00
parent 27f4b8b158
commit 9b89955bb7
17 changed files with 107 additions and 84 deletions

View File

@@ -9,20 +9,23 @@ interface ToolTipProps {
const defaultProps = {
active: false,
payload: {},
unit: ""
payload: Object,
unit: "",
};
interface ChartProps {
data: [{
time: string,
}],
color: string,
unit: string,
dataCollections?: any,
interface TimedValue {
time: Date;
value: Number;
}
interface ChartProps {
// eslint-disable-next-line react/require-default-props
data?: TimedValue[],
color: string,
unit: string,
// eslint-disable-next-line react/require-default-props
dataCollections?: any[],
}
function CustomizedTooltip(props: ToolTipProps) {
const { active, payload, unit } = props;
@@ -41,13 +44,23 @@ function CustomizedTooltip(props: ToolTipProps) {
CustomizedTooltip.defaultProps = defaultProps;
export default function Chart({ data, color, unit, dataCollections }: ChartProps) {
if (!data && !dataCollections) {
return null;
}
const timeFormatter = (tick: string) => {
return timeFormat("%I:%M")(new Date(tick));
};
let ticks = data.map((item) => item?.time);
if (dataCollections) {
ticks = dataCollections[0].data?.map((collection) => collection?.time);
let ticks
if (dataCollections.length > 0) {
ticks = dataCollections[0].data?.map(function (collection) {
return collection?.time;
})
} else if (data?.length > 0){
ticks = data?.map(function (item) {
return item?.time;
});
}
return (

View File

@@ -19,13 +19,18 @@ function renderColumnLevel(text, entry) {
return <div style={style}>{text}</div>;
}
function renderMessage(text, entry) {
function renderMessage(text) {
return (
<Linkify>{text}</Linkify>
)
}
export default function LogTable({ logs, pageSize }) {
interface Props {
logs: object[],
pageSize: number
}
export default function LogTable({ logs, pageSize }: Props) {
const columns = [
{
title: "Level",

View File

@@ -9,14 +9,13 @@ import {
LineChartOutlined,
CloseCircleOutlined,
PlayCircleFilled,
StopFilled,
MinusSquareFilled,
} from '@ant-design/icons';
import classNames from 'classnames';
import OwncastLogo from './logo';
import { BroadcastStatusContext } from '../utils/broadcast-status-context';
import { BroadcastStatusContext } from '../../utils/broadcast-status-context';
import adminStyles from '../../styles/styles.module.css';