@@ -8,42 +8,17 @@ export class JenkinsConfigure extends GoToAction {
88 return null ;
99 }
1010
11- const selector = JenkinsHelpers . getBreadcrumbItemSelector ( bodyElement ) ;
12- const breadCrumbListItems = doc . querySelectorAll ( selector ) ;
13- if ( breadCrumbListItems ) {
14- const urlParts = JenkinsHelpers . splitUrlPath ( urlString ) ;
15- const isUrlToRun =
16- "job" === urlParts [ urlParts . length - 3 ] &&
17- JenkinsHelpers . isInteger ( urlParts [ urlParts . length - 1 ] ) ;
18- if ( isUrlToRun ) {
19- const penultimateItem = breadCrumbListItems . item (
20- breadCrumbListItems . length - 2
21- ) ;
22- const anchor = penultimateItem . querySelector ( "a" ) ;
23- if ( anchor ) {
24- const path = anchor . getAttribute ( "href" ) ;
25- if ( path ) {
26- return (
27- JenkinsHelpers . buildUrl ( urlString , path ) +
28- "configure"
29- ) ;
30- }
31- }
32- return null ;
33- }
34- const lastItem = breadCrumbListItems . item (
35- breadCrumbListItems . length - 1
36- ) ;
37- const anchor = lastItem . querySelector ( "a" ) ;
38- if ( anchor ) {
39- const path = anchor . getAttribute ( "href" ) ;
40- if ( path ) {
41- return (
42- JenkinsHelpers . buildUrl ( urlString , path ) + "configure"
43- ) ;
44- }
45- }
11+ const jenkinsPage = JenkinsHelpers . parsePage (
12+ bodyElement ,
13+ urlString
14+ ) ;
15+ const jobCrumb = jenkinsPage . findJobCrumb ( ) ;
16+ if ( jobCrumb ) {
17+ const path = jobCrumb . href ;
18+ return jenkinsPage . buildUrl ( path + "configure" ) ;
4619 }
47- return null ;
20+ const lastCrumb = jenkinsPage . lastCrumb ( ) ;
21+ const path = lastCrumb . href ;
22+ return jenkinsPage . buildUrl ( path + "configure" ) ;
4823 }
4924}
0 commit comments