ui: Fixup peering imported/exported service counts (#13662)

* ui: Fix up peer states and counts in the listing
This commit is contained in:
John Cowen 2022-07-04 18:49:21 +01:00 committed by GitHub
parent 0910c41d95
commit 9377ac7635
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 36 deletions

View File

@ -1,5 +0,0 @@
{{#if this.count}}
<div {{tooltip this.tooltipText}}>
{{this.text}}
</div>
{{/if}}

View File

@ -1,29 +0,0 @@
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
export default class PeeringsServiceCount extends Component {
@service intl;
get count() {
const { peering, kind } = this.args;
return peering[`${kind.capitalize()}ServiceCount`];
}
get text() {
const { kind } = this.args;
const { intl, count } = this;
return intl.t(`routes.dc.peers.index.detail.${kind}.count`, { count });
}
get tooltipText() {
const {
kind,
peering: { name },
} = this.args;
const { intl } = this;
return intl.t(`routes.dc.peers.index.detail.${kind}.tooltip`, { name });
}
}

View File

@ -77,8 +77,31 @@ as |sort filters items|}}
<BlockSlot @name="details">
<div class="peers__list__peer-detail">
<Peerings::Badge @peering={{item}} />
<Peerings::ServiceCount @peering={{item}} @kind="imported"/>
<Peerings::ServiceCount @peering={{item}} @kind="exported"/>
<div
{{tooltip
(t 'routes.dc.peers.index.detail.imported.tooltip'
name=item.Name
)
}}
>
{{t 'routes.dc.peers.index.detail.imported.count'
count=(format-number item.ImportedServiceCount)
}}
</div>
<div
{{tooltip
(t 'routes.dc.peers.index.detail.exported.tooltip'
name=item.Name
)
}}
>
{{t 'routes.dc.peers.index.detail.exported.count'
count=(format-number item.ExportedServiceCount)
}}
</div>
</div>
</BlockSlot>
<BlockSlot @name="actions" as |Actions|>