mirror of https://github.com/status-im/consul.git
Prototype StreamStatus integration peers detail
This commit is contained in:
parent
90259d7366
commit
a61085258e
|
@ -1,8 +1,8 @@
|
||||||
<Hds::Card::Container @level="base" @hasBorder={{true}} class="mb-3 mt-6">
|
<Hds::Card::Container @level="base" @hasBorder={{true}} class="mt-6 mb-3">
|
||||||
<div class="h-24 p-6 flex space-x-12 overflow-x-scroll">
|
<div class="flex h-24 p-6 overflow-x-scroll space-x-12">
|
||||||
<div class="shrink-0">
|
<div class="shrink-0">
|
||||||
<div
|
<div
|
||||||
class="hds-typography-body-200 hds-font-weight-semibold mb-2 text-hds-foreground-primary"
|
class="mb-2 hds-typography-body-200 hds-font-weight-semibold text-hds-foreground-primary"
|
||||||
>Status</div>
|
>Status</div>
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
<Peerings::Badge @peering={{@peering}} />
|
<Peerings::Badge @peering={{@peering}} />
|
||||||
|
@ -10,11 +10,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="shrink-0">
|
<div class="shrink-0">
|
||||||
<div
|
<div
|
||||||
class="hds-typography-body-200 hds-font-weight-semibold mb-2 text-hds-foreground-primary"
|
class="mb-2 hds-typography-body-200 hds-font-weight-semibold text-hds-foreground-primary"
|
||||||
>Latest heartbeat</div>
|
>Latest heartbeat</div>
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
{{#if @peering.heartbeat}}
|
{{#if @peering.LastHeartbeat}}
|
||||||
{{#let (smart-date-format @peering.heartbeat) as |smartDate|}}
|
{{#let (smart-date-format @peering.LastHeartbeat) as |smartDate|}}
|
||||||
<FlightIcon
|
<FlightIcon
|
||||||
@name="activity"
|
@name="activity"
|
||||||
class="mr-0.5 text-hds-foreground-faint fill-current"
|
class="mr-0.5 text-hds-foreground-faint fill-current"
|
||||||
|
@ -32,11 +32,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="shrink-0">
|
<div class="shrink-0">
|
||||||
<div
|
<div
|
||||||
class="hds-typography-body-200 hds-font-weight-semibold mb-2 text-hds-foregrouny-primary"
|
class="mb-2 hds-typography-body-200 hds-font-weight-semibold text-hds-foregrouny-primary"
|
||||||
>Latest receipt</div>
|
>Latest receipt</div>
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
{{#if @peering.receipt}}
|
{{#if @peering.LastReceive}}
|
||||||
{{#let (smart-date-format @peering.receipt) as |smartDate|}}
|
{{#let (smart-date-format @peering.LastReceive) as |smartDate|}}
|
||||||
{{#if smartDate.isNearDate}}
|
{{#if smartDate.isNearDate}}
|
||||||
<span {{tooltip smartDate.friendly}}>{{smartDate.relative}}</span>
|
<span {{tooltip smartDate.friendly}}>{{smartDate.relative}}</span>
|
||||||
{{else}}
|
{{else}}
|
||||||
|
@ -50,11 +50,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="shrink-0">
|
<div class="shrink-0">
|
||||||
<div
|
<div
|
||||||
class="hds-typography-body-200 hds-font-weight-semibold mb-2 text-hds-foreground-primary"
|
class="mb-2 hds-typography-body-200 hds-font-weight-semibold text-hds-foreground-primary"
|
||||||
>Latest send</div>
|
>Latest send</div>
|
||||||
<div class="flex items-center">
|
<div class="flex items-center">
|
||||||
{{#if @peering.lastSend}}
|
{{#if @peering.LastSend}}
|
||||||
{{#let (smart-date-format @peering.lastSend) as |smartDate|}}
|
{{#let (smart-date-format @peering.LastSend) as |smartDate|}}
|
||||||
{{#if smartDate.isNearDate}}
|
{{#if smartDate.isNearDate}}
|
||||||
<span {{tooltip smartDate.friendly}}>{{smartDate.relative}}</span>
|
<span {{tooltip smartDate.friendly}}>{{smartDate.relative}}</span>
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
>
|
>
|
||||||
{{t
|
{{t
|
||||||
"routes.dc.peers.index.detail.imported.count"
|
"routes.dc.peers.index.detail.imported.count"
|
||||||
count=(format-number item.ImportedServiceCount)
|
count=(format-number (or item.ImportedServiceCount 0))
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
>
|
>
|
||||||
{{t
|
{{t
|
||||||
"routes.dc.peers.index.detail.exported.count"
|
"routes.dc.peers.index.detail.exported.count"
|
||||||
count=(format-number item.ExportedServiceCount)
|
count=(format-number (or item.ExportedServiceCount 0))
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,10 @@ const MILLISECONDS_IN_WEEK = MILLISECONDS_IN_DAY * 7;
|
||||||
*/
|
*/
|
||||||
function isNearDate(date) {
|
function isNearDate(date) {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const aWeekAgo = now - MILLISECONDS_IN_WEEK;
|
const aWeekAgo = +now - MILLISECONDS_IN_WEEK;
|
||||||
const aWeekInFuture = now + MILLISECONDS_IN_WEEK;
|
const aWeekInFuture = +now + MILLISECONDS_IN_WEEK;
|
||||||
|
|
||||||
return date >= aWeekAgo && aWeekInFuture;
|
return date >= aWeekAgo && date <= aWeekInFuture;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class SmartDateFormat extends Helper {
|
export default class SmartDateFormat extends Helper {
|
||||||
|
|
|
@ -22,6 +22,7 @@ export default class Peer extends Model {
|
||||||
@attr('string') PeerID;
|
@attr('string') PeerID;
|
||||||
|
|
||||||
@attr() PeerServerAddresses;
|
@attr() PeerServerAddresses;
|
||||||
|
@attr() StreamStatus;
|
||||||
|
|
||||||
// StreamStatus
|
// StreamStatus
|
||||||
@nullValue([]) @attr() ImportedServices;
|
@nullValue([]) @attr() ImportedServices;
|
||||||
|
|
|
@ -107,6 +107,16 @@ export default class PeerService extends RepositoryService {
|
||||||
}}
|
}}
|
||||||
`
|
`
|
||||||
)((headers, body, cache) => {
|
)((headers, body, cache) => {
|
||||||
|
const { StreamStatus } = body;
|
||||||
|
if (StreamStatus.LastHeartbeat) {
|
||||||
|
StreamStatus.LastHeartbeat = new Date(StreamStatus.LastHeartbeat);
|
||||||
|
}
|
||||||
|
if (StreamStatus.LastReceive) {
|
||||||
|
StreamStatus.LastReceive = new Date(StreamStatus.LastReceive);
|
||||||
|
}
|
||||||
|
if (StreamStatus.LastSend) {
|
||||||
|
StreamStatus.LastSend = new Date(StreamStatus.LastSend);
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
meta: {
|
meta: {
|
||||||
version: 2,
|
version: 2,
|
||||||
|
|
Loading…
Reference in New Issue