2021-05-24 22:29:49 +02:00
|
|
|
import protectedSessionHolder from "../../services/protected_session_holder.js";
|
2022-12-02 16:46:14 +01:00
|
|
|
import CommandButtonWidget from "./command_button.js";
|
2021-05-18 22:14:35 +02:00
|
|
|
|
2022-12-02 16:46:14 +01:00
|
|
|
export default class ProtectedSessionStatusWidget extends CommandButtonWidget {
|
|
|
|
|
constructor() {
|
|
|
|
|
super();
|
2021-05-18 22:14:35 +02:00
|
|
|
|
2022-12-02 16:46:14 +01:00
|
|
|
this.settings.icon = () => protectedSessionHolder.isProtectedSessionAvailable()
|
2021-09-29 13:19:21 +02:00
|
|
|
? "bx-check-shield"
|
|
|
|
|
: "bx-shield-quarter";
|
2021-05-18 22:14:35 +02:00
|
|
|
|
2022-12-02 16:46:14 +01:00
|
|
|
this.settings.title = () => protectedSessionHolder.isProtectedSessionAvailable()
|
2021-05-18 22:14:35 +02:00
|
|
|
? "Protected session is active. Click to leave protected session."
|
|
|
|
|
: "Click to enter protected session";
|
|
|
|
|
|
2022-12-02 16:46:14 +01:00
|
|
|
this.settings.command = () => protectedSessionHolder.isProtectedSessionAvailable()
|
2021-05-18 22:14:35 +02:00
|
|
|
? "leaveProtectedSession"
|
|
|
|
|
: "enterProtectedSession";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protectedSessionStartedEvent() {
|
|
|
|
|
this.refreshIcon();
|
|
|
|
|
}
|
|
|
|
|
}
|