Display the number of issues in the tab header
This commit is contained in:
parent
1cf9378523
commit
7518d194f0
@ -5,7 +5,7 @@
|
||||
<div id="schema-alignment-tabs" class="refine-tabs">
|
||||
<ul>
|
||||
<li><a href="#schema-alignment-tabs-schema" bind="schemaTabHeader"></a></li>
|
||||
<li><a href="#schema-alignment-tabs-warnings" bind="warningsTabHeader"></a></li>
|
||||
<li><a href="#schema-alignment-tabs-warnings"><span bind="warningsTabHeader"></span> <span class="schema-alignment-total-warning-count" bind="warningsTabCount"></span></a></li>
|
||||
<li><a href="#schema-alignment-tabs-preview-qs" bind="qsPreviewTabHeader"></a></li>
|
||||
</ul>
|
||||
<div id="schema-alignment-tabs-schema">
|
||||
|
@ -848,9 +848,9 @@ SchemaAlignmentDialog.preview = function(initial) {
|
||||
}
|
||||
|
||||
if (data.warnings) {
|
||||
self._updateWarnings(data.warnings);
|
||||
self._updateWarnings(data.warnings, data.nb_warnings);
|
||||
} else {
|
||||
self._updateWarnings([]);
|
||||
self._updateWarnings([], 0);
|
||||
}
|
||||
|
||||
if ("code" in data && data.code === "error") {
|
||||
@ -936,14 +936,25 @@ SchemaAlignmentDialog._renderWarning = function(warning) {
|
||||
return tr;
|
||||
}
|
||||
|
||||
SchemaAlignmentDialog._updateWarnings = function(warnings) {
|
||||
SchemaAlignmentDialog._updateWarnings = function(warnings, totalCount) {
|
||||
var mainDiv = this._elmts.warningsArea;
|
||||
var countsElem = this._elmts.warningsTabCount;
|
||||
|
||||
// clear everything
|
||||
mainDiv.empty();
|
||||
countsElem.hide();
|
||||
|
||||
var table = $('<table></table>').appendTo(mainDiv);
|
||||
for (var i = 0; i != warnings.length; i++) {
|
||||
var rendered = SchemaAlignmentDialog._renderWarning(warnings[i]);
|
||||
rendered.appendTo(table);
|
||||
}
|
||||
|
||||
// update the counts
|
||||
if (totalCount) {
|
||||
countsElem.text(totalCount);
|
||||
countsElem.show();
|
||||
}
|
||||
}
|
||||
|
||||
/********************
|
||||
|
@ -230,7 +230,8 @@ tr.wb-warning:nth-of-type(odd) {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
.wb-warning-count span {
|
||||
.wb-warning-count span,
|
||||
.schema-alignment-total-warning-count {
|
||||
color: white;
|
||||
background-color: #777;
|
||||
padding: 0px 5px;
|
||||
|
@ -94,6 +94,11 @@ public class PreviewWikibaseSchemaCommand extends Command {
|
||||
}
|
||||
writer.endArray();
|
||||
|
||||
// this is not the length of the warnings array written before,
|
||||
// but the total number of issues raised (before deduplication)
|
||||
writer.key("nb_warnings");
|
||||
writer.value(inspector.getTotalNumberOfWarnings());
|
||||
|
||||
// Export to QuickStatements
|
||||
QuickStatementsExporter exporter = new QuickStatementsExporter();
|
||||
exporter.translateItemList(editBatch, stringWriter);
|
||||
|
@ -79,4 +79,10 @@ public class EditInspector {
|
||||
return warningStore.getWarnings();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the number of warnings before deduplication
|
||||
*/
|
||||
public int getTotalNumberOfWarnings() {
|
||||
return warningStore.getNbWarnings();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user