fix: 🐛 bucket types icon in target association (#2503)
* fix: 🐛 bucket types icon in target association
This commit is contained in:
1 parent
b40c53fb45
commit
9b33812f9e
4 files changed
+73
-27
No files matched your search
@@ -439,6 +439,7 @@ storage-bucket:
|
||||
plugin-types:
|
||||
aws: Amazon S3
|
||||
minio: MinIO
|
||||
unknown: Unknown
|
||||
form:
|
||||
scope:
|
||||
label: Scope
|
||||
|
||||
@@ -29,8 +29,20 @@ export default class ScopesScopeTargetsTargetIndexRoute extends Route {
|
||||
'storage-bucket',
|
||||
storage_bucket_id,
|
||||
);
|
||||
const storage_bucket_name = storageBucket.displayName;
|
||||
controller.set('storage_bucket_name', storage_bucket_name);
|
||||
const {
|
||||
displayName: name,
|
||||
plugin: { name: pluginName },
|
||||
isAWS,
|
||||
isMinIO,
|
||||
isUnknown,
|
||||
} = storageBucket;
|
||||
let icon;
|
||||
if (isAWS) {
|
||||
icon = 'aws';
|
||||
} else if (isMinIO) {
|
||||
icon = 'cloud-upload';
|
||||
}
|
||||
controller.set('storageBucket', { name, pluginName, icon, isUnknown });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@
|
||||
}}
|
||||
|
||||
<Rose::Layout::Page as |page|>
|
||||
|
||||
<page.breadcrumbs>
|
||||
<Breadcrumbs::Container />
|
||||
</page.breadcrumbs>
|
||||
@@ -36,7 +35,9 @@
|
||||
<bc.Sidebar>
|
||||
{{#if @model.aliases}}
|
||||
<div class='target-sidebar-aliases'>
|
||||
<h3>{{t 'resources.alias.title_plural'}}</h3>
|
||||
<h3>
|
||||
{{t 'resources.alias.title_plural'}}
|
||||
</h3>
|
||||
<p class='description'>
|
||||
{{t 'resources.alias.form.sidebar.help'}}
|
||||
</p>
|
||||
@@ -92,7 +93,9 @@
|
||||
{{else}}
|
||||
{{#if (can 'create model' this.globalScope collection='aliases')}}
|
||||
<div class='target-sidebar-aliases'>
|
||||
<h3>{{t 'resources.alias.title_plural'}}</h3>
|
||||
<h3>
|
||||
{{t 'resources.alias.title_plural'}}
|
||||
</h3>
|
||||
<p class='description'>
|
||||
{{t 'resources.alias.form.sidebar.help'}}
|
||||
</p>
|
||||
@@ -108,31 +111,46 @@
|
||||
{{/if}}
|
||||
<div class='target-sidebar'>
|
||||
{{#if (and @model.isSSH (feature-flag 'ssh-session-recording'))}}
|
||||
<h3>{{t 'resources.target.form.sidebar.label'}}</h3>
|
||||
<h3>
|
||||
{{t 'resources.target.form.sidebar.label'}}
|
||||
</h3>
|
||||
<p class='description'>
|
||||
{{t 'resources.target.form.sidebar.help'}}
|
||||
</p>
|
||||
{{#if @model.enable_session_recording}}
|
||||
<LinkListPanel as |P|>
|
||||
<P.Item
|
||||
@icon='cloud-upload'
|
||||
@color='boundary'
|
||||
@text={{this.storage_bucket_name}}
|
||||
@route='scopes.scope.storage-buckets.storage-bucket'
|
||||
@model={{@model.storage_bucket_id}}
|
||||
>
|
||||
<Hds::Badge
|
||||
@text={{t 'resources.storage-bucket.types.aws_s3'}}
|
||||
@icon='aws'
|
||||
/>
|
||||
</P.Item>
|
||||
</LinkListPanel>
|
||||
<Hds::Link::Standalone
|
||||
@icon='arrow-right'
|
||||
@iconPosition='trailing'
|
||||
@text={{t 'resources.target.form.sidebar.link'}}
|
||||
@route='scopes.scope.targets.target.enable-session-recording'
|
||||
/>
|
||||
{{#if this.storageBucket.isUnknown}}
|
||||
<LinkListPanel as |P|>
|
||||
<P.Item @color='boundary' @text={{this.storageBucket.name}}>
|
||||
{{t 'resources.storage-bucket.plugin-types.unknown'}}
|
||||
</P.Item>
|
||||
</LinkListPanel>
|
||||
{{else}}
|
||||
<LinkListPanel as |P|>
|
||||
<P.Item
|
||||
@icon='cloud-upload'
|
||||
@color='boundary'
|
||||
@text={{this.storageBucket.name}}
|
||||
@route='scopes.scope.storage-buckets.storage-bucket'
|
||||
@model={{@model.storage_bucket_id}}
|
||||
>
|
||||
<Hds::Badge
|
||||
@text={{t
|
||||
(concat
|
||||
'resources.storage-bucket.plugin-types.'
|
||||
this.storageBucket.pluginName
|
||||
)
|
||||
}}
|
||||
@icon={{this.storageBucket.icon}}
|
||||
/>
|
||||
</P.Item>
|
||||
</LinkListPanel>
|
||||
<Hds::Link::Standalone
|
||||
@icon='arrow-right'
|
||||
@iconPosition='trailing'
|
||||
@text={{t 'resources.target.form.sidebar.link'}}
|
||||
@route='scopes.scope.targets.target.enable-session-recording'
|
||||
/>
|
||||
{{/if}}
|
||||
{{else}}
|
||||
<Hds::Button
|
||||
@text={{t 'resources.target.actions.enable-recording'}}
|
||||
|
||||
@@ -17,7 +17,7 @@ module(
|
||||
function (hooks) {
|
||||
setupApplicationTest(hooks);
|
||||
setupMirage(hooks);
|
||||
|
||||
let intl;
|
||||
let featuresService;
|
||||
let storageBucketOne;
|
||||
let storageBucketTwo;
|
||||
@@ -27,6 +27,7 @@ module(
|
||||
const DROPDOWN_SELECTOR = '[name=storage_bucket_id]';
|
||||
const LINK_LIST_SELECTOR = '.link-list-item > a';
|
||||
const LINK_LIST_SELECTOR_ITEM_TEXT = '.link-list-item__text';
|
||||
const BADGE_TEXT_SELECTOR = '.target-sidebar .hds-badge__text';
|
||||
const TOGGLE_SELECTOR = '[name=target-enable-session-recording]';
|
||||
const LINK_TO_NEW_STORAGE_BUCKET =
|
||||
'.enable-session-recording-toggle .hds-link-standalone';
|
||||
@@ -91,6 +92,8 @@ module(
|
||||
urls.newStorageBucket = `${urls.enableSessionRecording}/create-storage-bucket`;
|
||||
urls.storageBucket = `${urls.storageBuckets}/${storageBucketOne.id}`;
|
||||
|
||||
intl = this.owner.lookup('service:intl');
|
||||
|
||||
authenticateSession({ username: 'admin' });
|
||||
});
|
||||
|
||||
@@ -196,6 +199,12 @@ module(
|
||||
await click(SAVE_BTN_SELECTOR);
|
||||
|
||||
assert.strictEqual(currentURL(), urls.target);
|
||||
assert.strictEqual(
|
||||
find(BADGE_TEXT_SELECTOR).textContent.trim(),
|
||||
intl.t(
|
||||
`resources.storage-bucket.plugin-types.${storageBucketTwo.plugin.name}`,
|
||||
),
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
find(LINK_LIST_SELECTOR_ITEM_TEXT).textContent.trim(),
|
||||
@@ -219,6 +228,12 @@ module(
|
||||
|
||||
await click(CANCEL_BTN_SELECTOR);
|
||||
assert.strictEqual(currentURL(), urls.target);
|
||||
assert.strictEqual(
|
||||
find(BADGE_TEXT_SELECTOR).textContent.trim(),
|
||||
intl.t(
|
||||
`resources.storage-bucket.plugin-types.${storageBucketOne.plugin.name}`,
|
||||
),
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
find(LINK_LIST_SELECTOR_ITEM_TEXT).textContent.trim(),
|
||||
|
||||
Reference in new issue
Block a user