2022-10-05 12:43:54 +00:00
|
|
|
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';
|
2022-10-05 12:43:54 +00:00
|
|
|
|
|
|
|
export default class PeeringsProvider extends Component {
|
|
|
|
@service router;
|
|
|
|
|
|
|
|
get data() {
|
|
|
|
return {
|
|
|
|
tabs: this.tabs,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
get tabs() {
|
|
|
|
const { peer } = this.args;
|
|
|
|
const { router } = this;
|
|
|
|
const owner = getOwner(this);
|
|
|
|
|
2022-10-09 11:00:00 +00:00
|
|
|
let tabs = [
|
|
|
|
{ label: 'Imported Services', route: 'dc.peers.edit.imported' },
|
|
|
|
{
|
|
|
|
label: 'Exported Services',
|
|
|
|
route: 'dc.peers.edit.exported',
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2022-10-09 11:02:06 +00:00
|
|
|
if (peer.isReceiver) {
|
2022-10-09 11:00:00 +00:00
|
|
|
tabs = [...tabs, { label: 'Addresses', route: 'dc.peers.edit.addresses' }];
|
2022-10-05 12:43:54 +00:00
|
|
|
}
|
|
|
|
|
2022-10-05 13:14:38 +00:00
|
|
|
return tabs.map((tab) => new Tab({ ...tab, currentRouteName: router.currentRouteName, owner }));
|
2022-10-05 12:43:54 +00:00
|
|
|
}
|
|
|
|
}
|