File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 1
1
// ==UserScript==
2
2
// @name Auto-Tail CodePipeline Logs
3
3
// @namespace http://softwareengineerprogrammer.github.io
4
- // @version 0.1
4
+ // @version 0.2
5
5
// @description un-papercut tail logs
6
6
// @author softwareengineerprogrammer
7
7
// @match https://*.console.aws.amazon.com/codesuite/codepipeline/pipelines/*/debug*
13
13
( function ( ) {
14
14
'use strict' ;
15
15
16
- let maxTries = 10 ;
16
+ function isHidden ( el ) {
17
+ return el && ( el . offsetParent === null ) ;
18
+ }
19
+
20
+ const maxTries = 50 ;
17
21
let loop = function ( tries ) {
18
22
let elt = document . querySelector ( '.dx-LogTab__header > awsui-button:nth-child(2) > button:nth-child(1) > span:nth-child(1)' ) ;
19
23
if ( elt ) {
22
26
setTimeout ( function ( ) {
23
27
elt . click ( ) ;
24
28
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
+
25
37
} , 1000 ) ;
26
38
} else if ( tries < maxTries ) {
27
39
console . debug ( 'Didn\'t find Tail Logs button, will try again...' ) ;
You can’t perform that action at this time.
0 commit comments