Added basic control panel
This commit is contained in:
29
frontend/views/control/ts/outOfServiceMode.ts
Normal file
29
frontend/views/control/ts/outOfServiceMode.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { MorphComponent } from 'morphux';
|
||||
import { Main } from './main';
|
||||
|
||||
export class OutOfServiceMode {
|
||||
private _Main: Main;
|
||||
|
||||
state: boolean = false;
|
||||
input: HTMLInputElement = document.querySelector(
|
||||
'.ntsh-outofservicemode-input',
|
||||
);
|
||||
|
||||
constructor(Main: Main) {
|
||||
this._Main = Main;
|
||||
|
||||
this.registerListeners();
|
||||
}
|
||||
|
||||
private registerListeners() {
|
||||
this.input.addEventListener('change', async () => {
|
||||
const valid = await this._Main.executeCommand(
|
||||
this.state ? 'disableOutOfService' : 'enableOutOfService',
|
||||
`Are you sure you want to set the installation to "${this.state ? 'Out of Service' : 'Operational'}"?`,
|
||||
'unityWebSocket',
|
||||
);
|
||||
if (!valid) this.input.checked = this.state;
|
||||
this.state = this.input.checked;
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user