mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateData
synced 2024-11-24 07:53:37 +00:00
Avoid calling repopulateParamSelectWidget multiple times on setup
Change-Id: I05ce3d8ff1109980248a0c2389298591f9b54553
This commit is contained in:
parent
60883bf812
commit
89f8b35018
|
@ -18,6 +18,7 @@ mw.TemplateData.Dialog = function mwTemplateDataDialog( config ) {
|
||||||
this.selectedParamKey = '';
|
this.selectedParamKey = '';
|
||||||
this.propInputs = {};
|
this.propInputs = {};
|
||||||
this.propFieldLayout = {};
|
this.propFieldLayout = {};
|
||||||
|
this.isSetup = false;
|
||||||
|
|
||||||
// Initialize
|
// Initialize
|
||||||
this.$element.addClass( 'tdg-templateDataDialog' );
|
this.$element.addClass( 'tdg-templateDataDialog' );
|
||||||
|
@ -501,9 +502,14 @@ mw.TemplateData.Dialog.prototype.reset = function () {
|
||||||
* Empty and repopulate the parameter select widget.
|
* Empty and repopulate the parameter select widget.
|
||||||
*/
|
*/
|
||||||
mw.TemplateData.Dialog.prototype.repopulateParamSelectWidget = function () {
|
mw.TemplateData.Dialog.prototype.repopulateParamSelectWidget = function () {
|
||||||
var i, paramKey,
|
var i, paramKey, missingParams, paramList, paramOrder;
|
||||||
missingParams = this.model.getMissingParams(),
|
|
||||||
paramList = this.model.getParams(),
|
if ( !this.isSetup ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
missingParams = this.model.getMissingParams();
|
||||||
|
paramList = this.model.getParams();
|
||||||
paramOrder = this.model.getTemplateParamOrder();
|
paramOrder = this.model.getTemplateParamOrder();
|
||||||
|
|
||||||
this.paramSelect.clearItems();
|
this.paramSelect.clearItems();
|
||||||
|
@ -764,6 +770,8 @@ mw.TemplateData.Dialog.prototype.getSetupProcess = function ( data ) {
|
||||||
var i, language, languages,
|
var i, language, languages,
|
||||||
languageItems = [];
|
languageItems = [];
|
||||||
|
|
||||||
|
this.isSetup = false;
|
||||||
|
|
||||||
this.reset();
|
this.reset();
|
||||||
|
|
||||||
// The dialog must be supplied with a reference to a model
|
// The dialog must be supplied with a reference to a model
|
||||||
|
@ -821,6 +829,10 @@ mw.TemplateData.Dialog.prototype.getSetupProcess = function ( data ) {
|
||||||
// Trigger the initial language choice
|
// Trigger the initial language choice
|
||||||
this.languageDropdownWidget.getMenu().selectItemByData( language );
|
this.languageDropdownWidget.getMenu().selectItemByData( language );
|
||||||
|
|
||||||
|
this.isSetup = true;
|
||||||
|
|
||||||
|
this.repopulateParamSelectWidget();
|
||||||
|
|
||||||
// Show the panel
|
// Show the panel
|
||||||
this.$spinner.hide();
|
this.$spinner.hide();
|
||||||
this.panels.$element.show();
|
this.panels.$element.show();
|
||||||
|
|
Loading…
Reference in a new issue