Add spinner to indicate that Wikidata preview is in progress

This commit is contained in:
Antonin Delpeuch 2018-04-20 23:11:38 +02:00
parent 5fda43a5c7
commit 60db2828a8

View File

@ -73,12 +73,23 @@ SchemaAlignmentDialog.setUpTabs = function() {
.attr('href', '#wikidata-issues-panel')
.text($.i18n._('wikidata-schema')["warnings-tab-header"]+' ')
.appendTo(this._toolPanel);
this.issuesTabCount = $('<span></span>').addClass('schema-alignment-total-warning-count').appendTo(issuesButton);
this.issuesTabCount = $('<span></span>')
.addClass('schema-alignment-total-warning-count')
.appendTo(issuesButton)
.hide();
this.issueSpinner = $('<img />')
.attr('src', 'images/large-spinner.gif')
.attr('width', '16px')
.appendTo(issuesButton);
var previewButton = $('<div></div>')
.addClass('main-view-panel-tab-header')
.attr('href', '#wikidata-preview-panel')
.text($.i18n._('wikidata-schema')["edits-preview-tab-header"])
.appendTo(this._toolPanel);
this.previewSpinner = $('<img />')
.attr('src', 'images/large-spinner.gif')
.attr('width', '16px')
.appendTo(previewButton);
this._unsavedIndicator = $('<span></span>')
.html('&nbsp;*')
@ -1101,11 +1112,15 @@ SchemaAlignmentDialog.preview = function() {
$('.invalid-schema-warning').hide();
this._previewPanes.empty();
this.issueSpinner.show();
this.previewSpinner.show();
var schema = this.getJSON();
$.post(
"command/wikidata/preview-wikibase-schema?" + $.param({ project: theProject.id }),
{ schema: JSON.stringify(schema), engine: JSON.stringify(ui.browsingEngine.getJSON()) },
function(data) {
self.issueSpinner.hide();
self.previewSpinner.hide();
if ("edits_preview" in data) {
var previewContainer = self._previewPanes[0];
EditRenderer.renderEdits(data.edits_preview, previewContainer);