feat: 🎸 add empty state views for session recordings screen (#145)
* chore: 🤖 rebase session-recording * refactor: 💡 update calls to fetch recordings and buckets
This commit is contained in:
1 parent
d503b614bc
commit
b5045f1851
5 files changed
+81
-7
No files matched your search
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
};
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
</page.header>
|
||||
|
||||
<page.body>
|
||||
{{#if @model}}
|
||||
{{#if this.hasSessionRecordings}}
|
||||
<Hds::Table
|
||||
@model={{@model}}
|
||||
@model={{@model.sessionRecordings}}
|
||||
@density='tall'
|
||||
@columns={{array
|
||||
(hash label=(t 'resources.session-recording.form.time.label'))
|
||||
@@ -66,6 +66,33 @@
|
||||
</B.Tr>
|
||||
</:body>
|
||||
</Hds::Table>
|
||||
{{else}}
|
||||
<Rose::Layout::Centered>
|
||||
<Rose::Message
|
||||
@title={{t 'resources.session-recording.messages.none.title'}}
|
||||
as |message|
|
||||
>
|
||||
<message.description>
|
||||
{{#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}}
|
||||
</message.description>
|
||||
{{#unless this.hasSessionRecordingsConfigured}}
|
||||
<Hds::Link::Standalone
|
||||
@icon='plus-circle'
|
||||
@iconPosition='leading'
|
||||
@route='scopes.scope.storage-buckets.new'
|
||||
@text={{t 'resources.storage-bucket.messages.none.link'}}
|
||||
/>
|
||||
{{/unless}}
|
||||
</Rose::Message>
|
||||
</Rose::Layout::Centered>
|
||||
{{/if}}
|
||||
</page.body>
|
||||
</Rose::Layout::Page>
|
||||
@@ -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);
|
||||
});
|
||||
}
|
||||
);
|
||||
Reference in new issue
Block a user