Add ability to disable the refreshing of import previews (#4309)

* [#4009] Added checkbox to disable automatic preview updates for separator based files

* [#4009] Checkbox now added for most parser types

* [#4009] Google data and database additions for disabling auto preview

* [#4009] Excel and pc axis fixes

* [#4009] Test case addition

* [#4009] Added comments

* [#4009] Review comment fixes
This commit is contained in:
johnvl2 2021-11-26 15:36:21 -05:00 committed by GitHub
parent 5d3013c6d2
commit 047b990145
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 229 additions and 17 deletions

View File

@ -46,7 +46,8 @@
"database-parsing/updating-preview": "Updating preview …",
"database-parsing/worksheet": "Worksheets",
"database-parsing/option": "Options",
"database-parsing/preview-button": "Update Preview",
"database-parsing/preview-button": "Update preview",
"database-parsing/disable-auto-preview": "Disable auto preview",
"database-parsing/ignore-first": "Ignore first",
"database-parsing/ignore": "line(s) at beginning of file",
"database-parsing/parse-next": "Parse next",

View File

@ -13,7 +13,7 @@
"database-parsing/parse-next": "Parse next",
"database-parsing/ignore": "line(s) at beginning of file",
"database-parsing/ignore-first": "Ignore first",
"database-parsing/preview-button": "Update Preview",
"database-parsing/preview-button": "Update preview",
"database-parsing/option": "Options",
"database-parsing/worksheet": "Worksheets",
"database-parsing/updating-preview": "Updating preview …",

View File

@ -131,6 +131,8 @@ Refine.DatabaseImportController.prototype.getOptions = function() {
options.storeBlankRows = this._parsingPanelElmts.storeBlankRowsCheckbox[0].checked;
options.storeBlankCellsAsNulls = this._parsingPanelElmts.storeBlankCellsAsNullsCheckbox[0].checked;
options.disableAutoPreview = this._parsingPanelElmts.disableAutoPreviewCheckbox[0].checked;
return options;
};
@ -155,6 +157,7 @@ Refine.DatabaseImportController.prototype._showParsingPanel = function() {
this._parsingPanelElmts.database_limit.html($.i18n('database-parsing/limit'));
this._parsingPanelElmts.database_store_row.html($.i18n('database-parsing/store-row'));
this._parsingPanelElmts.database_store_cell.html($.i18n('database-parsing/store-cell'));
this._parsingPanelElmts.database_disable_auto_preview.text($.i18n('database-parsing/disable-auto-preview'));
if (this._parsingPanelResizer) {
$(window).unbind('resize', this._parsingPanelResizer);
@ -220,8 +223,16 @@ Refine.DatabaseImportController.prototype._showParsingPanel = function() {
this._parsingPanelElmts.storeBlankCellsAsNullsCheckbox.prop("checked", true);
}
if (this._options.disableAutoPreview) {
this._parsingPanelElmts.disableAutoPreviewCheckbox.prop('checked', true);
}
// If disableAutoPreviewCheckbox is not checked, we will schedule an automatic update
var onChange = function() {
self._scheduleUpdatePreview();
if (!self._parsingPanelElmts.disableAutoPreviewCheckbox[0].checked)
{
self._scheduleUpdatePreview();
}
};
this._parsingPanel.find("input").bind("change", onChange);
this._parsingPanel.find("select").bind("change", onChange);

View File

@ -23,6 +23,11 @@
<td bind="database_options"></td>
<td><button class="button" bind="previewButton"></button></td>
</tr>
<tr>
<td style="text-align: right;">&nbsp;</td>
<td width="1%"><input type="checkbox" bind="disableAutoPreviewCheckbox" id="$disable" />
<label for="$disable" bind="database_disable_auto_preview"></label></td>
</tr>
<tr>
<td>
<div class="grid-layout layout-tightest">

View File

@ -17,7 +17,8 @@
"gdata-parsing/updating-preview": "Updating preview …",
"gdata-parsing/worksheet": "Worksheets",
"gdata-parsing/option": "Options",
"gdata-parsing/preview-button": "Update&nbsp;Preview",
"gdata-parsing/preview-button": "Update&nbsp;preview",
"gdata-parsing/disable-auto-preview": "Disable auto preview",
"gdata-parsing/ignore-first": "Ignore first",
"gdata-parsing/ignore": "line(s) at beginning of file",
"gdata-parsing/parse-next": "Parse next",

View File

@ -18,6 +18,11 @@
<td colspan="2" bind="gdata_options"></td>
<td rowspan="2"><button class="button" bind="previewButton"></button></td>
</tr>
<tr>
<td style="text-align: right;">&nbsp;</td>
<td width="1%"><input type="checkbox" bind="disableAutoPreviewCheckbox" id="$disable" />
<label for="$disable" bind="gdata_disable_auto_preview"></label></td>
</tr>
<tr>
<td rowspan="2" width="40%"><div class="grid-layout layout-tightest"><table bind="sheetRecordContainer"></table></div></td>

View File

@ -157,6 +157,8 @@ Refine.GDataImportingController.prototype.getOptions = function() {
options.storeBlankRows = this._parsingPanelElmts.storeBlankRowsCheckbox[0].checked;
options.storeBlankCellsAsNulls = this._parsingPanelElmts.storeBlankCellsAsNullsCheckbox[0].checked;
options.disableAutoPreview = this._parsingPanelElmts.disableAutoPreviewCheckbox[0].checked;
return options;
};
@ -177,6 +179,7 @@ Refine.GDataImportingController.prototype._showParsingPanel = function() {
this._parsingPanelElmts.gdata_proj_name.html($.i18n('gdata-parsing/proj-name'));
this._parsingPanelElmts.createProjectButton.html($.i18n('gdata-parsing/create-proj'));
this._parsingPanelElmts.gdata_options.html($.i18n('gdata-parsing/option'));
this._parsingPanelElmts.gdata_disable_auto_preview.text($.i18n('gdata-parsing/disable-auto-preview'));
this._parsingPanelElmts.previewButton.html($.i18n('gdata-parsing/preview-button'));
this._parsingPanelElmts.gdata_updating.html($.i18n('gdata-parsing/updating-preview'));
this._parsingPanelElmts.gdata_discard_next.html($.i18n('gdata-parsing/discard-next'));
@ -286,8 +289,16 @@ Refine.GDataImportingController.prototype._showParsingPanel = function() {
this._parsingPanelElmts.storeBlankCellsAsNullsCheckbox.prop("checked", true);
}
if (this._options.disableAutoPreview) {
this._parsingPanelElmts.disableAutoPreviewCheckbox.prop('checked', true);
}
// If disableAutoPreviewCheckbox is not checked, we will schedule an automatic update
var onChange = function() {
self._scheduleUpdatePreview();
if (!self._parsingPanelElmts.disableAutoPreviewCheckbox[0].checked)
{
self._scheduleUpdatePreview();
}
};
this._parsingPanel.find("input").bind("change", onChange);
this._parsingPanel.find("select").bind("change", onChange);

View File

@ -9,7 +9,12 @@
<td colspan="2"><div class="grid-layout layout-tighter layout-full"><table>
<tr>
<td style="text-align: right;">&nbsp;</td>
<td width="1%"><button class="button" bind="previewButton">Update&nbsp;Preview</button></td>
<td width="1%"><button class="button" bind="previewButton">Update&nbsp;preview</button></td>
</tr>
<tr>
<td style="text-align: right;">&nbsp;</td>
<td width="1%"><input type="checkbox" bind="disableAutoPreviewCheckbox" id="$disable" />
<label for="$disable">Disable auto preview</label></td>
</tr>
</table></div></td>
</tr>

View File

@ -109,6 +109,8 @@ Refine.PCAxisParserUI.prototype.getOptions = function() {
options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked;
options.includeArchiveFileName = this._optionContainerElmts.includeArchiveFileCheckbox[0].checked;
options.disableAutoPreview = this._optionContainerElmts.disableAutoPreviewCheckbox[0].checked;
return options;
};
@ -143,8 +145,15 @@ Refine.PCAxisParserUI.prototype._initialize = function() {
this._optionContainerElmts.includeArchiveFileCheckbox.prop("checked", true);
}
if (this._config.disableAutoPreview) {
this._optionContainerElmts.disableAutoPreviewCheckbox.prop('checked', true);
}
var onChange = function() {
self._scheduleUpdatePreview();
if (!self._optionContainerElmts.disableAutoPreviewCheckbox[0].checked)
{
self._scheduleUpdatePreview();
}
};
this._optionContainer.find("input").bind("change", onChange);
this._optionContainer.find("select").bind("change", onChange);

View File

@ -219,4 +219,37 @@ describe(__filename, function () {
cy.get('table.data-table tr').eq(1).should('to.contain', '15.87');
cy.get('table.data-table tr').eq(1).should('to.contain', '717');
});
/*
The test case below uses the ignore feature to test the disable automatic preview update checkbox
We first test with automatic preview updates enabled
Then, we test with automatic preview updates disabled, which requires the update button to change the preview
*/
it('Tests disabling of automatic preview', function () {
navigateToProjectPreview();
// **Testing ignore feature with auto preview enabled** //
cy.get('input[bind="ignoreInput"]').type('{backspace}1');
cy.get('input[bind="ignoreCheckbox"]').check();
cy.waitForImportUpdate();
// Look for automatic preview update
cy.get('table.data-table tr').eq(1);
cy.get('table.data-table tr').eq(1).should('to.contain', '01002');
cy.get('input[bind="ignoreCheckbox"]').uncheck();
cy.waitForImportUpdate();
// **Testing ignore feature with auto preview disabled** //
cy.get('input[bind="disableAutoPreviewCheckbox"]').check();
// Verify no auto update
cy.get('input[bind="ignoreCheckbox"]').check();
cy.wait(5000); // 5 second wait. No choice but to use this here because the dom is not rendered.
cy.get('table.data-table tr').eq(1).should('to.contain', '1.');
cy.get('table.data-table tr').eq(1).should('to.contain', '01001');
// Verify update on button click
cy.get('button[bind="previewButton"]').click();
cy.waitForImportUpdate();
cy.get('table.data-table tr').eq(1).should('to.contain', '1.');
cy.get('table.data-table tr').eq(1).should('to.contain', '01002');
cy.get('input[bind="disableAutoPreviewCheckbox"]').uncheck();
});
});

View File

@ -131,6 +131,7 @@
"core-index-lang/label": "Select preferred language",
"core-index-lang/send-req": "Change language",
"core-index-lang/page-reload": "The page will be refreshed to apply the change.",
"core-index-parser/disable-auto-preview": "Disable auto preview",
"core-index-parser/ignore-first": "Ignore first",
"core-index-parser/lines-beg": "line(s) at beginning of file",
"core-index-parser/parse-next": "Parse next",
@ -735,7 +736,7 @@
"core-buttons/next": "Next &raquo;",
"core-buttons/previous": "Back",
"core-buttons/add-url": "Add another URL",
"core-buttons/update-preview": "Update&nbsp;Preview",
"core-buttons/update-preview": "Update&nbsp;preview",
"core-buttons/pick-record": "Pick record elements",
"core-buttons/merge-cluster": "Merge selected &amp; re-cluster",
"core-buttons/merge-close": "Merge selected &amp; Close",

View File

@ -6,6 +6,11 @@
<td style="text-align: right;">&nbsp;</td>
<td width="1%"><button class="button" bind="previewButton"></button></td>
</tr>
<tr>
<td style="..."></td>
<td width="1%"><input type="checkbox" bind="disableAutoPreviewCheckbox" id="$disable" />
<label for="$disable" id="or-disable-auto-preview"></label></td>
</tr>
</table></div></td>
</tr>
<tr>

View File

@ -110,6 +110,8 @@ Refine.ExcelParserUI.prototype.getOptions = function() {
options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked;
options.includeArchiveFileName = this._optionContainerElmts.includeArchiveFileCheckbox[0].checked;
options.disableAutoPreview = this._optionContainerElmts.disableAutoPreviewCheckbox[0].checked;
return options;
};
@ -125,6 +127,7 @@ Refine.ExcelParserUI.prototype._initialize = function() {
this._optionContainerElmts.selectAllButton.html($.i18n('core-buttons/select-all'));
this._optionContainerElmts.unselectAllButton.click(function() { self._unselectAll(); });
this._optionContainerElmts.unselectAllButton.html($.i18n('core-buttons/unselect-all'));
$('#or-disable-auto-preview').text($.i18n('core-index-parser/disable-auto-preview'));
$('#or-import-worksheet').text($.i18n('core-index-import/import-worksheet'));
$('#or-import-ignore').text($.i18n('core-index-parser/ignore-first'));
$('#or-import-lines').text($.i18n('core-index-parser/lines-beg'));
@ -192,8 +195,16 @@ Refine.ExcelParserUI.prototype._initialize = function() {
this._optionContainerElmts.includeArchiveFileCheckbox.prop("checked", true);
}
if (this._config.disableAutoPreview) {
this._optionContainerElmts.disableAutoPreviewCheckbox.prop('checked', true);
}
// If disableAutoPreviewCheckbox is not checked, we will schedule an automatic update
var onChange = function() {
self._scheduleUpdatePreview();
if (!self._optionContainerElmts.disableAutoPreviewCheckbox[0].checked)
{
self._scheduleUpdatePreview();
}
};
this._optionContainer.find("input").bind("change", onChange);
this._optionContainer.find("select").bind("change", onChange);

View File

@ -11,6 +11,11 @@
<td style="text-align: right;">&nbsp;</td>
<td width="1%"><button class="button" bind="previewButton"></button></td>
</tr>
<tr>
<td style="text-align: right;">&nbsp;</td>
<td width="1%"><input type="checkbox" bind="disableAutoPreviewCheckbox" id="$disable" />
<label for="$disable" id="or-disable-auto-preview"></label></td>
</tr>
</table></div></td>
</tr>
<tr>

View File

@ -112,6 +112,8 @@ Refine.FixedWidthParserUI.prototype.getOptions = function() {
options.includeArchiveFile = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked;
options.includeArchiveFileName = this._optionContainerElmts.includeArchiveFileCheckbox[0].checked;
options.disableAutoPreview = this._optionContainerElmts.disableAutoPreviewCheckbox[0].checked;
return options;
};
@ -124,6 +126,7 @@ Refine.FixedWidthParserUI.prototype._initialize = function() {
this._optionContainerElmts.previewButton.click(function() { self.updatePreview(); });
this._optionContainerElmts.previewButton.html($.i18n('core-buttons/update-preview'));
$('#or-disable-auto-preview').text($.i18n('core-index-parser/disable-auto-preview'));
$('#or-import-encoding').html($.i18n('core-index-import/char-encoding'));
$('#or-import-columnWidth').text($.i18n('core-index-import/column-widths'));
$('#or-import-columnNames').text($.i18n('core-index-import/column-names'));
@ -192,8 +195,16 @@ Refine.FixedWidthParserUI.prototype._initialize = function() {
this._optionContainerElmts.includeArchiveFileCheckbox.prop('checked', true);
}
if (this._config.disableAutoPreview) {
this._optionContainerElmts.disableAutoPreviewCheckbox.prop('checked', true);
}
// If disableAutoPreviewCheckbox is not checked, we will schedule an automatic update
var onChange = function() {
self._scheduleUpdatePreview();
if (!self._optionContainerElmts.disableAutoPreviewCheckbox[0].checked)
{
self._scheduleUpdatePreview();
}
};
this._optionContainer.find("input").bind("change", onChange);
this._optionContainer.find("select").bind("change", onChange);

View File

@ -6,6 +6,11 @@
<td width="1%"><button class="button" bind="pickRecordElementsButton"></button></td>
<td width="1%"><button class="button" bind="previewButton"></button></td>
</tr>
<tr>
<td style="text-align: right;">&nbsp;</td>
<td width="1%"><input type="checkbox" bind="disableAutoPreviewCheckbox" id="$disable" />
<label for="$disable" id="or-disable-auto-preview"></label></td>
</tr>
</table></div></td>
</tr>
<tr>

View File

@ -97,6 +97,7 @@ Refine.JsonParserUI.prototype.getOptions = function() {
options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked;
options.includeArchiveFileName = this._optionContainerElmts.includeArchiveFileCheckbox[0].checked;
options.disableAutoPreview = this._optionContainerElmts.disableAutoPreviewCheckbox[0].checked;
return options;
};
@ -111,6 +112,7 @@ Refine.JsonParserUI.prototype._initialize = function() {
this._optionContainerElmts.pickRecordElementsButton.text($.i18n('core-index-import/warning-record-path'));
this._optionContainerElmts.previewButton.html($.i18n('core-buttons/update-preview'));
$('#or-disable-auto-preview').text($.i18n('core-index-parser/disable-auto-preview'));
$('#or-import-load').text($.i18n('core-index-parser/load-at-most'));
$('#or-import-rows').text($.i18n('core-index-parser/rows-data'));
$('#or-import-preserve').text($.i18n('core-index-parser/preserve-empty'));
@ -143,8 +145,16 @@ Refine.JsonParserUI.prototype._initialize = function() {
self._showPickRecordNodesUI();
});
if (this._config.disableAutoPreview) {
this._optionContainerElmts.disableAutoPreviewCheckbox.prop('checked', true);
}
// If disableAutoPreviewCheckbox is not checked, we will schedule an automatic update
var onChange = function() {
self._scheduleUpdatePreview();
if (!self._optionContainerElmts.disableAutoPreviewCheckbox[0].checked)
{
self._scheduleUpdatePreview();
}
};
this._optionContainer.find("input").bind("change", onChange);
this._optionContainer.find("select").bind("change", onChange);

View File

@ -11,6 +11,11 @@
<td style="text-align: right;">&nbsp;</td>
<td width="1%"><button class="button" bind="previewButton"></button></td>
</tr>
<tr>
<td style="text-align: right;">&nbsp;</td>
<td width="1%"><input type="checkbox" bind="disableAutoPreviewCheckbox" id="$disable" />
<label for="$disable" id="or-disable-auto-preview"></label></td>
</tr>
</table></div></td>
</tr>
<tr>

View File

@ -100,6 +100,8 @@ Refine.LineBasedParserUI.prototype.getOptions = function() {
options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked;
options.includeArchiveFileName = this._optionContainerElmts.includeArchiveFileCheckbox[0].checked;
options.disableAutoPreview = this._optionContainerElmts.disableAutoPreviewCheckbox[0].checked;
return options;
};
@ -113,6 +115,7 @@ Refine.LineBasedParserUI.prototype._initialize = function() {
$('#or-import-encoding').html($.i18n('core-index-import/char-encoding'));
this._optionContainerElmts.previewButton.html($.i18n('core-buttons/update-preview'));
$('#or-disable-auto-preview').text($.i18n('core-index-parser/disable-auto-preview'));
$('#or-import-parseEvery').html($.i18n('core-index-parser/parse-every'));
$('#or-import-linesIntoRow').html($.i18n('core-index-parser/lines-into-row'));
$('#or-import-blank').text($.i18n('core-index-parser/store-blank'));
@ -164,8 +167,16 @@ Refine.LineBasedParserUI.prototype._initialize = function() {
this._optionContainerElmts.includeArchiveFileCheckbox.prop("checked", true);
}
if (this._config.disableAutoPreview) {
this._optionContainerElmts.disableAutoPreviewCheckbox.prop('checked', true);
}
// If disableAutoPreviewCheckbox is not checked, we will schedule an automatic update
var onChange = function() {
self._scheduleUpdatePreview();
if (!self._optionContainerElmts.disableAutoPreviewCheckbox[0].checked)
{
self._scheduleUpdatePreview();
}
};
this._optionContainer.find("input").bind("change", onChange);
this._optionContainer.find("select").bind("change", onChange);

View File

@ -11,6 +11,11 @@
<td style="text-align: right;">&nbsp;</td>
<td width="1%"><button class="button" bind="previewButton"></button></td>
</tr>
<tr>
<td style="text-align: right;">&nbsp;</td>
<td width="1%"><input type="checkbox" bind="disableAutoPreviewCheckbox" id="$disable" />
<label for="$disable" id="or-disable-auto-preview"></label></td>
</tr>
</table></div></td>
</tr>
</table></div>

View File

@ -65,6 +65,9 @@ Refine.RdfTriplesParserUI.prototype.getOptions = function() {
var options = {
encoding: $.trim(this._optionContainerElmts.encodingInput[0].value)
};
options.disableAutoPreview = this._optionContainerElmts.disableAutoPreviewCheckbox[0].checked;
return options;
};
@ -77,6 +80,7 @@ Refine.RdfTriplesParserUI.prototype._initialize = function() {
this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); });
this._optionContainerElmts.previewButton.html($.i18n('core-buttons/update-preview'));
$('#or-disable-auto-preview').text($.i18n('core-index-parser/disable-auto-preview'));
$('#or-import-encoding').html($.i18n('core-index-import/char-encoding'));
this._optionContainerElmts.encodingInput
@ -87,8 +91,16 @@ Refine.RdfTriplesParserUI.prototype._initialize = function() {
});
});
if (this._config.disableAutoPreview) {
this._optionContainerElmts.disableAutoPreviewCheckbox.prop('checked', true);
}
// If disableAutoPreviewCheckbox is not checked, we will schedule an automatic update
var onChange = function() {
self._scheduleUpdatePreview();
if (!self._optionContainerElmts.disableAutoPreviewCheckbox[0].checked)
{
self._scheduleUpdatePreview();
}
};
this._optionContainer.find("input").bind("change", onChange);
this._optionContainer.find("select").bind("change", onChange);

View File

@ -6,13 +6,20 @@
<td><input bind="encodingInput"></input></td>
</tr>
</table></div></td>
<td colspan="2"><div class="grid-layout layout-tighter layout-full"><table>
<tr>
<td style="text-align: right;">&nbsp;</td>
<td width="1%"><button class="button" bind="previewButton"></button></td>
</tr>
<tr>
<td style="text-align: right;">&nbsp;</td>
<td width="1%"><input type="checkbox" bind="disableAutoPreviewCheckbox" id="$disable" />
<label for="$disable" id="or-disable-auto-preview"></label></td>
</tr>
</table></div></td>
</tr>
<tr>
<td><div class="grid-layout layout-tightest"><table>
<tr><td colspan="2" id="or-import-colsep"></td></tr>

View File

@ -120,6 +120,8 @@ Refine.SeparatorBasedParserUI.prototype.getOptions = function() {
options.includeArchiveFileName = this._optionContainerElmts.includeArchiveFileCheckbox[0].checked;
options.trimStrings = this._optionContainerElmts.trimStringsCheckbox[0].checked;
options.disableAutoPreview = this._optionContainerElmts.disableAutoPreviewCheckbox[0].checked;
if (this._optionContainerElmts.columnNamesCheckbox[0].checked) {
var columnNames = this._optionContainerElmts.columnNamesInput.val();
if (columnNames != undefined && columnNames != null && columnNames != '') {
@ -139,6 +141,7 @@ Refine.SeparatorBasedParserUI.prototype._initialize = function() {
this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); });
this._optionContainerElmts.previewButton.html($.i18n('core-buttons/update-preview'));
$('#or-disable-auto-preview').text($.i18n('core-index-parser/disable-auto-preview'));
$('#or-import-encoding').html($.i18n('core-index-import/char-encoding'));
$('#or-import-colsep').html($.i18n('core-index-parser/col-separated-by'));
$('#or-import-commas').html($.i18n('core-index-parser/commas'));
@ -247,9 +250,18 @@ Refine.SeparatorBasedParserUI.prototype._initialize = function() {
this._optionContainerElmts.trimStringsCheckbox.prop('checked', false);
}
if (this._config.disableAutoPreview) {
this._optionContainerElmts.disableAutoPreviewCheckbox.prop('checked', true);
}
// If disableAutoPreviewCheckbox is not checked, we will schedule an automatic update
var onChange = function() {
self._scheduleUpdatePreview();
if (!self._optionContainerElmts.disableAutoPreviewCheckbox[0].checked)
{
self._scheduleUpdatePreview();
}
};
this._optionContainer.find("input").bind("change", onChange);
this._optionContainer.find("select").bind("change", onChange);
this._optionContainerElmts.columnNamesInput.bind("keyup",onChange);

View File

@ -36,4 +36,9 @@
<td width="1%"></td>
<td><button class="button" bind="previewButton"></button></td>
</tr>
<tr>
<td width="1%"></td>
<td width="1%"><input type="checkbox" bind="disableAutoPreviewCheckbox" id="$disable" />
<label for="$disable" id="or-disable-auto-preview"></label></td>
</tr>
</table></div>

View File

@ -104,6 +104,8 @@ Refine.WikitextParserUI.prototype.getOptions = function() {
options.reconService = ReconciliationManager.ensureDefaultServicePresent();
options.disableAutoPreview = this._optionContainerElmts.disableAutoPreviewCheckbox[0].checked;
return options;
};
@ -116,7 +118,7 @@ Refine.WikitextParserUI.prototype._initialize = function() {
this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); });
this._optionContainerElmts.previewButton.html($.i18n('core-buttons/update-preview'));
$('#or-disable-auto-preview').text($.i18n('core-index-parser/disable-auto-preview'));
$('#or-import-wiki-base-url').text($.i18n('core-index-parser/wiki-base-url'));
$('#or-import-parse').text($.i18n('core-index-parser/parse-next'));
$('#or-import-header').text($.i18n('core-index-parser/lines-header'));
@ -188,8 +190,16 @@ Refine.WikitextParserUI.prototype._initialize = function() {
this._optionContainerElmts.includeArchiveFileCheckbox.prop("checked", true);
}
if (this._config.disableAutoPreview) {
this._optionContainerElmts.disableAutoPreviewCheckbox.prop('checked', true);
}
// If disableAutoPreviewCheckbox is not checked, we will schedule an automatic update
var onChange = function() {
self._scheduleUpdatePreview();
if (!self._optionContainerElmts.disableAutoPreviewCheckbox[0].checked)
{
self._scheduleUpdatePreview();
}
};
this._optionContainer.find("input").bind("change", onChange);
this._optionContainer.find("select").bind("change", onChange);

View File

@ -6,6 +6,11 @@
<td width="1%"><button class="button" bind="pickRecordElementsButton"></button></td>
<td width="1%"><button class="button" bind="previewButton"></button></td>
</tr>
<tr>
<td style="text-align: right;">&nbsp;</td>
<td width="1%"><input type="checkbox" bind="disableAutoPreviewCheckbox" id="$disable" />
<label for="$disable" id="or-disable-auto-preview"></label></td>
</tr>
</table></div></td>
</tr>
<tr>

View File

@ -95,6 +95,8 @@ Refine.XmlParserUI.prototype.getOptions = function() {
options.includeFileSources = this._optionContainerElmts.includeFileSourcesCheckbox[0].checked;
options.includeArchiveFileName = this._optionContainerElmts.includeArchiveFileCheckbox[0].checked;
options.disableAutoPreview = this._optionContainerElmts.disableAutoPreviewCheckbox[0].checked;
return options;
};
@ -108,6 +110,7 @@ Refine.XmlParserUI.prototype._initialize = function() {
this._optionContainerElmts.pickRecordElementsButton.html($.i18n('core-buttons/pick-record'));
this._optionContainerElmts.previewButton.html($.i18n('core-buttons/update-preview'));
$('#or-disable-auto-preview').text($.i18n('core-index-parser/disable-auto-preview'));
$('#or-import-rows').text($.i18n('core-index-parser/rows-data'));
$('#or-import-load').text($.i18n('core-index-parser/load-at-most'));
$('#or-import-preserve').text($.i18n('core-index-parser/preserve-empty'));
@ -140,8 +143,16 @@ Refine.XmlParserUI.prototype._initialize = function() {
self._showPickRecordElementsUI();
});
if (this._config.disableAutoPreview) {
this._optionContainerElmts.disableAutoPreviewCheckbox.prop('checked', true);
}
// If disableAutoPreviewCheckbox is not checked, we will schedule an automatic update
var onChange = function() {
self._scheduleUpdatePreview();
if (!self._optionContainerElmts.disableAutoPreviewCheckbox[0].checked)
{
self._scheduleUpdatePreview();
}
};
this._optionContainer.find("input").bind("change", onChange);
this._optionContainer.find("select").bind("change", onChange);