Prepare for HTTPS

This commit is contained in:
maciejhirsz
2018-07-18 13:06:25 +02:00
parent d10fb4a1e1
commit 7b57cb99dd
4 changed files with 49 additions and 28 deletions
+43 -25
View File
@@ -5,30 +5,48 @@ import { Types, Maybe } from '@dotstats/common';
export namespace Node {
export interface Props {
id: Types.NodeId,
nodeDetails: Types.NodeDetails,
nodeStats: Types.NodeStats,
blockDetails: Types.BlockDetails,
location: Maybe<Types.NodeLocation>,
id: Types.NodeId;
nodeDetails: Types.NodeDetails;
nodeStats: Types.NodeStats;
blockDetails: Types.BlockDetails;
location: Maybe<Types.NodeLocation>;
}
export interface PixelPosition {
left: number;
top: number;
}
export function Row(props: Props) {
const [name, implementation, version] = props.nodeDetails;
const [height, hash, blockTime, blockTimestamp, propagationTime] = props.blockDetails;
const [peers, txcount] = props.nodeStats;
return (
<tr>
<td>{name}</td>
<td style={{ width: 240 }}>{implementation} v{version}</td>
<td style={{ width: 26 }}>{peers}</td>
<td style={{ width: 26 }}>{txcount}</td>
<td style={{ width: 88 }}>#{formatNumber(height)}</td>
<td style={{ width: 154 }}><span title={hash}>{trimHash(hash, 16)}</span></td>
<td style={{ width: 80 }}>{secondsWithPrecision(blockTime/1000)}</td>
<td style={{ width: 58 }}>{propagationTime === null ? '∞' : milliOrSecond(propagationTime as number)}</td>
<td style={{ width: 82 }}><Ago when={blockTimestamp} /></td>
</tr>
);
}
export function Location(props: Props & PixelPosition) {
const { left, top } = props;
return (
<span
className="Chain-map-node"
style={{ left, top }}
title={props.nodeDetails[0]}
data-location={JSON.stringify(props.location)}
/>
);
}
}
export function Node(props: Node.Props) {
const [name, implementation, version] = props.nodeDetails;
const [height, hash, blockTime, blockTimestamp, propagationTime] = props.blockDetails;
const [peers, txcount] = props.nodeStats;
return (
<tr>
<td>{name}</td>
<td style={{ width: 240 }}>{implementation} v{version}</td>
<td style={{ width: 26 }}>{peers}</td>
<td style={{ width: 26 }}>{txcount}</td>
<td style={{ width: 88 }}>#{formatNumber(height)}</td>
<td style={{ width: 154 }}><span title={hash}>{trimHash(hash, 16)}</span></td>
<td style={{ width: 80 }}>{secondsWithPrecision(blockTime/1000)}</td>
<td style={{ width: 58 }}>{propagationTime === null ? '∞' : milliOrSecond(propagationTime as number)}</td>
<td style={{ width: 82 }}><Ago when={blockTimestamp} /></td>
</tr>
);
}