chore: 🤖 add sessions property to target
This commit is contained in:
4 files changed
+86
-2
No files matched your search
@@ -36,6 +36,24 @@ export default class TargetModel extends GeneratedTargetModel {
|
||||
.filter((hostSetRef) => hostSetRef.model !== null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sessions associated with this target (but only already loaded sessions).
|
||||
* @type {SessionModel[]}
|
||||
*/
|
||||
get sessions() {
|
||||
return this.store.peekAll('session').filter(s => s.target_id === this.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* True if any sessions associated with this target are active or pending.
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isActive() {
|
||||
const pendingOrActiveSessions =
|
||||
this.sessions.filter(s => s.isActive || s.isPending);
|
||||
return Boolean(pendingOrActiveSessions.length);
|
||||
}
|
||||
|
||||
// =methods
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user