fix issue with design on n8n page

This commit is contained in:
usmannasir
2025-04-12 13:20:39 +05:00
parent f06e580037
commit 9fbae661f4
2 changed files with 86 additions and 69 deletions

View File

@@ -367,18 +367,17 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
// Create a backup // Create a backup
$scope.createBackup = function(container) { $scope.createBackup = function(container) {
$scope.cyberpanelLoading = false;
$('#cyberpanelLoading').show();
// Initialize backup options if they don't exist // Initialize backup options if they don't exist
$scope.initBackupOptions(container); $scope.initBackupOptions(container);
$scope.cyberpanelLoading = false;
$('#cyberpanelLoading').show();
var url = "/websites/n8n/create_backup"; var url = "/websites/n8n/create_backup";
var data = { var data = {
'container_id': container.id, 'container_id': container.id,
'include_credentials': container.backupOptions.includeCredentials, 'include_credentials': container.backupOptions.includeCredentials
'include_executions': container.backupOptions.includeExecutions
}; };
var config = { var config = {
@@ -387,9 +386,8 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
} }
}; };
$http.post(url, data, config).then( $http.post(url, data, config)
// Success handler .then(function(response) {
function(response) {
$scope.cyberpanelLoading = true; $scope.cyberpanelLoading = true;
$('#cyberpanelLoading').hide(); $('#cyberpanelLoading').hide();
@@ -415,25 +413,31 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
} else { } else {
new PNotify({ new PNotify({
title: 'Operation Failed!', title: 'Operation Failed!',
text: response.data.error_message || 'Unknown error occurred', text: response.data.error_message || 'Unknown error occurred during backup creation',
type: 'error' type: 'error'
}); });
console.error('Backup creation failed:', response.data);
} }
}, })
// Error handler .catch(function(error) {
function(error) {
$scope.cyberpanelLoading = true; $scope.cyberpanelLoading = true;
$('#cyberpanelLoading').hide(); $('#cyberpanelLoading').hide();
var errorMessage = 'Connection disrupted, refresh the page.';
if (error.data && error.data.error_message) {
errorMessage = error.data.error_message;
} else if (error.statusText) {
errorMessage = 'Server error: ' + error.statusText;
}
new PNotify({ new PNotify({
title: 'Operation Failed!', title: 'Operation Failed!',
text: 'Connection disrupted, refresh the page.', text: errorMessage,
type: 'error' type: 'error'
}); });
console.error('Error creating backup:', error); console.error('Error creating backup:', error);
} });
);
}; };
// Restore from a backup // Restore from a backup
@@ -472,9 +476,8 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
} }
}; };
$http.post(url, data, config).then( $http.post(url, data, config)
// Success handler .then(function(response) {
function(response) {
$scope.cyberpanelLoading = true; $scope.cyberpanelLoading = true;
$('#cyberpanelLoading').hide(); $('#cyberpanelLoading').hide();
@@ -494,21 +497,24 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
type: 'error' type: 'error'
}); });
} }
}, })
// Error handler .catch(function(error) {
function(error) {
$scope.cyberpanelLoading = true; $scope.cyberpanelLoading = true;
$('#cyberpanelLoading').hide(); $('#cyberpanelLoading').hide();
var errorMessage = 'Connection disrupted, refresh the page.';
if (error.data && error.data.error_message) {
errorMessage = error.data.error_message;
}
new PNotify({ new PNotify({
title: 'Operation Failed!', title: 'Operation Failed!',
text: 'Connection disrupted, refresh the page.', text: errorMessage,
type: 'error' type: 'error'
}); });
console.error('Error restoring backup:', error); console.error('Error restoring backup:', error);
} });
);
} catch (error) { } catch (error) {
$scope.cyberpanelLoading = true; $scope.cyberpanelLoading = true;
$('#cyberpanelLoading').hide(); $('#cyberpanelLoading').hide();
@@ -523,6 +529,17 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
} }
}; };
reader.onerror = function() {
$scope.cyberpanelLoading = true;
$('#cyberpanelLoading').hide();
new PNotify({
title: 'Error!',
text: 'Failed to read the backup file.',
type: 'error'
});
};
reader.readAsText(fileInput.files[0]); reader.readAsText(fileInput.files[0]);
}; };

View File

