Merge pull request 'Fix generated FQDN not being submitted' (#249) from 241-fqdn-saving into main
Reviewed-on: #249
This commit is contained in:
commit
3b97d4a1b6
2 changed files with 11 additions and 1 deletions
|
|
@ -129,6 +129,8 @@ const updateRemoveButtonVisibility = (container) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.updateHiddenInput = updateHiddenInput
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', initDynamicArrayWidget)
|
document.addEventListener('DOMContentLoaded', initDynamicArrayWidget)
|
||||||
document.addEventListener('htmx:afterSwap', initDynamicArrayWidget)
|
document.addEventListener('htmx:afterSwap', initDynamicArrayWidget)
|
||||||
document.addEventListener('htmx:afterSettle', initDynamicArrayWidget)
|
document.addEventListener('htmx:afterSettle', initDynamicArrayWidget)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
const initializeFqdnGeneration = () => {
|
const initializeFqdnGeneration = () => {
|
||||||
const nameField = document.querySelector('input[name="name"]');
|
const nameField = document.querySelector('input#id_name');
|
||||||
const fqdnField = document.querySelector('label[for="id_spec.parameters.service.fqdn"] + div input.array-item-input');
|
const fqdnField = document.querySelector('label[for="id_spec.parameters.service.fqdn"] + div input.array-item-input');
|
||||||
|
|
||||||
if (nameField && fqdnField) {
|
if (nameField && fqdnField) {
|
||||||
|
|
@ -17,6 +17,10 @@ const initializeFqdnGeneration = () => {
|
||||||
newNameField.addEventListener('input', function() {
|
newNameField.addEventListener('input', function() {
|
||||||
if (!newFqdnField.dataset.manuallyEdited) {
|
if (!newFqdnField.dataset.manuallyEdited) {
|
||||||
newFqdnField.value = generateFqdn(this.value);
|
newFqdnField.value = generateFqdn(this.value);
|
||||||
|
const container = newFqdnField.closest('.dynamic-array-widget');
|
||||||
|
if (container && window.updateHiddenInput) {
|
||||||
|
window.updateHiddenInput(container);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -26,6 +30,10 @@ const initializeFqdnGeneration = () => {
|
||||||
|
|
||||||
if (newNameField.value && !newFqdnField.value) {
|
if (newNameField.value && !newFqdnField.value) {
|
||||||
newFqdnField.value = generateFqdn(newNameField.value);
|
newFqdnField.value = generateFqdn(newNameField.value);
|
||||||
|
const container = newFqdnField.closest('.dynamic-array-widget');
|
||||||
|
if (container && window.updateHiddenInput) {
|
||||||
|
window.updateHiddenInput(container);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue