From f06001352a53dd431387e97d09f1f39c2fdc86e3 Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Thu, 13 Oct 2022 16:03:03 +0200 Subject: [PATCH] Always sort consul-gateway to bottom sources list --- .../consul/service/search-bar/index.hbs | 16 ++++++++-------- .../consul/service/search-bar/index.js | 10 ++++++++++ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/ui/packages/consul-ui/app/components/consul/service/search-bar/index.hbs b/ui/packages/consul-ui/app/components/consul/service/search-bar/index.hbs index df7abdc695..c88651b5eb 100644 --- a/ui/packages/consul-ui/app/components/consul/service/search-bar/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/service/search-bar/index.hbs @@ -134,7 +134,14 @@ {{#let components.Option as |Option|}} {{#if (gt @sources.length 0)}} - {{#each @sources as |source|}} + + {{#each this.sortedSources as |source|}} {{/if}} {{/let}} diff --git a/ui/packages/consul-ui/app/components/consul/service/search-bar/index.js b/ui/packages/consul-ui/app/components/consul/service/search-bar/index.js index 0db51f3404..700434c900 100644 --- a/ui/packages/consul-ui/app/components/consul/service/search-bar/index.js +++ b/ui/packages/consul-ui/app/components/consul/service/search-bar/index.js @@ -8,4 +8,14 @@ export default class ConsulServiceSearchBar extends Component { return ['passing', 'warning', 'critical', 'empty']; } } + + get sortedSources() { + const sources = this.args.sources || []; + + if (sources.includes('consul-api-gateway')) { + return [...sources.filter((s) => s !== 'consul-api-gateway'), 'consul-api-gateway']; + } else { + return sources; + } + } }