tophat / jenkins-timeline-plugin

A build timeline to facilitate the inspection of Jenkins pipelines and identify bottlenecks.
https://jenkinstimeline.com
Apache License 2.0
34 stars 11 forks source link

Update build url when navigating between build views #124

Open KimiJL opened 3 years ago

KimiJL commented 3 years ago

Is your feature request related to a problem? Please describe. Spawned from a discussion in https://github.com/tophat/jenkins-timeline-plugin/pull/120#pullrequestreview-605802987 where a feature to navigate between adjacent build is added

Currently navigating to new url does not update the url or the buildUrl state. This also applies to when using the Back button, it would also go back to the original build since we do not update the buildUrl.

The better way forward is likely to show on the url which build we have navigated to, and when backing to regular jenkins view, see the build that it's presently on inside jenkins-timeline

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

mcataford commented 3 years ago

Something I envision for this would be along the lines of the regular Jenkins URLS, something like /job/<job_id>/build/<build_id> instead of the current queryparam that contains that information. We don't necessarily have to throw in proper app state right away, but having this information neatly encoded in the URL and updated as we go would be neat.

What do you think?

KimiJL commented 3 years ago

I see what you mean now! I think I misunderstood initially.

Yeah, I think one way to do this is on the Java MenuItem end, instead of "/plugin/pipeline-timeline/index.html?build_url="+this.buildUrl;" do parse buildUrl to strip the https://jenkins.**.com out "/plugin/pipeline-timeline/strippedBuildUrl/index.html";

so it'd be /plugin/pipline-timeline/job/yourjob/build/3/index.html

A more UX question is, if Back button is clicked, should it go to the original build, or the build that it currently navigated to?

mcataford commented 3 years ago

IMO the Back Button as in "Back to Jenkins" should lead back to the Jenkins build page corresponding to the timeline you are viewing. If we know the build and job ids, composing the URL we need to jump to should be pretty straightforward.

I do think you're on the right track re:the URL, there's a change on the Java side to communicate where you want to go to the webapp, and some routing logic in React.

KimiJL commented 3 years ago

Agreed on the Back Button behaviour, and yeah the change is pretty trivial regardless of the way URL is passed.

I found where the Java side of things is URL wise, I think i'm ready to pick this up and see where it goes.

mcataford commented 3 years ago

Neat! Let me know if you want eyes on your PR along the way!