feat: 🎸 Add default client port to targets (#1700)

* feat: 🎸 Add default client port to targets

✅ Closes: ICU-9299
This commit is contained in:
Zhihe Li authored and GitHub committed 2023-05-31 18:33:27 -04:00
1 parent 9d7a23fcc4
commit 963b5d465d
7 files changed
+50 -11

No files matched your search

@@ -83,4 +83,17 @@ export default class GeneratedTargetModel extends BaseModel {
'An IP address or DNS name for the session to connect to. Cannot be used in conjunction with host sources.', 'An IP address or DNS name for the session to connect to. Cannot be used in conjunction with host sources.',
}) })
address; address;
@attr('number', {
isNestedAttribute: true,
description: 'The default port a target should use if present.',
})
default_port;
@attr('number', {
isNestedAttribute: true,
description:
"The default port that will be listened on by the client's local proxy.",
})
default_client_port;
} }
-6
View File
@@ -18,12 +18,6 @@ export default class TargetModel extends GeneratedTargetModel {
// =attributes // =attributes
@attr('number', {
isNestedAttribute: true,
description: 'The default port a target should use if present.',
})
default_port;
/** /**
* @type Array * @type Array
*/ */
@@ -17,5 +17,6 @@ export default Factory.extend({
updated_time: () => faker.date.recent(), updated_time: () => faker.date.recent(),
disabled: () => faker.datatype.boolean(), disabled: () => faker.datatype.boolean(),
default_port: () => faker.datatype.number(), default_port: () => faker.datatype.number(),
default_client_port: () => faker.datatype.number(),
version: () => faker.datatype.number(), version: () => faker.datatype.number(),
}); });
@@ -31,6 +31,7 @@ module('Unit | Serializer | target', function (hooks) {
type: 'org', type: 'org',
}, },
default_port: 1234, default_port: 1234,
default_client_port: 4321,
version: 1, version: 1,
type: TYPE_TARGET_TCP, type: TYPE_TARGET_TCP,
address: '0.0.0.0', address: '0.0.0.0',
@@ -51,6 +52,7 @@ module('Unit | Serializer | target', function (hooks) {
ingress_worker_filter: null, ingress_worker_filter: null,
attributes: { attributes: {
default_port: 1234, default_port: 1234,
default_client_port: 4321,
}, },
address: '0.0.0.0', address: '0.0.0.0',
}); });
@@ -157,6 +159,7 @@ module('Unit | Serializer | target', function (hooks) {
ingress_worker_filter: null, ingress_worker_filter: null,
attributes: { attributes: {
default_port: 1234, default_port: 1234,
default_client_port: null,
}, },
address: null, address: null,
}); });
@@ -192,6 +195,7 @@ module('Unit | Serializer | target', function (hooks) {
ingress_worker_filter: null, ingress_worker_filter: null,
attributes: { attributes: {
default_port: 1234, default_port: 1234,
default_client_port: null,
}, },
address: null, address: null,
}); });
@@ -227,6 +231,7 @@ module('Unit | Serializer | target', function (hooks) {
ingress_worker_filter: 'ingress worker', ingress_worker_filter: 'ingress worker',
attributes: { attributes: {
default_port: 1234, default_port: 1234,
default_client_port: null,
}, },
address: null, address: null,
}); });
-3
View File
@@ -33,9 +33,6 @@ grant:
address: address:
label: Address label: Address
help: An IP, host name, or other routable address help: An IP, host name, or other routable address
default_port:
label: Default Port
help: The default port on which to connect
current_password: current_password:
label: Current Password label: Current Password
new_password: new_password:
@@ -326,6 +326,12 @@ target:
worker_filter: worker_filter:
label: Worker Filter label: Worker Filter
help: Deprecated. Boolean expression to filter the workers that are allowed to satisfy this request. help: Deprecated. Boolean expression to filter the workers that are allowed to satisfy this request.
default_port:
label: Default Port
help: The default port on which to connect.
default_client_port:
label: Default Client Port
help: The local proxy port on which to listen by default when a session is started on a client.
questions: questions:
delete-host-sources: delete-host-sources:
title: Remove associated host sources? title: Remove associated host sources?
@@ -122,9 +122,9 @@
as |F| as |F|
> >
<F.Label data-test-default-port-label>{{t <F.Label data-test-default-port-label>{{t
'form.default_port.label' 'resources.target.form.default_port.label'
}}</F.Label> }}</F.Label>
<F.HelperText>{{t 'form.default_port.help'}}</F.HelperText> <F.HelperText>{{t 'resources.target.form.default_port.help'}}</F.HelperText>
{{#if @model.errors.default_port}} {{#if @model.errors.default_port}}
<F.Error as |E|> <F.Error as |E|>
{{#each @model.errors.default_port as |error|}} {{#each @model.errors.default_port as |error|}}
@@ -134,6 +134,29 @@
{{/if}} {{/if}}
</Hds::Form::TextInput::Field> </Hds::Form::TextInput::Field>
<Hds::Form::TextInput::Field
@isOptional={{true}}
@value={{@model.default_client_port}}
@isInvalid={{@model.errors.default_client_port}}
@type='text'
name='default_client_port'
disabled={{form.disabled}}
{{on 'input' (set-from-event @model 'default_client_port')}}
as |F|
>
<F.Label>{{t 'resources.target.form.default_client_port.label'}}</F.Label>
<F.HelperText>{{t
'resources.target.form.default_client_port.help'
}}</F.HelperText>
{{#if @model.errors.default_client_port}}
<F.Error as |E|>
{{#each @model.errors.default_client_port as |error|}}
<E.Message>{{error.message}}</E.Message>
{{/each}}
</F.Error>
{{/if}}
</Hds::Form::TextInput::Field>
<Hds::Form::TextInput::Field <Hds::Form::TextInput::Field
@isOptional={{true}} @isOptional={{true}}
@value={{@model.session_max_seconds}} @value={{@model.session_max_seconds}}