mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 22:36:12 +01:00
fix issue with design on n8n page
This commit is contained in:
@@ -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]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user