forked from 0x2620/pandora
rename error log api, fixes #2591
This commit is contained in:
parent
2f154aa610
commit
44ae4db25a
5 changed files with 18 additions and 18 deletions
|
@ -15,7 +15,7 @@ from item import utils
|
|||
import models
|
||||
|
||||
|
||||
def log(request, data):
|
||||
def logError(request, data):
|
||||
'''
|
||||
takes {
|
||||
url: string,
|
||||
|
@ -43,11 +43,11 @@ def log(request, data):
|
|||
l.save()
|
||||
response = json_response()
|
||||
return render_to_json_response(response)
|
||||
actions.register(log, cache=False)
|
||||
actions.register(logError, cache=False)
|
||||
|
||||
|
||||
@admin_required_json
|
||||
def removeLogs(request, data):
|
||||
def removeErrorLogs(request, data):
|
||||
'''
|
||||
takes {
|
||||
ids: [string]
|
||||
|
@ -57,7 +57,7 @@ def removeLogs(request, data):
|
|||
models.Log.objects.filter(id__in=[ox.fromAZ(i) for i in data['ids']]).delete()
|
||||
response = json_response()
|
||||
return render_to_json_response(response)
|
||||
actions.register(removeLogs, cache=False)
|
||||
actions.register(removeErrorLogs, cache=False)
|
||||
|
||||
def parse_query(data, user):
|
||||
query = {}
|
||||
|
@ -84,7 +84,7 @@ def order_query(qs, sort):
|
|||
return qs
|
||||
|
||||
@admin_required_json
|
||||
def findLogs(request, data):
|
||||
def findErrorLogs(request, data):
|
||||
'''
|
||||
takes {
|
||||
query: {
|
||||
|
@ -132,4 +132,4 @@ def findLogs(request, data):
|
|||
else:
|
||||
response['data']['items'] = qs.count()
|
||||
return render_to_json_response(response)
|
||||
actions.register(findLogs)
|
||||
actions.register(findErrorLogs)
|
||||
|
|
|
@ -117,7 +117,7 @@ pandora.ui.changelogDialog = function() {
|
|||
columnsMovable: true,
|
||||
columnsResizable: true,
|
||||
columnsVisible: true,
|
||||
items: pandora.api.findLogs,
|
||||
items: pandora.api.findErrorLogs,
|
||||
keys: ['line'],
|
||||
scrollbarVisible: true,
|
||||
sort: [{key: 'created', operator: '-'}],
|
||||
|
@ -130,8 +130,8 @@ pandora.ui.changelogDialog = function() {
|
|||
));
|
||||
},
|
||||
'delete': function(data) {
|
||||
pandora.api.removeLogs({ids: data.ids}, function(result) {
|
||||
Ox.Request.clearCache('findLogs');
|
||||
pandora.api.removeErrorLogs({ids: data.ids}, function(result) {
|
||||
Ox.Request.clearCache('findErrorLogs');
|
||||
$list.reloadList();
|
||||
});
|
||||
},
|
||||
|
|
|
@ -17,7 +17,7 @@ pandora.ui.errorlogsDialog = function() {
|
|||
.bindEvent({
|
||||
click: function() {
|
||||
$reloadButton.options({disabled: true});
|
||||
Ox.Request.clearCache('findLogs');
|
||||
Ox.Request.clearCache('findErrorLogs');
|
||||
$list.reloadList(true);
|
||||
}
|
||||
}),
|
||||
|
@ -118,7 +118,7 @@ pandora.ui.errorlogsDialog = function() {
|
|||
columnsMovable: true,
|
||||
columnsResizable: true,
|
||||
columnsVisible: true,
|
||||
items: pandora.api.findLogs,
|
||||
items: pandora.api.findErrorLogs,
|
||||
keys: ['line'],
|
||||
scrollbarVisible: true,
|
||||
sort: [{key: 'created', operator: '-'}],
|
||||
|
@ -131,8 +131,8 @@ pandora.ui.errorlogsDialog = function() {
|
|||
));
|
||||
},
|
||||
'delete': function(data) {
|
||||
pandora.api.removeLogs({ids: data.ids}, function(result) {
|
||||
Ox.Request.clearCache('findLogs');
|
||||
pandora.api.removeErrorLogs({ids: data.ids}, function(result) {
|
||||
Ox.Request.clearCache('findErrorLogs');
|
||||
$list.reloadList();
|
||||
});
|
||||
},
|
||||
|
@ -226,7 +226,7 @@ pandora.ui.errorlogsDialog = function() {
|
|||
|
||||
that.superClose = that.close;
|
||||
that.close = function() {
|
||||
Ox.Request.clearCache('findLogs');
|
||||
Ox.Request.clearCache('findErrorLogs');
|
||||
that.superClose();
|
||||
};
|
||||
|
||||
|
@ -253,7 +253,7 @@ pandora.ui.errorlogsDialog = function() {
|
|||
};
|
||||
$list.options({
|
||||
items: function(data, callback) {
|
||||
return pandora.api.findLogs(Ox.extend(data, {
|
||||
return pandora.api.findErrorLogs(Ox.extend(data, {
|
||||
query: query
|
||||
}), callback);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ appPanel
|
|||
|
||||
window.onerror = function(error, url, line) {
|
||||
try {
|
||||
!isMSIE && !/^resource:/.test(url) && pandora.api.log({
|
||||
!isMSIE && !/^resource:/.test(url) && pandora.api.logError({
|
||||
text: error,
|
||||
url: document.location.pathname + ' at ' + url,
|
||||
line: line
|
||||
|
|
|
@ -203,7 +203,7 @@ pandora.ui.uploadVideoDialog = function(data) {
|
|||
that.close();
|
||||
} else {
|
||||
$status.html(Ox._('Upload failed.'));
|
||||
pandora.api.log({
|
||||
pandora.api.logError({
|
||||
text: data.responseText,
|
||||
url: '/' + item,
|
||||
line: 1
|
||||
|
@ -257,7 +257,7 @@ pandora.ui.uploadVideoDialog = function(data) {
|
|||
that.close();
|
||||
} else {
|
||||
$status.html(cancelled ? Ox._('Upload cancelled.') : Ox._('Upload failed.'));
|
||||
!cancelled && pandora.api.log({
|
||||
!cancelled && pandora.api.logError({
|
||||
text: data.responseText,
|
||||
url: '/' + item,
|
||||
line: 1
|
||||
|
|
Loading…
Reference in a new issue