refactor: 💡 Add channel ability for asciicasts (#174)

This commit is contained in:
Zhihe Li authored and GitHub committed 2023-03-31 21:19:46 +00:00
1 parent 3bf2620b2c
commit 62ec3fe914
14 files changed
+1783 -860

No files matched your search

+11 -1
View File
@@ -1,8 +1,18 @@
import GeneratedChannelRecordingModel from '../generated/models/channel-recording';
import { belongsTo } from '@ember-data/model';
export const MIME_TYPE_ASCIICAST = 'application/x-asciicast';
export default class ChannelRecordingModel extends GeneratedChannelRecordingModel {
@belongsTo('connection-recording') connection_recording;
@belongsTo('connection-recording', { async: false }) connection_recording;
/**
* True if the channel supports asciicast.
* @type {boolean}
*/
get isAsciicast() {
return this.mime_types.includes(MIME_TYPE_ASCIICAST);
}
/**
* Download the ascii cast recording for this channel.
@@ -2,6 +2,6 @@ import GeneratedConnectionRecordingModel from '../generated/models/connection-re
import { belongsTo, hasMany } from '@ember-data/model';
export default class ConnectionRecordingModel extends GeneratedConnectionRecordingModel {
@belongsTo('session-recording') session_recording;
@hasMany('channel-recording') channel_recordings;
@belongsTo('session-recording', { async: false }) session_recording;
@hasMany('channel-recording', { async: false }) channel_recordings;
}
+1 -1
View File
@@ -8,7 +8,7 @@ export const TYPES_SESSION_RECORDING = Object.freeze([
]);
export default class SessionRecordingModel extends GeneratedSessionRecordingModel {
@hasMany('connection-recording') connection_recordings;
@hasMany('connection-recording', { async: false }) connection_recordings;
@service store;