Skip to content

Commit 4dbb5b0

Browse files
committed
Link to image stream tags in the same namespace from the build config
Fixes openshift/origin#5414
1 parent 2a982a1 commit 4dbb5b0

File tree

5 files changed

+91
-24
lines changed

5 files changed

+91
-24
lines changed

app/scripts/services/navigate.js

+6
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,12 @@ angular.module("openshiftConsole")
179179
url.segment("images")
180180
.segmentCoded(name);
181181
break;
182+
case "ImageStreamTag":
183+
var ind = name.indexOf(':');
184+
url.segment("images")
185+
.segmentCoded(name.substring(0, ind))
186+
.segmentCoded(name.substring(ind + 1));
187+
break;
182188
case "PersistentVolumeClaim":
183189
case "Pod":
184190
case "Route":

app/views/browse/_build-details.html

+10-2
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,16 @@ <h3>Configuration <span class="small" ng-if="buildConfigName">created from <a hr
7272
<dd ng-if-end>{{build.spec.source.git.ref}}</dd>
7373
<dt ng-if-start="build.spec.source.contextDir">Source Context Dir:</dt>
7474
<dd ng-if-end>{{build.spec.source.contextDir}}</dd>
75-
<dt ng-if-start="build.spec.output.to">Output Image:</dt>
76-
<dd ng-if-end>{{build.spec.output.to | imageObjectRef : build.metadata.namespace}}</dd>
75+
<dt ng-if-start="outputTo = build.spec.output.to">Output Image:</dt>
76+
<dd ng-if-end>
77+
<a ng-if="outputTo.kind === 'ImageStreamTag' && (!outputTo.namespace || build.metadata.namespace === outputTo.namespace)"
78+
ng-href="{{outputTo.name | navigateResourceURL : 'ImageStreamTag' : build.metadata.namespace}}">
79+
{{outputTo | imageObjectRef : build.metadata.namespace}}
80+
</a>
81+
<span ng-if="outputTo.kind !== 'ImageStreamTag' || (outputTo.namespace && build.metadata.namespace !== outputTo.namespace)">
82+
{{outputTo | imageObjectRef : build.metadata.namespace}}
83+
</span>
84+
</dd>
7785
<dt ng-if-start="build.spec.output.pushSecret.name">Push Secret:</dt>
7886
<dd ng-if-end>{{build.spec.output.pushSecret.name}}</dd>
7987
<dt ng-if-start="build.spec.strategy.jenkinsPipelineStrategy.jenkinsfilePath">

app/views/browse/build-config.html

+28-6
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,27 @@ <h4>{{imageSource.from | imageObjectRef : buildConfig.metadata.namespace}}</h4>
267267
</div>
268268
</div>
269269
</div>
270-
<dt ng-if-start="(buildConfig | buildStrategy).from">Builder Image:</dt>
271-
<dd ng-if-end>{{(buildConfig | buildStrategy).from | imageObjectRef : buildConfig.metadata.namespace}}</dd>
272-
<div ng-if="buildConfig.spec.output.to">
270+
<dt ng-if-start="buildFrom = (buildConfig | buildStrategy).from">Builder Image:</dt>
271+
<dd ng-if-end>
272+
<a ng-if="buildFrom.kind === 'ImageStreamTag' && (!buildFrom.namespace || buildConfig.metadata.namespace === buildFrom.namespace)"
273+
ng-href="{{buildFrom.name | navigateResourceURL : 'ImageStreamTag' : buildConfig.metadata.namespace}}">
274+
{{buildFrom | imageObjectRef : buildConfig.metadata.namespace}}
275+
</a>
276+
<span ng-if="buildFrom.kind !== 'ImageStreamTag' || (buildFrom.namespace && buildConfig.metadata.namespace !== buildFrom.namespace)">
277+
{{buildFrom | imageObjectRef : buildConfig.metadata.namespace}}
278+
</span>
279+
</dd>
280+
<div ng-if="outputTo = buildConfig.spec.output.to">
273281
<dt>Output To:</dt>
274-
<dd>{{buildConfig.spec.output.to | imageObjectRef : buildConfig.metadata.namespace}}</dd>
282+
<dd>
283+
<a ng-if="outputTo.kind === 'ImageStreamTag' && (!outputTo.namespace || buildConfig.metadata.namespace === outputTo.namespace)"
284+
ng-href="{{outputTo.name | navigateResourceURL : 'ImageStreamTag' : buildConfig.metadata.namespace}}">
285+
{{outputTo | imageObjectRef : buildConfig.metadata.namespace}}
286+
</a>
287+
<span ng-if="outputTo.kind !== 'ImageStreamTag' || (outputTo.namespace && buildConfig.metadata.namespace !== outputTo.namespace)">
288+
{{outputTo | imageObjectRef : buildConfig.metadata.namespace}}
289+
</span>
290+
</dd>
275291
</div>
276292
<div class="run-policy">
277293
<dt>Run Policy:</dt>
@@ -333,8 +349,14 @@ <h3>Triggers</h3>
333349
<dt>
334350
New Image For:
335351
</dt>
336-
<dd>
337-
{{(trigger.imageChange.from || (buildConfig | buildStrategy).from) | imageObjectRef : buildConfig.metadata.namespace}}
352+
<dd ng-init="triggerFrom = (trigger.imageChange.from || (buildConfig | buildStrategy).from)">
353+
<a ng-if="triggerFrom.kind === 'ImageStreamTag' && (!triggerFrom.namespace || buildConfig.metadata.namespace === triggerFrom.namespace)"
354+
ng-href="{{triggerFrom.name | navigateResourceURL : 'ImageStreamTag' : buildConfig.metadata.namespace}}">
355+
{{triggerFrom | imageObjectRef : buildConfig.metadata.namespace}}
356+
</a>
357+
<span ng-if="triggerFrom.kind !== 'ImageStreamTag' || (triggerFrom.namespace && buildConfig.metadata.namespace !== triggerFrom.namespace)">
358+
{{triggerFrom | imageObjectRef : buildConfig.metadata.namespace}}
359+
</span>
338360
</dd>
339361
</div>
340362
<div ng-switch-when="ConfigChange">

dist/scripts/scripts.js

+13-8
Original file line numberDiff line numberDiff line change
@@ -2174,6 +2174,11 @@ case "ImageStream":
21742174
i.segment("images").segmentCoded(h);
21752175
break;
21762176

2177+
case "ImageStreamTag":
2178+
var m = h.indexOf(":");
2179+
i.segment("images").segmentCoded(h.substring(0, m)).segmentCoded(h.substring(m + 1));
2180+
break;
2181+
21772182
case "PersistentVolumeClaim":
21782183
case "Pod":
21792184
case "Route":
@@ -2183,16 +2188,16 @@ i.segment(g.kindToResource(b)).segmentCoded(h);
21832188
break;
21842189

21852190
default:
2186-
var m;
2187-
if (a.metadata) m = g.objectToResourceGroupVersion(a); else if (_.get(e, "apiVersion")) {
2188-
var n = g.kindToResource(b), o = g.parseGroupVersion(e.apiVersion);
2189-
o.resource = n, m = g.toResourceGroupVersion(o);
2190-
} else m = g.toResourceGroupVersion(g.kindToResource(b));
2191-
var p = g.apiInfo(m);
2192-
if (!p) return null;
2191+
var n;
2192+
if (a.metadata) n = g.objectToResourceGroupVersion(a); else if (_.get(e, "apiVersion")) {
2193+
var o = g.kindToResource(b), p = g.parseGroupVersion(e.apiVersion);
2194+
p.resource = o, n = g.toResourceGroupVersion(p);
2195+
} else n = g.toResourceGroupVersion(g.kindToResource(b));
2196+
var q = g.apiInfo(n);
2197+
if (!q) return null;
21932198
i.segment("other").search({
21942199
kind:b,
2195-
group:m.group
2200+
group:n.group
21962201
});
21972202
}
21982203
return i.toString();

dist/scripts/templates.js

