diff --git a/websiteFunctions/static/websiteFunctions/DockerContainers.js b/websiteFunctions/static/websiteFunctions/DockerContainers.js index a23e7d38f..2b439bf1f 100644 --- a/websiteFunctions/static/websiteFunctions/DockerContainers.js +++ b/websiteFunctions/static/websiteFunctions/DockerContainers.js @@ -1,6 +1,17 @@ +// Add the json filter to the application +app.filter('json', function() { + return function(input) { + if (input === undefined || input === null) { + return ''; + } + return JSON.stringify(input, null, 2); + }; +}); + app.controller('ListDockersitecontainer', function ($scope, $http) { $scope.cyberPanelLoading = true; $scope.conatinerview = true; + $scope.JSON = window.JSON; // Make JSON available to templates $('#cyberpanelLoading').hide(); // Format bytes to human readable @@ -465,57 +476,66 @@ app.controller('ListDockersitecontainer', function ($scope, $http) { if (response.data.status === 1) { var diagnostics = response.data.diagnostics; - // Initialize diagnostic results if not exists - if (!container.diagnosticResults) { - container.diagnosticResults = {}; - } - - // Store diagnostic results - container.diagnosticResults = diagnostics; - container.showDiagnostics = true; - - // Show summary notification - var summaryMessage = ""; + // Create a formatted diagnostic message + var summaryMessage = "

Diagnostic Results

"; + summaryMessage += ""; + + // Display diagnostic results in a modal + var modal = ""; + + // Add modal to document if it doesn't exist + if ($('#diagnosticModal').length === 0) { + $('body').append(modal); + } else { + $('#diagnosticModal .modal-body').html(summaryMessage); + } + + // Show modal + $('#diagnosticModal').modal('show'); } else { new PNotify({ @@ -550,7 +570,7 @@ app.controller('ListDockersitecontainer', function ($scope, $http) { $scope.restoreFromBackup = function(container) { // Check if a file has been selected var fileInput = document.getElementById('backupFile'); - if (!fileInput.files || fileInput.files.length === 0) { + if (!fileInput || !fileInput.files || fileInput.files.length === 0) { new PNotify({ title: 'Error!', text: 'Please select a backup file to restore.', @@ -594,8 +614,13 @@ app.controller('ListDockersitecontainer', function ($scope, $http) { type: 'success' }); + // Reset file input + fileInput.value = ''; + // Refresh workflows after restore - $scope.refreshWorkflows(container); + setTimeout(function() { + $scope.refreshWorkflows(container); + }, 1000); } else { new PNotify({ title: 'Operation Failed!', diff --git a/websiteFunctions/templates/websiteFunctions/DockerSiteHome.html b/websiteFunctions/templates/websiteFunctions/DockerSiteHome.html index d40a523b3..8a0814d14 100644 --- a/websiteFunctions/templates/websiteFunctions/DockerSiteHome.html +++ b/websiteFunctions/templates/websiteFunctions/DockerSiteHome.html @@ -611,9 +611,9 @@ Settings - + @@ -714,9 +714,9 @@ Settings - + @@ -844,7 +847,7 @@
- +
@@ -1714,10 +1717,10 @@
-
{$ selectedExecution.inputData | json $}
+
{{JSON.stringify(selectedExecution.inputData, null, 2)}}
-
{$ selectedExecution.outputData | json $}
+
{{JSON.stringify(selectedExecution.outputData, null, 2)}}
@@ -1883,7 +1886,7 @@
N8n API Diagnostics
-
@@ -1969,7 +1972,7 @@
Port Mappings
-
{{container.diagnosticResults.port_mappings | json}}
+
{{JSON.stringify(container.diagnosticResults.port_mappings, null, 2)}}
@@ -1982,7 +1985,7 @@
API Error
-
{{container.diagnosticResults.api_error}}
+
{{JSON.stringify(container.diagnosticResults.api_error, null, 2)}}