From b7faee9bd6d35bfd57e23b5d9d237fc2fb4c2e42 Mon Sep 17 00:00:00 2001 From: Sebastian Schulze Date: Tue, 25 Jan 2022 21:11:11 +0100 Subject: [PATCH] [greasemonkey] Fix the GitLab downstream pipelines overview This will expand all the triggered Downstream pipelines once they are visible, instead of me having to manually click through all of them. As a side convenience, it will enable the job dependency display. --- .../greasemonkey/fix-gitlab-pipelines.js | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 dot_config/private_qutebrowser/greasemonkey/fix-gitlab-pipelines.js diff --git a/dot_config/private_qutebrowser/greasemonkey/fix-gitlab-pipelines.js b/dot_config/private_qutebrowser/greasemonkey/fix-gitlab-pipelines.js new file mode 100644 index 0000000..8e6098f --- /dev/null +++ b/dot_config/private_qutebrowser/greasemonkey/fix-gitlab-pipelines.js @@ -0,0 +1,40 @@ +// ==UserScript== +// @name FixGitLabPipelines +// @namespace https://git.bascht.space +// @description Fix display of downstream triggers and job dependencies +// @include /^https://git.*/pipelines// +// @run-at document-start +// @version 1 +// @author Bascht +// ==/UserScript== + +(function IIFE() { + 'use strict'; + + document.addEventListener('DOMContentLoaded', function() { + const jsTabPipeline = document.querySelector("#js-tab-pipeline div"); + const observer = new MutationObserver(function() { + // Pick that little wiggly button once the rest of the tab show has stopped it's irish tap dance. + var expanderButton = document.querySelector('button[aria-label="Expand pipeline"]') + + // Check that there is actually something to expand + var isExpandable = expanderButton.querySelector("svg[data-testid='angle-right-icon']") !== null + + // Expand if possible + if(isExpandable) { + expanderButton.click(); + } + // Otherwise visualise the job dependencies + else { + var linksToggle = document.querySelector('div[data-testid="show-links-toggle"] button[role="switch"]') + + // If it's not yet toggled + if(linksToggle.ariaChecked == "false") { + console.log("Toggle Button") + linksToggle.click(); + } + } + }); + observer.observe(jsTabPipeline, {subtree: true, childList: true}); + }); +})();