feat: 🎸 Refactored sessions page filters to load separately (#3053)
This commit is contained in:
1 parent
953e35bcd6
commit
013aa2e570
7 files changed
+351
-220
No files matched your search
@@ -297,6 +297,71 @@ module('Acceptance | sessions | list', function (hooks) {
|
||||
assert.dom(selectors.NO_RESULTS_MSG).includesText('No results found');
|
||||
});
|
||||
|
||||
test('user can search for sessions by associated user name', async function (assert) {
|
||||
setRunOptions({
|
||||
rules: {
|
||||
'color-contrast': {
|
||||
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
instances.sessions[0].update({
|
||||
userId: instances.admin.id,
|
||||
});
|
||||
instances.sessions[1].update({
|
||||
userId: instances.dev.id,
|
||||
});
|
||||
instances.sessions[2].update({
|
||||
userId: instances.dev.id,
|
||||
});
|
||||
|
||||
await visit(urls.projectScope);
|
||||
await click(commonSelectors.HREF(urls.sessions));
|
||||
await fillIn(commonSelectors.SEARCH_INPUT, 'dev');
|
||||
await waitFor(selectors.TABLE_SESSION_ID(instances.sessions[0].id), {
|
||||
count: 0,
|
||||
});
|
||||
|
||||
assert.dom(selectors.TABLE_SESSION_ID(instances.sessions[1].id)).exists();
|
||||
assert.dom(selectors.TABLE_SESSION_ID(instances.sessions[2].id)).exists();
|
||||
assert.dom(commonSelectors.TABLE_ROWS).exists({ count: 2 });
|
||||
});
|
||||
|
||||
test('user can search for sessions by associated target name', async function (assert) {
|
||||
setRunOptions({
|
||||
rules: {
|
||||
'color-contrast': {
|
||||
// [ember-a11y-ignore]: axe rule "color-contrast" automatically ignored on 2025-08-01
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
instances.sessions[0].update({
|
||||
targetId: instances.tcpTarget.id,
|
||||
});
|
||||
instances.sessions[1].update({
|
||||
targetId: instances.sshTarget.id,
|
||||
});
|
||||
instances.sessions[2].update({
|
||||
targetId: instances.sshTarget.id,
|
||||
});
|
||||
|
||||
await visit(urls.projectScope);
|
||||
|
||||
await click(commonSelectors.HREF(urls.sessions));
|
||||
await fillIn(commonSelectors.SEARCH_INPUT, instances.sshTarget.name);
|
||||
await waitFor(selectors.TABLE_SESSION_ID(instances.sessions[0].id), {
|
||||
count: 0,
|
||||
});
|
||||
|
||||
assert.dom(selectors.TABLE_SESSION_ID(instances.sessions[1].id)).exists();
|
||||
assert.dom(selectors.TABLE_SESSION_ID(instances.sessions[2].id)).exists();
|
||||
assert.dom(commonSelectors.TABLE_ROWS).exists({ count: 2 });
|
||||
});
|
||||
|
||||
test('user can filter for sessions by user', async function (assert) {
|
||||
setRunOptions({
|
||||
rules: {
|
||||
|
||||
@@ -17,13 +17,11 @@ module('Unit | Controller | scopes/scope/sessions/index', function (hooks) {
|
||||
status: 'active',
|
||||
created_time: '2024-03-12T20:44:14.808699Z',
|
||||
};
|
||||
const user = { id: 'u_123', name: 'admin' };
|
||||
const target = { id: 't_123', name: 'target' };
|
||||
const model = {
|
||||
sessions: [session],
|
||||
associatedUsers: [user],
|
||||
associatedTargets: [target],
|
||||
allSessions: [session],
|
||||
canListUsers: true,
|
||||
canListTargets: true,
|
||||
doSessionsExist: true,
|
||||
totalItems: 1,
|
||||
};
|
||||
|
||||
@@ -58,18 +56,8 @@ module('Unit | Controller | scopes/scope/sessions/index', function (hooks) {
|
||||
name: 'Terminated',
|
||||
},
|
||||
],
|
||||
targets: [
|
||||
{
|
||||
id: 't_123',
|
||||
name: 'target',
|
||||
},
|
||||
],
|
||||
users: [
|
||||
{
|
||||
id: 'u_123',
|
||||
name: 'admin',
|
||||
},
|
||||
],
|
||||
targets: [],
|
||||
users: [],
|
||||
});
|
||||
assert.deepEqual(controller.filters.selectedFilters, {
|
||||
users: [],
|
||||
@@ -112,23 +100,4 @@ module('Unit | Controller | scopes/scope/sessions/index', function (hooks) {
|
||||
assert.strictEqual(controller.page, 1);
|
||||
assert.deepEqual(controller.users, selectedItems);
|
||||
});
|
||||
|
||||
test('refresh action calls refreshAll', async function (assert) {
|
||||
assert.expect(2);
|
||||
let controller = this.owner.lookup(
|
||||
'controller:scopes/scope/sessions/index',
|
||||
);
|
||||
controller.set('target', {
|
||||
send(actionName, ...args) {
|
||||
assert.strictEqual(actionName, 'refreshAll');
|
||||
assert.deepEqual(
|
||||
args,
|
||||
[],
|
||||
'refreshAll was called with the correct arguments',
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
await controller.refresh();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user