@@ -721,28 +721,28 @@
<button class="btn btn-sm btn-primary" ng-click="refreshWorkflows(web)"> <button class="btn btn-sm btn-primary" ng-click="refreshWorkflows(web)">
<i class="fa fa-refresh"></i> Refresh <i class="fa fa-refresh"></i> Refresh
</button> </button>
</div> </div>
<div ng-if="web.workflows && web.workflows.length > 0"> <div ng-if="web.workflows && web.workflows.length > 0">
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Status</th> <th>Status</th>
<th>Last Execution</th> <th>Last Execution</th>
<th>Success Rate</th> <th>Success Rate</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="workflow in web.workflows"> <tr ng-repeat="workflow in web.workflows">
<td>{$ workflow.name $}</td> <td>{$ workflow.name $}</td>
<td> <td>
<span class="workflow-status" ng-class="{'active': workflow.active, 'error': !workflow.active}"> <span class="workflow-status" ng-class="{'active': workflow.active, 'error': !workflow.active}">
{$ workflow.active ? 'Active' : 'Inactive' $} {$ workflow.active ? 'Active' : 'Inactive' $}
</span> </span>
</td> </td>
<td>{$ workflow.lastExecution | date:'medium' $}</td> <td>{$ workflow.lastExecution | date:'medium' $}</td>
<td> <td>
<div class="progress" style="height: 15px; margin-bottom: 0;"> <div class="progress" style="height: 15px; margin-bottom: 0;">
@@ -774,11 +774,11 @@
</button> </button>
</div> </div>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
<div ng-if="!web.workflows || web.workflows.length === 0" class="n8n-empty-state"> <div ng-if="!web.workflows || web.workflows.length === 0" class="n8n-empty-state">
<i class="fa fa-info-circle"></i> <i class="fa fa-info-circle"></i>
<p>No workflows found or container is not running</p> <p>No workflows found or container is not running</p>
@@ -787,8 +787,8 @@
target="_blank"> target="_blank">
<i class="fa fa-plus"></i> Create New Workflow <i class="fa fa-plus"></i> Create New Workflow
</a> </a>
</div> </div>
</div> </div>
<!-- Backup & Restore Section --> <!-- Backup & Restore Section -->
<div class="n8n-dashboard-section"> <div class="n8n-dashboard-section">
@@ -889,16 +889,16 @@
<div class="version-history"> <div class="version-history">
<h5 class="border-bottom pb-2 mb-2">Version History</h5> <h5 class="border-bottom pb-2 mb-2">Version History</h5>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-hover mb-0"> <table class="table table-striped table-hover mb-0">
<thead> <thead>
<tr> <tr>
<th>Date</th> <th>Date</th>
<th>Version</th> <th>Version</th>
<th>Action</th> <th>Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="version in web.versionHistory"> <tr ng-repeat="version in web.versionHistory">
<td>{$ version.date | date:'medium' $}</td> <td>{$ version.date | date:'medium' $}</td>
<td><span class="label label-default">{$ version.version $}</span></td> <td><span class="label label-default">{$ version.version $}</span></td>
@@ -907,13 +907,13 @@
<i class="fa fa-search"></i> Details <i class="fa fa-search"></i> Details
</button> </button>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>
</div>
</div> </div>
</div> </div>
</div>
</div>
<!-- Credential Security Dashboard --> <!-- Credential Security Dashboard -->
<div class="col-md-6"> <div class="col-md-6">
@@ -947,18 +947,18 @@
</div> </div>
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Type</th> <th>Type</th>
<th>Usage</th> <th>Usage</th>
<th>Security</th> <th>Security</th>
<th>Actions</th> <th>Actions</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr ng-repeat="credential in web.credentials"> <tr ng-repeat="credential in web.credentials">
<td>{$ credential.name $}</td> <td>{$ credential.name $}</td>
<td> <td>
@@ -991,11 +991,11 @@
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
</button> </button>
</div> </div>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="text-right mt-3"> <div class="text-right mt-3">
<a class="btn btn-success" <a class="btn btn-success"
@@ -1007,8 +1007,8 @@
ng-disabled="web.unusedCredentials.length === 0"> ng-disabled="web.unusedCredentials.length === 0">
<i class="fa fa-broom"></i> Cleanup Unused <i class="fa fa-broom"></i> Cleanup Unused
</button> </button>
</div> </div>
</div> </div>
<div ng-if="!web.credentials || web.credentials.length === 0" class="n8n-empty-state"> <div ng-if="!web.credentials || web.credentials.length === 0" class="n8n-empty-state">
<i class="fa fa-lock"></i> <i class="fa fa-lock"></i>
@@ -1310,8 +1310,8 @@
</h4> </h4>
<div class="content-box-wrapper"> <div class="content-box-wrapper">
<textarea name="logs" class="form-control" cols="30" rows="10">{$ web.logs $}</textarea> <textarea name="logs" class="form-control" cols="30" rows="10">{$ web.logs $}</textarea>
</div>
</div> </div>
</div>
<!-- Custom Domain Configuration --> <!-- Custom Domain Configuration -->
<div class="info-box shadow-sm mt-4"> <div class="info-box shadow-sm mt-4">