Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link to image stream tags in the same namespace from the build config #922

Merged
merged 1 commit into from
Nov 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/scripts/services/navigate.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ angular.module("openshiftConsole")
url.segment("images")
.segmentCoded(name);
break;
case "ImageStreamTag":
var ind = name.indexOf(':');
url.segment("images")
.segmentCoded(name.substring(0, ind))
.segmentCoded(name.substring(ind + 1));
break;
case "PersistentVolumeClaim":
case "Pod":
case "Route":
Expand Down
12 changes: 10 additions & 2 deletions app/views/browse/_build-details.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,16 @@ <h3>Configuration <span class="small" ng-if="buildConfigName">created from <a hr
<dd ng-if-end>{{build.spec.source.git.ref}}</dd>
<dt ng-if-start="build.spec.source.contextDir">Source Context Dir:</dt>
<dd ng-if-end>{{build.spec.source.contextDir}}</dd>
<dt ng-if-start="build.spec.output.to">Output Image:</dt>
<dd ng-if-end>{{build.spec.output.to | imageObjectRef : build.metadata.namespace}}</dd>
<dt ng-if-start="outputTo = build.spec.output.to">Output Image:</dt>
<dd ng-if-end>
<a ng-if="outputTo.kind === 'ImageStreamTag' && (!outputTo.namespace || build.metadata.namespace === outputTo.namespace)"
ng-href="{{outputTo.name | navigateResourceURL : 'ImageStreamTag' : build.metadata.namespace}}">
{{outputTo | imageObjectRef : build.metadata.namespace}}
</a>
<span ng-if="outputTo.kind !== 'ImageStreamTag' || (outputTo.namespace && build.metadata.namespace !== outputTo.namespace)">
{{outputTo | imageObjectRef : build.metadata.namespace}}
</span>
</dd>
<dt ng-if-start="build.spec.output.pushSecret.name">Push Secret:</dt>
<dd ng-if-end>{{build.spec.output.pushSecret.name}}</dd>
<dt ng-if-start="build.spec.strategy.jenkinsPipelineStrategy.jenkinsfilePath">
Expand Down
34 changes: 28 additions & 6 deletions app/views/browse/build-config.html
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,27 @@ <h4>{{imageSource.from | imageObjectRef : buildConfig.metadata.namespace}}</h4>
</div>
</div>
</div>
<dt ng-if-start="(buildConfig | buildStrategy).from">Builder Image:</dt>
<dd ng-if-end>{{(buildConfig | buildStrategy).from | imageObjectRef : buildConfig.metadata.namespace}}</dd>
<div ng-if="buildConfig.spec.output.to">
<dt ng-if-start="buildFrom = (buildConfig | buildStrategy).from">Builder Image:</dt>
<dd ng-if-end>
<a ng-if="buildFrom.kind === 'ImageStreamTag' && (!buildFrom.namespace || buildConfig.metadata.namespace === buildFrom.namespace)"
ng-href="{{buildFrom.name | navigateResourceURL : 'ImageStreamTag' : buildConfig.metadata.namespace}}">
{{buildFrom | imageObjectRef : buildConfig.metadata.namespace}}
</a>
<span ng-if="buildFrom.kind !== 'ImageStreamTag' || (buildFrom.namespace && buildConfig.metadata.namespace !== buildFrom.namespace)">
{{buildFrom | imageObjectRef : buildConfig.metadata.namespace}}
</span>
</dd>
<div ng-if="outputTo = buildConfig.spec.output.to">
<dt>Output To:</dt>
<dd>{{buildConfig.spec.output.to | imageObjectRef : buildConfig.metadata.namespace}}</dd>
<dd>
<a ng-if="outputTo.kind === 'ImageStreamTag' && (!outputTo.namespace || buildConfig.metadata.namespace === outputTo.namespace)"
ng-href="{{outputTo.name | navigateResourceURL : 'ImageStreamTag' : buildConfig.metadata.namespace}}">
{{outputTo | imageObjectRef : buildConfig.metadata.namespace}}
</a>
<span ng-if="outputTo.kind !== 'ImageStreamTag' || (outputTo.namespace && buildConfig.metadata.namespace !== outputTo.namespace)">
{{outputTo | imageObjectRef : buildConfig.metadata.namespace}}
</span>
</dd>
</div>
<div class="run-policy">
<dt>Run Policy:</dt>
Expand Down Expand Up @@ -333,8 +349,14 @@ <h3>Triggers</h3>
<dt>
New Image For:
</dt>
<dd>
{{(trigger.imageChange.from || (buildConfig | buildStrategy).from) | imageObjectRef : buildConfig.metadata.namespace}}
<dd ng-init="triggerFrom = (trigger.imageChange.from || (buildConfig | buildStrategy).from)">
<a ng-if="triggerFrom.kind === 'ImageStreamTag' && (!triggerFrom.namespace || buildConfig.metadata.namespace === triggerFrom.namespace)"
ng-href="{{triggerFrom.name | navigateResourceURL : 'ImageStreamTag' : buildConfig.metadata.namespace}}">
{{triggerFrom | imageObjectRef : buildConfig.metadata.namespace}}
</a>
<span ng-if="triggerFrom.kind !== 'ImageStreamTag' || (triggerFrom.namespace && buildConfig.metadata.namespace !== triggerFrom.namespace)">
{{triggerFrom | imageObjectRef : buildConfig.metadata.namespace}}
</span>
</dd>
</div>
<div ng-switch-when="ConfigChange">
Expand Down
21 changes: 13 additions & 8 deletions dist/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2174,6 +2174,11 @@ case "ImageStream":
i.segment("images").segmentCoded(h);
break;

