From 948bffa7be288cbd2111aa54a9533fb85e82c83f Mon Sep 17 00:00:00 2001 From: usmannasir Date: Sat, 12 Apr 2025 21:52:19 +0500 Subject: [PATCH] show n8n version --- .../websiteFunctions/DockerContainers.js | 37 +++++++++++++++++++ .../websiteFunctions/DockerSiteHome.html | 9 ++--- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/websiteFunctions/static/websiteFunctions/DockerContainers.js b/websiteFunctions/static/websiteFunctions/DockerContainers.js index be2563669..247db9e7f 100644 --- a/websiteFunctions/static/websiteFunctions/DockerContainers.js +++ b/websiteFunctions/static/websiteFunctions/DockerContainers.js @@ -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'; + }; }); \ No newline at end of file diff --git a/websiteFunctions/templates/websiteFunctions/DockerSiteHome.html b/websiteFunctions/templates/websiteFunctions/DockerSiteHome.html index 80754f41c..bb20e8dbf 100644 --- a/websiteFunctions/templates/websiteFunctions/DockerSiteHome.html +++ b/websiteFunctions/templates/websiteFunctions/DockerSiteHome.html @@ -1211,12 +1211,9 @@ n8n Container: {$ web.name $} - -
{$ web | json $}
- v{$ getN8nVersion(web) $} - - Update Available - + Debug - Environment: {$ web.environment | json $} + +