From 469fe420b38a93ff0fc954015a111bc1ed9ed022 Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Sat, 8 Oct 2022 13:35:25 +0200 Subject: [PATCH] Make exported-services searchable by name --- .../app/controllers/dc/peers/edit/exported.js | 17 +++ .../app/templates/dc/peers/edit/exported.hbs | 103 +++++++++++++++++- .../vendor/consul-peerings/routes.js | 6 + 3 files changed, 121 insertions(+), 5 deletions(-) create mode 100644 ui/packages/consul-peerings/app/controllers/dc/peers/edit/exported.js diff --git a/ui/packages/consul-peerings/app/controllers/dc/peers/edit/exported.js b/ui/packages/consul-peerings/app/controllers/dc/peers/edit/exported.js new file mode 100644 index 0000000000..59e61c489c --- /dev/null +++ b/ui/packages/consul-peerings/app/controllers/dc/peers/edit/exported.js @@ -0,0 +1,17 @@ +import Controller from "@ember/controller"; +import { tracked } from "@glimmer/tracking"; +import { action } from "@ember/object"; + +export default class PeersEditExportedController extends Controller { + queryParams = { + search: { + as: "filter", + }, + }; + + @tracked search = ""; + + @action updateSearch(value) { + this.search = value; + } +} diff --git a/ui/packages/consul-peerings/app/templates/dc/peers/edit/exported.hbs b/ui/packages/consul-peerings/app/templates/dc/peers/edit/exported.hbs index b7b30f9538..7c814c2775 100644 --- a/ui/packages/consul-peerings/app/templates/dc/peers/edit/exported.hbs +++ b/ui/packages/consul-peerings/app/templates/dc/peers/edit/exported.hbs @@ -22,13 +22,106 @@ -
-
- + {{#if items.length}} +
+
+ +
-
- + {{/if}} + + + {{#if p.data.height}} +
+ {{#if search.data.items.length}} + +
  • +
    {{service.Name}}
    +
  • +
    + {{else}} + + +

    + No visible exported services to + {{route.model.peer.Name}} +

    +
    + + {{#if items.length}} +
    + No services where found matching that search, or you + may not have access to view the services you are + searching for. +
    + {{else}} +
    + Services must be exported from one peer to another to + enable service communication across two peers. There + don't seem to be any services exported to peer-a yet, + or you may not have + services:read + permissions to access to this view. +
    + {{/if}} +
    + + + + +
    + {{/if}} +
    + {{/if}} +
    + +
    {{/let}} + \ No newline at end of file diff --git a/ui/packages/consul-peerings/vendor/consul-peerings/routes.js b/ui/packages/consul-peerings/vendor/consul-peerings/routes.js index b11bf8e445..2cfc21e4e0 100644 --- a/ui/packages/consul-peerings/vendor/consul-peerings/routes.js +++ b/ui/packages/consul-peerings/vendor/consul-peerings/routes.js @@ -34,6 +34,12 @@ exported: { _options: { path: "/exported-services", + queryParams: { + search: { + as: "filter", + replace: true, + }, + }, }, }, addresses: {