mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
#7084: Fix issue where hidden VLAN form fields were incorrectly included in the form submission
This commit is contained in:
@ -320,6 +320,7 @@ export class APISelect {
|
||||
this.slim.slim.multiSelected.container.setAttribute('disabled', '');
|
||||
}
|
||||
}
|
||||
this.slim.disable();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -335,6 +336,7 @@ export class APISelect {
|
||||
this.slim.slim.multiSelected.container.removeAttribute('disabled');
|
||||
}
|
||||
}
|
||||
this.slim.enable();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -357,6 +359,11 @@ export class APISelect {
|
||||
this.fetchOptions(this.more, 'merge'),
|
||||
);
|
||||
|
||||
// When the base select element is disabled or enabled, properly disable/enable this instance.
|
||||
this.base.addEventListener(`netbox.select.disabled.${this.name}`, event =>
|
||||
this.handleDisableEnable(event),
|
||||
);
|
||||
|
||||
// Create a unique iterator of all possible form fields which, when changed, should cause this
|
||||
// element to update its API query.
|
||||
// const dependencies = new Set([...this.filterParams.keys(), ...this.pathValues.keys()]);
|
||||
@ -578,6 +585,23 @@ export class APISelect {
|
||||
Promise.all([this.loadData()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Event handler to be dispatched when the base select element is disabled or enabled. When that
|
||||
* occurs, run the instance's `disable()` or `enable()` methods to synchronize UI state with
|
||||
* desired action.
|
||||
*
|
||||
* @param event Dispatched event matching pattern `netbox.select.disabled.<name>`
|
||||
*/
|
||||
private handleDisableEnable(event: Event): void {
|
||||
const target = event.target as HTMLSelectElement;
|
||||
|
||||
if (target.disabled === true) {
|
||||
this.disable();
|
||||
} else if (target.disabled === false) {
|
||||
this.enable();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* When the API returns an error, show it to the user and reset this element's available options.
|
||||
*
|
||||
|
Reference in New Issue
Block a user