Restore preview tab

This commit is contained in:
Antonin Delpeuch 2018-03-30 17:26:24 +01:00
parent 41eb14f3c0
commit d8d7e82be1
7 changed files with 59 additions and 23 deletions

View File

@ -72,6 +72,10 @@ PerformEditsDialog.checkAndLaunch = function () {
this._elmts = DOM.bind(this.frame); this._elmts = DOM.bind(this.frame);
this.missingSchema = false; this.missingSchema = false;
if (SchemaAlignmentDialog.isSetUp() && SchemaAlignmentDialog._hasUnsavedChanges) {
SchemaAlignmentDialog._save();
}
ManageAccountDialog.ensureLoggedIn(function(logged_in_username) { ManageAccountDialog.ensureLoggedIn(function(logged_in_username) {
if (logged_in_username) { if (logged_in_username) {
var discardWaiter = DialogSystem.showBusy($.i18n._('perform-wikidata-edits')["analyzing-edits"]); var discardWaiter = DialogSystem.showBusy($.i18n._('perform-wikidata-edits')["analyzing-edits"]);
@ -80,7 +84,7 @@ PerformEditsDialog.checkAndLaunch = function () {
{ engine: JSON.stringify(ui.browsingEngine.getJSON()) }, { engine: JSON.stringify(ui.browsingEngine.getJSON()) },
function(data) { function(data) {
discardWaiter(); discardWaiter();
if(data['status'] != 'error') { if(data['code'] != 'error') {
PerformEditsDialog._updateWarnings(data); PerformEditsDialog._updateWarnings(data);
PerformEditsDialog.launch(logged_in_username, data['max_severity']); PerformEditsDialog.launch(logged_in_username, data['max_severity']);
} else { } else {

View File

@ -59,10 +59,14 @@ SchemaAlignmentDialog.setUpTabs = function() {
this._issuesPanel = $('<div id="wikidata-issues-panel"></div>') this._issuesPanel = $('<div id="wikidata-issues-panel"></div>')
.addClass('main-view-panel-tab') .addClass('main-view-panel-tab')
.appendTo(this._rightPanel); .appendTo(this._rightPanel);
this._previewPanel = $('<div id="wikidata-preview-panel"></div>')
.addClass('main-view-panel-tab')
.appendTo(this._rightPanel);
var schemaButton = $('<div></div>') var schemaButton = $('<div></div>')
.addClass('main-view-panel-tab-header') .addClass('main-view-panel-tab-header')
.attr('href', '#wikidata-schema-panel') .attr('href', '#wikidata-schema-panel')
.text($.i18n._('wikidata-schema')["schema-tab-header"])
.appendTo(this._toolPanel); .appendTo(this._toolPanel);
var issuesButton = $('<div></div>') var issuesButton = $('<div></div>')
.addClass('main-view-panel-tab-header') .addClass('main-view-panel-tab-header')
@ -70,15 +74,21 @@ SchemaAlignmentDialog.setUpTabs = function() {
.text($.i18n._('wikidata-schema')["warnings-tab-header"]+' ') .text($.i18n._('wikidata-schema')["warnings-tab-header"]+' ')
.appendTo(this._toolPanel); .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);
var previewButton = $('<div></div>')
schemaButton.text($.i18n._('wikidata-schema')["schema-tab-header"]); .addClass('main-view-panel-tab-header')
// this._elmts.editsPreviewTabHeader.text($.i18n._('wikidata-schema')["edits-preview-tab-header"]); .attr('href', '#wikidata-preview-panel')
.text($.i18n._('wikidata-schema')["edits-preview-tab-header"])
.appendTo(this._toolPanel);
$('.main-view-panel-tab-header').click(function() { $('.main-view-panel-tab-header').click(function() {
var targetTab = $(this).attr('href'); var targetTab = $(this).attr('href');
SchemaAlignmentDialog.switchTab(targetTab); SchemaAlignmentDialog.switchTab(targetTab);
}); });
/**
* Init the schema tab
*/
var schemaTab = $(DOM.loadHTML("wikidata", "scripts/schema-alignment-tab.html")).appendTo(this._schemaPanel); var schemaTab = $(DOM.loadHTML("wikidata", "scripts/schema-alignment-tab.html")).appendTo(this._schemaPanel);
var schemaElmts = this._schemaElmts = DOM.bind(schemaTab); var schemaElmts = this._schemaElmts = DOM.bind(schemaTab);
schemaElmts.dialogExplanation.text($.i18n._('wikidata-schema')["dialog-explanation"]); schemaElmts.dialogExplanation.text($.i18n._('wikidata-schema')["dialog-explanation"]);
@ -117,6 +127,22 @@ SchemaAlignmentDialog.setUpTabs = function() {
var url = ReconciliationManager.ensureDefaultServicePresent(); var url = ReconciliationManager.ensureDefaultServicePresent();
SchemaAlignmentDialog._reconService = ReconciliationManager.getServiceFromUrl(url); SchemaAlignmentDialog._reconService = ReconciliationManager.getServiceFromUrl(url);
/**
* Init the issues tab
*/
var issuesTab = $(DOM.loadHTML("wikidata", "scripts/issues-tab.html")).appendTo(this._issuesPanel);
var issuesElmts = this._schemaElmts = DOM.bind(issuesTab);
issuesElmts.invalidSchemaWarningIssues.text($.i18n._('wikidata-schema')["invalid-schema-warning-issues"]);
/**
* Init the preview tab
*/
var previewTab = $(DOM.loadHTML("wikidata", "scripts/preview-tab.html")).appendTo(this._previewPanel);
var previewElmts = this._schemaElmts = DOM.bind(previewTab);
previewElmts.previewExplanation.text($.i18n._('wikidata-schema')["preview-explanation"]);
previewElmts.invalidSchemaWarningPreview.text($.i18n._('wikidata-schema')["invalid-schema-warning-preview"]);
this._previewPanes = $(".schema-alignment-dialog-preview"); this._previewPanes = $(".schema-alignment-dialog-preview");
this.preview(); this.preview();
} }
@ -127,6 +153,10 @@ SchemaAlignmentDialog.switchTab = function(targetTab) {
$('.main-view-panel-tab-header[href="'+targetTab+'"]').addClass('active'); $('.main-view-panel-tab-header[href="'+targetTab+'"]').addClass('active');
$(targetTab).show(); $(targetTab).show();
resizeAll(); resizeAll();
var panelHeight = this._viewPanel.height();
this._schemaPanel.height(panelHeight);
this._issuesPanel.height(panelHeight);
this._previewPanel.height(panelHeight);
} }
SchemaAlignmentDialog.isSetUp = function() { SchemaAlignmentDialog.isSetUp = function() {
@ -216,10 +246,7 @@ SchemaAlignmentDialog._createDialog = function() {
// //
this._elmts.previewExplanation.text($.i18n._('wikidata-schema')["preview-explanation"]);
this._elmts.invalidSchemaWarningIssues.text($.i18n._('wikidata-schema')["invalid-schema-warning-issues"]);
this._elmts.invalidSchemaWarningPreview.text($.i18n._('wikidata-schema')["invalid-schema-warning-preview"]);
this._elmts.resetButton.text($.i18n._('wikidata-schema')["reset-button"]); this._elmts.resetButton.text($.i18n._('wikidata-schema')["reset-button"]);
this._elmts.saveButton.text($.i18n._('wikidata-schema')["save-button"]); this._elmts.saveButton.text($.i18n._('wikidata-schema')["save-button"]);
this._elmts.closeButton.text($.i18n._('wikidata-schema')["close-button"]); this._elmts.closeButton.text($.i18n._('wikidata-schema')["close-button"]);

View File

@ -0,0 +1,5 @@
<div id="schema-issues-tab">
<div class="invalid-schema-warning" bind="invalidSchemaWarningIssues"></div>
<div class="schema-issues-area" bind="warningsArea"></div>
</div>

View File

@ -1,5 +1,5 @@
<div id="schema-preview-tab"> <div id="schema-preview-tab">
<p class="body-text" bind="previewExplanation"></p> <p class="panel-explanation" bind="previewExplanation"></p>
<div class="invalid-schema-warning" bind="invalidSchemaWarningPreview"></div> <div class="invalid-schema-warning" bind="invalidSchemaWarningPreview"></div>
<div class="schema-alignment-dialog-preview"></div> <div class="schema-alignment-dialog-preview"></div>
</div> </div>

View File

@ -1,5 +1,5 @@
<div id="schema-alignment-tab"> <div id="schema-alignment-tab">
<p class="schema-alignment-explanation" bind="dialogExplanation"></p> <p class="panel-explanation" bind="dialogExplanation"></p>
<div class="schema-alignment-dialog-canvas"> <div class="schema-alignment-dialog-canvas">
<div class="schema-alignment-dialog-columns-area"> <div class="schema-alignment-dialog-columns-area">
</div> </div>

View File

@ -1,5 +0,0 @@
<div id="schema-warnings-tab">
<div class="invalid-schema-warning" bind="invalidSchemaWarningIssues"></div>
<div class="schema-alignment-dialog-warnings" bind="warningsArea"></div>
</div>

View File

@ -39,7 +39,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
position: initial; position: initial;
} }
#wikidata-schema-panel, #wikidata-issues-panel { #wikidata-schema-panel, #wikidata-issues-panel, #wikidata-preview-panel {
display: block; display: block;
overflow: hidden; overflow: hidden;
height: 100%; height: 100%;
@ -47,6 +47,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
font-size: 1.2em; font-size: 1.2em;
} }
#schema-preview-tab, #schema-issues-tab, #schema-alignment-tab {
overflow: auto;
height: 100%;
}
.main-view-panel-tab-header { .main-view-panel-tab-header {
margin-top: 9px; margin-top: 9px;
margin-left: 7px; margin-left: 7px;
@ -58,13 +63,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
} }
.main-view-panel-tab-header.active { .main-view-panel-tab-header.active {
background-color: #f2f2f2; background-color: white;
color: black; color: black;
border: 1px solid #818fb7; border: 1px solid #818fb7;
border-bottom: none; border-bottom: none;
} }
.main-view-panel-tab-header.active:first-child {
background-color: #f2f2f2;
}
.schema-alignment-dialog-canvas { .schema-alignment-dialog-canvas {
padding: 0px padding: 0px
@ -74,12 +81,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.schema-alignment-dialog-statements-area { .schema-alignment-dialog-statements-area {
padding: 10px; padding: 10px;
max-height: 350px; max-width: 900px;
min-height: 250px;
overflow-y: auto; overflow-y: auto;
} }
.schema-alignment-explanation { .panel-explanation {
margin: 1em; margin: 1em;
} }
@ -420,7 +426,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
font-size: 1.2em; font-size: 1.2em;
} }
.schema-alignment-dialog-warnings table, .schema-issues-area table,
.perform-edits-warnings-area table { .perform-edits-warnings-area table {
width: 100%; width: 100%;
} }
@ -475,7 +481,6 @@ tr.wb-warning:nth-of-type(odd) {
float: clear; float: clear;
} }
div.schema-alignment-dialog-warnings,
div.perform-edits-warnings-area { div.perform-edits-warnings-area {
min-height: 340px; min-height: 340px;
max-height: 400px; max-height: 400px;
@ -499,7 +504,7 @@ div.perform-edits-warnings-area {
div.schema-alignment-dialog-preview { div.schema-alignment-dialog-preview {
min-height: 340px; min-height: 340px;
max-height: 400px; max-width: 900px;
overflow: auto; overflow: auto;
background: white; background: white;
padding: 10px; padding: 10px;