mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-13 16:56:09 +01:00
show n8n version
This commit is contained in:
@@ -74,6 +74,7 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
|
|||||||
|
|
||||||
if (response.data.status === 1) {
|
if (response.data.status === 1) {
|
||||||
var containerInfo = response.data.data[1];
|
var containerInfo = response.data.data[1];
|
||||||
|
console.log("Container Info received:", containerInfo);
|
||||||
|
|
||||||
// Find the container in the list and update its information
|
// Find the container in the list and update its information
|
||||||
for (var i = 0; i < $scope.ContainerList.length; i++) {
|
for (var i = 0; i < $scope.ContainerList.length; i++) {
|
||||||
@@ -83,6 +84,7 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
|
|||||||
$scope.ContainerList[i].created = new Date(containerInfo.created);
|
$scope.ContainerList[i].created = new Date(containerInfo.created);
|
||||||
$scope.ContainerList[i].uptime = containerInfo.uptime;
|
$scope.ContainerList[i].uptime = containerInfo.uptime;
|
||||||
$scope.ContainerList[i].image = containerInfo.image;
|
$scope.ContainerList[i].image = containerInfo.image;
|
||||||
|
console.log("Updated container image:", $scope.ContainerList[i].image);
|
||||||
|
|
||||||
// Resource Usage
|
// Resource Usage
|
||||||
var memoryBytes = containerInfo.memory_usage;
|
var memoryBytes = containerInfo.memory_usage;
|
||||||
@@ -98,6 +100,7 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
|
|||||||
|
|
||||||
// Environment Variables
|
// Environment Variables
|
||||||
$scope.ContainerList[i].environment = containerInfo.environment;
|
$scope.ContainerList[i].environment = containerInfo.environment;
|
||||||
|
console.log("Container environment:", $scope.ContainerList[i].environment);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -943,10 +943,14 @@
|
|||||||
|
|
||||||
// Function to extract n8n version from environment variables
|
// Function to extract n8n version from environment variables
|
||||||
$scope.getN8nVersion = function(container) {
|
$scope.getN8nVersion = function(container) {
|
||||||
|
console.log("Getting version for container:", container);
|
||||||
|
|
||||||
if (container.environment) {
|
if (container.environment) {
|
||||||
|
console.log("Checking environment variables:", container.environment);
|
||||||
for (var i = 0; i < container.environment.length; i++) {
|
for (var i = 0; i < container.environment.length; i++) {
|
||||||
var env = container.environment[i];
|
var env = container.environment[i];
|
||||||
if (env.startsWith('N8N_VERSION=')) {
|
if (env.startsWith('N8N_VERSION=')) {
|
||||||
|
console.log("Found N8N_VERSION:", env);
|
||||||
return env.split('=')[1];
|
return env.split('=')[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -954,26 +958,25 @@
|
|||||||
|
|
||||||
// If no version found in environment, try to extract from image tag
|
// If no version found in environment, try to extract from image tag
|
||||||
if (container.image) {
|
if (container.image) {
|
||||||
console.log("Image format:", container.image);
|
console.log("Checking image tag:", container.image);
|
||||||
|
|
||||||
// Try to extract version using regex patterns
|
// Try to extract version using regex patterns
|
||||||
// This handles various formats like:
|
|
||||||
// - name:0.1.2
|
|
||||||
// - name:v0.1.2
|
|
||||||
// - name:version-0.1.2
|
|
||||||
// - registry/name:0.1.2
|
|
||||||
var versionMatch = container.image.match(/:([vV]?[0-9]+(\.[0-9]+)*(-[a-zA-Z0-9]+)?)/);
|
var versionMatch = container.image.match(/:([vV]?[0-9]+(\.[0-9]+)*(-[a-zA-Z0-9]+)?)/);
|
||||||
if (versionMatch && versionMatch[1]) {
|
if (versionMatch && versionMatch[1]) {
|
||||||
|
console.log("Found version via regex:", versionMatch[1]);
|
||||||
return versionMatch[1];
|
return versionMatch[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Simple fallback: just split by colon and use the last part
|
// Simple fallback: just split by colon and use the last part
|
||||||
if (container.image.includes(':')) {
|
if (container.image.includes(':')) {
|
||||||
var parts = container.image.split(':');
|
var parts = container.image.split(':');
|
||||||
return parts[parts.length - 1];
|
var version = parts[parts.length - 1];
|
||||||
|
console.log("Found version via split:", version);
|
||||||
|
return version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log("No version found, returning unknown");
|
||||||
return 'unknown';
|
return 'unknown';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user