show n8n version

This commit is contained in:
usmannasir
2025-04-12 21:31:32 +05:00
parent a6bb91aa97
commit 8a22ac6bbf
2 changed files with 40 additions and 13 deletions

View File

@@ -74,7 +74,7 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
if (response.data.status === 1) {
var containerInfo = response.data.data[1];
console.log("Container Info received:", containerInfo);
console.log("Full container info:", containerInfo);
// Find the container in the list and update its information
for (var i = 0; i < $scope.ContainerList.length; i++) {
@@ -84,11 +84,15 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
$scope.ContainerList[i].created = new Date(containerInfo.created);
$scope.ContainerList[i].uptime = containerInfo.uptime;
$scope.ContainerList[i].image = containerInfo.image;
console.log("Container environment:", containerInfo.environment);
// Environment Variables
$scope.ContainerList[i].environment = containerInfo.environment;
console.log("Updated container environment:", $scope.ContainerList[i].environment);
// Environment Variables - ensure it's properly set
if (containerInfo.environment) {
console.log("Setting environment:", containerInfo.environment);
$scope.ContainerList[i].environment = containerInfo.environment;
console.log("Container after env update:", $scope.ContainerList[i]);
} else {
console.log("No environment in container info");
}
// Resource Usage
var memoryBytes = containerInfo.memory_usage;

View File

@@ -943,15 +943,36 @@
// Function to extract n8n version from environment variables
$scope.getN8nVersion = function(container) {
if (container && container.environment && Array.isArray(container.environment)) {
var version = container.environment.find(function(env) {
return env.startsWith('N8N_VERSION=');
});
if (version) {
return version.split('=')[1];
}
console.log('getN8nVersion called with:', container);
if (!container) {
console.log('Container is null/undefined');
return 'unknown';
}
if (!container.environment) {
console.log('No environment in container');
return 'unknown';
}
if (!Array.isArray(container.environment)) {
console.log('Environment is not an array:', container.environment);
return 'unknown';
}
console.log('Searching through environment:', container.environment);
var version = container.environment.find(function(env) {
return typeof env === 'string' && env.startsWith('N8N_VERSION=');
});
if (version) {
var versionNumber = version.split('=')[1];
console.log('Found version:', versionNumber);
return versionNumber;
}
console.log('No N8N_VERSION found in environment');
return 'unknown';
};
@@ -1190,6 +1211,8 @@
<i class="fa fa-cube"></i>
n8n Container: {$ web.name $}
<span class="version-badge">
<!-- Debug output -->
<pre style="display:none">{$ web | json $}</pre>
<i class="fa fa-tag"></i> v{$ getN8nVersion(web) $}
<span ng-if="checkN8nUpdates(getN8nVersion(web))" class="update-available">
<i class="fa fa-arrow-up"></i> Update Available