(list: HTMLElement | null)
| 114 | } |
| 115 | |
| 116 | function setupResourceListHandlers(list: HTMLElement | null): void { |
| 117 | if (!list || resourceListHandlersReady) return; |
| 118 | |
| 119 | list.addEventListener('click', (event) => { |
| 120 | const target = event.target as HTMLElement; |
| 121 | if (target.closest('.resource-actions')) { |
| 122 | return; |
| 123 | } |
| 124 | |
| 125 | const item = target.closest('.resource-item') as HTMLElement | null; |
| 126 | const button = item?.querySelector('.resource-preview') as HTMLElement | undefined; |
| 127 | const path = item?.dataset.path; |
| 128 | if (path) { |
| 129 | openWorkflowDetailsModal(path, button); |
| 130 | } |
| 131 | }); |
| 132 | |
| 133 | document.addEventListener('click', async (event) => { |
| 134 | const target = event.target as HTMLElement; |
| 135 | const copyPathButton = target.closest( |
| 136 | '#workflow-details-copy-path' |
| 137 | ) as HTMLButtonElement | null; |
| 138 | if (!copyPathButton) return; |
| 139 | const workflowPath = copyPathButton.dataset.workflowPath || ''; |
| 140 | if (!workflowPath) return; |
| 141 | const success = await copyToClipboard(workflowPath); |
| 142 | showToast(success ? 'Path copied!' : 'Failed to copy path', success ? 'success' : 'error'); |
| 143 | }); |
| 144 | |
| 145 | resourceListHandlersReady = true; |
| 146 | } |
| 147 | |
| 148 | function syncUrlState(): void { |
| 149 | updateQueryParams({ |
no test coverage detected