-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautotail-codepipeline-logs.user.js
More file actions
49 lines (42 loc) · 1.73 KB
/
Copy pathautotail-codepipeline-logs.user.js
File metadata and controls
49 lines (42 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// ==UserScript==
// @name Auto-Tail CodePipeline Logs
// @namespace http://softwareengineerprogrammer.github.io
// @version 0.2
// @description un-papercut tail logs
// @author softwareengineerprogrammer
// @match https://*.console.aws.amazon.com/codesuite/codepipeline/pipelines/*/debug*
// @grant none
// @updateURL https://softwareengineerprogrammer.github.io/userscripts/autotail-codepipeline-logs.user.js
// @downloadURL https://softwareengineerprogrammer.github.io/userscripts/autotail-codepipeline-logs.user.js
// ==/UserScript==
(function () {
'use strict';
function isHidden(el) {
return el && (el.offsetParent === null);
}
const maxTries = 50;
let loop = function (tries) {
let elt = document.querySelector('.dx-LogTab__header > awsui-button:nth-child(2) > button:nth-child(1) > span:nth-child(1)');
if (elt) {
console.debug('Found Tail Logs button...');
setTimeout(function () {
elt.click();
console.debug('Clicked Tail Logs button.');
setTimeout(function () {
if (isHidden(document.querySelector('div.dx-StatusIndicator:nth-child(1)'))) {
console.debug('Tail Logs pane not showing, resuming search-n-click...');
loop(tries);
}
}, 1000);
}, 1000);
} else if (tries < maxTries) {
console.debug('Didn\'t find Tail Logs button, will try again...');
setTimeout(function () {
loop(tries + 1);
}, 250);
} else {
console.debug('Giving up trying to click Tail Logs button');
}
};
loop(0);
})();