зеркало из https://github.com/mozilla/pjs.git
Bug 669913 - Viewing Sync quota blocks the entire Options window. r=rnewman
Part 2: Use Service.getStorageInfo in the Quota dialog UI.
This commit is contained in:
Родитель
1b6dfcd1f8
Коммит
d5b88fb566
|
@ -58,16 +58,21 @@ let gSyncQuota = {
|
||||||
},
|
},
|
||||||
|
|
||||||
loadData: function loadData() {
|
loadData: function loadData() {
|
||||||
window.setTimeout(function() {
|
this._usage_req = Weave.Service.getStorageInfo(Weave.INFO_COLLECTION_USAGE,
|
||||||
let usage = Weave.Service.getCollectionUsage();
|
function (error, usage) {
|
||||||
|
delete gSyncQuota._usage_req;
|
||||||
|
// displayUsageData handles null values, so no need to check 'error'.
|
||||||
gUsageTreeView.displayUsageData(usage);
|
gUsageTreeView.displayUsageData(usage);
|
||||||
}, 0);
|
});
|
||||||
|
|
||||||
let usageLabel = document.getElementById("usageLabel");
|
let usageLabel = document.getElementById("usageLabel");
|
||||||
let bundle = this.bundle;
|
let bundle = this.bundle;
|
||||||
window.setTimeout(function() {
|
|
||||||
let quota = Weave.Service.getQuota();
|
this._quota_req = Weave.Service.getStorageInfo(Weave.INFO_QUOTA,
|
||||||
if (!quota) {
|
function (error, quota) {
|
||||||
|
delete gSyncQuota._quota_req;
|
||||||
|
|
||||||
|
if (error) {
|
||||||
usageLabel.value = bundle.getString("quota.usageError.label");
|
usageLabel.value = bundle.getString("quota.usageError.label");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -82,7 +87,17 @@ let gSyncQuota = {
|
||||||
let total = gSyncQuota.convertKB(quota[1]);
|
let total = gSyncQuota.convertKB(quota[1]);
|
||||||
usageLabel.value = bundle.getFormattedString(
|
usageLabel.value = bundle.getFormattedString(
|
||||||
"quota.usagePercentage.label", [percent].concat(used).concat(total));
|
"quota.usagePercentage.label", [percent].concat(used).concat(total));
|
||||||
}, 0);
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onCancel: function onCancel() {
|
||||||
|
if (this._usage_req) {
|
||||||
|
this._usage_req.abort();
|
||||||
|
}
|
||||||
|
if (this._quota_req) {
|
||||||
|
this._quota_req.abort();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
onAccept: function onAccept() {
|
onAccept: function onAccept() {
|
||||||
|
@ -95,7 +110,7 @@ let gSyncQuota = {
|
||||||
let Service = Weave.Service;
|
let Service = Weave.Service;
|
||||||
Weave.Utils.nextTick(function() { Service.sync(); });
|
Weave.Utils.nextTick(function() { Service.sync(); });
|
||||||
}
|
}
|
||||||
return true;
|
return this.onCancel();
|
||||||
},
|
},
|
||||||
|
|
||||||
convertKB: function convertKB(value) {
|
convertKB: function convertKB(value) {
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
onload="gSyncQuota.init()"
|
onload="gSyncQuota.init()"
|
||||||
buttons="accept,cancel"
|
buttons="accept,cancel"
|
||||||
title=""a.dialogTitle.label;"
|
title=""a.dialogTitle.label;"
|
||||||
ondialogcancel="return true;"
|
ondialogcancel="return gSyncQuota.onCancel();"
|
||||||
ondialogaccept="return gSyncQuota.onAccept();">
|
ondialogaccept="return gSyncQuota.onAccept();">
|
||||||
|
|
||||||
<script type="application/javascript"
|
<script type="application/javascript"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче