blob: f5840ef586f894502e92344df419dea892accecd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
// js/maintenance.js
function displayLogs(){
const log_table = getElementOrThrow('log_table');
// ouvrir, fermer, recharger
if(log_table.innerHTML != ''){
log_table.innerHTML = "";
return;
}
const fetcher = new Fetcher({
endpoint: 'index.php?action=get_logs',
method: 'POST',
onSuccess: (data) => {
log_table.innerHTML = data.view;
console.log(log_table);
},
onFailure: () => {
toastNotify("Aucune donnée disponible");
}
});
fetcher.send({});
}
function cleanLogs(){
if(!confirm('Voulez-vous vraiment supprimer cette entrée?')){
return;
}
const log_table = getElementOrThrow('log_table');
const fetcher = new Fetcher({
endpoint: 'index.php?action=erase_logs',
method: 'POST',
onSuccess: () => {
log_table.innerHTML = '';
toastNotify('Les journaux de connexion ont été effacés');
},
onFailure: () => {
toastNotify("L'application a rencontré une erreur, rien n'a été effacé");
}
});
fetcher.send({});
}
// notification de succès ou erreur après restauration
document.addEventListener('DOMContentLoaded', function(){
// 1/ message généré avant la redirection
const params = new URLSearchParams(window.location.search);
if(params.has('read_backups_dir')){
toastNotify("Une erreur s'est produite:<br>" + params.get('read_backups_dir'));
}
if(params.has('database_restauration')){
if(params.get('database_restauration') === 'successful'){
toastNotify("La base de données a été restaurée avec succès !!");
}
else{
toastNotify("Une erreur s'est produite:<br>" + params.get('database_restauration'));
}
}
if(params.has('get_last_dump')){
toastNotify(params.get('get_last_dump'));
}
if(params.has('get_all_media')){
toastNotify(params.get('get_all_media'));
}
// 2/ message généré après la redirection, au moment de l'ouverture de la page
if(typeof window.error_message !== "undefined"){
toastNotify(window.error_message);
}
});
|