Files
threshold-ui/addons/api/addon/models/session-recording.js
T
Cameron Perera a63776e76f Icu 9415 remove sorted computed value for connections channels (#276)
* refactor: 💡 remove sorted connections from session recording

Removed from session recording model and respective templates

✅ Closes: ICU-9415

* refactor: 💡 remove sorted channels from connections model

and removed from the appropriate templates and breadcrumb
2023-05-23 16:10:39 -05:00

56 lines
1.5 KiB
JavaScript

import GeneratedSessionRecordingModel from '../generated/models/session-recording';
import { hasMany } from '@ember-data/model';
import { inject as service } from '@ember/service';
export const TYPE_SESSION_RECORDING_SSH = 'ssh';
export const TYPES_SESSION_RECORDING = Object.freeze([
TYPE_SESSION_RECORDING_SSH,
]);
export const STATE_SESSION_RECORDING_STARTED = 'started';
export const STATE_SESSION_RECORDING_AVAILABLE = 'available';
export const STATE_SESSION_RECORDING_UNKNOWN = 'unknown';
export default class SessionRecordingModel extends GeneratedSessionRecordingModel {
@hasMany('connection-recording', { async: false }) connection_recordings;
@service store;
/**
* True if the session recording type is `ssh`.
* @type {boolean}
*/
get isSSH() {
return this.type === TYPE_SESSION_RECORDING_SSH;
}
/**
* True if the session recording is an unknown type.
* @type {boolean}
*/
get isUnknown() {
return !TYPES_SESSION_RECORDING.includes(this.type);
}
/**
* Returns scope name or scope id from the target that belongs to the session recording.
* @type {string}
*/
get targetScopeDisplayName() {
return (
this.create_time_values?.target?.scope?.name ||
this.create_time_values?.target?.scope?.id
);
}
/**
* Returns the user name or user id that belongs to the session recording.
* @type {string}
*/
get userDisplayName() {
return (
this.create_time_values?.user?.name || this.create_time_values?.user?.id
);
}
}