From f067e571697f5bedbf781ba63d729ba54dc6b96c Mon Sep 17 00:00:00 2001 From: usmannasir Date: Sat, 12 Apr 2025 20:47:47 +0500 Subject: [PATCH] front end for n8n version --- .../websiteFunctions/DockerSiteHome.html | 87 +++++++++++-------- 1 file changed, 49 insertions(+), 38 deletions(-) diff --git a/websiteFunctions/templates/websiteFunctions/DockerSiteHome.html b/websiteFunctions/templates/websiteFunctions/DockerSiteHome.html index 7097db516..187b63318 100644 --- a/websiteFunctions/templates/websiteFunctions/DockerSiteHome.html +++ b/websiteFunctions/templates/websiteFunctions/DockerSiteHome.html @@ -941,23 +941,34 @@ $scope.conatinerview = false; $scope.cyberpanelLoading = true; - // Initialize container data - $scope.initContainer = function(container) { - if (container.environment && container.environment.some(env => env.includes('n8n'))) { - // Get container details including image info - $http.get('/docker/container/' + container.id + '/json').then(function(response) { - container.image = response.data.Config.Image; - $scope.$apply(); - }); + // Function to extract n8n version from environment variables + $scope.getN8nVersion = function(container) { + if (container.environment) { + for (var i = 0; i < container.environment.length; i++) { + var env = container.environment[i]; + if (env.startsWith('N8N_VERSION=')) { + return env.split('=')[1]; + } + } } + // If no version found in environment, try to extract from image tag + if (container.image && container.image.includes(':')) { + return container.image.split(':')[1]; + } + return 'unknown'; + }; + + // Function to check if updates are available + $scope.checkN8nUpdates = function(currentVersion) { + // This is a placeholder. You'll need to implement the actual version check + // For now, we'll assume an update is available if version is not 'latest' + return currentVersion !== 'latest'; }; - // Watch for container list changes - $scope.$watch('ContainerList', function(newVal) { - if (newVal && newVal.length > 0) { - newVal.forEach($scope.initContainer); - } - }); + // Add custom icon rendering for container actions + $scope.renderIcon = function(iconName) { + return ''; + }; // Handle container actions $scope.handleAction = function(action, container) { @@ -1180,16 +1191,16 @@

- n8n Container: {{ web.name }} - - v{{ web.image.split(':')[1] || 'unknown' }} - + n8n Container: {$ web.name $} + + v{$ getN8nVersion(web) $} + Update Available - {{ web.status }} + {$ web.status $}

@@ -1205,10 +1216,10 @@ - - + Open n8n
@@ -1347,11 +1358,11 @@

- {% trans "Container: " %} {{ web.name }} + {% trans "Container: " %} {$ web.name $} - {{ web.status }} + {$ web.status $}

@@ -1379,15 +1390,15 @@ Container ID: - {{ web.id }} + {$ web.id $} Created: - {{ web.created | date:'medium' }} + {$ web.created | date:'medium' $} Uptime: - {{ web.uptime }} + {$ web.uptime $} @@ -1396,22 +1407,22 @@

Resource Usage

- +
- +
@@ -1433,10 +1444,10 @@ - {{ containerPort }} + {$ containerPort $} - {{ binding.HostIp || '0.0.0.0' }}:{{ binding.HostPort }} + {$ binding.HostIp || '0.0.0.0' $}:{$ binding.HostPort $} @@ -1460,8 +1471,8 @@ - {{ volume.Source }} - {{ volume.Destination }} + {$ volume.Source $} + {$ volume.Destination $} @@ -1487,10 +1498,10 @@ - {{ env.split('=')[0] }} + {$ env.split('=')[0] $} - {{ env.split('=')[1] }} - {{ env.split('=')[1] }} + {$ env.split('=')[1] $} + {$ env.split('=')[1] $} @@ -1507,7 +1518,7 @@ Refresh - +