2021-12-08 09:29:42 -05:00
|
|
|
/**
|
|
|
|
* Webhook Events
|
|
|
|
* Manages dynamic selection control in the webhook form interface.
|
|
|
|
*/
|
2022-11-15 11:04:46 -05:00
|
|
|
import {Component} from "./component";
|
|
|
|
|
|
|
|
export class WebhookEvents extends Component {
|
2021-12-08 09:29:42 -05:00
|
|
|
|
|
|
|
setup() {
|
|
|
|
this.checkboxes = this.$el.querySelectorAll('input[type="checkbox"]');
|
2021-12-08 12:35:58 -05:00
|
|
|
this.allCheckbox = this.$el.querySelector('input[type="checkbox"][value="all"]');
|
2021-12-08 09:29:42 -05:00
|
|
|
|
|
|
|
this.$el.addEventListener('change', event => {
|
|
|
|
if (event.target.checked && event.target === this.allCheckbox) {
|
|
|
|
this.deselectIndividualEvents();
|
|
|
|
} else if (event.target.checked) {
|
|
|
|
this.allCheckbox.checked = false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
deselectIndividualEvents() {
|
|
|
|
for (const checkbox of this.checkboxes) {
|
|
|
|
if (checkbox !== this.allCheckbox) {
|
|
|
|
checkbox.checked = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-15 11:04:46 -05:00
|
|
|
}
|