Implemented shutdown through UI and implemented router check

This commit is contained in:
2025-11-28 10:23:57 +01:00
parent 368f60d7b6
commit b2c5d08ff4
29 changed files with 639 additions and 71 deletions

View File

@@ -73,6 +73,21 @@ var MenuBar = /** @class */ (function () {
});
}); },
},
{
type: 'icon',
text: 'Shutdown',
materialIcon: 'power_settings_new',
uniqueIdentifier: 'shutdown_installation',
click: function () { return __awaiter(_this, void 0, void 0, function () {
var mobileMenu;
return __generator(this, function (_a) {
mobileMenu = document.querySelector('.mux_mobilemenu');
mobileMenu === null || mobileMenu === void 0 ? void 0 : mobileMenu.click();
this.shutdownInstallation();
return [2 /*return*/];
});
}); },
},
],
right: [
{
@@ -100,6 +115,21 @@ var MenuBar = /** @class */ (function () {
});
}); },
},
{
type: 'normal',
text: 'Shutdown',
materialIcon: 'power_settings_new',
uniqueIdentifier: 'shutdown_installation',
click: function () { return __awaiter(_this, void 0, void 0, function () {
var mobileMenu;
return __generator(this, function (_a) {
mobileMenu = document.querySelector('.mux_mobilemenu');
mobileMenu === null || mobileMenu === void 0 ? void 0 : mobileMenu.click();
this.shutdownInstallation();
return [2 /*return*/];
});
}); },
},
{
type: 'normal',
text: 'Dashboard',
@@ -215,6 +245,38 @@ var MenuBar = /** @class */ (function () {
});
});
};
MenuBar.prototype.shutdownInstallation = function () {
return __awaiter(this, void 0, void 0, function () {
var confirmed, shutdownContainer;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, morphux_1.MorphFeature.Confirm({
title: 'Shutdown Installation',
message: 'Are you sure you want to shutdown the installation?',
})];
case 1:
confirmed = _a.sent();
if (!confirmed)
return [2 /*return*/];
morphux_1.MorphFeature.Loader({
active: true,
message: 'Shutting down installation...',
});
shutdownContainer = document.querySelector('.ntsh_shutdown');
this._Main.socket.emit('shutdownInstallation', function (response) {
morphux_1.MorphFeature.Loader({ active: false });
if (!response.succeed)
return morphux_1.MorphFeature.Alert({
title: 'Error',
message: response.message,
});
shutdownContainer.style.display = 'flex';
});
return [2 /*return*/];
}
});
});
};
MenuBar.prototype.toggleServiceMode = function (mode, skipPin) {
return __awaiter(this, void 0, void 0, function () {
var newMode, servicePin;