From d8199b8274ccdf0eec3ec9e45604e012bb9a9370 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 6 Feb 2020 11:34:52 +0100 Subject: [PATCH] Update UI for trim history --- www/common/common-ui-elements.js | 6 ++++-- www/settings/inner.js | 8 +++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 4520e68fe..c12d23dc9 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -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(); diff --git a/www/settings/inner.js b/www/settings/inner.js index 50a4c0205..e2a7881ef 100644 --- a/www/settings/inner.js +++ b/www/settings/inner.js @@ -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 }); });