diff --git a/containers/backupchecks/src/templates/main/job_detail.html b/containers/backupchecks/src/templates/main/job_detail.html index 17f0505..86bbc6c 100644 --- a/containers/backupchecks/src/templates/main/job_detail.html +++ b/containers/backupchecks/src/templates/main/job_detail.html @@ -284,63 +284,63 @@ .replace(/'/g, "'"); } - // Cross-browser copy to clipboard function - function copyToClipboard(text, button) { - // Method 1: Modern Clipboard API (works in most browsers with HTTPS) - if (navigator.clipboard && navigator.clipboard.writeText) { - navigator.clipboard.writeText(text) - .then(function () { - showCopyFeedback(button); - }) - .catch(function () { - // Fallback to method 2 if clipboard API fails - fallbackCopy(text, button); - }); - } else { - // Method 2: Legacy execCommand method - fallbackCopy(text, button); - } - } - - function fallbackCopy(text, button) { - var textarea = document.createElement('textarea'); - textarea.value = text; - textarea.style.position = 'fixed'; - textarea.style.opacity = '0'; - textarea.style.top = '0'; - textarea.style.left = '0'; - document.body.appendChild(textarea); - textarea.focus(); - textarea.select(); - - try { - var successful = document.execCommand('copy'); - if (successful) { - showCopyFeedback(button); - } else { - // If execCommand fails, use prompt as last resort - window.prompt('Copy ticket number:', text); - } - } catch (err) { - // If all else fails, show prompt - window.prompt('Copy ticket number:', text); - } - - document.body.removeChild(textarea); - } - - function showCopyFeedback(button) { - if (!button) return; - var original = button.textContent; - button.textContent = '✓'; - setTimeout(function () { - button.textContent = original; - }, 800); - } - (function () { var currentRunId = null; + // Cross-browser copy to clipboard function + function copyToClipboard(text, button) { + // Method 1: Modern Clipboard API (works in most browsers with HTTPS) + if (navigator.clipboard && navigator.clipboard.writeText) { + navigator.clipboard.writeText(text) + .then(function () { + showCopyFeedback(button); + }) + .catch(function () { + // Fallback to method 2 if clipboard API fails + fallbackCopy(text, button); + }); + } else { + // Method 2: Legacy execCommand method + fallbackCopy(text, button); + } + } + + function fallbackCopy(text, button) { + var textarea = document.createElement('textarea'); + textarea.value = text; + textarea.style.position = 'fixed'; + textarea.style.opacity = '0'; + textarea.style.top = '0'; + textarea.style.left = '0'; + document.body.appendChild(textarea); + textarea.focus(); + textarea.select(); + + try { + var successful = document.execCommand('copy'); + if (successful) { + showCopyFeedback(button); + } else { + // If execCommand fails, use prompt as last resort + window.prompt('Copy ticket number:', text); + } + } catch (err) { + // If all else fails, show prompt + window.prompt('Copy ticket number:', text); + } + + document.body.removeChild(textarea); + } + + function showCopyFeedback(button) { + if (!button) return; + var original = button.textContent; + button.textContent = '✓'; + setTimeout(function () { + button.textContent = original; + }, 800); + } + function apiJson(url, opts) { opts = opts || {}; opts.headers = opts.headers || {}; diff --git a/docs/changelog-claude.md b/docs/changelog-claude.md index 589ff09..8c2d7ab 100644 --- a/docs/changelog-claude.md +++ b/docs/changelog-claude.md @@ -6,6 +6,7 @@ This file documents all changes made to this project via Claude Code. ### Fixed - Fixed tickets not being displayed in Run Checks modal detail view (Meldingen section) by extending `/api/job-runs//alerts` endpoint to include both run-specific tickets (via ticket_job_runs) and job-level tickets (via ticket_scopes), ensuring newly created tickets are visible immediately in the modal instead of only after being resolved +- Fixed copy ticket button not working in Edge browser on Job Details page by moving clipboard functions (copyToClipboard, fallbackCopy, showCopyFeedback) inside IIFE scope for proper closure access (Edge is stricter than Firefox about scope resolution) ## [2026-02-10]