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
+1
-1
@@ -8,7 +8,7 @@ import ModelAbility from './model';
|
||||
/**
|
||||
* Provides abilities for session recordings.
|
||||
*/
|
||||
export default class RecordingAbility extends ModelAbility {
|
||||
export default class SessionRecordingAbility extends ModelAbility {
|
||||
// =services
|
||||
|
||||
// =permissions
|
||||
+1
-1
@@ -9,7 +9,7 @@ import { attr } from '@ember-data/model';
|
||||
/**
|
||||
* A channel contains data for a single channel within a connection.
|
||||
*/
|
||||
export default class GeneratedChannelModel extends BaseModel {
|
||||
export default class GeneratedChannelRecordingModel extends BaseModel {
|
||||
// =attributes
|
||||
|
||||
@attr('string', {
|
||||
+1
-1
@@ -9,7 +9,7 @@ import { attr } from '@ember-data/model';
|
||||
/**
|
||||
* A connection contains data for a boundary connection within a session.
|
||||
*/
|
||||
export default class GeneratedConnectionModel extends BaseModel {
|
||||
export default class GeneratedConnectionRecordingModel extends BaseModel {
|
||||
// =attributes
|
||||
|
||||
@attr('number', {
|
||||
+2
-2
@@ -7,9 +7,9 @@ import BaseModel from '../../models/base';
|
||||
import { attr } from '@ember-data/model';
|
||||
|
||||
/**
|
||||
* A recording contains all data related to session recordings
|
||||
* A session recording contains all data related to session recordings
|
||||
*/
|
||||
export default class GeneratedRecordingModel extends BaseModel {
|
||||
export default class GeneratedSessionRecordingModel extends BaseModel {
|
||||
// =attributes
|
||||
|
||||
@attr('string', {
|
||||
@@ -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 },
|
||||
});
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -5,6 +5,6 @@ export default class ConnectionSerializer extends ApplicationSerializer.extend(
|
||||
EmbeddedRecordsMixin
|
||||
) {
|
||||
attrs = {
|
||||
channels: { embedded: 'always' },
|
||||
channel_recordings: { embedded: 'always' },
|
||||
};
|
||||
}
|
||||
+1
-1
@@ -4,6 +4,6 @@ export default class RecordingSerializer extends ApplicationSerializer.extend(
|
||||
EmbeddedRecordsMixin
|
||||
) {
|
||||
attrs = {
|
||||
connections: { embedded: 'always' },
|
||||
connection_recordings: { embedded: 'always' },
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user