case "ImageStreamTag":
var m = h.indexOf(":");
i.segment("images").segmentCoded(h.substring(0, m)).segmentCoded(h.substring(m + 1));
break;

case "PersistentVolumeClaim":
case "Pod":
case "Route":
Expand All @@ -2183,16 +2188,16 @@ i.segment(g.kindToResource(b)).segmentCoded(h);
break;

default:
var m;
if (a.metadata) m = g.objectToResourceGroupVersion(a); else if (_.get(e, "apiVersion")) {
var n = g.kindToResource(b), o = g.parseGroupVersion(e.apiVersion);
o.resource = n, m = g.toResourceGroupVersion(o);
} else m = g.toResourceGroupVersion(g.kindToResource(b));
var p = g.apiInfo(m);
if (!p) return null;
var n;
if (a.metadata) n = g.objectToResourceGroupVersion(a); else if (_.get(e, "apiVersion")) {
var o = g.kindToResource(b), p = g.parseGroupVersion(e.apiVersion);
p.resource = o, n = g.toResourceGroupVersion(p);
} else n = g.toResourceGroupVersion(g.kindToResource(b));
var q = g.apiInfo(n);
if (!q) return null;
i.segment("other").search({
kind:b,
group:m.group
group:n.group
});
}
return i.toString();
Expand Down
42 changes: 34 additions & 8 deletions dist/scripts/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -1278,8 +1278,15 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<dd ng-if-end>{{build.spec.source.git.ref}}</dd>\n" +
"<dt ng-if-start=\"build.spec.source.contextDir\">Source Context Dir:</dt>\n" +
"<dd ng-if-end>{{build.spec.source.contextDir}}</dd>\n" +
"<dt ng-if-start=\"build.spec.output.to\">Output Image:</dt>\n" +
"<dd ng-if-end>{{build.spec.output.to | imageObjectRef : build.metadata.namespace}}</dd>\n" +
"<dt ng-if-start=\"outputTo = build.spec.output.to\">Output Image:</dt>\n" +
"<dd ng-if-end>\n" +
"<a ng-if=\"outputTo.kind === 'ImageStreamTag' && (!outputTo.namespace || build.metadata.namespace === outputTo.namespace)\" ng-href=\"{{outputTo.name | navigateResourceURL : 'ImageStreamTag' : build.metadata.namespace}}\">\n" +
"{{outputTo | imageObjectRef : build.metadata.namespace}}\n" +
"</a>\n" +
"<span ng-if=\"outputTo.kind !== 'ImageStreamTag' || (outputTo.namespace && build.metadata.namespace !== outputTo.namespace)\">\n" +
"{{outputTo | imageObjectRef : build.metadata.namespace}}\n" +
"</span>\n" +
"</dd>\n" +
"<dt ng-if-start=\"build.spec.output.pushSecret.name\">Push Secret:</dt>\n" +
"<dd ng-if-end>{{build.spec.output.pushSecret.name}}</dd>\n" +
"<dt ng-if-start=\"build.spec.strategy.jenkinsPipelineStrategy.jenkinsfilePath\">\n" +
Expand Down Expand Up @@ -1897,11 +1904,25 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"</div>\n" +
"</div>\n" +
"</div>\n" +
"<dt ng-if-start=\"(buildConfig | buildStrategy).from\">Builder Image:</dt>\n" +
"<dd ng-if-end>{{(buildConfig | buildStrategy).from | imageObjectRef : buildConfig.metadata.namespace}}</dd>\n" +
"<div ng-if=\"buildConfig.spec.output.to\">\n" +
"<dt ng-if-start=\"buildFrom = (buildConfig | buildStrategy).from\">Builder Image:</dt>\n" +
"<dd ng-if-end>\n" +
"<a ng-if=\"buildFrom.kind === 'ImageStreamTag' && (!buildFrom.namespace || buildConfig.metadata.namespace === buildFrom.namespace)\" ng-href=\"{{buildFrom.name | navigateResourceURL : 'ImageStreamTag' : buildConfig.metadata.namespace}}\">\n" +
"{{buildFrom | imageObjectRef : buildConfig.metadata.namespace}}\n" +
"</a>\n" +
"<span ng-if=\"buildFrom.kind !== 'ImageStreamTag' || (buildFrom.namespace && buildConfig.metadata.namespace !== buildFrom.namespace)\">\n" +
"{{buildFrom | imageObjectRef : buildConfig.metadata.namespace}}\n" +
"</span>\n" +
"</dd>\n" +
"<div ng-if=\"outputTo = buildConfig.spec.output.to\">\n" +
"<dt>Output To:</dt>\n" +
"<dd>{{buildConfig.spec.output.to | imageObjectRef : buildConfig.metadata.namespace}}</dd>\n" +
"<dd>\n" +
"<a ng-if=\"outputTo.kind === 'ImageStreamTag' && (!outputTo.namespace || buildConfig.metadata.namespace === outputTo.namespace)\" ng-href=\"{{outputTo.name | navigateResourceURL : 'ImageStreamTag' : buildConfig.metadata.namespace}}\">\n" +
"{{outputTo | imageObjectRef : buildConfig.metadata.namespace}}\n" +
"</a>\n" +
"<span ng-if=\"outputTo.kind !== 'ImageStreamTag' || (outputTo.namespace && buildConfig.metadata.namespace !== outputTo.namespace)\">\n" +
"{{outputTo | imageObjectRef : buildConfig.metadata.namespace}}\n" +
"</span>\n" +
"</dd>\n" +
"</div>\n" +
"<div class=\"run-policy\">\n" +
"<dt>Run Policy:</dt>\n" +
Expand Down Expand Up @@ -1963,8 +1984,13 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<dt>\n" +
"New Image For:\n" +
"</dt>\n" +
"<dd>\n" +
"{{(trigger.imageChange.from || (buildConfig | buildStrategy).from) | imageObjectRef : buildConfig.metadata.namespace}}\n" +
"<dd ng-init=\"triggerFrom = (trigger.imageChange.from || (buildConfig | buildStrategy).from)\">\n" +
"<a ng-if=\"triggerFrom.kind === 'ImageStreamTag' && (!triggerFrom.namespace || buildConfig.metadata.namespace === triggerFrom.namespace)\" ng-href=\"{{triggerFrom.name | navigateResourceURL : 'ImageStreamTag' : buildConfig.metadata.namespace}}\">\n" +
"{{triggerFrom | imageObjectRef : buildConfig.metadata.namespace}}\n" +
"</a>\n" +
"<span ng-if=\"triggerFrom.kind !== 'ImageStreamTag' || (triggerFrom.namespace && buildConfig.metadata.namespace !== triggerFrom.namespace)\">\n" +
"{{triggerFrom | imageObjectRef : buildConfig.metadata.namespace}}\n" +
"</span>\n" +
"</dd>\n" +
"</div>\n" +
"<div ng-switch-when=\"ConfigChange\">\n" +
Expand Down