Update UI for trim history

pull/1/head
yflory 5 years ago
parent 9a857ea058
commit d8199b8274

@ -765,7 +765,7 @@ define([
if (bytes === 0) { return void cb(void 0, $d); }
var formatted = UIElements.prettySize(bytes);
if (!owned || !historyBytes || historyBytes > bytes) {
if (!owned || !historyBytes || historyBytes > bytes || historyBytes < 0) {
$d.append(h('div.cp-app-prop', [Messages.upload_size, h('br'), h('span.cp-app-prop-content', formatted)]));
return void cb(void 0, $d);
}
@ -801,7 +801,9 @@ define([
var $button = $(button);
$button.click(function () {
UI.confirm(Messages.trimHistory_confirm, function (yes) {
UI.confirmButton(button, {
classes: 'btn-danger'
}, function (yes) {
if (!yes) { return; }
$button.remove();

@ -1201,7 +1201,7 @@ define([
makeBlock('trim-history', function (cb) {
if (!common.isLoggedIn()) { return; }
// XXX settings_trimHistoryTitle, settings_trimHistoryHint, trimHistory_button, trimHistory_error
// XXX trimHistory_success, trimHistory_confirm
// XXX trimHistory_success, trimHistory_confirm, trimHistory_noHistory
//if (!privateData.isDriveOwned) { return; } // XXX
@ -1237,6 +1237,10 @@ define([
size = UIElements.prettySize(Number(obj.size));
}));
}).nThen(function () {
if (!size || size < 1024) {
$(currentSize).html(Messages.trimHistory_noHistory || 'no history...')); // XXX
return;
}
$(currentSize).html(Messages._getKey('trimHistory_currentSize', [size]));
$button.click(function () {
//UI.confirm(Messages.trimHistory_confirm, function (yes) {
@ -1255,6 +1259,8 @@ define([
return;
}
spinner.hide();
// XXX redraw this block instead of displaying a green message?
$(currentSize).remove();
$(content).append(h('div.alert.alert-success', Messages.trimHistory_success || 'ok')); // XXX
});
});

Loading…
Cancel
Save