refactor: 💡 remove unused target/sessions controller (#1979)

This commit is contained in:
Cameron Perera authored and GitHub committed 2023-11-01 13:54:36 -05:00
1 parent 4cdcaefe15
commit 861562201b
1 file changed
-41
@@ -1,41 +0,0 @@
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import sortBy from 'lodash/sortBy';
export default class ScopesScopeProjectsTargetsTargetSessionsController extends Controller {
// =services
@service session;
/**
* Sessions belonging to the target.
* @type {SessionModel[]}
*/
get sessions() {
return this.model.sessions;
}
/**
* Sort and filter to active sessions of current user.
* @param {[SessionModel]} model
* @param {object} session
* @type {[SessionModel]}
*/
get cancelableUserSessions() {
const sessions = this.sessions;
const userId = this.session.data.authenticated.user_id;
const filteredSessions = sessions.filter(
(session) => session.isAvailable && session.user_id === userId
);
// Sort sessions
const sortedSessions = sortBy(filteredSessions, 'created_time').reverse();
return sortedSessions;
}
}