diff --git a/addons/core/translations/actions/en-us.yaml b/addons/core/translations/actions/en-us.yaml index 125ea3f51..5cf7a182a 100644 --- a/addons/core/translations/actions/en-us.yaml +++ b/addons/core/translations/actions/en-us.yaml @@ -3,6 +3,7 @@ add: Add cancel: Cancel +edit: Edit delete: Delete remove: Remove discard: Discard diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 16326b2f2..0a137c8c4 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -224,6 +224,14 @@ storage-bucket: title_plural: Storage Buckets titles: new: New Storage Bucket + aws: AWS + global: Global + orgs: Orgs + actions: + delete: Delete Storage Bucket + form: + scope: Scope + provider: Provider project: title: Project title_plural: Projects diff --git a/ui/admin/app/routes/scopes/scope/storage-buckets.js b/ui/admin/app/routes/scopes/scope/storage-buckets.js index 6c01670d9..56b2632b6 100644 --- a/ui/admin/app/routes/scopes/scope/storage-buckets.js +++ b/ui/admin/app/routes/scopes/scope/storage-buckets.js @@ -4,10 +4,37 @@ */ import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; export default class ScopesScopeStorageBucketsRoute extends Route { - model() { - // Temporary placeholder - return [{ scope_id: 'sb_123456' }]; + // =services + + @service store; + @service intl; + @service session; + @service can; + @service router; + + // =methods + + /** + * If arriving here unauthenticated, redirect to index for further processing. + */ + beforeModel() { + if (!this.session.isAuthenticated) this.router.transitionTo('index'); } + + /** + * Load all storage buckets under current scope. + * @return {Promise{[StorageBucketModel]}} + */ + async model() { + const scope = this.modelFor('scopes.scope'); + const { id: scope_id } = scope; + if (this.can.can('list storage-bucket', scope, { collection: 'storage-buckets' })) { + return this.store.query('storage-bucket', { scope_id }); + } + } + + // =actions } diff --git a/ui/admin/app/routes/scopes/scope/storage-buckets/storage-bucket.js b/ui/admin/app/routes/scopes/scope/storage-buckets/storage-bucket.js index 8bf0c5ef4..ac33f0f36 100644 --- a/ui/admin/app/routes/scopes/scope/storage-buckets/storage-bucket.js +++ b/ui/admin/app/routes/scopes/scope/storage-buckets/storage-bucket.js @@ -4,11 +4,22 @@ */ import Route from '@ember/routing/route'; +import { inject as service } from '@ember/service'; export default class ScopesScopeStorageBucketsStorageBucketRoute extends Route { - model() { - return { - scope_id: 'sb_1234567890', - }; + // =services + + @service store; + + // =methods + + /** + * Load a user in current scope. + * @param {object} params + * @param {string} params.storage_bucket_id + * @return {StorageBucketModel} + */ + async model({ storage_bucket_id }) { + return this.store.findRecord('storage-bucket', storage_bucket_id); } } diff --git a/ui/admin/app/styles/app.scss b/ui/admin/app/styles/app.scss index c1bc62db0..f71bcf07e 100644 --- a/ui/admin/app/styles/app.scss +++ b/ui/admin/app/styles/app.scss @@ -776,3 +776,7 @@ 'sidebar'; } } + +.storage-bucket-list { + border-collapse: revert; +} diff --git a/ui/admin/app/templates/scopes/scope.hbs b/ui/admin/app/templates/scopes/scope.hbs index 22be84374..67694f447 100644 --- a/ui/admin/app/templates/scopes/scope.hbs +++ b/ui/admin/app/templates/scopes/scope.hbs @@ -26,13 +26,16 @@ {{t 'resources.org.title_plural'}} - {{! TODO: Check can abilities }} {{#if (feature-flag 'session-recording')}} {{t 'resources.session-recording.title_plural'}} - {{#if (can 'navigate model' @model collection='storage-buckets')}} + {{#if + (can + 'navigate storage-bucket' @model collection='storage-buckets' + ) + }} - + + {{#if @model}} + + <:body as |B|> + + + {{#if (can 'read storage-bucket' B.data)}} + + {{B.data.displayName}} + + {{else}} + {{B.data.displayName}} + {{/if}} + {{#if B.data.description}} +

{{B.data.description}}

+ {{/if}} +
+ + + {{B.data.id}} + + + + {{#if B.data.isAWS}} + + {{else}} + {{B.data.plugin.name}} + {{/if}} + + + {{#if B.data.scopeModel.isGlobal}} + + {{else}} + + {{/if}} + + + {{!TODO: add dropdown for delete and edit actions}} + +
+ +
+ {{else}} + {{!TODO: Render new landing page }} + {{/if}} +
\ No newline at end of file diff --git a/ui/admin/app/templates/scopes/scope/storage-buckets/storage-bucket.hbs b/ui/admin/app/templates/scopes/scope/storage-buckets/storage-bucket.hbs index 1d6ed5ba4..40b29859d 100644 --- a/ui/admin/app/templates/scopes/scope/storage-buckets/storage-bucket.hbs +++ b/ui/admin/app/templates/scopes/scope/storage-buckets/storage-bucket.hbs @@ -5,5 +5,4 @@ {{page-title @model.displayName}} -

{{@model.scope_id}}

{{outlet}} \ No newline at end of file