fix #1218 (error log dialog lacks reload button)

This commit is contained in:
rolux 2013-07-19 07:38:21 +00:00
parent 860ffd49d7
commit fa6b65e235

View file

@ -3,9 +3,24 @@
'use strict'; 'use strict';
pandora.ui.logsDialog = function() { pandora.ui.logsDialog = function() {
var height = Math.round((window.innerHeight - 48) * 0.9), var height = Math.round((window.innerHeight - 48) * 0.9),
width = Math.round(window.innerWidth * 0.9), width = Math.round(window.innerWidth * 0.9),
numberOfLogs = 0,
$reloadButton = Ox.Button({
disabled: true,
title: 'redo',
tooltip: Ox._('Reload'),
type: 'image'
})
.css({float: 'left', margin: '4px'})
.bindEvent({
click: function() {
$reloadButton.options({disabled: true});
Ox.Request.clearCache('findLogs');
$list.reloadList(true);
}
}),
$findSelect = Ox.Select({ $findSelect = Ox.Select({
items: [ items: [
@ -111,11 +126,9 @@ pandora.ui.logsDialog = function() {
}) })
.bindEvent({ .bindEvent({
init: function(data) { init: function(data) {
numberOfLogs = data.items; $status.html(Ox.toTitleCase(
$status.html( Ox.formatCount(data.items, 'entry', 'entries')
Ox.formatNumber(numberOfLogs) + ' ' ));
+ (numberOfLogs == 1 ? 'entry' : 'entries')
);
}, },
'delete': function(data) { 'delete': function(data) {
pandora.api.removeLogs({ids: data.ids}, function(result) { pandora.api.removeLogs({ids: data.ids}, function(result) {
@ -123,6 +136,9 @@ pandora.ui.logsDialog = function() {
$list.reloadList(); $list.reloadList();
}); });
}, },
load: function() {
$reloadButton.options({disabled: false});
},
open: function(data) { open: function(data) {
var value = $list.value(Ox.last(data.ids)), var value = $list.value(Ox.last(data.ids)),
$dialog; $dialog;
@ -174,10 +190,8 @@ pandora.ui.logsDialog = function() {
elements: [ elements: [
{ {
element: Ox.Bar({size: 24}) element: Ox.Bar({size: 24})
.append($status) .append($reloadButton)
.append( .append($findElement),
$findElement
),
size: 24 size: 24
}, },
{ {