From 56446d540af4492a38a0e4b2491bb9de961b3f65 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Mon, 18 Jul 2022 17:39:22 +0100 Subject: [PATCH] ui: Adds Peer initiation form (#13754) --- .../consul/peer/form/initiate/README.mdx | 26 +++++++++ .../peer/form/initiate/actions/index.hbs | 7 +++ .../peer/form/initiate/fieldsets/index.hbs | 53 +++++++++++++++++++ .../consul/peer/form/initiate/index.hbs | 41 ++++++++++++++ .../consul-ui/translations/common/en-us.yaml | 9 ++++ 5 files changed, 136 insertions(+) create mode 100644 ui/packages/consul-peerings/app/components/consul/peer/form/initiate/README.mdx create mode 100644 ui/packages/consul-peerings/app/components/consul/peer/form/initiate/actions/index.hbs create mode 100644 ui/packages/consul-peerings/app/components/consul/peer/form/initiate/fieldsets/index.hbs create mode 100644 ui/packages/consul-peerings/app/components/consul/peer/form/initiate/index.hbs diff --git a/ui/packages/consul-peerings/app/components/consul/peer/form/initiate/README.mdx b/ui/packages/consul-peerings/app/components/consul/peer/form/initiate/README.mdx new file mode 100644 index 0000000000..0144569363 --- /dev/null +++ b/ui/packages/consul-peerings/app/components/consul/peer/form/initiate/README.mdx @@ -0,0 +1,26 @@ +# Consul::Peer::Form::Initiate + +```hbs preview-template + +{{#if source.data}} + + + + +{{/if}} + +``` diff --git a/ui/packages/consul-peerings/app/components/consul/peer/form/initiate/actions/index.hbs b/ui/packages/consul-peerings/app/components/consul/peer/form/initiate/actions/index.hbs new file mode 100644 index 0000000000..555ddf3b03 --- /dev/null +++ b/ui/packages/consul-peerings/app/components/consul/peer/form/initiate/actions/index.hbs @@ -0,0 +1,7 @@ + + Add peer + diff --git a/ui/packages/consul-peerings/app/components/consul/peer/form/initiate/fieldsets/index.hbs b/ui/packages/consul-peerings/app/components/consul/peer/form/initiate/fieldsets/index.hbs new file mode 100644 index 0000000000..f0f2fd5eb6 --- /dev/null +++ b/ui/packages/consul-peerings/app/components/consul/peer/form/initiate/fieldsets/index.hbs @@ -0,0 +1,53 @@ +
+ {{#let + (hash + help='Enter a name to locally identify the new peer.' + Name=(array + (hash + test=(t 'common.validations.dns-hostname.test') + error=(t 'common.validations.dns-hostname.error' name="Name") + ) + ) + ) + + (hash + help='Enter the token received from the operator of the desired peer.' + PeeringToken=(array) + ) + + as |Name PeeringToken|}} +

+ Enter a token generated in the desired peer. +

+ + +
+ + + {{yield (hash + valid=(not (state-matches fsm.state 'error')) + )}} +
+ +
+ {{/let}} +
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 new file mode 100644 index 0000000000..a0b1294bf4 --- /dev/null +++ b/ui/packages/consul-peerings/app/components/consul/peer/form/initiate/index.hbs @@ -0,0 +1,41 @@ +
+ + +{{#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 + ) + )}} +
+{{/let}} +
+
+
diff --git a/ui/packages/consul-ui/translations/common/en-us.yaml b/ui/packages/consul-ui/translations/common/en-us.yaml index d45545c3c0..a096b0980a 100644 --- a/ui/packages/consul-ui/translations/common/en-us.yaml +++ b/ui/packages/consul-ui/translations/common/en-us.yaml @@ -72,3 +72,12 @@ sort: status: asc: Unhealthy to Healthy desc: Healthy to Unhealthy +validations: + dns-hostname: + help: | + Must be a valid DNS hostname. Must contain 1-64 characters (numbers, letters, and hyphens), and must begin with a letter. + test: "^[a-zA-Z0-9]([a-zA-Z0-9-]'{0,62}'[a-zA-Z0-9])?$" + error: "{name} must be a valid DNS hostname." + immutable: + help: Once created, this cannot be changed. +