Chore/update model names (#125)
* chore: 🤖 Rename recording to session-recording * chore: 🤖 Update names for connection models * chore: 🤖 Update channel models to new name * chore: 🤖 Update remaining models after merge conflict
This commit is contained in:
1 parent
24f50b3e2d
commit
d08ce29e5a
46 files changed
+442
-372
No files matched your search
@@ -0,0 +1,27 @@
|
||||
import GeneratedChannelRecordingModel from '../generated/models/channel-recording';
|
||||
import { belongsTo } from '@ember-data/model';
|
||||
|
||||
export const TYPE_CHANNEL_RECORDING_SESSION = 'session';
|
||||
export const TYPES_CHANNEL_RECORDING = Object.freeze([
|
||||
TYPE_CHANNEL_RECORDING_SESSION,
|
||||
]);
|
||||
|
||||
export default class ChannelRecordingModel extends GeneratedChannelRecordingModel {
|
||||
@belongsTo('connection-recording') connection_recording;
|
||||
|
||||
/**
|
||||
* True if the channel type is `session`.
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isSession() {
|
||||
return this.type === TYPE_CHANNEL_RECORDING_SESSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the channel is an unknown type.
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isUnknown() {
|
||||
return !TYPES_CHANNEL_RECORDING.includes(this.type);
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import GeneratedChannelModel from '../generated/models/channel';
|
||||
import { belongsTo } from '@ember-data/model';
|
||||
|
||||
export const TYPE_CHANNEL_SESSION = 'session';
|
||||
export const TYPES_CHANNEL = Object.freeze([TYPE_CHANNEL_SESSION]);
|
||||
|
||||
export default class ChannelModel extends GeneratedChannelModel {
|
||||
@belongsTo('connection') connection;
|
||||
|
||||
/**
|
||||
* True if the channel type is `session`.
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isSession() {
|
||||
return this.type === TYPE_CHANNEL_SESSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the channel is an unknown type.
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isUnknown() {
|
||||
return !TYPES_CHANNEL.includes(this.type);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import GeneratedConnectionRecordingModel from '../generated/models/connection-recording';
|
||||
import { belongsTo, hasMany } from '@ember-data/model';
|
||||
|
||||
export default class ConnectionRecordingModel extends GeneratedConnectionRecordingModel {
|
||||
@belongsTo('session-recording') session_recording;
|
||||
@hasMany('channel-recording') channel_recordings;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
import GeneratedConnectionModel from '../generated/models/connection';
|
||||
import { belongsTo, hasMany } from '@ember-data/model';
|
||||
|
||||
export default class ConnectionModel extends GeneratedConnectionModel {
|
||||
@belongsTo('recording') recording;
|
||||
@hasMany('channel') channels;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
import GeneratedRecordingModel from '../generated/models/recording';
|
||||
import { hasMany } from '@ember-data/model';
|
||||
|
||||
export const TYPE_RECORDING_SSH = 'ssh';
|
||||
export const TYPES_RECORDING = Object.freeze([TYPE_RECORDING_SSH]);
|
||||
|
||||
export default class RecordingModel extends GeneratedRecordingModel {
|
||||
@hasMany('connection') connections;
|
||||
|
||||
/**
|
||||
* True if the recording type is `ssh`.
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isSSH() {
|
||||
return this.type === TYPE_RECORDING_SSH;
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the recording is an unknown type.
|
||||
* @type {boolean}
|
||||
*/
|
||||
get isUnknown() {
|
||||
return !TYPES_RECORDING.includes(this.type);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
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 default class SessionRecordingModel extends GeneratedSessionRecordingModel {
|
||||
@hasMany('connection-recording') 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);
|
||||
}
|
||||
|
||||
getAsciiCast({ connectionId, channelId, mimeType }) {
|
||||
const adapter = this.store.adapterFor('application');
|
||||
const options = { adapterOptions: { method: 'download' } };
|
||||
const url = adapter.buildURL(
|
||||
'session-recording',
|
||||
this.id,
|
||||
options,
|
||||
'findRecord'
|
||||
);
|
||||
return adapter.ajax(url, 'GET', {
|
||||
data: { connectionId, channelId, mimeType },
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user