* refactor: 💡 Show View instead of Play if channel not asciicast ✅ Closes: ICU-9524 * refactor: 💡 every third channel is missing mime_types * refactor: 💡 create new abilities for channel-recording * refactor: 💡 use abilities for button logic for channels * test: 💍 update channel-recording ability tests * refactor: 💡 fix ChannelRecording ability import name * refactor: 💡 change ability name to canPlay from canPlayChannel * refactor: 💡 update OverrideChannelRecording ability methods
31 lines
872 B
JavaScript
31 lines
872 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
import ChannelRecordingAbility from 'api/abilities/channel-recording';
|
|
import { inject as service } from '@ember/service';
|
|
|
|
export default class OverrideChannelRecordingAbility extends ChannelRecordingAbility {
|
|
// =service
|
|
@service features;
|
|
|
|
/**
|
|
* returns true if session recording is completed and the channel
|
|
* has the correct mime type
|
|
*/
|
|
get canPlay() {
|
|
const { session_recording } = this.model.connection_recording;
|
|
return session_recording.isAvailable && this.model.isAsciicast;
|
|
}
|
|
|
|
/**
|
|
* returns true if session recording is completed and the channel
|
|
* is not the correct mime type
|
|
*/
|
|
get canViewOnly() {
|
|
const { session_recording } = this.model.connection_recording;
|
|
return session_recording.isAvailable && !this.model.isAsciicast;
|
|
}
|
|
}
|