From eff5f90394d4f9e260a95fee8a2767f0fe4afdfd Mon Sep 17 00:00:00 2001 From: dharini Date: Mon, 28 Mar 2022 14:02:27 -0700 Subject: [PATCH 01/16] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20update=20target=20?= =?UTF-8?q?route=20to=20support=20ssh=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/controllers/scopes/scope/targets/new.js | 7 +++++++ ui/admin/app/routes/scopes/scope/targets/new.js | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 ui/admin/app/controllers/scopes/scope/targets/new.js diff --git a/ui/admin/app/controllers/scopes/scope/targets/new.js b/ui/admin/app/controllers/scopes/scope/targets/new.js new file mode 100644 index 0000000000..bd048a0efd --- /dev/null +++ b/ui/admin/app/controllers/scopes/scope/targets/new.js @@ -0,0 +1,7 @@ +import Controller from '@ember/controller'; + +export default class ScopesScopeTargetsNewController extends Controller { + // =attributes + + queryParams = ['type']; +} diff --git a/ui/admin/app/routes/scopes/scope/targets/new.js b/ui/admin/app/routes/scopes/scope/targets/new.js index 5e3d97603c..98fa5dd38f 100644 --- a/ui/admin/app/routes/scopes/scope/targets/new.js +++ b/ui/admin/app/routes/scopes/scope/targets/new.js @@ -3,14 +3,24 @@ import Route from '@ember/routing/route'; export default class ScopesScopeTargetsNewRoute extends Route { // =methods + // =attributes + queryParams = { + type: { + refreshModel: true, + }, + }; /** * Creates a new unsaved target in current scope. * @return {TargetModel} */ - model() { + + model(params) { const scopeModel = this.modelFor('scopes.scope'); + if (!params.type) { + params.type = 'tcp'; //tcp is the default type + } return this.store.createRecord('target', { - type: 'tcp', + type: params.type, scopeModel, }); } From 5f7497a9d49581e05fc15e7f0c48b1831723901e Mon Sep 17 00:00:00 2001 From: dharini Date: Mon, 28 Mar 2022 14:02:27 -0700 Subject: [PATCH 02/16] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20update=20target=20?= =?UTF-8?q?route=20to=20support=20ssh=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/controllers/scopes/scope/targets/new.js | 7 +++++++ ui/admin/app/routes/scopes/scope/targets/new.js | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 ui/admin/app/controllers/scopes/scope/targets/new.js diff --git a/ui/admin/app/controllers/scopes/scope/targets/new.js b/ui/admin/app/controllers/scopes/scope/targets/new.js new file mode 100644 index 0000000000..bd048a0efd --- /dev/null +++ b/ui/admin/app/controllers/scopes/scope/targets/new.js @@ -0,0 +1,7 @@ +import Controller from '@ember/controller'; + +export default class ScopesScopeTargetsNewController extends Controller { + // =attributes + + queryParams = ['type']; +} diff --git a/ui/admin/app/routes/scopes/scope/targets/new.js b/ui/admin/app/routes/scopes/scope/targets/new.js index 5e3d97603c..98fa5dd38f 100644 --- a/ui/admin/app/routes/scopes/scope/targets/new.js +++ b/ui/admin/app/routes/scopes/scope/targets/new.js @@ -3,14 +3,24 @@ import Route from '@ember/routing/route'; export default class ScopesScopeTargetsNewRoute extends Route { // =methods + // =attributes + queryParams = { + type: { + refreshModel: true, + }, + }; /** * Creates a new unsaved target in current scope. * @return {TargetModel} */ - model() { + + model(params) { const scopeModel = this.modelFor('scopes.scope'); + if (!params.type) { + params.type = 'tcp'; //tcp is the default type + } return this.store.createRecord('target', { - type: 'tcp', + type: params.type, scopeModel, }); } From b63a49cd4688f792ebedef89937b9103bb3103d3 Mon Sep 17 00:00:00 2001 From: dharini Date: Wed, 16 Mar 2022 17:16:01 -0700 Subject: [PATCH 03/16] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20create=20SSH=20tar?= =?UTF-8?q?get=20in=20admin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/admin/app/components/form/target/index.hbs | 128 +---------------- .../app/components/form/target/ssh/index.hbs | 134 ++++++++++++++++++ .../app/components/form/target/tcp/index.hbs | 134 ++++++++++++++++++ .../templates/scopes/scope/targets/index.hbs | 27 +++- .../tests/acceptance/targets/create-test.js | 2 +- 5 files changed, 301 insertions(+), 124 deletions(-) create mode 100644 ui/admin/app/components/form/target/ssh/index.hbs create mode 100644 ui/admin/app/components/form/target/tcp/index.hbs diff --git a/ui/admin/app/components/form/target/index.hbs b/ui/admin/app/components/form/target/index.hbs index fc87570415..35086d4a9d 100644 --- a/ui/admin/app/components/form/target/index.hbs +++ b/ui/admin/app/components/form/target/index.hbs @@ -1,122 +1,6 @@ - - - - - - {{#if @model.errors.name}} - - {{#each @model.errors.name as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - {{#if @model.errors.description}} - - {{#each @model.errors.description as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - {{#if @model.errors.session_max_seconds}} - - {{#each @model.errors.session_max_seconds as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - {{#if @model.errors.session_connection_limit}} - - {{#each @model.errors.session_connection_limit as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - {{! TODO this is a type-specific field }} - - {{! TODO need to figure out how to reference `attributes.errors` here }} - {{#if @model.errors.default_port}} - - {{#each @model.errors.default_port as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - {{#if (can 'save model' @model)}} - - {{/if}} - \ No newline at end of file +{{component + (concat 'form/target/' @model.type) + model=@model + submit=@submit + cancel=@cancel +}} \ No newline at end of file diff --git a/ui/admin/app/components/form/target/ssh/index.hbs b/ui/admin/app/components/form/target/ssh/index.hbs new file mode 100644 index 0000000000..220efaad8b --- /dev/null +++ b/ui/admin/app/components/form/target/ssh/index.hbs @@ -0,0 +1,134 @@ + + + {{#if @model.errors.name}} + + {{#each @model.errors.name as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + {{#if @model.errors.description}} + + {{#each @model.errors.description as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + <:title>{{t 'form.type.label'}} + <:body> + + + + + + + + {{#if @model.errors.session_max_seconds}} + + {{#each @model.errors.session_max_seconds as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + {{#if @model.errors.session_connection_limit}} + + {{#each @model.errors.session_connection_limit as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + {{! TODO this is a type-specific field }} + + {{! TODO need to figure out how to reference `attributes.errors` here }} + {{#if @model.errors.default_port}} + + {{#each @model.errors.default_port as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + {{#if (can 'save model' @model)}} + + {{/if}} + \ No newline at end of file diff --git a/ui/admin/app/components/form/target/tcp/index.hbs b/ui/admin/app/components/form/target/tcp/index.hbs new file mode 100644 index 0000000000..627e969b10 --- /dev/null +++ b/ui/admin/app/components/form/target/tcp/index.hbs @@ -0,0 +1,134 @@ + + + {{#if @model.errors.name}} + + {{#each @model.errors.name as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + {{#if @model.errors.description}} + + {{#each @model.errors.description as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + <:title>{{t 'form.type.label'}} + <:body> + + + + + + + + {{#if @model.errors.session_max_seconds}} + + {{#each @model.errors.session_max_seconds as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + {{#if @model.errors.session_connection_limit}} + + {{#each @model.errors.session_connection_limit as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + {{! TODO this is a type-specific field }} + + {{! TODO need to figure out how to reference `attributes.errors` here }} + {{#if @model.errors.default_port}} + + {{#each @model.errors.default_port as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + {{#if (can 'save model' @model)}} + + {{/if}} + \ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/targets/index.hbs b/ui/admin/app/templates/scopes/scope/targets/index.hbs index 4705b4a2f2..775f3234ab 100644 --- a/ui/admin/app/templates/scopes/scope/targets/index.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/index.hbs @@ -14,7 +14,7 @@ {{/if}} - + {{!-- {{#if (can 'create model' this.scope collection='targets')}} {{#if @model}} {{t @@ -22,6 +22,31 @@ }} {{/if}} {{/if}} + --}} + + + {{#if (can 'create model' this.scope collection='targets')}} + {{#if @model}} + + + {{t 'resources.target.types.tcp'}} + + + {{t 'resources.target.types.ssh'}} + + + {{/if}} + {{/if}} diff --git a/ui/admin/tests/acceptance/targets/create-test.js b/ui/admin/tests/acceptance/targets/create-test.js index fd69af27ec..df8640309c 100644 --- a/ui/admin/tests/acceptance/targets/create-test.js +++ b/ui/admin/tests/acceptance/targets/create-test.js @@ -52,7 +52,7 @@ module('Acceptance | targets | create', function (hooks) { urls.targets = `${urls.projectScope}/targets`; urls.target = `${urls.targets}/${instances.target.id}`; urls.unknownTarget = `${urls.targets}/foo`; - urls.newTarget = `${urls.targets}/new`; + urls.newTarget = `${urls.targets}/new?type=tcp`; // Generate resource couner getTargetCount = () => this.server.schema.targets.all().models.length; authenticateSession({}); From 5a5bb307dc52937fc3b2a9e5b90bead8da1f0dc5 Mon Sep 17 00:00:00 2001 From: dharini Date: Wed, 16 Mar 2022 17:36:36 -0700 Subject: [PATCH 04/16] =?UTF-8?q?fix:=20=F0=9F=90=9B=20remove=20comments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/admin/app/components/form/target/ssh/index.hbs | 2 -- ui/admin/app/components/form/target/tcp/index.hbs | 2 -- 2 files changed, 4 deletions(-) diff --git a/ui/admin/app/components/form/target/ssh/index.hbs b/ui/admin/app/components/form/target/ssh/index.hbs index 220efaad8b..68d874e946 100644 --- a/ui/admin/app/components/form/target/ssh/index.hbs +++ b/ui/admin/app/components/form/target/ssh/index.hbs @@ -102,7 +102,6 @@ {{/if}} - {{! TODO this is a type-specific field }} - {{! TODO need to figure out how to reference `attributes.errors` here }} {{#if @model.errors.default_port}} {{#each @model.errors.default_port as |error|}} diff --git a/ui/admin/app/components/form/target/tcp/index.hbs b/ui/admin/app/components/form/target/tcp/index.hbs index 627e969b10..abdb261978 100644 --- a/ui/admin/app/components/form/target/tcp/index.hbs +++ b/ui/admin/app/components/form/target/tcp/index.hbs @@ -102,7 +102,6 @@ {{/if}} - {{! TODO this is a type-specific field }} - {{! TODO need to figure out how to reference `attributes.errors` here }} {{#if @model.errors.default_port}} {{#each @model.errors.default_port as |error|}} From 240ef58cffd1e92c582f52af9221d70e98e78ec8 Mon Sep 17 00:00:00 2001 From: dharini Date: Thu, 17 Mar 2022 09:14:14 -0700 Subject: [PATCH 05/16] =?UTF-8?q?chore:=20=F0=9F=A4=96=20remove=20comment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/admin/app/templates/scopes/scope/targets/index.hbs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/ui/admin/app/templates/scopes/scope/targets/index.hbs b/ui/admin/app/templates/scopes/scope/targets/index.hbs index 775f3234ab..a2ebfb5630 100644 --- a/ui/admin/app/templates/scopes/scope/targets/index.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/index.hbs @@ -14,16 +14,6 @@ {{/if}} - {{!-- - {{#if (can 'create model' this.scope collection='targets')}} - {{#if @model}} - {{t - 'titles.new' - }} - {{/if}} - {{/if}} - --}} - {{#if (can 'create model' this.scope collection='targets')}} {{#if @model}} From 8c8fbee99503fef03d06f1347e5bf33c2c1b8d83 Mon Sep 17 00:00:00 2001 From: dharini Date: Thu, 17 Mar 2022 13:45:48 -0700 Subject: [PATCH 06/16] =?UTF-8?q?chore:=20=F0=9F=A4=96=20add=20helper=20te?= =?UTF-8?q?xt=20for=20tcp=20and=20ssh=20target=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/core/translations/resources/en-us.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index b381c96b8e..6c2d9d67d5 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -278,6 +278,9 @@ target: types: tcp: TCP ssh: SSH + help: + tcp: This target belongs to an SSH host catalog and will use SSH to connect + ssh: This target belongs to an TCP host catalog and will use TCP to connect host-source: title: Host Source title_plural: Host Sources From f910d5a01d3625cf227a53284eedcbf7f9f2a346 Mon Sep 17 00:00:00 2001 From: dharini Date: Mon, 28 Mar 2022 10:34:12 -0700 Subject: [PATCH 07/16] =?UTF-8?q?fix:=20=F0=9F=90=9B=20add=20placeholder?= =?UTF-8?q?=20to=20default=20ports?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/admin/app/components/form/target/ssh/index.hbs | 2 ++ ui/admin/app/components/form/target/tcp/index.hbs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ui/admin/app/components/form/target/ssh/index.hbs b/ui/admin/app/components/form/target/ssh/index.hbs index 68d874e946..96f7616f7e 100644 --- a/ui/admin/app/components/form/target/ssh/index.hbs +++ b/ui/admin/app/components/form/target/ssh/index.hbs @@ -53,6 +53,7 @@ > Date: Mon, 28 Mar 2022 13:23:19 -0700 Subject: [PATCH 08/16] =?UTF-8?q?chore:=20=F0=9F=A4=96=20add=20a=20conditi?= =?UTF-8?q?onal=20check=20to=20display=20and=20create=20ssh=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/scopes/scope/targets/index.hbs | 111 ++++++++++++------ 1 file changed, 75 insertions(+), 36 deletions(-) diff --git a/ui/admin/app/templates/scopes/scope/targets/index.hbs b/ui/admin/app/templates/scopes/scope/targets/index.hbs index a2ebfb5630..8c6a5707e3 100644 --- a/ui/admin/app/templates/scopes/scope/targets/index.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/index.hbs @@ -28,12 +28,14 @@ > {{t 'resources.target.types.tcp'}} - - {{t 'resources.target.types.ssh'}} - + {{#if (feature-flag 'ssh-target')}} + + {{t 'resources.target.types.ssh'}} + + {{/if}} {{/if}} {{/if}} @@ -52,37 +54,74 @@ {{#each @model as |target|}} - - - {{#if (can 'read model' target)}} - + {{#if (feature-flag 'ssh-target')}} + + + + {{#if (can 'read model' target)}} + + {{target.displayName}} + + {{else}} {{target.displayName}} - - {{else}} - {{target.displayName}} - {{/if}} -

{{target.description}}

-
- - {{#if target.type}} - - {{t (concat 'resources.target.types.' target.type)}} - - {{/if}} - - - - {{target.id}} - - -
+ {{/if}} +

{{target.description}}

+ + + {{#if target.type}} + + {{t (concat 'resources.target.types.' target.type)}} + + {{/if}} + + + + {{target.id}} + + + + {{else}} + {{#if (eq target.type 'tcp')}} + + + {{#if (can 'read model' target)}} + + {{target.displayName}} + + {{else}} + {{target.displayName}} + {{/if}} +

{{target.description}}

+
+ + {{#if target.type}} + + {{t (concat 'resources.target.types.' target.type)}} + + {{/if}} + + + + {{target.id}} + + +
+ {{/if}} + {{/if}} {{/each}}
From e585c487230eb9eee6c2f370ecfe690b75852354 Mon Sep 17 00:00:00 2001 From: dharini Date: Mon, 28 Mar 2022 13:40:38 -0700 Subject: [PATCH 09/16] =?UTF-8?q?test:=20=F0=9F=92=8D=20add=20a=20create?= =?UTF-8?q?=20test=20for=20type=20ssh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tests/acceptance/targets/create-test.js | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/ui/admin/tests/acceptance/targets/create-test.js b/ui/admin/tests/acceptance/targets/create-test.js index df8640309c..7e46e243ef 100644 --- a/ui/admin/tests/acceptance/targets/create-test.js +++ b/ui/admin/tests/acceptance/targets/create-test.js @@ -29,7 +29,8 @@ module('Acceptance | targets | create', function (hooks) { projectScope: null, targets: null, target: null, - newTarget: null, + newTCPTarget: null, + newSSHTarget: null, }; hooks.beforeEach(function () { @@ -52,16 +53,26 @@ module('Acceptance | targets | create', function (hooks) { urls.targets = `${urls.projectScope}/targets`; urls.target = `${urls.targets}/${instances.target.id}`; urls.unknownTarget = `${urls.targets}/foo`; - urls.newTarget = `${urls.targets}/new?type=tcp`; + urls.newTCPTarget = `${urls.targets}/new?type=tcp`; + urls.newSSHTarget = `${urls.targets}/new?type=ssh`; // Generate resource couner getTargetCount = () => this.server.schema.targets.all().models.length; authenticateSession({}); }); - test('can create new targets', async function (assert) { + test('can create new targets of type TCP', async function (assert) { assert.expect(1); const count = getTargetCount(); - await visit(urls.newTarget); + await visit(urls.newTCPTarget); + await fillIn('[name="name"]', 'random string'); + await click('[type="submit"]'); + assert.equal(getTargetCount(), count + 1); + }); + + test('can create new targets of type SSH', async function (assert) { + assert.expect(1); + const count = getTargetCount(); + await visit(urls.newSSHTarget); await fillIn('[name="name"]', 'random string'); await click('[type="submit"]'); assert.equal(getTargetCount(), count + 1); @@ -75,7 +86,7 @@ module('Acceptance | targets | create', function (hooks) { 'create' ) ); - assert.ok(find(`[href="${urls.newTarget}"]`)); + assert.ok(find(`[href="${urls.newTCPTarget}"]`)); }); test('cannot navigate to new targets route without proper authorization', async function (assert) { @@ -87,13 +98,13 @@ module('Acceptance | targets | create', function (hooks) { 'create' ) ); - assert.notOk(find(`[href="${urls.newTarget}"]`)); + assert.notOk(find(`[href="${urls.newTCPTarget}"]`)); }); test('can cancel create new targets', async function (assert) { assert.expect(2); const count = getTargetCount(); - await visit(urls.newTarget); + await visit(urls.newTCPTarget); await fillIn('[name="name"]', 'random string'); await click('.rose-form-actions [type="button"]'); assert.equal(currentURL(), urls.targets); @@ -121,7 +132,7 @@ module('Acceptance | targets | create', function (hooks) { } ); }); - await visit(urls.newTarget); + await visit(urls.newTCPTarget); await click('[type="submit"]'); assert.ok( find('[role="alert"]').textContent.trim(), From 384f28e44ed085661255d2427b11b1707d91ade0 Mon Sep 17 00:00:00 2001 From: dharini Date: Wed, 16 Mar 2022 17:16:01 -0700 Subject: [PATCH 10/16] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20create=20SSH=20tar?= =?UTF-8?q?get=20in=20admin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/scopes/scope/targets/index.hbs | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/ui/admin/app/templates/scopes/scope/targets/index.hbs b/ui/admin/app/templates/scopes/scope/targets/index.hbs index 8c6a5707e3..ae1dbbee2b 100644 --- a/ui/admin/app/templates/scopes/scope/targets/index.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/index.hbs @@ -14,7 +14,7 @@ {{/if}} - + {{!-- {{#if (can 'create model' this.scope collection='targets')}} {{#if @model}} {{/if}} {{/if}} + --}} + + + {{#if (can 'create model' this.scope collection='targets')}} + {{#if @model}} + + + {{t 'resources.target.types.tcp'}} + + + {{t 'resources.target.types.ssh'}} + + + {{/if}} + {{/if}} From f521974cf9ae538593e95d4efe038d80d1a753ab Mon Sep 17 00:00:00 2001 From: dharini Date: Thu, 17 Mar 2022 09:14:14 -0700 Subject: [PATCH 11/16] =?UTF-8?q?chore:=20=F0=9F=A4=96=20remove=20comment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ui/admin/app/templates/scopes/scope/targets/index.hbs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/admin/app/templates/scopes/scope/targets/index.hbs b/ui/admin/app/templates/scopes/scope/targets/index.hbs index ae1dbbee2b..1625a4c19d 100644 --- a/ui/admin/app/templates/scopes/scope/targets/index.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/index.hbs @@ -14,6 +14,7 @@ {{/if}} +<<<<<<< HEAD {{!-- {{#if (can 'create model' this.scope collection='targets')}} {{#if @model}} @@ -41,6 +42,8 @@ {{/if}} --}} +======= +>>>>>>> f1402640 (chore: 🤖 remove comment) {{#if (can 'create model' this.scope collection='targets')}} {{#if @model}} From aa993f8b307c8a4a76840abb8bfd93ca76beedf5 Mon Sep 17 00:00:00 2001 From: dharini Date: Mon, 28 Mar 2022 13:23:19 -0700 Subject: [PATCH 12/16] =?UTF-8?q?chore:=20=F0=9F=A4=96=20add=20a=20conditi?= =?UTF-8?q?onal=20check=20to=20display=20and=20create=20ssh=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/templates/scopes/scope/targets/index.hbs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ui/admin/app/templates/scopes/scope/targets/index.hbs b/ui/admin/app/templates/scopes/scope/targets/index.hbs index 1625a4c19d..62ff4ad0f8 100644 --- a/ui/admin/app/templates/scopes/scope/targets/index.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/index.hbs @@ -58,12 +58,14 @@ > {{t 'resources.target.types.tcp'}} - - {{t 'resources.target.types.ssh'}} - + {{#if (feature-flag 'ssh-target')}} + + {{t 'resources.target.types.ssh'}} + + {{/if}} {{/if}} {{/if}} From 1128d6da4f5c9f358cb916048b7f3a4d7726f132 Mon Sep 17 00:00:00 2001 From: dharini Date: Mon, 28 Mar 2022 14:56:32 -0700 Subject: [PATCH 13/16] =?UTF-8?q?fix:=20=F0=9F=90=9B=20resolve=20merge=20c?= =?UTF-8?q?onflict?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/scopes/scope/targets/index.hbs | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/ui/admin/app/templates/scopes/scope/targets/index.hbs b/ui/admin/app/templates/scopes/scope/targets/index.hbs index 62ff4ad0f8..8c6a5707e3 100644 --- a/ui/admin/app/templates/scopes/scope/targets/index.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/index.hbs @@ -14,36 +14,6 @@ {{/if}} -<<<<<<< HEAD - {{!-- - {{#if (can 'create model' this.scope collection='targets')}} - {{#if @model}} - - - {{t 'resources.target.types.tcp'}} - - {{#if (feature-flag 'ssh-target')}} - - {{t 'resources.target.types.ssh'}} - - {{/if}} - - {{/if}} - {{/if}} - --}} - -======= ->>>>>>> f1402640 (chore: 🤖 remove comment) {{#if (can 'create model' this.scope collection='targets')}} {{#if @model}} From 8093881e06bf6b5fec0092b1dbcaa28f493dfccd Mon Sep 17 00:00:00 2001 From: Dharini Jeeva Date: Mon, 28 Mar 2022 16:08:34 -0700 Subject: [PATCH 14/16] Update addons/core/translations/resources/en-us.yaml Co-authored-by: Cameron Perera --- addons/core/translations/resources/en-us.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 6c2d9d67d5..32f098cc4a 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -279,8 +279,8 @@ target: tcp: TCP ssh: SSH help: - tcp: This target belongs to an SSH host catalog and will use SSH to connect - ssh: This target belongs to an TCP host catalog and will use TCP to connect + tcp: This target belongs to an TCP host catalog and will use TCP to connect + ssh: This target belongs to an SSH host catalog and will use SSH to connect host-source: title: Host Source title_plural: Host Sources From 4d5dee8dcb80d474dadf626da64c22945acb9c43 Mon Sep 17 00:00:00 2001 From: dharini Date: Tue, 29 Mar 2022 17:42:45 -0700 Subject: [PATCH 15/16] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20simplify=20tar?= =?UTF-8?q?get=20type=20components?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/components/form/target/details.hbs | 134 +++++++++++++++++ .../app/components/form/target/ssh/index.hbs | 141 +----------------- .../app/components/form/target/tcp/index.hbs | 141 +----------------- .../templates/scopes/scope/targets/index.hbs | 2 +- 4 files changed, 149 insertions(+), 269 deletions(-) create mode 100644 ui/admin/app/components/form/target/details.hbs diff --git a/ui/admin/app/components/form/target/details.hbs b/ui/admin/app/components/form/target/details.hbs new file mode 100644 index 0000000000..41f8d8c7c6 --- /dev/null +++ b/ui/admin/app/components/form/target/details.hbs @@ -0,0 +1,134 @@ + + + {{#if @model.errors.name}} + + {{#each @model.errors.name as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + {{#if @model.errors.description}} + + {{#each @model.errors.description as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + <:title>{{t 'form.type.label'}} + <:body> + + + + + + + + {{#if @model.errors.session_max_seconds}} + + {{#each @model.errors.session_max_seconds as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + {{#if @model.errors.session_connection_limit}} + + {{#each @model.errors.session_connection_limit as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + + + {{#if @model.errors.default_port}} + + {{#each @model.errors.default_port as |error|}} + {{error.message}} + {{/each}} + + {{/if}} + + {{#if (can 'save model' @model)}} + + {{/if}} + \ No newline at end of file diff --git a/ui/admin/app/components/form/target/ssh/index.hbs b/ui/admin/app/components/form/target/ssh/index.hbs index 96f7616f7e..0c0400430a 100644 --- a/ui/admin/app/components/form/target/ssh/index.hbs +++ b/ui/admin/app/components/form/target/ssh/index.hbs @@ -1,134 +1,7 @@ - - - {{#if @model.errors.name}} - - {{#each @model.errors.name as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - {{#if @model.errors.description}} - - {{#each @model.errors.description as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - <:title>{{t 'form.type.label'}} - <:body> - - - - - - - - {{#if @model.errors.session_max_seconds}} - - {{#each @model.errors.session_max_seconds as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - {{#if @model.errors.session_connection_limit}} - - {{#each @model.errors.session_connection_limit as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - {{#if @model.errors.default_port}} - - {{#each @model.errors.default_port as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - {{#if (can 'save model' @model)}} - - {{/if}} - \ No newline at end of file +{{component + (concat 'form/target/details') + model=@model + defaultPort=22 + submit=@submit + cancel=@cancel +}} \ No newline at end of file diff --git a/ui/admin/app/components/form/target/tcp/index.hbs b/ui/admin/app/components/form/target/tcp/index.hbs index 4728e67aa2..4e622b1ca2 100644 --- a/ui/admin/app/components/form/target/tcp/index.hbs +++ b/ui/admin/app/components/form/target/tcp/index.hbs @@ -1,134 +1,7 @@ - - - {{#if @model.errors.name}} - - {{#each @model.errors.name as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - {{#if @model.errors.description}} - - {{#each @model.errors.description as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - <:title>{{t 'form.type.label'}} - <:body> - - - - - - - - {{#if @model.errors.session_max_seconds}} - - {{#each @model.errors.session_max_seconds as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - {{#if @model.errors.session_connection_limit}} - - {{#each @model.errors.session_connection_limit as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - - - {{#if @model.errors.default_port}} - - {{#each @model.errors.default_port as |error|}} - {{error.message}} - {{/each}} - - {{/if}} - - {{#if (can 'save model' @model)}} - - {{/if}} - \ No newline at end of file +{{component + (concat 'form/target/details') + model=@model + defaultPort=443 + submit=@submit + cancel=@cancel +}} \ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/targets/index.hbs b/ui/admin/app/templates/scopes/scope/targets/index.hbs index 8c6a5707e3..8215961d13 100644 --- a/ui/admin/app/templates/scopes/scope/targets/index.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/index.hbs @@ -88,7 +88,7 @@ {{else}} - {{#if (eq target.type 'tcp')}} + {{#if target.isTCP}} {{#if (can 'read model' target)}} From 93df2bd71ebbe289e239adf88e758c2ec386845c Mon Sep 17 00:00:00 2001 From: dharini Date: Wed, 30 Mar 2022 16:09:55 -0700 Subject: [PATCH 16/16] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20move=20details?= =?UTF-8?q?=20into=20a=20shared=20component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/target/{details.hbs => details/index.hbs} | 0 ui/admin/app/components/form/target/ssh/index.hbs | 13 ++++++------- ui/admin/app/components/form/target/tcp/index.hbs | 13 ++++++------- 3 files changed, 12 insertions(+), 14 deletions(-) rename ui/admin/app/components/form/target/{details.hbs => details/index.hbs} (100%) diff --git a/ui/admin/app/components/form/target/details.hbs b/ui/admin/app/components/form/target/details/index.hbs similarity index 100% rename from ui/admin/app/components/form/target/details.hbs rename to ui/admin/app/components/form/target/details/index.hbs diff --git a/ui/admin/app/components/form/target/ssh/index.hbs b/ui/admin/app/components/form/target/ssh/index.hbs index 0c0400430a..7deff40789 100644 --- a/ui/admin/app/components/form/target/ssh/index.hbs +++ b/ui/admin/app/components/form/target/ssh/index.hbs @@ -1,7 +1,6 @@ -{{component - (concat 'form/target/details') - model=@model - defaultPort=22 - submit=@submit - cancel=@cancel -}} \ No newline at end of file + \ No newline at end of file diff --git a/ui/admin/app/components/form/target/tcp/index.hbs b/ui/admin/app/components/form/target/tcp/index.hbs index 4e622b1ca2..878c8e6f31 100644 --- a/ui/admin/app/components/form/target/tcp/index.hbs +++ b/ui/admin/app/components/form/target/tcp/index.hbs @@ -1,7 +1,6 @@ -{{component - (concat 'form/target/details') - model=@model - defaultPort=443 - submit=@submit - cancel=@cancel -}} \ No newline at end of file + \ No newline at end of file