Remove per-library sync error indicators, at least for now

The hidden column caused collection names to be cut off unnecessarily,
and the extra icons were overly distracting. For now, just show the
first error that comes in in the main sync error panel, along with the
library name.
This commit is contained in:
Dan Stillman 2013-03-20 22:35:44 -04:00
parent 0782344c41
commit e85790541b
5 changed files with 76 additions and 81 deletions

View file

@ -403,9 +403,6 @@ Zotero.CollectionTreeView.prototype.getCellText = function(row, column)
if (column.id == 'zotero-collections-name-column') {
return obj.getName();
}
else if (column.id == 'zotero-collections-sync-status-column') {
return "";
}
else
return "";
}
@ -426,27 +423,6 @@ Zotero.CollectionTreeView.prototype.getImageSrc = function(row, col)
switch (collectionType) {
case 'library':
if (col.id == 'zotero-collections-sync-status-column') {
if (itemGroup.isLibrary(true)) {
var libraryID = itemGroup.isLibrary() ? 0 : itemGroup.ref.libraryID;
var errors = Zotero.Sync.Runner.getErrors(libraryID);
if (errors) {
var e = Zotero.Sync.Runner.getPrimaryError(errors);
switch (e.errorMode) {
case 'warning':
var image = 'error';
break;
default:
var image = 'exclamation';
break;
}
return 'chrome://zotero/skin/' + image + '.png';
}
}
return '';
}
break;
case 'trash':

View file

@ -947,28 +947,44 @@ Zotero.Sync.Runner = new function () {
this.updateErrorPanel = function (doc, errors) {
var panel = doc.getElementById('zotero-sync-error-panel');
var panelContent = doc.getElementById('zotero-sync-error-panel-content');
var panelButtons = doc.getElementById('zotero-sync-error-panel-buttons');
// Clear existing panel content
while (panelContent.hasChildNodes()) {
panelContent.removeChild(panelContent.firstChild);
}
while (panelButtons.hasChildNodes()) {
panelButtons.removeChild(panelButtons.firstChild);
while (panel.hasChildNodes()) {
panel.removeChild(panel.firstChild);
}
// TEMP: for now, we only show one error
var e = errors.concat().shift();
var e = this
for each(var e in errors.concat()) {
e = this.parseSyncError(e);
var box = doc.createElement('vbox');
var label = doc.createElement('label');
if (typeof e.libraryID != 'undefined') {
label.className = "zotero-sync-error-panel-library-name";
if (e.libraryID == 0) {
var libraryName = Zotero.getString('pane.collections.library');
}
else {
let group = Zotero.Groups.getByLibraryID(e.libraryID);
var libraryName = group.name;
}
label.setAttribute('value', libraryName);
}
var content = doc.createElement('hbox');
var buttons = doc.createElement('hbox');
buttons.pack = 'end';
box.appendChild(label);
box.appendChild(content);
box.appendChild(buttons);
var desc = doc.createElement('description');
var msg = e.message;
/*if (e.fileName) {
msg += '\n\nFile: ' + e.fileName + '\nLine: ' + e.lineNumber;
}*/
desc.textContent = msg;
panelContent.appendChild(desc);
content.appendChild(desc);
// If not an error and there's no explicit button text, don't show
// button to report errors
@ -991,7 +1007,13 @@ Zotero.Sync.Runner = new function () {
var button = doc.createElement('button');
button.setAttribute('label', buttonText);
button.onclick = buttonCallback;
panelButtons.appendChild(button);
buttons.appendChild(button);
}
panel.appendChild(box)
// TEMP: Only show one error for now
break;
}
return panel;

View file

@ -1093,10 +1093,11 @@ var ZoteroPane = new function()
var itemgroup = this.collectionsView._getItemAtRow(this.collectionsView.selection.currentIndex);
if (itemgroup.isSeparator()) {
// Not necessary with seltype="cell", which calls nsITreeView::isSelectable()
/*if (itemgroup.isSeparator()) {
document.getElementById('zotero-items-tree').view = this.itemsView = null;
return;
}
}*/
itemgroup.setSearch('');
itemgroup.setTags(getTagSelection());

View file

@ -209,13 +209,13 @@
</hbox>
</hbox>
<toolbarbutton id="zotero-tb-sync-error" hidden="true"/>
<!-- We put this here, but it's used for all sync errors -->
<panel id="zotero-sync-error-panel" type="arrow">
<vbox>
<hbox id="zotero-sync-error-panel-content"/>
<hbox id="zotero-sync-error-panel-buttons"/>
</vbox>
</panel>
<!--
We put this here, but it can be used wherever
Zotero.Sync.Runner.updateErrorPanel() puts it
-->
<panel id="zotero-sync-error-panel" type="arrow"/>
<toolbarbutton id="zotero-tb-sync" class="zotero-tb-button" tooltip="_child"
oncommand="Zotero.Sync.Server.canAutoResetClient = true; Zotero.Sync.Server.manualSyncRequired = false; Zotero.Sync.Runner.sync()">
<tooltip
@ -305,16 +305,13 @@
ondragenter="return ZoteroPane_Local.collectionsView.onDragEnter(event)"
ondragover="return ZoteroPane_Local.collectionsView.onDragOver(event)"
ondrop="return ZoteroPane_Local.collectionsView.onDrop(event)"
seltype="single" flex="1">
seltype="cell" flex="1">
<treecols>
<treecol
id="zotero-collections-name-column"
flex="1"
primary="true"
hideheader="true"/>
<treecol
id="zotero-collections-sync-status-column"
hideheader="true"/>
</treecols>
<treechildren/>
</tree>

View file

@ -430,17 +430,16 @@
list-style-image: url(chrome://zotero/skin/bell_error.png);
}
#zotero-tb-sync-error {
/*border: 1px orange dashed;*/
}
/* Sync error panel */
#zotero-sync-error-panel {
margin-right: 0px;
.zotero-sync-error-panel-library-name {
font-size: 12px;
font-weight: bold;
margin-left: 0;
margin-bottom: 1.1em;
}
#zotero-sync-error-panel description {
width: 350px;
width: 370px;
white-space: pre-wrap;
}