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

View File

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