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