From ac41499d9bc8ffa7768f4cf422e3246c0abac570 Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Wed, 26 Oct 2022 10:11:41 +0200 Subject: [PATCH 1/3] prettify peer/initiate form --- .../consul/peer/form/initiate/index.hbs | 77 ++++++++----------- 1 file changed, 33 insertions(+), 44 deletions(-) diff --git a/ui/packages/consul-peerings/app/components/consul/peer/form/initiate/index.hbs b/ui/packages/consul-peerings/app/components/consul/peer/form/initiate/index.hbs index 8b29c46b8..f7daf88cf 100644 --- a/ui/packages/consul-peerings/app/components/consul/peer/form/initiate/index.hbs +++ b/ui/packages/consul-peerings/app/components/consul/peer/form/initiate/index.hbs @@ -1,54 +1,43 @@ -
+
- - - -

- Error
- {{error.message}} -

-
-
-
- -{{#let - (unique-id) -as |id|}} -
- {{yield (hash - Fieldsets=(component "consul/peer/form/initiate/fieldsets" - item=@item + as |writer| + > + + + +

+ Error
+ {{error.message}} +

+
+
+
+ + {{#let (unique-id) as |id|}} + + {{yield + (hash + Fieldsets=(component + "consul/peer/form/initiate/fieldsets" item=@item + ) + Actions=(component + "consul/peer/form/initiate/actions" item=@item id=id + ) ) - Actions=(component "consul/peer/form/initiate/actions" - item=@item - id=id - ) - )}} + }} -{{/let}} + {{/let}}
-
+
\ No newline at end of file From 6eaa9d94dae32eb6464df3a93de25db387559bb8 Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Wed, 26 Oct 2022 11:15:06 +0200 Subject: [PATCH 2/3] Prettify peers.index template --- .../app/templates/dc/peers/index.hbs | 386 +++++++++--------- 1 file changed, 191 insertions(+), 195 deletions(-) diff --git a/ui/packages/consul-peerings/app/templates/dc/peers/index.hbs b/ui/packages/consul-peerings/app/templates/dc/peers/index.hbs index 75ee9afa7..aa1bfee1c 100644 --- a/ui/packages/consul-peerings/app/templates/dc/peers/index.hbs +++ b/ui/packages/consul-peerings/app/templates/dc/peers/index.hbs @@ -1,235 +1,231 @@ - + + ) + }} + as |loader| + > - + -{{#let - - (hash - value=(or sortBy "State:asc") - change=(action (mut sortBy) value="target.selected") - ) - - (hash - state=(hash - value=(if state (split state ',') undefined) - change=(action (mut state) value="target.selectedItems") - ) - searchproperty=(hash - value=(if (not-eq searchproperty undefined) - (split searchproperty ',') - searchProperties - ) - change=(action (mut searchproperty) value="target.selectedItems") - default=searchProperties - ) - ) - - loader.data - -as |sort filters items|}} - - -

- -

-
- - - {{#if (gt items.length 0)}} - - {{/if}} - - - - - - - - {{did-insert (set this 'create' modal)}} -

- Add peer connection -

-
- - - {{#if modal.opened}} - - - {{did-insert (set this 'form' form)}} - - - - {{/if}} - - - - - -
- - Add peer connection - - -
- - - + searchproperty=(hash + value=(if + (not-eq searchproperty undefined) + (split searchproperty ",") + searchProperties + ) + change=(action (mut searchproperty) value="target.selectedItems") + default=searchProperties + ) + ) + loader.data + as |sort filters items| + }} + + +

+ +

+
+ - - - - + {{#if (gt items.length 0)}} + + {{/if}} + + + + @aria={{hash label="Add peer connection"}} + class="peer-create-modal" + as |modal| + > - {{did-insert (set this 'regenerate' modal)}} + {{did-insert (set this "create" modal)}}

- Regenerate token + Add peer connection

- {{#if this.item}} - - {{did-insert (set this 'regenerateForm' form)}} - - + + {{#if modal.opened}} + + + {{did-insert (set this "form" form)}} + + + {{/if}} + - +
+ + Add peer connection + - + + + - + @label="Peer" + as |writer| + > - + + + - - - {{!-- TODO: do we need to check permissions here or will we receive an error automatically? --}} - + {{did-insert (set this "regenerate" modal)}}

- {{t 'routes.dc.peers.index.empty.header' - items=items.length - }} + Regenerate token

-

- {{t 'routes.dc.peers.index.empty.body' - items=items.length - canUsePartitions=(can "use partitions") - canUseACLs=(can "use acls") - htmlSafe=true - }} -

+ {{#if this.item}} + + {{did-insert (set this "regenerateForm" form)}} + + + {{/if}}
- - + -
-
-
-
-
-
-
-{{/let}} + + + + + + + + + + {{! TODO: do we need to check permissions here or will we receive an error automatically? }} + + +

+ {{t + "routes.dc.peers.index.empty.header" + items=items.length + }} +

+
+ +

+ {{t + "routes.dc.peers.index.empty.body" + items=items.length + canUsePartitions=(can "use partitions") + canUseACLs=(can "use acls") + htmlSafe=true + }} +

+
+ + + + +
+
+
+
+ + + + {{/let}}
-
+
\ No newline at end of file From be97a2a4a8057986fea60e65415d1ae696a92adc Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Wed, 26 Oct 2022 11:15:57 +0200 Subject: [PATCH 3/3] Redirect to peers.show after establishing peering --- .../app/controllers/dc/peers/index.js | 12 ++++++++++++ .../consul-peerings/app/templates/dc/peers/index.hbs | 2 +- .../tests/acceptance/dc/peers/establish.feature | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 ui/packages/consul-peerings/app/controllers/dc/peers/index.js diff --git a/ui/packages/consul-peerings/app/controllers/dc/peers/index.js b/ui/packages/consul-peerings/app/controllers/dc/peers/index.js new file mode 100644 index 000000000..e8812e486 --- /dev/null +++ b/ui/packages/consul-peerings/app/controllers/dc/peers/index.js @@ -0,0 +1,12 @@ +import Controller from "@ember/controller"; +import { inject as service } from "@ember/service"; + +export default class DcPeersIndexController extends Controller { + @service router; + + redirectToPeerShow = (modalCloseFn, peerModel) => { + modalCloseFn?.(); + + this.router.transitionTo("dc.peers.show", peerModel.Name); + }; +} diff --git a/ui/packages/consul-peerings/app/templates/dc/peers/index.hbs b/ui/packages/consul-peerings/app/templates/dc/peers/index.hbs index aa1bfee1c..2d57dec8d 100644 --- a/ui/packages/consul-peerings/app/templates/dc/peers/index.hbs +++ b/ui/packages/consul-peerings/app/templates/dc/peers/index.hbs @@ -76,7 +76,7 @@ {{did-insert (set this "form" form)}} diff --git a/ui/packages/consul-ui/tests/acceptance/dc/peers/establish.feature b/ui/packages/consul-ui/tests/acceptance/dc/peers/establish.feature index f037d4572..c773155ac 100644 --- a/ui/packages/consul-ui/tests/acceptance/dc/peers/establish.feature +++ b/ui/packages/consul-ui/tests/acceptance/dc/peers/establish.feature @@ -28,3 +28,4 @@ Feature: dc / peers / establish: Peer Establish Peering --- And "[data-notification]" has the "notification-update" class And "[data-notification]" has the "success" class + And the url should be /dc-1/peers/new-peer/imported-services