cron_logs_view.mustache
3.12 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.25/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.js"></script>
<div class="container">
<div class="cardtitle">
<p class="banner-title mb-0 pb-0 bold" style="font-size: 30px;">Cron logs view</p>
<p class="dasboard_margin">It shows all cron entries that should be ran today. We can fliter the cron details based on the date filter</p>
</div>
</div>
<div class="container">
<div class="input-group mb-3">
<div class="input-group-prepend" style="display: block;padding: 10px;text-align: justify;width: 25em;">
<label for="date_filter">Date</label>
<input type="date" id="date_filter" class="form-control" aria-label="Default" aria-describedby="date_filter">
</div>
<div id="date_filter_error_div"></div>
</div>
<div class="input-group mb-3">
<div>
<button id="filter_logs" class="btn btn-primary" type="button" title="Filter">Filter
<span class="icon-stack"><i style="line-height: 0.5em;" class="icon-filter icon-stack-base" aria-hidden="true"></i>
<i style="line-height: 0.2em;" class="icon-add"></i></span></button>
</div>
</div>
</div>
<div class="container">
<table id="view_logs_entries_table" class="compact table table-bordered table-striped table-hover">
<thead><tr><th class="center-class">Sno</th><th class="center-class">Cron file</th><th class="center-class">Cron log</th></tr></thead>
<tbody>
{{#tablecontents}}
<tr>
<td class="center-class">{{sno}}</td>
<td class="center-class">{{{name}}}</td>
<td class="center-class">{{log}}</td>
</tr>
{{/tablecontents}}
</tbody>
</table>
</div>
<script>
var log_DataTable = "";
log_DataTable = $('#view_logs_entries_table').DataTable({
dom: 'lBfrtip',
"pageLength": 30,
"lengthChange": false,
lengthMenu: [[10, 25, 50, 100],[10, 25, 50, 100]],
"language": {
"emptyTable": "No records found."
},
"columns": [
{ "data": "sno" },
{ "data": "name" },
{ "data": "log" }
]
});
$('#view_slots_filter').click(function() {
var date = $("#date_filter").val();
if((date == '')) {
var alert_message = '<p style="color: red;">* Please select date filter.</p>';
if(('#date_filter_error_div').length != 0 ) {
$('#date_filter_error_div').empty();
}
$('#date_filter_error_div').append(alert_message);
}
else {
if(('#date_filter_error_div').length != 0 ) {
$('#date_filter_error_div').empty();
}
$.ajax({
method: "GET",
url: M.cfg.wwwroot + '/blocks/log/ajax.php',
data: {"choice" : "get_logs","date" : date}
}).done(function(response) {
var data = JSON.parse(response);
var userdata = JSON.parse(data.userdata);
log_DataTable.clear().draw();
log_DataTable.rows.add(userdata).draw();
});
}
});
</script>