Files
threshold-ui/addons/api/addon/models/channel-recording.js
T

34 lines
886 B
JavaScript
Raw Normal View History

/**
2026-01-28 17:09:06 -08:00
* Copyright IBM Corp. 2021, 2026
* SPDX-License-Identifier: BUSL-1.1
*/
2023-03-16 13:49:04 -04:00
import GeneratedChannelRecordingModel from '../generated/models/channel-recording';
import { belongsTo } from '@ember-data/model';
export const MIME_TYPE_ASCIICAST = 'application/x-asciicast';
2023-03-16 13:49:04 -04:00
export default class ChannelRecordingModel extends GeneratedChannelRecordingModel {
@belongsTo('connection-recording', {
async: false,
inverse: 'channel_recordings',
})
connection_recording;
/**
* True if the channel supports asciicast.
* @type {boolean}
*/
get isAsciicast() {
2023-05-31 15:27:30 -04:00
return this.mime_types?.includes(MIME_TYPE_ASCIICAST) ?? false;
}
2023-03-16 13:49:04 -04:00
/**
* Download the ascii cast recording for this channel.
* @returns {Promise<string>}
*/
getAsciicast() {
const adapter = this.store.adapterFor('session-recording');
return adapter.getAsciicast(this.id);
}
2023-03-16 13:49:04 -04:00
}