Added basic control panel
This commit is contained in:
96
frontend/views/control/dist/checklist.js
vendored
Normal file
96
frontend/views/control/dist/checklist.js
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Checklist = void 0;
|
||||
var morphux_1 = require("morphux");
|
||||
var Checklist = /** @class */ (function () {
|
||||
function Checklist(Main) {
|
||||
this.Rows = {
|
||||
CAMERAPC: document.querySelector(".ntsh-checklist-row[status=\"CAMERAPC\"]"),
|
||||
CAMERAPROCESS: document.querySelector(".ntsh-checklist-row[status=\"CAMERAPROCESS\"]"),
|
||||
CAMERAUNITYSTREAM: document.querySelector(".ntsh-checklist-row[status=\"CAMERAUNITYSTREAM\"]"),
|
||||
UNITYBUILD: document.querySelector(".ntsh-checklist-row[status=\"UNITYBUILD\"]"),
|
||||
REPLAYFUNCTION: document.querySelector(".ntsh-checklist-row[status=\"REPLAYFUNCTION\"]"),
|
||||
};
|
||||
this.FullReboot = document.querySelector('.ntsh-fullreboot-button');
|
||||
this._Main = Main;
|
||||
this.registerListeners();
|
||||
}
|
||||
Checklist.prototype.update = function (status) {
|
||||
this.updateRow(this.Rows.CAMERAPC, status.CAMERAPC);
|
||||
this.updateRow(this.Rows.CAMERAPROCESS, status.CAMERAPROCESS);
|
||||
this.updateRow(this.Rows.CAMERAUNITYSTREAM, status.CAMERAUNITYSTREAM);
|
||||
this.updateRow(this.Rows.UNITYBUILD, status.UNITYBUILD);
|
||||
this.updateRow(this.Rows.REPLAYFUNCTION, status.REPLAYFUNCTION);
|
||||
console.log('Updated checklist:', status);
|
||||
};
|
||||
Checklist.prototype.updateRow = function (row, state) {
|
||||
var _a, _b, _c;
|
||||
var status = row.querySelector('.ntsh-checklist-row-status');
|
||||
var message = row.querySelector('p');
|
||||
var startButton = row.querySelector('.ntsh-checklist-row-button.start');
|
||||
var stopButton = row.querySelector('.ntsh-checklist-row-button.stop');
|
||||
var rebootButton = row.querySelector('.ntsh-checklist-row-button.reboot');
|
||||
status.classList.remove('RED', 'GREEN', 'YELLOW', 'GRAY');
|
||||
status.classList.add(state.state);
|
||||
message.innerText = state.message;
|
||||
startButton.style.display = ((_a = state.buttons) === null || _a === void 0 ? void 0 : _a.start) ? 'block' : 'none';
|
||||
stopButton.style.display = ((_b = state.buttons) === null || _b === void 0 ? void 0 : _b.stop) ? 'block' : 'none';
|
||||
rebootButton.style.display = ((_c = state.buttons) === null || _c === void 0 ? void 0 : _c.reboot) ? 'block' : 'none';
|
||||
};
|
||||
Checklist.prototype.registerListeners = function () {
|
||||
var _this = this;
|
||||
this.FullReboot.onclick = function () {
|
||||
morphux_1.MorphFeature.Confirm({
|
||||
title: 'Full Reboot',
|
||||
message: 'Are you sure you want to perform a full reboot?',
|
||||
}, function (state) {
|
||||
if (!state)
|
||||
return;
|
||||
_this._Main.socket.emit('status', 'fullreboot');
|
||||
});
|
||||
};
|
||||
var _loop_1 = function (key) {
|
||||
var row = this_1.Rows[key];
|
||||
var startButton = row.querySelector('.ntsh-checklist-row-button.start');
|
||||
startButton.onclick = function () {
|
||||
return morphux_1.MorphFeature.Confirm({
|
||||
title: 'Start',
|
||||
message: 'Are you sure you want to start?',
|
||||
}, function (state) {
|
||||
if (!state)
|
||||
return;
|
||||
_this._Main.socket.emit('status', 'start', key);
|
||||
});
|
||||
};
|
||||
var stopButton = row.querySelector('.ntsh-checklist-row-button.stop');
|
||||
stopButton.onclick = function () {
|
||||
return morphux_1.MorphFeature.Confirm({
|
||||
title: 'Stop',
|
||||
message: 'Are you sure you want to stop?',
|
||||
}, function (state) {
|
||||
if (!state)
|
||||
return;
|
||||
_this._Main.socket.emit('status', 'stop', key);
|
||||
});
|
||||
};
|
||||
var rebootButton = row.querySelector('.ntsh-checklist-row-button.reboot');
|
||||
rebootButton.onclick = function () {
|
||||
return morphux_1.MorphFeature.Confirm({
|
||||
title: 'Reboot',
|
||||
message: 'Are you sure you want to reboot?',
|
||||
}, function (state) {
|
||||
if (!state)
|
||||
return;
|
||||
_this._Main.socket.emit('status', 'reboot', key);
|
||||
});
|
||||
};
|
||||
};
|
||||
var this_1 = this;
|
||||
for (var key in this.Rows) {
|
||||
_loop_1(key);
|
||||
}
|
||||
};
|
||||
return Checklist;
|
||||
}());
|
||||
exports.Checklist = Checklist;
|
||||
//# sourceMappingURL=checklist.js.map
|
||||
Reference in New Issue
Block a user