Skip to content

Commit 912b62a

Browse files
partially fix autotail - FIXME TODO, requires tracking navigation within SPA to work without page refresh
1 parent 56360ad commit 912b62a

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

userscripts/autotail-codepipeline-logs.user.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name Auto-Tail CodePipeline Logs
33
// @namespace http://softwareengineerprogrammer.github.io
4-
// @version 0.1
4+
// @version 0.2
55
// @description un-papercut tail logs
66
// @author softwareengineerprogrammer
77
// @match https://*.console.aws.amazon.com/codesuite/codepipeline/pipelines/*/debug*
@@ -13,7 +13,11 @@
1313
(function () {
1414
'use strict';
1515

16-
let maxTries = 10;
16+
function isHidden(el) {
17+
return el && (el.offsetParent === null);
18+
}
19+
20+
const maxTries = 50;
1721
let loop = function (tries) {
1822
let elt = document.querySelector('.dx-LogTab__header > awsui-button:nth-child(2) > button:nth-child(1) > span:nth-child(1)');
1923
if (elt) {
@@ -22,6 +26,14 @@
2226
setTimeout(function () {
2327
elt.click();
2428
console.debug('Clicked Tail Logs button.');
29+
30+
setTimeout(function () {
31+
if (isHidden(document.querySelector('div.dx-StatusIndicator:nth-child(1)'))) {
32+
console.debug('Tail Logs pane not showing, resuming search-n-click...');
33+
loop(tries);
34+
}
35+
}, 1000);
36+
2537
}, 1000);
2638
} else if (tries < maxTries) {
2739
console.debug('Didn\'t find Tail Logs button, will try again...');

0 commit comments

Comments
 (0)