Skip to content

Commit c44d36d

Browse files
committed
show items with same display name on job and build pages
[JENKINS-54231]
1 parent 3fec4c9 commit c44d36d

File tree

8 files changed

+23
-21
lines changed

8 files changed

+23
-21
lines changed

docs/Home.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ Browse the Jenkins issue tracker to see any [open issues](https://issues.jenkins
3737
([JENKINS-44142](https://issues.jenkins-ci.org/browse/JENKINS-44142))
3838
* Fixed [[Dynamic DSL]] problem
3939
([JENKINS-57817](https://issues.jenkins-ci.org/browse/JENKINS-57817))
40+
* Show items with same display name on job and build pages
41+
([JENKINS-54231](https://issues.jenkins-ci.org/browse/JENKINS-54231))
4042
* Deprecated `concurrentBuild` method in `pipelineJob` context, see [Migration](Migration#migrating-to-176)
4143
([JENKINS-53775](https://issues.jenkins-ci.org/browse/JENKINS-53775))
4244
* Support for older versions of the [Pipeline Job Plugin](https://plugins.jenkins.io/workflow-job) is deprecated, see

job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/actions/GeneratedJobsAction.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ class GeneratedJobsAction extends GeneratedObjectsAction<GeneratedJob, Generated
1010
super(job, GeneratedJobsBuildAction)
1111
}
1212

13-
Set<Item> getItems() {
14-
Set<Item> result = new TreeSet<>(Comparators.ITEM_COMPARATOR)
13+
Iterable<Item> getItems() {
14+
Set<Item> result = []
1515
for (Run run : job.builds) {
1616
GeneratedJobsBuildAction action = run.getAction(GeneratedJobsBuildAction)
1717
if (action != null) {
1818
result.addAll(action.items)
1919
}
2020
}
21-
result
21+
result.toSorted(Comparators.ITEM_COMPARATOR)
2222
}
2323
}

job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/actions/GeneratedJobsBuildAction.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ class GeneratedJobsBuildAction extends GeneratedObjectsRunAction<GeneratedJob> {
1919
this.lookupStrategy = lookupStrategy
2020
}
2121

22-
Set<Item> getItems() {
23-
Set<Item> result = new TreeSet<>(Comparators.ITEM_COMPARATOR)
22+
Iterable<Item> getItems() {
23+
Set<Item> result = []
2424
for (GeneratedJob job : modifiedObjects) {
2525
Item item = lookupStrategy.getItem(owner.parent, job.jobName, Item)
2626
if (item != null) {
2727
result << item
2828
}
2929
}
30-
result
30+
result.toSorted(Comparators.ITEM_COMPARATOR)
3131
}
3232

3333
@Override

job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/actions/GeneratedViewsAction.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ class GeneratedViewsAction extends GeneratedObjectsAction<GeneratedView, Generat
1010
super(job, GeneratedViewsBuildAction)
1111
}
1212

13-
Set<View> getViews() {
14-
Set<View> result = new TreeSet<>(Comparators.VIEW_COMPARATOR)
13+
Iterable<View> getViews() {
14+
Set<View> result = []
1515
for (Run run : job.builds) {
1616
GeneratedViewsBuildAction action = run.getAction(GeneratedViewsBuildAction)
1717
if (action != null) {
1818
result.addAll(action.views)
1919
}
2020
}
21-
result
21+
result.toSorted(Comparators.VIEW_COMPARATOR)
2222
}
2323
}

job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/actions/GeneratedViewsBuildAction.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ class GeneratedViewsBuildAction extends GeneratedObjectsRunAction<GeneratedView>
2222
this.lookupStrategy = lookupStrategy
2323
}
2424

25-
Set<View> getViews() {
26-
Set<View> allGeneratedViews = new TreeSet<>(Comparators.VIEW_COMPARATOR)
25+
Iterable<View> getViews() {
26+
Set<View> allGeneratedViews = []
2727
for (GeneratedView generatedView : modifiedObjects) {
2828
ItemGroup itemGroup = lookupStrategy.getParent(owner.parent, generatedView.name)
2929
if (itemGroup instanceof ViewGroup) {
@@ -34,7 +34,7 @@ class GeneratedViewsBuildAction extends GeneratedObjectsRunAction<GeneratedView>
3434
}
3535
}
3636
}
37-
allGeneratedViews
37+
allGeneratedViews.toSorted(Comparators.VIEW_COMPARATOR)
3838
}
3939

4040
@Override

job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/actions/GeneratedJobsBuildActionSpec.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ class GeneratedJobsBuildActionSpec extends Specification {
4646
action.onLoad(run)
4747

4848
when:
49-
Set<Item> items = action.items
49+
Iterable<Item> items = action.items
5050

5151
then:
5252
items != null
53-
items.empty
53+
items.size() == 0
5454
}
5555

5656
def 'get items'() {

job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/actions/GeneratedViewsActionSpec.groovy

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ class GeneratedViewsActionSpec extends Specification {
8282
project.builds >> fromRuns([])
8383

8484
when:
85-
Set<View> views = new GeneratedViewsAction(project).views
85+
Iterable<View> views = new GeneratedViewsAction(project).views
8686

8787
then:
8888
views != null
89-
views.isEmpty()
89+
views.size() == 0
9090
}
9191

9292
def 'getViews no build action'() {
@@ -95,11 +95,11 @@ class GeneratedViewsActionSpec extends Specification {
9595
project.builds >> fromRuns([build1])
9696

9797
when:
98-
Set<View> views = new GeneratedViewsAction(project).views
98+
Iterable<View> views = new GeneratedViewsAction(project).views
9999

100100
then:
101101
views != null
102-
views.isEmpty()
102+
views.size() == 0
103103
}
104104

105105
def 'getViews'() {
@@ -116,7 +116,7 @@ class GeneratedViewsActionSpec extends Specification {
116116
project.builds >> fromRuns([build1, build2])
117117

118118
when:
119-
Set<View> views = new GeneratedViewsAction(project).views
119+
Iterable<View> views = new GeneratedViewsAction(project).views
120120

121121
then:
122122
views != null

job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/actions/GeneratedViewsBuildActionSpec.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ class GeneratedViewsBuildActionSpec extends Specification {
4646
action.onLoad(run)
4747

4848
when:
49-
Set<View> views = action.views
49+
Iterable<View> views = action.views
5050

5151
then:
5252
views != null
53-
views.empty
53+
views.size() == 0
5454
}
5555

5656
def 'get views'() {

0 commit comments

Comments
 (0)