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); } if (bytes === 0) { return void cb(void 0, $d); }
var formatted = UIElements.prettySize(bytes); 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)])); $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); return void cb(void 0, $d);
} }
@ -801,7 +801,9 @@ define([
var $button = $(button); var $button = $(button);
$button.click(function () { $button.click(function () {
UI.confirm(Messages.trimHistory_confirm, function (yes) { UI.confirmButton(button, {
classes: 'btn-danger'
}, function (yes) {
if (!yes) { return; } if (!yes) { return; }
$button.remove(); $button.remove();

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

Loading…
Cancel
Save