Lots of changes

-    Feedback van dataSensor array
-    dataSliders min/max and unit
-    Camera before Unity
-    Restart knop buiten service mode
-    Operator phonenumber button
-    Gracefull shutdown
-    Out of service control
This commit is contained in:
2025-10-23 17:45:35 +02:00
parent f07ba57168
commit cd33670361
36 changed files with 1444 additions and 277 deletions

View File

@@ -11628,6 +11628,17 @@
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (commonjsGlobal && commonjsGlobal.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(Component_MenuBar, "__esModule", { value: true });
Component_MenuBar.ComponentMenuBar = void 0;
var Index_1 = requireIndex();
@@ -11854,15 +11865,27 @@
var inner = (0, CE_1.ce)('div', 'mux_mobilemenu-inner');
this.mobileMenu = new ComponentMenuBar({
direction: 'vertical',
left: this._leftItems.filter(function (item) {
left: this._leftItems
.filter(function (item) {
if (item.uniqueIdentifier == undefined)
return true;
return !_this.mobileIgnoreItems.includes(item.uniqueIdentifier);
})
.map(function (item) {
if (item.type !== 'icon')
return item;
return __assign(__assign({}, item), { type: 'normal' });
}),
right: this._rightItems.filter(function (item) {
right: this._rightItems
.filter(function (item) {
if (item.uniqueIdentifier == undefined)
return true;
return !_this.mobileIgnoreItems.includes(item.uniqueIdentifier);
})
.map(function (item) {
if (item.type !== 'icon')
return item;
return __assign(__assign({}, item), { type: 'normal' });
}),
});
this.mobileMenu.setSelected(this.selected);
@@ -14399,6 +14422,9 @@
this.container = document.querySelector('.ntsh_menubar');
this._Main = main;
this.build();
this._Main.socket.on('supportNumber', function (number) {
_this.supportNumber = number;
});
setTimeout(function () {
if ((localStorage === null || localStorage === void 0 ? void 0 : localStorage.getItem('serviceMode')) === 'true')
_this.toggleServiceMode(true, true);
@@ -14407,10 +14433,49 @@
MenuBar.prototype.build = function () {
var _this = this;
this.menubar = new Component_MenuBar_1.ComponentMenuBar({
mobile: {
left: [
{
type: 'icon',
text: 'Restart',
materialIcon: 'restart_alt',
uniqueIdentifier: 'restart_installation',
click: function () { return __awaiter$4(_this, void 0, void 0, function () {
var mobileMenu;
return __generator$4(this, function (_a) {
mobileMenu = document.querySelector('.mux_mobilemenu');
mobileMenu === null || mobileMenu === void 0 ? void 0 : mobileMenu.click();
this.restartInstallation();
return [2 /*return*/];
});
}); },
},
],
right: [
{
type: 'icon',
text: 'Support',
materialIcon: 'call_quality',
uniqueIdentifier: 'call_support',
click: function () { return _this.showSupport(); },
},
],
},
left: [
{
type: 'image',
url: '/img/morphix_logo_white.png',
type: 'normal',
text: 'Restart',
materialIcon: 'restart_alt',
uniqueIdentifier: 'restart_installation',
click: function () { return __awaiter$4(_this, void 0, void 0, function () {
var mobileMenu;
return __generator$4(this, function (_a) {
mobileMenu = document.querySelector('.mux_mobilemenu');
mobileMenu === null || mobileMenu === void 0 ? void 0 : mobileMenu.click();
this.restartInstallation();
return [2 /*return*/];
});
}); },
},
{
type: 'normal',
@@ -14446,7 +14511,16 @@
],
right: [
{
type: 'normal',
type: 'icon',
text: 'Support',
materialIcon: 'call_quality',
uniqueIdentifier: 'call_support',
click: function () { return _this.showSupport(); },
},
{
type: document.body.classList.contains('ntsh_service')
? 'normal'
: 'icon',
text: document.body.classList.contains('ntsh_service')
? 'Exit Service'
: 'Service Mode',
@@ -14469,6 +14543,55 @@
this.container.innerHTML = '';
this.container.appendChild(this.menubar.container);
};
MenuBar.prototype.showSupport = function () {
return __awaiter$4(this, void 0, void 0, function () {
var dialog, callAnchor;
return __generator$4(this, function (_a) {
dialog = new morphux_1$5.MorphComponent.Dialog({
title: 'Contact Support',
width: 'medium',
height: 'auto',
okButtonVisible: false,
cancelButtonVisible: false,
});
this.supportNumber.slice();
callAnchor = (0, morphux_1$5.ce)('a', 'ntsh_callanchor', { href: "tel:".concat(this.supportNumber) }, "+".concat(this.supportNumber));
dialog.content.appendChild(callAnchor);
setTimeout(function () { return callAnchor.click(); }, 100);
return [2 /*return*/];
});
});
};
MenuBar.prototype.restartInstallation = function () {
return __awaiter$4(this, void 0, void 0, function () {
var confirmed;
return __generator$4(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, morphux_1$5.MorphFeature.Confirm({
title: 'Restart Installation',
message: 'Are you sure you want to restart the installation?',
})];
case 1:
confirmed = _a.sent();
if (!confirmed)
return [2 /*return*/];
morphux_1$5.MorphFeature.Loader({
active: true,
message: 'Restarting installation...',
});
this._Main.socket.emit('restartInstallation', function (response) {
morphux_1$5.MorphFeature.Loader({ active: false });
if (!response.succeed)
return morphux_1$5.MorphFeature.Alert({
title: 'Error',
message: response.message,
});
});
return [2 /*return*/];
}
});
});
};
MenuBar.prototype.toggleServiceMode = function (mode, skipPin) {
return __awaiter$4(this, void 0, void 0, function () {
var newMode, servicePin;
@@ -14671,18 +14794,19 @@
statusElement.classList.add("ntsh_status-".concat(state));
};
exports.setStatusState = setStatusState;
var setProgressState = function (progressElement, percentage) {
var value = progressElement.querySelector('.ntsh_progress-value');
value.style.width = "".concat(percentage * 100, "%");
var setProgressState = function (progressElement, value, min, max, unit) {
var percentage = (value - min) / (max - min);
var progressValue = progressElement.querySelector('.ntsh_progress-value');
progressValue.style.width = "".concat(percentage * 100, "%");
var label = progressElement.querySelector('.ntsh_progress-label');
label.innerText = "".concat(Math.round(percentage * 100), "%");
label.innerText = "".concat(value).concat(unit);
};
exports.setProgressState = setProgressState;
var createProgress = function (value) {
var createProgress = function (value, min, max, unit) {
var progress = (0, morphux_1.ce)('div', 'ntsh_progress');
progress.appendChild((0, morphux_1.ce)('div', 'ntsh_progress-value'));
progress.appendChild((0, morphux_1.ce)('div', 'ntsh_progress-label'));
(0, exports.setProgressState)(progress, value);
(0, exports.setProgressState)(progress, value, min, max, unit);
return progress;
};
exports.createProgress = createProgress;
@@ -15520,6 +15644,10 @@
this.uptimeInfo = document.querySelector('.ntsh_dashboard-unity-uptime');
this.webSocketStatus = document.querySelector('.ntsh_dashboard-unity-websocketstatus');
this.webSocketInfo = document.querySelector('.ntsh_dashboard-unity-websocketinfo');
this.outOfServiceStatus = document.querySelector('.ntsh_dashboard-unity-outofservicestatus');
this.outOfServiceInfo = document.querySelector('.ntsh_dashboard-unity-outofserviceinfo');
this.enableOutOfServiceButton = document.querySelector('.ntsh_dashboard-unity-enableoutofservice');
this.disableOutOfServiceButton = document.querySelector('.ntsh_dashboard-unity-disableoutofservice');
this.zedStreamStatus = document.querySelector('.ntsh_dashboard-unity-zedstreamstatus');
this.zedStreamInfo = document.querySelector('.ntsh_dashboard-unity-zedstreaminfo');
this.zedStreamFps = document.querySelector('.ntsh_dashboard-unity-zedstreamfps');
@@ -15528,6 +15656,7 @@
this.timelineStanding = document.querySelector('.ntsh_dashboard-unity-timeline-standing');
this.timelineProgress = document.querySelector('.ntsh_dashboard-unity-timeline-progress');
this.parametersTable = document.querySelector('.ntsh_dashboard-unity-parameters');
this.sensorsTable = document.querySelector('.ntsh_dashboard-unity-sensors');
this.errorContainer = document.querySelector('.ntsh_dashboard-unity-error');
this.errorText = document.querySelector('.ntsh_dashboard-unity-errortext');
this._Main = Main;
@@ -15545,7 +15674,7 @@
}
(0, utils_1.setStatusState)(this.processStatus, {
RUNNING: 'green',
STOPPED: 'red',
STOPPED: 'gray',
STARTING: 'yellow',
PROBLEM: 'red',
}[state.state]);
@@ -15571,6 +15700,28 @@
FAILED: 'red',
}[state.state]);
this.webSocketInfo.innerText = (_a = state.message) !== null && _a !== void 0 ? _a : '';
// ----------- Out of Service -----------
(0, utils_1.setStatusState)(this.outOfServiceStatus, state.parameters.outOfService == null
? 'gray'
: state.parameters.outOfService
? 'red'
: 'green');
this.outOfServiceInfo.innerText =
state.parameters.outOfService == null
? ''
: state.parameters.outOfService
? 'Out of Service'
: 'Operational';
this.enableOutOfServiceButton.style.display =
state.parameters.outOfService == null ||
state.parameters.outOfService
? 'none'
: 'flex';
this.disableOutOfServiceButton.style.display =
state.parameters.outOfService &&
state.parameters.outOfService != null
? 'flex'
: 'none';
// ----------- ZED Stream -----------
(0, utils_1.setStatusState)(this.zedStreamStatus, state.parameters.zedReady ? 'green' : 'red');
this.zedStreamInfo.innerText = state.parameters.zedReady
@@ -15585,9 +15736,10 @@
this.timelineStanding.innerText = state.parameters.timelineStanding
? 'Yes'
: 'No';
(0, utils_1.setProgressState)(this.timelineProgress, state.parameters.timelineProgress);
(0, utils_1.setProgressState)(this.timelineProgress, Math.round(state.parameters.timelineProgress * 100), 0, 100, '%');
// ----------- Parameters -----------
this.renderParameterSliders(state.parameters.parameters);
this.renderParameterSliders(state.state == 'CONNECTED' ? state.parameters.sliders : []);
this.renderParameterSensors(state.state == 'CONNECTED' ? state.parameters.sensors : []);
// ----------- Error -----------
if (((_b = state === null || state === void 0 ? void 0 : state.error) !== null && _b !== void 0 ? _b : '').trim().length > 0)
this.webSocketError = state.error;
@@ -15595,55 +15747,107 @@
this.webSocketError = null;
this.updateError();
};
DashboardUnity.prototype.renderParameterSliders = function (parameters) {
DashboardUnity.prototype.renderParameterSliders = function (sliders) {
var _this = this;
if (parameters.length === 0)
return;
var existingSliders = this.parametersTable.querySelectorAll('.ntsh_dashboard-unity-parameter-row');
if (existingSliders.length !== parameters.length) {
if (existingSliders.length !== sliders.length) {
this.parametersTable.innerHTML = '';
parameters.forEach(function (param) {
var row = (0, morphux_1$1.ce)('tr', 'ntsh_dashboard-unity-parameter-row');
var nameCell = (0, morphux_1$1.ce)('td');
nameCell.appendChild((0, morphux_1$1.ce)('div', 'mux_text', null, param.sliderName));
row.appendChild(nameCell);
var progressCell = (0, morphux_1$1.ce)('td', 'no-service');
progressCell.appendChild((0, utils_1.createProgress)(param.outputValue));
row.appendChild(progressCell);
var sliderCell = (0, morphux_1$1.ce)('td', 'only-service');
var sliderProgress = (0, utils_1.createProgress)(param.outputValue);
var sliderValue = sliderProgress.querySelector('.ntsh_progress-value');
sliderValue.classList.add('mux_resizer');
sliderCell.appendChild(sliderProgress);
var resizer = new morphux_1$1.MorphComponent.Resizer({
existingContainer: sliderValue,
direction: 'right',
relative: true,
min: 0,
max: function () { return sliderProgress.clientWidth; },
if (sliders.length === 0) {
var row = (0, morphux_1$1.ce)('tr');
var cell = (0, morphux_1$1.ce)('td');
cell.appendChild((0, morphux_1$1.ce)('div', ['mux_text', 'ntsh_dashboard-unity-parameters-loading'], null, 'Waiting for Unity...'));
row.appendChild(cell);
this.parametersTable.appendChild(row);
}
else
sliders.forEach(function (slider) {
var _a, _b;
var multiplierFactor = (_a = slider.visualMultiplier) !== null && _a !== void 0 ? _a : 1;
var decimalPlacesFactor = Math.pow(10, ((_b = slider.decimalPlaces) !== null && _b !== void 0 ? _b : 0));
var value = Math.round(slider.outputValue *
multiplierFactor *
decimalPlacesFactor) / decimalPlacesFactor;
var row = (0, morphux_1$1.ce)('tr', 'ntsh_dashboard-unity-parameter-row');
var nameCell = (0, morphux_1$1.ce)('td');
nameCell.appendChild((0, morphux_1$1.ce)('div', 'mux_text', null, slider.sliderName));
row.appendChild(nameCell);
var progressCell = (0, morphux_1$1.ce)('td', 'no-service');
progressCell.appendChild((0, utils_1.createProgress)(value, slider.min * multiplierFactor, slider.max * multiplierFactor, slider.unit));
row.appendChild(progressCell);
var sliderCell = (0, morphux_1$1.ce)('td', 'only-service');
var sliderProgress = (0, utils_1.createProgress)(value, slider.min * multiplierFactor, slider.max * multiplierFactor, slider.unit);
var sliderValue = sliderProgress.querySelector('.ntsh_progress-value');
sliderValue.classList.add('mux_resizer');
sliderCell.appendChild(sliderProgress);
var resizer = new morphux_1$1.MorphComponent.Resizer({
existingContainer: sliderValue,
direction: 'right',
relative: true,
min: 0,
max: function () { return sliderProgress.clientWidth; },
});
var lastValue = -1;
resizer.on('resized', function (size) {
var percentage = Math.round((size / sliderProgress.clientWidth) * 100) / 100;
var actualValue = slider.min + percentage * (slider.max - slider.min);
if (actualValue === lastValue)
return;
lastValue = actualValue;
_this._Main.socket.emit('unityWebSocket', 'parameterValue', slider.sliderIndex, actualValue);
(0, utils_1.setProgressState)(sliderProgress, Math.round(actualValue *
multiplierFactor *
decimalPlacesFactor) / decimalPlacesFactor, slider.min * multiplierFactor, slider.max * multiplierFactor, slider.unit);
});
row.appendChild(sliderCell);
_this.parametersTable.appendChild(row);
});
var lastPercentage = -1;
resizer.on('resized', function (size) {
var percentage = Math.round((size / sliderProgress.clientWidth) * 100) /
100;
if (percentage === lastPercentage)
return;
lastPercentage = percentage;
_this._Main.socket.emit('unityWebSocket', 'parameterValue', param.sliderIndex, percentage);
(0, utils_1.setProgressState)(sliderProgress, percentage);
});
row.appendChild(sliderCell);
_this.parametersTable.appendChild(row);
});
}
else {
existingSliders.forEach(function (row, index) {
var value = parameters[index].outputValue;
var _a, _b;
var slider = sliders[index];
var multiplierFactor = (_a = slider.visualMultiplier) !== null && _a !== void 0 ? _a : 1;
var decimalPlacesFactor = Math.pow(10, ((_b = slider.decimalPlaces) !== null && _b !== void 0 ? _b : 0));
var value = Math.round(slider.outputValue *
multiplierFactor *
decimalPlacesFactor) / decimalPlacesFactor;
var progressElement = row.querySelector('.no-service .ntsh_progress');
(0, utils_1.setProgressState)(progressElement, value);
(0, utils_1.setProgressState)(progressElement, value, slider.min * multiplierFactor, slider.max * multiplierFactor, slider.unit);
var sliderElement = row.querySelector('.only-service .ntsh_progress');
if (sliderElement.querySelector('.mux_resizer-moving') == null)
(0, utils_1.setProgressState)(sliderElement, value);
(0, utils_1.setProgressState)(sliderElement, value, slider.min * multiplierFactor, slider.max * multiplierFactor, slider.unit);
});
}
};
DashboardUnity.prototype.renderParameterSensors = function (sensors) {
var _this = this;
var existingSensors = this.sensorsTable.querySelectorAll('.ntsh_dashboard-unity-sensor-row');
if (existingSensors.length !== sensors.length) {
this.sensorsTable.innerHTML = '';
if (sensors.length === 0) {
var row = (0, morphux_1$1.ce)('tr');
var cell = (0, morphux_1$1.ce)('td');
cell.appendChild((0, morphux_1$1.ce)('div', ['mux_text', 'ntsh_dashboard-unity-sensors-loading'], null, 'Waiting for Unity...'));
row.appendChild(cell);
this.sensorsTable.appendChild(row);
}
else
sensors.forEach(function (sensor) {
var row = (0, morphux_1$1.ce)('tr', 'ntsh_dashboard-unity-sensor-row');
var nameCell = (0, morphux_1$1.ce)('td');
nameCell.appendChild((0, morphux_1$1.ce)('div', 'mux_text', null, sensor.deviceName));
row.appendChild(nameCell);
var progressCell = (0, morphux_1$1.ce)('td');
progressCell.appendChild((0, utils_1.createProgress)(Math.round(sensor.outputValue * 100), 0, 100, '%'));
row.appendChild(progressCell);
_this.sensorsTable.appendChild(row);
});
}
else {
existingSensors.forEach(function (row, index) {
var value = sensors[index].outputValue;
var progressElement = row.querySelector('.ntsh_progress');
(0, utils_1.setProgressState)(progressElement, Math.round(value * 100), 0, 100, '%');
});
}
};
@@ -15674,10 +15878,23 @@
return [2 /*return*/];
});
}); });
this.enableOutOfServiceButton.addEventListener('click', function () { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
this.executeCommand('enableOutOfService', 'Are you sure you want to set the installation to "Out of Service"?', 'unityWebSocket');
return [2 /*return*/];
});
}); });
this.disableOutOfServiceButton.addEventListener('click', function () { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
this.executeCommand('disableOutOfService', 'Are you sure you want to set the installation to "Operational"?', 'unityWebSocket');
return [2 /*return*/];
});
}); });
};
DashboardUnity.prototype.executeCommand = function (command, message) {
return __awaiter(this, void 0, void 0, function () {
DashboardUnity.prototype.executeCommand = function (command_1, message_1) {
return __awaiter(this, arguments, void 0, function (command, message, type) {
var confirmed;
if (type === void 0) { type = 'unityRunner'; }
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, morphux_1$1.MorphFeature.Confirm({
@@ -15690,9 +15907,9 @@
return [2 /*return*/];
morphux_1$1.MorphFeature.Loader({
active: true,
message: "Requesting Unity Runner ".concat(command, "..."),
message: "Dispatching command...",
});
this._Main.socket.emit('unityRunner', command, function (response) {
this._Main.socket.emit(type, command, function (response) {
morphux_1$1.MorphFeature.Loader({ active: false });
if (!response.succeed)
return morphux_1$1.MorphFeature.Alert({
@@ -15701,7 +15918,7 @@
});
morphux_1$1.MorphFeature.Notification({
level: 'success',
message: "Unity Runner is ".concat(command, "ing..."),
message: "Dispatched command",
});
});
return [2 /*return*/];