Skip to content

Expand pipeline logs based on clicked graph node#42

Merged
timja merged 4 commits intojenkinsci:mainfrom
timbrown5:getExpandedNodeHierarchy
Aug 2, 2021
Merged

Expand pipeline logs based on clicked graph node#42
timja merged 4 commits intojenkinsci:mainfrom
timbrown5:getExpandedNodeHierarchy

Conversation

@timbrown5
Copy link
Contributor

Allow control to expand a set of nodes on load (whilst allowing the user to toggle nodes from then on).

This doesn't read the selected-node variable added by @timja - I assume that's easy, but couldn't see an easy way 😅 .

@timbrown5 timbrown5 requested a review from a team as a code owner August 2, 2021 12:10
@timbrown5 timbrown5 changed the title Get expanded node hierarchy Expand nodes based on passed HTTP parameter. Aug 2, 2021
@timja
Copy link
Member

timja commented Aug 2, 2021

Allow control to expand a set of nodes on load (whilst allowing the user to toggle nodes from then on).

This doesn't read the selected-node variable added by @timja - I assume that's easy, but couldn't see an easy way 😅 .

https://developer.mozilla.org/en-US/docs/Web/API/Location/search

if this was a functional component I would use the react hook useSearch but it's not for some reason.

IIRC search is case sensitive and it's not an object (need to call .get("")) so don't try access with . or blah["param"]

@timbrown5
Copy link
Contributor Author

Thanks, it's now reading selected-node. There is an issue that selecting the first stage of a parallel block only expands the parent stage (not the child one). Selecting the second node works as expected (it expands the parent and child).
I believe this is because the ID of the node in the graph is that of the parent, and not the child (so the ID passed to the console view is that of the parent).

'Select > Nested 1' (incorrect - only 'Branch C' is expanded).
Screenshot 2021-08-02 at 13 31 59
Results in:
Screenshot 2021-08-02 at 13 32 03

'Select > Nested 2' (correct, 'Branch C' and 'Nested 2' expanded).
Screenshot 2021-08-02 at 13 32 26

Results in:
Screenshot 2021-08-02 at 13 32 30

pipeline {
    agent any
    stages {
        stage('Non-Parallel Stage') {
            steps {
                echo 'This stage will be executed first.'
            }
        }
        stage('Parallel Stage') {
            failFast true
            parallel {
                stage('Branch A') {
                    steps {
                        echo ""
                        echo "On Branch A - 2"
                    }
                }
                stage('Branch B') {
                    steps {
                        echo "On Branch B - 1"
                        echo "On Branch B - 2"
                    }
                }
                stage('Branch C') {
                    stages {
                        stage('Nested 1') {
                            steps {
                                echo "In stage Nested 1 - 1 within Branch C"
                                echo "In stage Nested 1 - 2 within Branch C"
                            }
                        }
                        stage('Nested 2') {
                            steps {
                                echo "In stage Nested 2 - 1 within Branch C"
                                echo "In stage Nested 2 - 2 within Branch C"
                            }
                        }
                        stage('Nested 3') {
                            steps {
                                echo "In stage Nested 3 - 1 within Branch C"
                                echo "In stage Nested 3 - 2 within Branch C"
                            }
                        }
                    }
                }
            }
        }
        stage('Skipped stage') {
            when {
                branch 'master'
            }
            steps {
                echo 'This stage will be skipped.'
            }
        }
    }
}

@timbrown5
Copy link
Contributor Author

There is another issue (which I think is part of #18) that 'Nested 3' is not shown inside the 'Branch C' but as a sequential stage:
Screenshot 2021-08-02 at 13 38 00

@timja timja added the enhancement New feature or request label Aug 2, 2021
Copy link
Member

@timja timja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested locally, works except where you noted already.

🚢

@timja timja changed the title Expand nodes based on passed HTTP parameter. Expand pipeline logs based on clicked graph node. Aug 2, 2021
@timja timja enabled auto-merge (squash) August 2, 2021 13:04
@timja timja changed the title Expand pipeline logs based on clicked graph node. Expand pipeline logs based on clicked graph node Aug 2, 2021
@timja timja disabled auto-merge August 2, 2021 13:05
@timja timja changed the title Expand pipeline logs based on clicked graph node Expand pipeline logs based on clicked graph node. Aug 2, 2021
@timja timja changed the title Expand pipeline logs based on clicked graph node. Expand pipeline logs based on clicked graph node Aug 2, 2021
@timja timja enabled auto-merge (squash) August 2, 2021 13:05
@timja timja merged commit 6487ab8 into jenkinsci:main Aug 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants