open-consul/ui/packages/consul-ui/app/components/peerings/provider/index.js

42 lines
1.1 KiB
JavaScript
Raw Normal View History

import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { getOwner } from '@ember/application';
2022-10-05 13:14:38 +00:00
import { Tab } from 'consul-ui/components/tab-nav';
export default class PeeringsProvider extends Component {
@service router;
2022-10-10 09:06:48 +00:00
@service intl;
get data() {
return {
tabs: this.tabs,
};
}
get tabs() {
const { peer } = this.args;
const { router } = this;
const owner = getOwner(this);
2022-10-10 09:06:48 +00:00
const { isReceiver, Name: name } = peer;
let tabs = [
2022-10-10 09:06:48 +00:00
{
label: 'Imported Services',
route: 'dc.peers.edit.imported',
tooltip: this.intl.t('routes.dc.peers.index.detail.imported.tab-tooltip', { name }),
},
{
label: 'Exported Services',
route: 'dc.peers.edit.exported',
2022-10-10 09:06:48 +00:00
tooltip: this.intl.t('routes.dc.peers.index.detail.exported.tab-tooltip', { name }),
},
];
2022-10-10 09:06:48 +00:00
if (isReceiver) {
tabs = [...tabs, { label: 'Addresses', route: 'dc.peers.edit.addresses' }];
}
2022-10-05 13:14:38 +00:00
return tabs.map((tab) => new Tab({ ...tab, currentRouteName: router.currentRouteName, owner }));
}
}