From 6a48c31d83e61a2838bd922c03f3eb1e59223dcf Mon Sep 17 00:00:00 2001 From: lisbet-alvarez <107949262+lisbet-alvarez@users.noreply.github.com> Date: Wed, 5 Apr 2023 10:49:15 -0700 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20add=20storage=20bucket?= =?UTF-8?q?=20card=20on=20ssh=20target=20(#163)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 🎸 storage bucket card on ssh target ✅ Closes: ICU-8631 * Update ui/admin/app/routes/scopes/scope/targets/target/index.js Co-authored-by: Zhihe Li --------- Co-authored-by: Zhihe Li --- addons/core/translations/resources/en-us.yaml | 6 ++--- .../components/form/storage-bucket/index.hbs | 2 +- .../scopes/scope/targets/target/index.js | 27 ++++++++++++++++++- .../scopes/scope/storage-buckets/index.hbs | 7 ++--- .../scopes/scope/targets/target/index.hbs | 2 +- .../tests/acceptance/targets/read-test.js | 21 ++++++++++++++- 6 files changed, 52 insertions(+), 13 deletions(-) diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 593e9db6a..c63974fe8 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -261,12 +261,10 @@ storage-bucket: titles: new: New Storage Bucket aws: AWS - global: Global - orgs: Orgs - types: - aws_s3: AWS S3 actions: delete: Delete Storage Bucket + types: + aws_s3: AWS S3 form: scope: label: Scope diff --git a/ui/admin/app/components/form/storage-bucket/index.hbs b/ui/admin/app/components/form/storage-bucket/index.hbs index 18018710f..aec210bde 100644 --- a/ui/admin/app/components/form/storage-bucket/index.hbs +++ b/ui/admin/app/components/form/storage-bucket/index.hbs @@ -11,7 +11,7 @@ as |form| > {{#if B.data.scopeModel.isGlobal}} - + {{else}} {{/if}} diff --git a/ui/admin/app/templates/scopes/scope/targets/target/index.hbs b/ui/admin/app/templates/scopes/scope/targets/target/index.hbs index d76840a99..fc3152c1a 100644 --- a/ui/admin/app/templates/scopes/scope/targets/target/index.hbs +++ b/ui/admin/app/templates/scopes/scope/targets/target/index.hbs @@ -56,7 +56,7 @@ diff --git a/ui/admin/tests/acceptance/targets/read-test.js b/ui/admin/tests/acceptance/targets/read-test.js index a4367202c..55b127369 100644 --- a/ui/admin/tests/acceptance/targets/read-test.js +++ b/ui/admin/tests/acceptance/targets/read-test.js @@ -21,7 +21,7 @@ module('Acceptance | targets | read', function (hooks) { setupMirage(hooks); let featuresService; - + const LINK_LIST_SELECTOR = '.link-list-item'; const instances = { scopes: { global: null, @@ -30,6 +30,7 @@ module('Acceptance | targets | read', function (hooks) { }, sshTarget: null, tcpTarget: null, + storageBucket: null, }; const urls = { globalScope: null, @@ -39,6 +40,7 @@ module('Acceptance | targets | read', function (hooks) { sshTarget: null, tcpTarget: null, enableSessionRecording: null, + storageBucket: null, }; hooks.beforeEach(function () { @@ -61,6 +63,9 @@ module('Acceptance | targets | read', function (hooks) { type: TYPE_TARGET_TCP, scope: instances.scopes.project, }); + instances.storageBucket = this.server.create('storage-bucket', { + scope: instances.scopes.global, + }); // Generate route URLs for resources urls.globalScope = `/scopes/global/scopes`; urls.orgScope = `/scopes/${instances.scopes.org.id}/scopes`; @@ -70,6 +75,7 @@ module('Acceptance | targets | read', function (hooks) { urls.tcpTarget = `${urls.targets}/${instances.tcpTarget.id}`; urls.unknownTarget = `${urls.targets}/foo`; urls.enableSessionRecording = `${urls.sshTarget}/enable-session-recording`; + urls.storageBucket = `${urls.projectScope}/storage-buckets/${instances.storageBucket.id}`; authenticateSession({}); }); @@ -214,6 +220,19 @@ module('Acceptance | targets | read', function (hooks) { assert.strictEqual(currentURL(), urls.enableSessionRecording); }); + test('users can click on associated storage bucket card on an ssh target', async function (assert) { + assert.expect(1); + featuresService.enable('ssh-target'); + featuresService.enable('session-recording'); + instances.sshTarget.update({ storageBucketId: instances.storageBucket.id }); + await visit(urls.targets); + + await click(`[href="${urls.sshTarget}"]`); + await click(LINK_LIST_SELECTOR); + + assert.strictEqual(currentURL(), urls.storageBucket); + }); + test('users can click on settings icon in target session-recording sidebar and it takes them to enable session recording', async function (assert) { featuresService.enable('session-recording'); assert.expect(1);