[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.
This commit is contained in:
parent
ea9eae3b9d
commit
b7faee9bd6
|
@ -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});
|
||||
});
|
||||
})();
|
Loading…
Reference in New Issue