Merge pull request #486 from hashicorp/feature-desktop-filtering

Feature desktop filtering - ICU-1169 ICU-1071
This commit is contained in:
Susmitha Girumala authored and GitHub committed 2021-03-04 16:48:41 -05:00
commit 49795c81c1
3 files changed
+11 -10

No files matched your search

@@ -1,12 +1,7 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
export default class ScopesScopeProjectsSessionsIndexController extends Controller {
// =sessions
@service session;
// =attributes
/**
@@ -15,11 +10,8 @@ export default class ScopesScopeProjectsSessionsIndexController extends Controll
* @type {SessionModel[]}
*/
get sorted() {
const userId = this.session.data.authenticated.user_id;
const sessions = this.model;
const sortedSessions = sessions
// filter sessions by current user
.filter(session => session.user_id === userId)
// sort by created time
.sortBy('session.created_time').reverse();
return [
@@ -48,8 +48,13 @@ export default class ScopesScopeProjectsSessionsRoute extends Route {
*/
async model() {
const { id: scope_id } = this.modelFor('scopes.scope');
const { user_id } = this.session.data.authenticated;
await this.store.query('target', { recursive: true, scope_id });
return await this.store.query('session', { recursive: true, scope_id });
return await this.store.query('session', {
filter: `"/item/user_id" == "${user_id}"`,
recursive: true,
scope_id
});
}
/**
@@ -52,7 +52,11 @@ export default class ScopesScopeProjectsTargetsRoute extends Route {
async model() {
const { id: scope_id } = this.modelFor('scopes.scope');
await this.refreshSessions();
return this.store.query('target', { recursive: true, scope_id });
return this.store.query('target', {
filter: '"authorize-session" in "/item/authorized_actions"',
recursive: true,
scope_id
});
}
/**