Bug 1003860 - Various tweaks to the storage inspector. r=mratcliffe

This commit is contained in:
Alexandre Poirot 2016-01-20 14:09:25 -08:00
Родитель a6f117c118
Коммит 25bba3377c
3 изменённых файлов: 19 добавлений и 4 удалений

Просмотреть файл

@ -57,7 +57,10 @@ StoragePanel.prototype = {
this.emit("ready"); this.emit("ready");
return this; return this;
}).catch(this.destroy); }).catch(e => {
console.log("error while opening storage panel", e);
this.destroy();
});
}, },
/** /**

Просмотреть файл

@ -487,6 +487,7 @@ function* selectTreeItem(ids) {
let selector = "[data-id='" + JSON.stringify(ids) + "'] > .tree-widget-item"; let selector = "[data-id='" + JSON.stringify(ids) + "'] > .tree-widget-item";
let target = gPanelWindow.document.querySelector(selector); let target = gPanelWindow.document.querySelector(selector);
ok(target, "tree item found with ids " + JSON.stringify(ids));
let updated = gUI.once("store-objects-updated"); let updated = gUI.once("store-objects-updated");
@ -503,6 +504,7 @@ function* selectTreeItem(ids) {
function* selectTableItem(id) { function* selectTableItem(id) {
let selector = ".table-widget-cell[data-id='" + id + "']"; let selector = ".table-widget-cell[data-id='" + id + "']";
let target = gPanelWindow.document.querySelector(selector); let target = gPanelWindow.document.querySelector(selector);
ok(target, "table item found with ids " + id);
yield click(target); yield click(target);
yield gUI.once("sidebar-updated"); yield gUI.once("sidebar-updated");

Просмотреть файл

@ -341,11 +341,16 @@ StorageUI.prototype = {
populateStorageTree: function(storageTypes) { populateStorageTree: function(storageTypes) {
this.storageTypes = {}; this.storageTypes = {};
for (let type in storageTypes) { for (let type in storageTypes) {
// Ignore `from` field, which is just a protocol.js implementation artifact
if (type === "from") { if (type === "from") {
continue; continue;
} }
let typeLabel = type;
let typeLabel = L10N.getStr("tree.labels." + type); try {
typeLabel = L10N.getStr("tree.labels." + type);
} catch(e) {
console.error("Unable to localize tree label type:" + type);
}
this.tree.add([{id: type, label: typeLabel, type: "store"}]); this.tree.add([{id: type, label: typeLabel, type: "store"}]);
if (!storageTypes[type].hosts) { if (!storageTypes[type].hosts) {
continue; continue;
@ -568,7 +573,12 @@ StorageUI.prototype = {
if (!uniqueKey) { if (!uniqueKey) {
this.table.uniqueId = uniqueKey = key; this.table.uniqueId = uniqueKey = key;
} }
columns[key] = L10N.getStr("table.headers." + type + "." + key); columns[key] = key;
try {
columns[key] = L10N.getStr("table.headers." + type + "." + key);
} catch(e) {
console.error("Unable to localize table header type:" + type + " key:" + key);
}
} }
this.table.setColumns(columns, null, HIDDEN_COLUMNS); this.table.setColumns(columns, null, HIDDEN_COLUMNS);
this.shouldResetColumns = false; this.shouldResetColumns = false;