open-consul/ui/packages/consul-ui/app/components/consul/discovery-chain/route-card/index.js

23 lines
537 B
JavaScript

import Component from '@glimmer/component';
import { get } from '@ember/object';
export default class RouteCard extends Component {
get path() {
return Object.entries(get(this.args.item, 'Definition.Match.HTTP') || {}).reduce(
function(prev, [key, value]) {
if (key.toLowerCase().startsWith('path')) {
return {
type: key.replace('Path', ''),
value: value,
};
}
return prev;
},
{
type: 'Prefix',
value: '/',
}
);
}
}