MCPcopy
hub / github.com/github/awesome-copilot / setupResourceListHandlers

Function setupResourceListHandlers

website/src/scripts/pages/workflows.ts:116–146  ·  view source on GitHub ↗
(list: HTMLElement | null)

Source from the content-addressed store, hash-verified

114}
115
116function 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
148function syncUrlState(): void {
149 updateQueryParams({

Callers 1

initWorkflowsPageFunction · 0.70

Calls 4

copyToClipboardFunction · 0.90
showToastFunction · 0.90
openWorkflowDetailsModalFunction · 0.85
addEventListenerMethod · 0.80

Tested by

no test coverage detected