Update AddParameterPage validation when the template changes

This applies in several situations. A trivial one is a parameter
that's already in use, but you uncheck it while the relevant
error message is shown. Vice versa.

Bug: T290977
Change-Id: Ia4114194a2efe34a7d51e633c776ce892cc9cb18
This commit is contained in:
Thiemo Kreuz 2021-09-14 17:10:41 +02:00
parent 7bbdca3fb9
commit 51ad403117

View file

@ -18,7 +18,12 @@ ve.ui.MWAddParameterPage = function VeUiMWAddParameterPage( parameter, name, con
scrollable: false
}, config ) );
this.template = parameter.getTemplate();
this.template = parameter.getTemplate()
.connect( this, {
// There is a "change" event, but it triggers way to often even for content changes
add: 'onTemplateParametersChanged',
remove: 'onTemplateParametersChanged'
} );
this.isExpanded = false;
// Header button to expand
@ -96,6 +101,13 @@ ve.ui.MWAddParameterPage.prototype.focus = function () {
ve.ui.MWAddParameterPage.super.prototype.focus.apply( this, arguments );
};
/**
* @private
*/
ve.ui.MWAddParameterPage.prototype.onTemplateParametersChanged = function () {
this.onParameterNameChanged( this.paramInputField.getValue() );
};
/**
* @private
* @param {string} value