feat: 🎸 add session fields to targets
This commit is contained in:
6 files changed
+66
-1
No files matched your search
@@ -22,6 +22,18 @@ export default class GeneratedTargetModel extends BaseModel {
|
||||
})
|
||||
description;
|
||||
|
||||
@attr('number', {
|
||||
description: '',
|
||||
defaultValue: 28800
|
||||
})
|
||||
session_max_seconds;
|
||||
|
||||
@attr('number', {
|
||||
description: '',
|
||||
defaultValue: 1
|
||||
})
|
||||
session_connection_limit;
|
||||
|
||||
@attr('date', {
|
||||
description: 'The time this resource was created\nOutput only.',
|
||||
readOnly: true,
|
||||
|
||||
@@ -20,7 +20,7 @@ module('Unit | Serializer | target', function (hooks) {
|
||||
type: 'org',
|
||||
},
|
||||
version: 1,
|
||||
type: 'tcp',
|
||||
type: 'tcp'
|
||||
});
|
||||
const snapshot = record._createSnapshot();
|
||||
snapshot.adapterOptions = {};
|
||||
@@ -31,6 +31,8 @@ module('Unit | Serializer | target', function (hooks) {
|
||||
version: 1,
|
||||
type: 'tcp',
|
||||
scope_id: 'org_1',
|
||||
session_max_seconds: 28800,
|
||||
session_connection_limit: 1,
|
||||
attributes: {
|
||||
default_port: null,
|
||||
},
|
||||
|
||||
@@ -47,6 +47,44 @@
|
||||
{{/if}}
|
||||
</form.textarea>
|
||||
|
||||
<form.input
|
||||
@name="session_max_seconds"
|
||||
@type="number"
|
||||
@value={{@model.session_max_seconds}}
|
||||
@label={{t "form.session_max_seconds.label"}}
|
||||
@error={{@model.errors.session_max_seconds}}
|
||||
@helperText={{t "form.session_max_seconds.help"}}
|
||||
min="0"
|
||||
step="1"
|
||||
as |field|>
|
||||
{{#if @model.errors.session_max_seconds}}
|
||||
<field.errors as |errors|>
|
||||
{{#each @model.errors.session_max_seconds as |error|}}
|
||||
<errors.message>{{error.message}}</errors.message>
|
||||
{{/each}}
|
||||
</field.errors>
|
||||
{{/if}}
|
||||
</form.input>
|
||||
|
||||
<form.input
|
||||
@name="session_connection_limit"
|
||||
@type="number"
|
||||
@value={{@model.session_connection_limit}}
|
||||
@label={{t "form.session_connection_limit.label"}}
|
||||
@error={{@model.errors.session_connection_limit}}
|
||||
@helperText={{t "form.session_connection_limit.help"}}
|
||||
min="-1"
|
||||
step="1"
|
||||
as |field|>
|
||||
{{#if @model.errors.session_connection_limit}}
|
||||
<field.errors as |errors|>
|
||||
{{#each @model.errors.session_connection_limit as |error|}}
|
||||
<errors.message>{{error.message}}</errors.message>
|
||||
{{/each}}
|
||||
</field.errors>
|
||||
{{/if}}
|
||||
</form.input>
|
||||
|
||||
{{!-- TODO this is a type-specific field --}}
|
||||
<form.input
|
||||
@name="default_port"
|
||||
|
||||
@@ -7,6 +7,11 @@ const hostSetChance = 0.3;
|
||||
|
||||
export default factory.extend({
|
||||
|
||||
/**
|
||||
* -1 means "unlimited" and we want to generate these on occassion.
|
||||
*/
|
||||
session_connection_limit: () => random.arrayElement([-1, random.number()]),
|
||||
|
||||
/**
|
||||
* Generates attributes fields by type.
|
||||
*/
|
||||
|
||||
@@ -8,6 +8,8 @@ export default Factory.extend({
|
||||
|
||||
type: 'tcp',
|
||||
name: () => random.words(),
|
||||
session_max_seconds: () => random.number(),
|
||||
session_connection_limit: () => random.number(),
|
||||
description: () => random.words(),
|
||||
created_time: () => date.recent(),
|
||||
updated_time: () => date.recent(),
|
||||
|
||||
@@ -35,3 +35,9 @@ started:
|
||||
label: Started
|
||||
status:
|
||||
label: Status
|
||||
session_max_seconds:
|
||||
label: Maximum Duration (in seconds)
|
||||
help: The maximum duration of a session.
|
||||
session_connection_limit:
|
||||
label: Maximum Connections
|
||||
help: The maximum number of connections allowed per session. For unlimited, specify "-1".
|
||||
Reference in new issue
Block a user