+34-8
Original file line numberDiff line numberDiff line change
@@ -1278,8 +1278,15 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
12781278
"<dd ng-if-end>{{build.spec.source.git.ref}}</dd>\n" +
12791279
"<dt ng-if-start=\"build.spec.source.contextDir\">Source Context Dir:</dt>\n" +
12801280
"<dd ng-if-end>{{build.spec.source.contextDir}}</dd>\n" +
1281-
"<dt ng-if-start=\"build.spec.output.to\">Output Image:</dt>\n" +
1282-
"<dd ng-if-end>{{build.spec.output.to | imageObjectRef : build.metadata.namespace}}</dd>\n" +
1281+
"<dt ng-if-start=\"outputTo = build.spec.output.to\">Output Image:</dt>\n" +
1282+
"<dd ng-if-end>\n" +
1283+
"<a ng-if=\"outputTo.kind === 'ImageStreamTag' && (!outputTo.namespace || build.metadata.namespace === outputTo.namespace)\" ng-href=\"{{outputTo.name | navigateResourceURL : 'ImageStreamTag' : build.metadata.namespace}}\">\n" +
1284+
"{{outputTo | imageObjectRef : build.metadata.namespace}}\n" +
1285+
"</a>\n" +
1286+
"<span ng-if=\"outputTo.kind !== 'ImageStreamTag' || (outputTo.namespace && build.metadata.namespace !== outputTo.namespace)\">\n" +
1287+
"{{outputTo | imageObjectRef : build.metadata.namespace}}\n" +
1288+
"</span>\n" +
1289+
"</dd>\n" +
12831290
"<dt ng-if-start=\"build.spec.output.pushSecret.name\">Push Secret:</dt>\n" +
12841291
"<dd ng-if-end>{{build.spec.output.pushSecret.name}}</dd>\n" +
12851292
"<dt ng-if-start=\"build.spec.strategy.jenkinsPipelineStrategy.jenkinsfilePath\">\n" +
@@ -1897,11 +1904,25 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
18971904
"</div>\n" +
18981905
"</div>\n" +
18991906
"</div>\n" +
1900-
"<dt ng-if-start=\"(buildConfig | buildStrategy).from\">Builder Image:</dt>\n" +
1901-
"<dd ng-if-end>{{(buildConfig | buildStrategy).from | imageObjectRef : buildConfig.metadata.namespace}}</dd>\n" +
1902-
"<div ng-if=\"buildConfig.spec.output.to\">\n" +
1907+
"<dt ng-if-start=\"buildFrom = (buildConfig | buildStrategy).from\">Builder Image:</dt>\n" +
1908+
"<dd ng-if-end>\n" +
1909+
"<a ng-if=\"buildFrom.kind === 'ImageStreamTag' && (!buildFrom.namespace || buildConfig.metadata.namespace === buildFrom.namespace)\" ng-href=\"{{buildFrom.name | navigateResourceURL : 'ImageStreamTag' : buildConfig.metadata.namespace}}\">\n" +
1910+
"{{buildFrom | imageObjectRef : buildConfig.metadata.namespace}}\n" +
1911+
"</a>\n" +
1912+
"<span ng-if=\"buildFrom.kind !== 'ImageStreamTag' || (buildFrom.namespace && buildConfig.metadata.namespace !== buildFrom.namespace)\">\n" +
1913+
"{{buildFrom | imageObjectRef : buildConfig.metadata.namespace}}\n" +
1914+
"</span>\n" +
1915+
"</dd>\n" +
1916+
"<div ng-if=\"outputTo = buildConfig.spec.output.to\">\n" +
19031917
"<dt>Output To:</dt>\n" +
1904-
"<dd>{{buildConfig.spec.output.to | imageObjectRef : buildConfig.metadata.namespace}}</dd>\n" +
1918+
"<dd>\n" +
1919+
"<a ng-if=\"outputTo.kind === 'ImageStreamTag' && (!outputTo.namespace || buildConfig.metadata.namespace === outputTo.namespace)\" ng-href=\"{{outputTo.name | navigateResourceURL : 'ImageStreamTag' : buildConfig.metadata.namespace}}\">\n" +
1920+
"{{outputTo | imageObjectRef : buildConfig.metadata.namespace}}\n" +
1921+
"</a>\n" +
1922+
"<span ng-if=\"outputTo.kind !== 'ImageStreamTag' || (outputTo.namespace && buildConfig.metadata.namespace !== outputTo.namespace)\">\n" +
1923+
"{{outputTo | imageObjectRef : buildConfig.metadata.namespace}}\n" +
1924+
"</span>\n" +
1925+
"</dd>\n" +
19051926
"</div>\n" +
19061927
"<div class=\"run-policy\">\n" +
19071928
"<dt>Run Policy:</dt>\n" +
@@ -1963,8 +1984,13 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
19631984
"<dt>\n" +
19641985
"New Image For:\n" +
19651986
"</dt>\n" +
1966-
"<dd>\n" +
1967-
"{{(trigger.imageChange.from || (buildConfig | buildStrategy).from) | imageObjectRef : buildConfig.metadata.namespace}}\n" +
1987+
"<dd ng-init=\"triggerFrom = (trigger.imageChange.from || (buildConfig | buildStrategy).from)\">\n" +
1988+
"<a ng-if=\"triggerFrom.kind === 'ImageStreamTag' && (!triggerFrom.namespace || buildConfig.metadata.namespace === triggerFrom.namespace)\" ng-href=\"{{triggerFrom.name | navigateResourceURL : 'ImageStreamTag' : buildConfig.metadata.namespace}}\">\n" +
1989+
"{{triggerFrom | imageObjectRef : buildConfig.metadata.namespace}}\n" +
1990+
"</a>\n" +
1991+
"<span ng-if=\"triggerFrom.kind !== 'ImageStreamTag' || (triggerFrom.namespace && buildConfig.metadata.namespace !== triggerFrom.namespace)\">\n" +
1992+
"{{triggerFrom | imageObjectRef : buildConfig.metadata.namespace}}\n" +
1993+
"</span>\n" +
19681994
"</dd>\n" +
19691995
"</div>\n" +
19701996
"<div ng-switch-when=\"ConfigChange\">\n" +

0 commit comments

Comments
 (0)