show n8n version

This commit is contained in:
usmannasir
2025-04-12 21:52:19 +05:00
parent 8a22ac6bbf
commit 948bffa7be
2 changed files with 40 additions and 6 deletions

View File

@@ -355,4 +355,41 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
// Add location service to the controller for the n8n URL
$scope.location = window.location;
// Function to extract n8n version from environment variables
$scope.getN8nVersion = function(container) {
console.log('getN8nVersion called with container:', container);
if (!container || !container.environment) {
console.log('No container or environment data');
return 'unknown';
}
console.log('Container environment:', container.environment);
var version = null;
// Try to find NODE_VERSION first
version = container.environment.find(function(env) {
return env && env.startsWith('NODE_VERSION=');
});
if (version) {
console.log('Found NODE_VERSION:', version);
return version.split('=')[1];
}
// Try to find N8N_VERSION
version = container.environment.find(function(env) {
return env && env.startsWith('N8N_VERSION=');
});
if (version) {
console.log('Found N8N_VERSION:', version);
return version.split('=')[1];
}
console.log('No version found in environment');
return 'unknown';
};
});

View File

@@ -1211,12 +1211,9 @@
<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
</span>
<span style="display: none;">Debug - Environment: {$ web.environment | json $}</span>
<i class="fa fa-tag"></i>
<span ng-bind="'v' + getN8nVersion(web)"></span>
</span>
<span class="workflow-status" ng-class="{'active': web.status === 'running', 'error': web.status !== 'running'}">
<i class="fa" ng-class="{'fa-check-circle': web.status === 'running', 'fa-times-circle': web.status !== 'running'}"></i>