Merge pull request #139 from hashicorp/feat-add-breadcrumbs-session-recordings

Feat add breadcrumbs session recordings
This commit is contained in:
Carlos Alcaide Corvo authored and GitHub committed 2023-03-22 15:41:47 -07:00
commit a81540fae8
13 files changed
+220 -1

No files matched your search

@@ -217,6 +217,8 @@ session-recording:
connection:
title: Connection
title_plural: Connections
channels-by-connection:
title: Channels by connection
channel:
title: Channel
title_plural: Channels
@@ -0,0 +1,15 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeSessionRecordingsSessionRecordingController extends Controller {
// =services
@service intl;
/**
* Session recording breadcrumb
*/
get breadCrumb() {
return this.model.displayName;
}
}
@@ -0,0 +1,18 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeSessionRecordingsSessionRecordingChannelsByConnectionController extends Controller {
// =services
@service intl;
// =attributes
/**
* Translated breadcrumb
*/
get breadCrumb() {
return this.intl.t(
'resources.session-recording.channels-by-connection.title'
);
}
}
@@ -0,0 +1,15 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeSessionRecordingsSessionRecordingChannelsByConnectionChannelController extends Controller {
// =services
@service intl;
/**
* Session recording channel breadcrumb
*/
get breadCrumb() {
return this.model.channel_id;
}
}
@@ -1,6 +1,10 @@
{{page-title (t 'resources.session-recording.channel.title')}}
<Rose::Layout::Page as |page|>
<page.breadcrumbs>
<BreadCrumbs />
</page.breadcrumbs>
<page.header>
<h2>{{t 'resources.session-recording.channel.title'}}</h2>
</page.header>
@@ -1,4 +1,8 @@
<Rose::Layout::Page as |page|>
<page.breadcrumbs>
<BreadCrumbs />
</page.breadcrumbs>
<page.header>
<h2>{{t 'resources.session-recording.session.title'}}</h2>
</page.header>
@@ -12,6 +12,7 @@ module('Acceptance | session recordings | list', function (hooks) {
const LIST_SESSION_RECORDING_BUTTON =
'table > tbody > tr > td:last-child > a';
// Instances
const instances = {
scopes: {
global: null,
@@ -20,6 +21,7 @@ module('Acceptance | session recordings | list', function (hooks) {
sessionRecording: null,
};
// Urls
const urls = {
globalScope: null,
sessionRecordings: null,
@@ -0,0 +1,63 @@
import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
module(
'Acceptance | session recordings | session recording | channels by connection | channel',
function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
// Instances
const instances = {
scopes: {
global: null,
org: null,
},
sessionRecording: null,
connectionRecording: null,
channelRecording: null,
};
// Urls
const urls = {
globalScope: null,
sessionRecordings: null,
sessionRecording: null,
};
hooks.beforeEach(function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
});
instances.sessionRecording = this.server.create('session-recording', {
scope: instances.scopes.global,
});
instances.connectionRecording = this.server.create(
'connection-recording',
{
session_recording: instances.sessionRecording,
}
);
instances.channelRecording = this.server.create('channel-recording', {
connection_recording: instances.connectionRecording,
});
urls.globalScope = `/scopes/global`;
urls.sessionRecordings = `${urls.globalScope}/session-recordings`;
urls.sessionRecording = `${urls.sessionRecordings}/${instances.sessionRecording.id}`;
urls.connectionRecording = `${urls.sessionRecording}/channels-by-connection/${instances.channelRecording.id}`;
authenticateSession({});
});
test('user can navigate to a channel', async function (assert) {
assert.expect(1);
// Visit channel
await visit(urls.connectionRecording);
assert.strictEqual(currentURL(), urls.connectionRecording);
});
}
);
@@ -0,0 +1,48 @@
import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'admin/tests/helpers';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | session recordings | session recording', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
// Instances
const instances = {
scopes: {
global: null,
org: null,
},
sessionRecording: null,
};
// Urls
const urls = {
globalScope: null,
sessionRecordings: null,
sessionRecording: null,
};
hooks.beforeEach(function () {
instances.scopes.global = this.server.create('scope', { id: 'global' });
instances.scopes.org = this.server.create('scope', {
type: 'org',
scope: { id: 'global', type: 'global' },
});
instances.sessionRecording = this.server.create('session-recording', {
scope: instances.scopes.global,
});
urls.globalScope = `/scopes/global`;
urls.sessionRecordings = `${urls.globalScope}/session-recordings`;
urls.sessionRecording = `${urls.sessionRecordings}/${instances.sessionRecording.id}`;
authenticateSession({});
});
test('user can navigate to a session recording', async function (assert) {
assert.expect(1);
// Visit session recording
await visit(urls.sessionRecording);
assert.strictEqual(currentURL(), urls.sessionRecording);
});
});
@@ -1,7 +1,7 @@
import { module, test } from 'qunit';
import { setupTest } from 'admin/tests/helpers';
module('Unit | Controller | scopes/scope/session-recordings', function (hooks) {
module('Unit | Controller | session-recordings', function (hooks) {
setupTest(hooks);
test('it exists', function (assert) {
@@ -0,0 +1,16 @@
import { module, test } from 'qunit';
import { setupTest } from 'admin/tests/helpers';
module(
'Unit | Controller | session-recordings | session-recording',
function (hooks) {
setupTest(hooks);
test('it exists', function (assert) {
let controller = this.owner.lookup(
'controller:scopes/scope/session-recordings/session-recording'
);
assert.ok(controller);
});
}
);
@@ -0,0 +1,16 @@
import { module, test } from 'qunit';
import { setupTest } from 'admin/tests/helpers';
module(
'Unit | Controller | session-recordings | session-recording | channels-by-connection',
function (hooks) {
setupTest(hooks);
test('it exists', function (assert) {
let controller = this.owner.lookup(
'controller:scopes/scope/session-recordings/session-recording/channels-by-connection'
);
assert.ok(controller);
});
}
);
@@ -0,0 +1,16 @@
import { module, test } from 'qunit';
import { setupTest } from 'admin/tests/helpers';
module(
'Unit | Controller | session-recordings | session-recording | channels-by-connection | channel',
function (hooks) {
setupTest(hooks);
test('it exists', function (assert) {
let controller = this.owner.lookup(
'controller:scopes/scope/session-recordings/session-recording/channels-by-connection/channel'
);
assert.ok(controller);
});
}
);