Created
March 3, 2026 19:20
-
-
Save stingray82/eb00c420e98c9ee110a16f8b035b0ab4 to your computer and use it in GitHub Desktop.
Flowmattic - Execution show ---> Task History
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name FlowMattic - Make Execution Count Clickable | |
| // @namespace https://example.local/ | |
| // @version 1.0.0 | |
| // @description Turns the "Executions" count into a link to View History for each workflow row. | |
| // @match *://*/wp-admin/admin.php?page=flowmattic-workflows* | |
| // @match *://*/wp-admin/admin.php?page=flowmattic* | |
| // @run-at document-end | |
| // @grant none | |
| // ==/UserScript== | |
| (function () { | |
| 'use strict'; | |
| function buildHistoryUrl(workflowId) { | |
| const url = new URL(window.location.href); | |
| url.pathname = '/wp-admin/admin.php'; | |
| url.search = ''; | |
| url.searchParams.set('page', 'flowmattic-task-history'); | |
| url.searchParams.set('workflow-id', workflowId); | |
| return url.toString(); | |
| } | |
| function enhanceRow(row) { | |
| if (!row || row.dataset.fmExecLinkified === '1') return; | |
| const workflowId = row.getAttribute('data-workflow-id'); | |
| if (!workflowId) return; | |
| const countEl = row.querySelector('.execution-count'); | |
| if (!countEl) return; | |
| // If it's already a link (or inside one), do nothing. | |
| if (countEl.closest('a')) { | |
| row.dataset.fmExecLinkified = '1'; | |
| return; | |
| } | |
| const historyUrl = buildHistoryUrl(workflowId); | |
| // Wrap the count in a link | |
| const link = document.createElement('a'); | |
| link.href = historyUrl; | |
| link.target = '_blank'; | |
| link.rel = 'noopener noreferrer'; | |
| link.title = 'View History'; | |
| link.style.textDecoration = 'none'; | |
| // Make it feel clickable even if styles change | |
| link.style.cursor = 'pointer'; | |
| // Move the count element into the link | |
| const parent = countEl.parentElement; | |
| link.appendChild(countEl.cloneNode(true)); | |
| countEl.replaceWith(link); | |
| row.dataset.fmExecLinkified = '1'; | |
| } | |
| function enhanceAll() { | |
| document.querySelectorAll('tr.workflow-row[data-workflow-id]').forEach(enhanceRow); | |
| } | |
| // Initial run | |
| enhanceAll(); | |
| // Watch for table updates (AJAX, filtering, pagination, etc.) | |
| const observer = new MutationObserver(() => enhanceAll()); | |
| observer.observe(document.documentElement, { childList: true, subtree: true }); | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment