diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 5097060a7..59244dd21 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -233,6 +233,11 @@ session-recording: label: Target duration: label: Duration + messages: + none: + title: Welcome to session recording + description: Review, playback, and download recorded sessions. To get started, configure recording on a target and start a session. + no-storage-bucket-description: To start using session recordings, create a storage bucket and configure recording on a target. storage-bucket: title: Storage Bucket title_plural: Storage Buckets diff --git a/ui/admin/app/controllers/scopes/scope/session-recordings/index.js b/ui/admin/app/controllers/scopes/scope/session-recordings/index.js new file mode 100644 index 000000000..ee4b8092b --- /dev/null +++ b/ui/admin/app/controllers/scopes/scope/session-recordings/index.js @@ -0,0 +1,19 @@ +import Controller from '@ember/controller'; + +export default class ScopesScopeSessionRecordingsIndexController extends Controller { + /** + * Returns true if any session recordings exist + * @type {boolean} + */ + get hasSessionRecordings() { + return this.model.sessionRecordings.length > 0; + } + + /** + * Returns true if any storage buckets exist + * @type {boolean} + */ + get hasSessionRecordingsConfigured() { + return this.model.storageBuckets.length > 0; + } +} diff --git a/ui/admin/app/routes/scopes/scope/session-recordings.js b/ui/admin/app/routes/scopes/scope/session-recordings.js index 1f45a3e95..9b121c822 100644 --- a/ui/admin/app/routes/scopes/scope/session-recordings.js +++ b/ui/admin/app/routes/scopes/scope/session-recordings.js @@ -20,14 +20,21 @@ export default class ScopesScopeSessionRecordingsRoute extends Route { /** * Load all session recordings. - * @return {SessionRecordingModel} + * @return {{sessionRecordings: Array, storageBuckets: Array}} */ - model() { - // TODO: awaiting modeled data + async model() { const scope = this.modelFor('scopes.scope'); - const { id: scope_id } = scope; // if (this.can.can('list session-recording', scope, { collection: 'session-recordings' })) { - return this.store.query('session-recording', { scope_id }); + const { id: scope_id } = scope; + const sessionRecordings = await this.store.findAll('session-recording'); + const storageBuckets = await this.store.query('storage-bucket', { + scope_id, + recursive: true, + }); + return { + sessionRecordings, + storageBuckets, + }; // } } diff --git a/ui/admin/app/templates/scopes/scope/session-recordings/index.hbs b/ui/admin/app/templates/scopes/scope/session-recordings/index.hbs index 8a7d8b86e..7bcc9e1f9 100644 --- a/ui/admin/app/templates/scopes/scope/session-recordings/index.hbs +++ b/ui/admin/app/templates/scopes/scope/session-recordings/index.hbs @@ -8,9 +8,9 @@ - {{#if @model}} + {{#if this.hasSessionRecordings}} + {{else}} + + + + {{#if this.hasSessionRecordingsConfigured}} + {{! storage buckets exist but no recordings }} + {{t 'resources.session-recording.messages.none.description'}} + {{else}} + {{! No storage buckets exist }} + {{t + 'resources.session-recording.messages.none.no-storage-bucket-description' + }} + {{/if}} + + {{#unless this.hasSessionRecordingsConfigured}} + + {{/unless}} + + {{/if}} \ No newline at end of file diff --git a/ui/admin/tests/unit/controllers/scopes/scope/session-recordings/index-test.js b/ui/admin/tests/unit/controllers/scopes/scope/session-recordings/index-test.js new file mode 100644 index 000000000..03ad5a50c --- /dev/null +++ b/ui/admin/tests/unit/controllers/scopes/scope/session-recordings/index-test.js @@ -0,0 +1,16 @@ +import { module, test } from 'qunit'; +import { setupTest } from 'admin/tests/helpers'; + +module( + 'Unit | Controller | scopes/scope/session-recordings/index', + function (hooks) { + setupTest(hooks); + + test('it exists', function (assert) { + let controller = this.owner.lookup( + 'controller:scopes/scope/session-recordings/index' + ); + assert.ok(controller); + }); + } +);