open-consul/ui-v2/app/components/route-card.js
John Cowen 1fdf60234c
ui: Discovery chain improvements (#7222)
* ui: remove the default word when describing routes

* ui: Avoid mutating the chain and look for the default edges more safely

* ui: Use not null check instead of a truthy check for showing disco-chain

* ui: Upgrade consul-api-double for better disco-chain mocks/fixtures
2020-02-06 12:06:47 +00:00

24 lines
565 B
JavaScript

import Component from '@ember/component';
import { get, computed } from '@ember/object';
export default Component.extend({
tagName: '',
path: computed('item', function() {
return Object.entries(get(this, '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: '/',
}
);
}),
});