mirror of https://github.com/hashicorp/consul
ui: Add ServerExternalAddresses field to token generation
parent
941f6da202
commit
ea23bac1fb
|
@ -36,5 +36,26 @@
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
{{/let}}
|
{{/let}}
|
||||||
|
|
||||||
|
{{#let
|
||||||
|
(hash
|
||||||
|
help=(t 'common.validations.server-external-addresses.help')
|
||||||
|
)
|
||||||
|
as |ServerExternalAddresses|}}
|
||||||
|
<fieldset>
|
||||||
|
<TextInput
|
||||||
|
@label="Server address(es)"
|
||||||
|
@name="ServerExternalAddresses"
|
||||||
|
@item={{@item}}
|
||||||
|
@chart={{fsm}}
|
||||||
|
@validations={{ServerExternalAddresses}}
|
||||||
|
@oninput={{pick 'target.value' this.onInput}}
|
||||||
|
/>
|
||||||
|
{{yield (hash
|
||||||
|
valid=(not (state-matches fsm.state 'error'))
|
||||||
|
)}}
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
{{/let}}
|
||||||
</StateMachine>
|
</StateMachine>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
import Component from '@glimmer/component';
|
||||||
|
import { action } from '@ember/object';
|
||||||
|
|
||||||
|
export default class PeerGenerateFieldSets extends Component {
|
||||||
|
@action
|
||||||
|
onInput(addresses) {
|
||||||
|
if (addresses) {
|
||||||
|
addresses = addresses.split(',').map(address => address.trim());
|
||||||
|
} else {
|
||||||
|
addresses = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
this.args.item.ServerExternalAddresses = addresses;
|
||||||
|
}
|
||||||
|
}
|
|
@ -44,12 +44,13 @@
|
||||||
|
|
||||||
<fsm.State @matches={{'loading'}}>
|
<fsm.State @matches={{'loading'}}>
|
||||||
<DataSource
|
<DataSource
|
||||||
@src={{uri '/${partition}/${nspace}/${dc}/peering/token-for/${name}'
|
@src={{uri '/${partition}/${nspace}/${dc}/peering/token-for/${name}/${externalAddresses}'
|
||||||
(hash
|
(hash
|
||||||
partition=@item.Partition
|
partition=@item.Partition
|
||||||
nspace=''
|
nspace=''
|
||||||
dc=@item.Datacenter
|
dc=@item.Datacenter
|
||||||
name=@item.Name
|
name=@item.Name
|
||||||
|
externalAddresses=@item.ServerExternalAddresses
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
@onchange={{queue
|
@onchange={{queue
|
||||||
|
|
|
@ -17,6 +17,8 @@ export default class Peer extends Model {
|
||||||
@attr('string') Name;
|
@attr('string') Name;
|
||||||
@attr('string') State;
|
@attr('string') State;
|
||||||
@attr('string') ID;
|
@attr('string') ID;
|
||||||
|
@attr('string') ServerExternalAddresses;
|
||||||
|
@nullValue([]) @attr() ServerExternalAddresses;
|
||||||
|
|
||||||
// only the side that establishes will hold this property
|
// only the side that establishes will hold this property
|
||||||
@attr('string') PeerID;
|
@attr('string') PeerID;
|
||||||
|
|
|
@ -44,8 +44,11 @@ export default class PeerService extends RepositoryService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@dataSource('/:partition/:ns/:dc/peering/token-for/:name')
|
@dataSource('/:partition/:ns/:dc/peering/token-for/:name/:externalAddresses')
|
||||||
async fetchToken({ dc, ns, partition, name }, configuration, request) {
|
async fetchToken({ dc, ns, partition, name, externalAddresses }, configuration, request) {
|
||||||
|
const ServerExternalAddresses =
|
||||||
|
externalAddresses?.length > 0 ? externalAddresses.split(',') : [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
await request`
|
await request`
|
||||||
POST /v1/peering/token
|
POST /v1/peering/token
|
||||||
|
@ -53,6 +56,7 @@ export default class PeerService extends RepositoryService {
|
||||||
${{
|
${{
|
||||||
PeerName: name,
|
PeerName: name,
|
||||||
Partition: partition || undefined,
|
Partition: partition || undefined,
|
||||||
|
ServerExternalAddresses,
|
||||||
}}
|
}}
|
||||||
`
|
`
|
||||||
)((headers, body, cache) => body);
|
)((headers, body, cache) => body);
|
||||||
|
|
|
@ -81,4 +81,8 @@ validations:
|
||||||
error: "{name} must be a valid DNS hostname."
|
error: "{name} must be a valid DNS hostname."
|
||||||
immutable:
|
immutable:
|
||||||
help: Once created, this cannot be changed.
|
help: Once created, this cannot be changed.
|
||||||
|
server-external-addresses:
|
||||||
|
help: |
|
||||||
|
Enter a fallback server address for this peer to be used in the event of failed automatic updates. This field is required for HCP-managed clusters.
|
||||||
|
test: "^$|^[a-zA-Z0-9]([a-zA-Z0-9-]'{0,62}'[a-zA-Z0-9])?$"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue