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

View File

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

View File

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