Files
threshold-ui/ui/admin/app/abilities/channel-recording.js
T
Cameron Perera b01d5f0271 refactor: 💡 Show View instead of Play if channel not asciicast (#325)
* 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
2023-06-07 14:15:55 -05:00

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;
}
}