ip mac date pretty print

This commit is contained in:
snoop 2017-08-14 18:15:26 +09:00
parent 6a38cd64ea
commit f3f26ec8d4
6 changed files with 20 additions and 7 deletions

View File

@ -17,6 +17,11 @@ export function sec2date(ms: number): string {
return dateTime.toLocaleString();
}
export function date2date(timestampe: Date): string {
let dateTime = new Date(timestampe);
return dateTime.toLocaleString();
}
function numHex(s: number): string {
let a = s.toString(16);
if ((a.length % 2) > 0) { a = '0' + a; }

View File

@ -10,6 +10,8 @@ import {
import Probe from '@overflow/probe/api/model/Probe';
import { Discovery } from '@overflow/discovery/react/components/Discovery';
import * as Utils from '@overflow/commons/util/Utils';
export interface StateProps {
id: string;
probe: Probe;
@ -77,13 +79,13 @@ export class ProbeDetailInfo extends React.Component<Props, State> {
<Table.Cell collapsing>
<Header size='small'>Created at</Header>
</Table.Cell>
<Table.Cell>{this.props.probe.createDate}</Table.Cell>
<Table.Cell>{Utils.date2date(this.props.probe.createDate)}</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell collapsing>
<Header size='small'>Authorized at</Header>
</Table.Cell>
<Table.Cell>{this.props.probe.authorizeDate}</Table.Cell>
<Table.Cell>{Utils.date2date(this.props.probe.authorizeDate)}</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell collapsing>

View File

@ -10,6 +10,8 @@ import {
import Probe from '@overflow/probe/api/model/Probe';
import InfraHost from '@overflow/infra/api/model/InfraHost';
import * as Utils from '@overflow/commons/util/Utils';
export interface StateProps {
id: string;
probe: Probe;
@ -48,13 +50,13 @@ export class ProbeHost extends React.Component<Props, State> {
<Table.Cell collapsing>
<Header size='small'>IP</Header>
</Table.Cell>
<Table.Cell>{this.props.probe.host.ip}</Table.Cell>
<Table.Cell>{Utils.int2ip(this.props.probe.host.ip)}</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell collapsing>
<Header size='small'>MAC</Header>
</Table.Cell>
<Table.Cell>{this.props.probe.host.mac}</Table.Cell>
<Table.Cell>{Utils.intToMac(this.props.probe.host.mac)}</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell collapsing>

View File

@ -4,6 +4,7 @@ import { DetailContainer } from '@overflow/commons/react/component/DetailContain
import Sensor from '@overflow/sensor/api/model/Sensor';
import Probe from '@overflow/probe/api/model/Probe';
import * as Utils from '@overflow/commons/util/Utils';
export interface SensorDetailInfoStateProps {
sensorId?: number;
@ -106,7 +107,7 @@ export class SensorDetailInfo extends React.Component<SensorDetailInfoProps, Sen
<Table.Cell>
<Header size='small'>Created at</Header>
</Table.Cell>
<Table.Cell>{this.props.sensor.createDate}</Table.Cell>
<Table.Cell>{Utils.date2date(this.props.sensor.createDate)}</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>

View File

@ -5,6 +5,7 @@ import { TargetDetailInfra } from './TargetDetailInfra';
import InfraDetailContainer from '@overflow/infra/react/InfraDetail';
import Infra from '@overflow/infra/api/model/Infra';
import * as Utils from '@overflow/commons/util/Utils';
export interface StateProps {
id: string;
@ -106,7 +107,7 @@ export class TargetBasicInfo extends React.Component<TargetBasicInfoProps, Targe
<Header size='small'>Created at</Header>
</Table.Cell>
<Table.Cell>
{this.props.infra.target.createDate}
{Utils.date2date(this.props.infra.target.createDate)}
</Table.Cell>
</Table.Row>

View File

@ -7,6 +7,8 @@ import Domain from '@overflow/domain/api/model/Domain';
import { ListContainer } from '@overflow/commons/react/component/ListContainer';
import { Discovery } from '../../../discovery/react/components/Discovery';
import * as Utils from '@overflow/commons/util/Utils';
export interface StateProps {
probeId?: string;
infraList?: Infra[];
@ -119,7 +121,7 @@ export class TargetList extends React.Component<Props, State> {
<Table.Cell textAlign={'center'}>{infra.infraType.name}</Table.Cell>
<Table.Cell textAlign={'center'}>{infra.target.displayName}</Table.Cell>
<Table.Cell>TODO</Table.Cell>
<Table.Cell>{infra.target.createDate}</Table.Cell>
<Table.Cell>{Utils.date2date(infra.target.createDate)}</Table.Cell>
</Table.Row>
))}
</Table.Body>