2023-03-14 13:18:55 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
2023-08-11 13:12:13 +00:00
|
|
|
* SPDX-License-Identifier: BUSL-1.1
|
2023-03-14 13:18:55 +00:00
|
|
|
*/
|
|
|
|
|
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;
|
2022-10-10 09:06:48 +00:00
|
|
|
@service intl;
|
2022-10-05 12:43:54 +00:00
|
|
|
|
|
|
|
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;
|
2022-10-09 11:00:00 +00:00
|
|
|
let tabs = [
|
2022-10-10 09:06:48 +00:00
|
|
|
{
|
|
|
|
label: 'Imported Services',
|
2022-10-12 08:36:25 +00:00
|
|
|
route: 'dc.peers.show.imported',
|
2022-10-10 09:06:48 +00:00
|
|
|
tooltip: this.intl.t('routes.dc.peers.index.detail.imported.tab-tooltip', { name }),
|
|
|
|
},
|
2022-10-09 11:00:00 +00:00
|
|
|
{
|
|
|
|
label: 'Exported Services',
|
2022-10-12 08:36:25 +00:00
|
|
|
route: 'dc.peers.show.exported',
|
2022-10-10 09:06:48 +00:00
|
|
|
tooltip: this.intl.t('routes.dc.peers.index.detail.exported.tab-tooltip', { name }),
|
2022-10-09 11:00:00 +00:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2022-10-10 09:06:48 +00:00
|
|
|
if (isReceiver) {
|
2022-10-13 17:45:03 +00:00
|
|
|
tabs = [...tabs, { label: 'Server Addresses', route: 'dc.peers.show.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
|
|
|
}
|
|
|
|
}
|