mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-10 23:42:37 -07:00
Add newsletter logs table
This commit is contained in:
parent
b9b82b23f7
commit
50b37d6b3a
5 changed files with 382 additions and 14 deletions
136
data/interfaces/default/js/tables/newsletter_logs.js
Normal file
136
data/interfaces/default/js/tables/newsletter_logs.js
Normal file
|
@ -0,0 +1,136 @@
|
|||
newsletter_log_table_options = {
|
||||
"destroy": true,
|
||||
"serverSide": true,
|
||||
"processing": false,
|
||||
"pagingType": "full_numbers",
|
||||
"order": [ 0, 'desc'],
|
||||
"pageLength": 50,
|
||||
"stateSave": true,
|
||||
"language": {
|
||||
"search":"Search: ",
|
||||
"lengthMenu": "Show _MENU_ lines per page",
|
||||
"emptyTable": "No log information available",
|
||||
"info" :"Showing _START_ to _END_ of _TOTAL_ lines",
|
||||
"infoEmpty": "Showing 0 to 0 of 0 lines",
|
||||
"infoFiltered": "(filtered from _MAX_ total lines)",
|
||||
"loadingRecords": '<i class="fa fa-refresh fa-spin"></i> Loading items...</div>'
|
||||
},
|
||||
"autoWidth": false,
|
||||
"scrollX": true,
|
||||
"columnDefs": [
|
||||
{
|
||||
"targets": [0],
|
||||
"data": "timestamp",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if (cellData !== '') {
|
||||
$(td).html(moment(cellData, "X").format('YYYY-MM-DD HH:mm:ss'));
|
||||
}
|
||||
},
|
||||
"width": "10%",
|
||||
"className": "no-wrap"
|
||||
},
|
||||
{
|
||||
"targets": [1],
|
||||
"data": "newsletter_id",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if (cellData !== '') {
|
||||
$(td).html(cellData);
|
||||
}
|
||||
},
|
||||
"width": "5%",
|
||||
"className": "no-wrap"
|
||||
},
|
||||
{
|
||||
"targets": [2],
|
||||
"data": "agent_name",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if (cellData !== '') {
|
||||
$(td).html(cellData);
|
||||
}
|
||||
},
|
||||
"width": "10%",
|
||||
"className": "no-wrap"
|
||||
},
|
||||
{
|
||||
"targets": [3],
|
||||
"data": "notify_action",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if (cellData !== '') {
|
||||
$(td).html(cellData);
|
||||
}
|
||||
},
|
||||
"width": "5%",
|
||||
"className": "no-wrap"
|
||||
},
|
||||
{
|
||||
"targets": [4],
|
||||
"data": "subject_text",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if (cellData !== '') {
|
||||
$(td).html('<a href="newsletter/' + rowData['uuid'] + '" target="_blank">' + cellData + '</a>');
|
||||
}
|
||||
},
|
||||
"width": "38%"
|
||||
},
|
||||
{
|
||||
"targets": [5],
|
||||
"data": "start_date",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if (cellData !== '') {
|
||||
$(td).html(cellData);
|
||||
}
|
||||
},
|
||||
"width": "10%"
|
||||
},
|
||||
{
|
||||
"targets": [6],
|
||||
"data": "end_date",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if (cellData !== '') {
|
||||
$(td).html(cellData);
|
||||
}
|
||||
},
|
||||
"width": "10%"
|
||||
},
|
||||
{
|
||||
"targets": [7],
|
||||
"data": "uuid",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if (cellData !== '') {
|
||||
$(td).html(cellData);
|
||||
}
|
||||
},
|
||||
"width": "10%"
|
||||
},
|
||||
{
|
||||
"targets": [8],
|
||||
"data": "success",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if (cellData === 1) {
|
||||
$(td).html('<span class="success-tooltip" data-toggle="tooltip" title="Newsletter Sent"><i class="fa fa-lg fa-fw fa-check"></i></span>');
|
||||
} else {
|
||||
$(td).html('<span class="success-tooltip" data-toggle="tooltip" title="Newsletter Failed"><i class="fa fa-lg fa-fw fa-times"></i></span>');
|
||||
}
|
||||
},
|
||||
"searchable": false,
|
||||
"orderable": false,
|
||||
"className": "no-wrap",
|
||||
"width": "2%"
|
||||
},
|
||||
],
|
||||
"drawCallback": function (settings) {
|
||||
// Jump to top of page
|
||||
//$('html,body').scrollTop(0);
|
||||
$('#ajaxMsg').fadeOut();
|
||||
|
||||
// Create the tooltips.
|
||||
$('body').tooltip({
|
||||
selector: '[data-toggle="tooltip"]',
|
||||
container: 'body'
|
||||
});
|
||||
},
|
||||
"preDrawCallback": function(settings) {
|
||||
var msg = "<i class='fa fa-refresh fa-spin'></i> Fetching rows...";
|
||||
showMsg(msg, false, false, 0)
|
||||
}
|
||||
};
|
|
@ -86,7 +86,7 @@ notification_log_table_options = {
|
|||
"targets": [6],
|
||||
"data": "success",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if (cellData == 1) {
|
||||
if (cellData === 1) {
|
||||
$(td).html('<span class="success-tooltip" data-toggle="tooltip" title="Notification Sent"><i class="fa fa-lg fa-fw fa-check"></i></span>');
|
||||
} else {
|
||||
$(td).html('<span class="success-tooltip" data-toggle="tooltip" title="Notification Failed"><i class="fa fa-lg fa-fw fa-times"></i></span>');
|
||||
|
@ -113,4 +113,4 @@ notification_log_table_options = {
|
|||
var msg = "<i class='fa fa-refresh fa-spin'></i> Fetching rows...";
|
||||
showMsg(msg, false, false, 0)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
<button class="btn btn-dark" id="download-plexscannerlog" style="display: none;"><i class="fa fa-download"></i> Download logs</button>
|
||||
<button class="btn btn-dark" id="clear-logs"><i class="fa fa-trash-o"></i> Clear logs</button>
|
||||
<button class="btn btn-dark" id="clear-notify-logs" style="display: none;"><i class="fa fa-trash-o"></i> Clear logs</button>
|
||||
<button class="btn btn-dark" id="clear-newsletter-logs" style="display: none;"><i class="fa fa-trash-o"></i> Clear logs</button>
|
||||
<button class="btn btn-dark" id="clear-login-logs" style="display: none;"><i class="fa fa-trash-o"></i> Clear logs</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -62,6 +63,7 @@
|
|||
<li role="presentation"><a id="plex-scanner-logs-btn" href="#tabs-plex_scanner_log" aria-controls="tabs-plex_scanner_log" role="tab" data-toggle="tab">Plex Media Scanner Logs</a></li>
|
||||
<li role="presentation"><a id="plex-websocket-logs-btn" href="#tabs-plex_websocket_log" aria-controls="tabs-plex_websocket_log" role="tab" data-toggle="tab">Plex Websocket Logs</a></li>
|
||||
<li role="presentation"><a id="notification-logs-btn" href="#tabs-notification_log" aria-controls="tabs-notification_log" role="tab" data-toggle="tab">Notification Logs</a></li>
|
||||
<li role="presentation"><a id="newsletter-logs-btn" href="#tabs-newsletter_log" aria-controls="tabs-newsletter_log" role="tab" data-toggle="tab">Newsletter Logs</a></li>
|
||||
<li role="presentation"><a id="login-logs-btn" href="#tabs-login_log" aria-controls="tabs-login_log" role="tab" data-toggle="tab">Login Logs</a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
|
@ -141,6 +143,24 @@
|
|||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="tabs-newsletter_log">
|
||||
<table class="display" id="newsletter_log_table" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="left" id="newsletter_timestamp">Timestamp</th>
|
||||
<th align="left" id="newsletter_newsletter_id">Newsletter ID</th>
|
||||
<th align="left" id="newsletter_agent_name">Agent</th>
|
||||
<th align="left" id="newsletter_notify_action">Action</th>
|
||||
<th align="left" id="newsletter_subject_text">Subject Text</th>
|
||||
<th align="left" id="newsletter_start_date">Start Date</th>
|
||||
<th align="left" id="newsletter_end_date">End Date</th>
|
||||
<th align="left" id="newsletter_uuid">UUID</th>
|
||||
<th align="left" id="newsletter_success"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="tabs-login_log">
|
||||
<table class="display login_log_table" id="login_log_table" width="100%">
|
||||
<thead>
|
||||
|
@ -191,6 +211,7 @@
|
|||
<script src="${http_root}js/tables/logs.js${cache_param}"></script>
|
||||
<script src="${http_root}js/tables/plex_logs.js${cache_param}"></script>
|
||||
<script src="${http_root}js/tables/notification_logs.js${cache_param}"></script>
|
||||
<script src="${http_root}js/tables/newsletter_logs.js${cache_param}"></script>
|
||||
<script src="${http_root}js/tables/login_logs.js${cache_param}"></script>
|
||||
<script>
|
||||
|
||||
|
@ -275,6 +296,18 @@
|
|||
notification_log_table = $('#notification_log_table').DataTable(notification_log_table_options);
|
||||
}
|
||||
|
||||
function loadNewsletterLogs() {
|
||||
newsletter_log_table_options.ajax = {
|
||||
url: "get_newsletter_log",
|
||||
data: function (d) {
|
||||
return {
|
||||
json_data: JSON.stringify(d)
|
||||
};
|
||||
}
|
||||
};
|
||||
newsletter_log_table = $('#newsletter_log_table').DataTable(newsletter_log_table_options);
|
||||
}
|
||||
|
||||
function loadLoginLogs() {
|
||||
login_log_table_options.pageLength = 50;
|
||||
login_log_table_options.ajax = {
|
||||
|
@ -296,6 +329,7 @@
|
|||
$("#download-plexserverlog").hide();
|
||||
$("#download-plexscannerlog").hide();
|
||||
$("#clear-notify-logs").hide();
|
||||
$("#clear-newsletter-logs").hide();
|
||||
$("#clear-login-logs").hide();
|
||||
loadtautullilogs('tautulli', selected_log_level);
|
||||
clearSearchButton('tautulli_log_table', log_table);
|
||||
|
@ -309,6 +343,7 @@
|
|||
$("#download-plexserverlog").hide();
|
||||
$("#download-plexscannerlog").hide();
|
||||
$("#clear-notify-logs").hide();
|
||||
$("#clear-newsletter-logs").hide();
|
||||
$("#clear-login-logs").hide();
|
||||
loadtautullilogs('tautulli_api', selected_log_level);
|
||||
clearSearchButton('tautulli_api_log_table', log_table);
|
||||
|
@ -322,6 +357,7 @@
|
|||
$("#download-plexserverlog").hide();
|
||||
$("#download-plexscannerlog").hide();
|
||||
$("#clear-notify-logs").hide();
|
||||
$("#clear-newsletter-logs").hide();
|
||||
$("#clear-login-logs").hide();
|
||||
loadtautullilogs('plex_websocket', selected_log_level);
|
||||
clearSearchButton('plex_websocket_log_table', log_table);
|
||||
|
@ -335,6 +371,7 @@
|
|||
$("#download-plexserverlog").show();
|
||||
$("#download-plexscannerlog").hide();
|
||||
$("#clear-notify-logs").hide();
|
||||
$("#clear-newsletter-logs").hide();
|
||||
$("#clear-login-logs").hide();
|
||||
loadPlexLogs();
|
||||
clearSearchButton('plex_log_table', plex_log_table);
|
||||
|
@ -348,6 +385,7 @@
|
|||
$("#download-plexserverlog").hide();
|
||||
$("#download-plexscannerlog").show();
|
||||
$("#clear-notify-logs").hide();
|
||||
$("#clear-newsletter-logs").hide();
|
||||
$("#clear-login-logs").hide();
|
||||
loadPlexScannerLogs();
|
||||
clearSearchButton('plex_scanner_log_table', plex_scanner_log_table);
|
||||
|
@ -361,11 +399,26 @@
|
|||
$("#download-plexserverlog").hide();
|
||||
$("#download-plexscannerlog").hide();
|
||||
$("#clear-notify-logs").show();
|
||||
$("#clear-newsletter-logs").hide();
|
||||
$("#clear-login-logs").hide();
|
||||
loadNotificationLogs();
|
||||
clearSearchButton('notification_log_table', notification_log_table);
|
||||
});
|
||||
|
||||
$("#newsletter-logs-btn").click(function () {
|
||||
$("#tautulli-log-levels").hide();
|
||||
$("#plex-log-levels").hide();
|
||||
$("#clear-logs").hide();
|
||||
$("#download-tautullilog").hide();
|
||||
$("#download-plexserverlog").hide();
|
||||
$("#download-plexscannerlog").hide();
|
||||
$("#clear-notify-logs").hide();
|
||||
$("#clear-newsletter-logs").show();
|
||||
$("#clear-login-logs").hide();
|
||||
loadNewsletterLogs();
|
||||
clearSearchButton('newsletter_log_table', newsletter_log_table);
|
||||
});
|
||||
|
||||
$("#login-logs-btn").click(function () {
|
||||
$("#tautulli-log-levels").hide();
|
||||
$("#plex-log-levels").hide();
|
||||
|
@ -374,6 +427,7 @@
|
|||
$("#download-plexserverlog").hide();
|
||||
$("#download-plexscannerlog").hide();
|
||||
$("#clear-notify-logs").hide();
|
||||
$("#clear-newsletter-logs").hide();
|
||||
$("#clear-login-logs").show();
|
||||
loadLoginLogs();
|
||||
clearSearchButton('login_log_table', notification_log_table);
|
||||
|
@ -442,6 +496,27 @@
|
|||
});
|
||||
});
|
||||
|
||||
$("#clear-newsletter-logs").click(function () {
|
||||
$("#confirm-message").text("Are you sure you want to clear the Tautulli Newsletter Logs?");
|
||||
$('#confirm-modal').modal();
|
||||
$('#confirm-modal').one('click', '#confirm-button', function () {
|
||||
$.ajax({
|
||||
url: 'delete_newsletter_log',
|
||||
type: 'POST',
|
||||
complete: function (xhr, status) {
|
||||
result = $.parseJSON(xhr.responseText);
|
||||
msg = result.message;
|
||||
if (result.result === 'success') {
|
||||
showMsg('<i class="fa fa-check"></i> ' + msg, false, true, 5000)
|
||||
} else {
|
||||
showMsg('<i class="fa fa-times"></i> ' + msg, false, true, 5000, true)
|
||||
}
|
||||
newsletter_log_table.draw();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$("#clear-login-logs").click(function () {
|
||||
$("#confirm-message").text("Are you sure you want to clear the Tautulli Login Logs?");
|
||||
$('#confirm-modal').modal();
|
||||
|
|
|
@ -1563,6 +1563,77 @@ class DataFactory(object):
|
|||
logger.warn(u"Tautulli DataFactory :: Unable to execute database query for delete_notification_log: %s." % e)
|
||||
return False
|
||||
|
||||
def get_newsletter_log(self, kwargs=None):
|
||||
data_tables = datatables.DataTables()
|
||||
|
||||
columns = ['newsletter_log.id',
|
||||
'newsletter_log.timestamp',
|
||||
'newsletter_log.newsletter_id',
|
||||
'newsletter_log.agent_id',
|
||||
'newsletter_log.agent_name',
|
||||
'newsletter_log.notify_action',
|
||||
'newsletter_log.subject_text',
|
||||
'newsletter_log.start_date',
|
||||
'newsletter_log.end_date',
|
||||
'newsletter_log.uuid',
|
||||
'newsletter_log.success'
|
||||
]
|
||||
try:
|
||||
query = data_tables.ssp_query(table_name='newsletter_log',
|
||||
columns=columns,
|
||||
custom_where=[],
|
||||
group_by=[],
|
||||
join_types=[],
|
||||
join_tables=[],
|
||||
join_evals=[],
|
||||
kwargs=kwargs)
|
||||
except Exception as e:
|
||||
logger.warn(u"Tautulli DataFactory :: Unable to execute database query for get_newsletter_log: %s." % e)
|
||||
return {'recordsFiltered': 0,
|
||||
'recordsTotal': 0,
|
||||
'draw': 0,
|
||||
'data': 'null',
|
||||
'error': 'Unable to execute database query.'}
|
||||
|
||||
newsletters = query['result']
|
||||
|
||||
rows = []
|
||||
for item in newsletters:
|
||||
row = {'id': item['id'],
|
||||
'timestamp': item['timestamp'],
|
||||
'newsletter_id': item['newsletter_id'],
|
||||
'agent_id': item['agent_id'],
|
||||
'agent_name': item['agent_name'],
|
||||
'notify_action': item['notify_action'],
|
||||
'subject_text': item['subject_text'],
|
||||
'start_date': item['start_date'],
|
||||
'end_date': item['end_date'],
|
||||
'uuid': item['uuid'],
|
||||
'success': item['success']
|
||||
}
|
||||
|
||||
rows.append(row)
|
||||
|
||||
dict = {'recordsFiltered': query['filteredCount'],
|
||||
'recordsTotal': query['totalCount'],
|
||||
'data': rows,
|
||||
'draw': query['draw']
|
||||
}
|
||||
|
||||
return dict
|
||||
|
||||
def delete_newsletter_log(self):
|
||||
monitor_db = database.MonitorDatabase()
|
||||
|
||||
try:
|
||||
logger.info(u"Tautulli DataFactory :: Clearing newsletter logs from database.")
|
||||
monitor_db.action('DELETE FROM newsletter_log')
|
||||
monitor_db.action('VACUUM')
|
||||
return True
|
||||
except Exception as e:
|
||||
logger.warn(u"Tautulli DataFactory :: Unable to execute database query for delete_newsletter_log: %s." % e)
|
||||
return False
|
||||
|
||||
def get_user_devices(self, user_id=''):
|
||||
monitor_db = database.MonitorDatabase()
|
||||
|
||||
|
|
|
@ -2394,8 +2394,8 @@ class WebInterface(object):
|
|||
None
|
||||
|
||||
Optional parameters:
|
||||
order_column (str): "timestamp", "agent_name", "notify_action",
|
||||
"subject_text", "body_text", "script_args"
|
||||
order_column (str): "timestamp", "notifier_id", "agent_name", "notify_action",
|
||||
"subject_text", "body_text",
|
||||
order_dir (str): "desc" or "asc"
|
||||
start (int): Row to start from, 0
|
||||
length (int): Number of items to return, 25
|
||||
|
@ -2408,15 +2408,14 @@ class WebInterface(object):
|
|||
"recordsFiltered": 163,
|
||||
"data":
|
||||
[{"agent_id": 13,
|
||||
"agent_name": "Telegram",
|
||||
"body_text": "Game of Thrones - S06E01 - The Red Woman [Transcode].",
|
||||
"agent_name": "telegram",
|
||||
"body_text": "DanyKhaleesi69 started playing The Red Woman.",
|
||||
"id": 1000,
|
||||
"notify_action": "play",
|
||||
"poster_url": "http://i.imgur.com/ZSqS8Ri.jpg",
|
||||
"notify_action": "on_play",
|
||||
"rating_key": 153037,
|
||||
"script_args": "[]",
|
||||
"session_key": 147,
|
||||
"subject_text": "Tautulli (Winterfell-Server)",
|
||||
"success": 1,
|
||||
"timestamp": 1462253821,
|
||||
"user": "DanyKhaleesi69",
|
||||
"user_id": 8008135
|
||||
|
@ -2432,17 +2431,79 @@ class WebInterface(object):
|
|||
if not kwargs.get('json_data'):
|
||||
# TODO: Find some one way to automatically get the columns
|
||||
dt_columns = [("timestamp", True, True),
|
||||
("notifier_id", True, True),
|
||||
("agent_name", True, True),
|
||||
("notify_action", True, True),
|
||||
("subject_text", True, True),
|
||||
("body_text", True, True),
|
||||
("script_args", True, True)]
|
||||
("body_text", True, True)]
|
||||
kwargs['json_data'] = build_datatables_json(kwargs, dt_columns, "timestamp")
|
||||
|
||||
data_factory = datafactory.DataFactory()
|
||||
notifications = data_factory.get_notification_log(kwargs=kwargs)
|
||||
notification_logs = data_factory.get_notification_log(kwargs=kwargs)
|
||||
|
||||
return notifications
|
||||
return notification_logs
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
@requireAuth(member_of("admin"))
|
||||
@addtoapi()
|
||||
def get_newsletter_log(self, **kwargs):
|
||||
""" Get the data on the Tautulli newsletter logs table.
|
||||
|
||||
```
|
||||
Required parameters:
|
||||
None
|
||||
|
||||
Optional parameters:
|
||||
order_column (str): "timestamp", "newsletter_id", "agent_name", "notify_action",
|
||||
"subject_text", "start_date", "end_date", "uuid"
|
||||
order_dir (str): "desc" or "asc"
|
||||
start (int): Row to start from, 0
|
||||
length (int): Number of items to return, 25
|
||||
search (str): A string to search for, "Telegram"
|
||||
|
||||
Returns:
|
||||
json:
|
||||
{"draw": 1,
|
||||
"recordsTotal": 1039,
|
||||
"recordsFiltered": 163,
|
||||
"data":
|
||||
[{"agent_id": 0,
|
||||
"agent_name": "recently_added",
|
||||
"end_date": "2018-03-18",
|
||||
"id": 7,
|
||||
"newsletter_id": 1,
|
||||
"notify_action": "on_cron",
|
||||
"start_date": "2018-03-05",
|
||||
"subject_text": "Recently Added to Plex (Winterfell-Server)! (2018-03-18)",
|
||||
"success": 1,
|
||||
"timestamp": 1462253821,
|
||||
"uuid": "7fe4g65i"
|
||||
},
|
||||
{...},
|
||||
{...}
|
||||
]
|
||||
}
|
||||
```
|
||||
"""
|
||||
# Check if datatables json_data was received.
|
||||
# If not, then build the minimal amount of json data for a query
|
||||
if not kwargs.get('json_data'):
|
||||
# TODO: Find some one way to automatically get the columns
|
||||
dt_columns = [("timestamp", True, True),
|
||||
("newsletter_id", True, True),
|
||||
("agent_name", True, True),
|
||||
("notify_action", True, True),
|
||||
("subject_text", True, True),
|
||||
("start_date", True, True),
|
||||
("end_date", True, True),
|
||||
("uuid", True, True)]
|
||||
kwargs['json_data'] = build_datatables_json(kwargs, dt_columns, "timestamp")
|
||||
|
||||
data_factory = datafactory.DataFactory()
|
||||
newsletter_logs = data_factory.get_newsletter_log(kwargs=kwargs)
|
||||
|
||||
return newsletter_logs
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
|
@ -2469,6 +2530,31 @@ class WebInterface(object):
|
|||
|
||||
return {'result': res, 'message': msg}
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
@requireAuth(member_of("admin"))
|
||||
@addtoapi()
|
||||
def delete_newsletter_log(self, **kwargs):
|
||||
""" Delete the Tautulli newsletter logs.
|
||||
|
||||
```
|
||||
Required paramters:
|
||||
None
|
||||
|
||||
Optional parameters:
|
||||
None
|
||||
|
||||
Returns:
|
||||
None
|
||||
```
|
||||
"""
|
||||
data_factory = datafactory.DataFactory()
|
||||
result = data_factory.delete_newsletter_log()
|
||||
res = 'success' if result else 'error'
|
||||
msg = 'Cleared newsletter logs.' if result else 'Failed to clear newsletter logs.'
|
||||
|
||||
return {'result': res, 'message': msg}
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
@requireAuth(member_of("admin"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue