mirror of
https://github.com/go-gitea/gitea.git
synced 2026-11-26 10:47:04 -06:00
A webhook delivery looked failed while its HTTP request was still in flight. Recent Deliveries now tells the states apart and refreshes in place while a delivery is pending. - Rows show queued, in progress, succeeded or failed, plus the HTTP status code - Transport failures show as timed out, connection failed or blocked by the outbound request policy - Test Push Event and the 5s polling update the list without a page reload - Details open in a dialog, times render in the viewer's timezone | | Before | After | |-|-|-| | List | <img width="600" alt="Recent deliveries before" src="https://github.com/user-attachments/assets/c5fa2217-91d4-4278-bdd2-fc7e98f47bd7" /> | <img width="600" alt="Recent deliveries after" src="https://github.com/user-attachments/assets/0b91706e-ab5b-4fed-97f0-30c28e374f50" /> | | Details | <img width="600" alt="Delivery details before" src="https://github.com/user-attachments/assets/04fcae63-de09-4906-96d9-bcea4e15550f" /> | <img width="216" height="207" alt="Delivery details after" src="https://github.com/user-attachments/assets/9c0f68a4-2dcf-4fd3-b4e0-31f4f031465f" /> | Fixes: https://github.com/go-gitea/gitea/issues/40013 Assisted-by: Codex:GPT-6, Claude Code:claude-opus-5-5 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
37 lines
1.6 KiB
TypeScript
37 lines
1.6 KiB
TypeScript
import {registerGlobalInitFunc} from '../../modules/observer.ts';
|
|
import {queryElems, toggleElem} from '../../utils/dom.ts';
|
|
|
|
function initCompWebHookEditorForm(el: HTMLElement) {
|
|
const elCustomEvents = el.querySelector('.js-webhook-custom-events')!;
|
|
|
|
// Trigger On: use custom events or not
|
|
queryElems<HTMLInputElement>(el, 'input[name=events]', (input) => input.addEventListener('change', () => {
|
|
if (!input.checked) return;
|
|
toggleElem(elCustomEvents, input.value === 'choose_events');
|
|
}));
|
|
|
|
// Select All / Deselect All custom events
|
|
queryElems(el, 'button[data-events-select-all]', (btn) => btn.addEventListener('click', () => {
|
|
const checked = btn.getAttribute('data-events-select-all') === 'true';
|
|
queryElems<HTMLInputElement>(elCustomEvents, 'input[type=checkbox]', (input) => {
|
|
input.checked = checked;
|
|
input.dispatchEvent(new Event('change', {bubbles: true})); // for the areYouSure dirty tracking
|
|
});
|
|
}));
|
|
|
|
// some webhooks (like Gitea) allow to set the request method (GET/POST), and it would toggle the "Content Type" field
|
|
const httpMethodInput = el.querySelector<HTMLInputElement>('#http_method');
|
|
if (httpMethodInput) {
|
|
const updateContentType = () => {
|
|
const visible = httpMethodInput.value === 'POST';
|
|
toggleElem(el.querySelector('#content_type')!.closest('.field')!, visible);
|
|
};
|
|
updateContentType();
|
|
httpMethodInput.addEventListener('change', updateContentType);
|
|
}
|
|
}
|
|
|
|
export function initCompWebHookEditor() {
|
|
registerGlobalInitFunc('initCompWebHookEditorForm', initCompWebHookEditorForm);
|
|
}
|