Merge "Avoid calling repopulateParamSelectWidget multiple times on setup"

This commit is contained in:
jenkins-bot 2016-02-25 20:52:19 +00:00 committed by Gerrit Code Review
commit 97f1b8797e

View file

@ -18,6 +18,7 @@ mw.TemplateData.Dialog = function mwTemplateDataDialog( config ) {
this.selectedParamKey = '';
this.propInputs = {};
this.propFieldLayout = {};
this.isSetup = false;
// Initialize
this.$element.addClass( 'tdg-templateDataDialog' );
@ -501,9 +502,14 @@ mw.TemplateData.Dialog.prototype.reset = function () {
* Empty and repopulate the parameter select widget.
*/
mw.TemplateData.Dialog.prototype.repopulateParamSelectWidget = function () {
var i, paramKey,
missingParams = this.model.getMissingParams(),
paramList = this.model.getParams(),
var i, paramKey, missingParams, paramList, paramOrder;
if ( !this.isSetup ) {
return;
}
missingParams = this.model.getMissingParams();
paramList = this.model.getParams();
paramOrder = this.model.getTemplateParamOrder();
this.paramSelect.clearItems();
@ -764,6 +770,8 @@ mw.TemplateData.Dialog.prototype.getSetupProcess = function ( data ) {
var i, language, languages,
languageItems = [];
this.isSetup = false;
this.reset();
// 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
this.languageDropdownWidget.getMenu().selectItemByData( language );
this.isSetup = true;
this.repopulateParamSelectWidget();
// Show the panel
this.$spinner.hide();
this.panels.$element.show();