Showing with 35 additions and 22 deletions.
  1. +17 −4 assets/app/scripts/filters/util.js
  2. +1 −1 assets/app/views/browse/build-config.html
  3. +1 −1 assets/app/views/browse/build.html
  4. +2 −2 assets/app/views/builds.html
  5. +14 −14 pkg/assets/bindata.go
@@ -164,12 +164,25 @@ angular.module('openshiftConsole')
};
})
.filter('githubLink', function() {
return function(link, commit) {
var m = link.match(/^(?:https?:\/\/|git:\/\/|git\+ssh:\/\/|git\+https:\/\/)?(?:[^@]+@)?github\.com[:\/]([^\/]+\/[^\/]+?)(?:\.git(#.*)?)?$/);
return function(link, ref, contextDir) {
var m = link.match(/^(?:https?:\/\/|git:\/\/|git\+ssh:\/\/|git\+https:\/\/)?(?:[^@]+@)?github\.com[:\/]([^\/]+\/[^\/]+?)(\/|(?:\.git(#.*)?))?$/);
if (m) {
link = "https://github.com/" + m[1];
if (commit) {
link += "/commit/" + commit;
// Remove leading / if there is one
if (contextDir && contextDir.charAt(0) === "/") {
contextDir = contextDir.substring(1);
}

// always use /tree for a generic ref instead of /commit or /blob, /tree will always resolve to the right thing.
if (contextDir) {
// Encode it in case there are funky characters in the folder names
contextDir = encodeURIComponent(contextDir);
// But then unencode the / characters
contextDir = contextDir.replace("%2F", "/");
link += "/tree/" + (encodeURIComponent(ref) || "master") + "/" + contextDir;
}
else if (ref && ref !== "master") {
link += "/tree/" + encodeURIComponent(ref);
}
}
return link;
@@ -34,7 +34,7 @@ <h2>{{buildConfig.metadata.name}}</h2>
<div ng-if="buildConfig.spec.source">
<div ng-if="buildConfig.spec.source.type == 'Git'">
<dt>Source repo:</dt>
<dd ng-bind-html='buildConfig.spec.source.git.uri | githubLink | linky'></dd>
<dd ng-bind-html='buildConfig.spec.source.git.uri | githubLink : buildConfig.spec.source.git.ref : buildConfig.spec.source.contextDir | linky'></dd>
<dt ng-if="buildConfig.spec.source.git.ref">Source ref:</dt>
<dd ng-if="buildConfig.spec.source.git.ref">{{buildConfig.spec.source.git.ref}}</dd>
<dt ng-if="buildConfig.spec.source.contextDir">Source context dir:</dt>
@@ -73,7 +73,7 @@
<dt>Source type:</dt>
<dd>{{build.spec.source.type}}</dd>
<dt ng-if="build.spec.source.type === 'Git'">Source repo:</dt>
<dd ng-if="build.spec.source.type === 'Git'"><span ng-bind-html='build.spec.source.git.uri | githubLink | linky'></span></dd>
<dd ng-if="build.spec.source.type === 'Git'"><span ng-bind-html='build.spec.source.git.uri | githubLink : build.spec.source.git.ref : build.spec.source.contextDir | linky'></span></dd>
<dt ng-if="build.spec.source.git.ref">Source ref:</dt>
<dd ng-if="build.spec.source.git.ref">{{build.spec.source.git.ref}}</dd>
<dt ng-if="build.spec.source.contextDir">Source context dir:</dt>
@@ -32,7 +32,7 @@ <h1>Builds</h1>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>{{buildConfigs[buildConfigName].spec.strategy.type}}</td>
<td><span ng-if="buildConfigs[buildConfigName].spec.source.type == 'Git'" ng-bind-html='buildConfigs[buildConfigName].spec.source.git.uri | githubLink | linky'></span></td>
<td><span ng-if="buildConfigs[buildConfigName].spec.source.type == 'Git'" ng-bind-html='buildConfigs[buildConfigName].spec.source.git.uri | githubLink : buildConfigs[buildConfigName].spec.source.git.ref : buildConfigs[buildConfigName].spec.source.contextDir | linky'></span></td>
<td>&nbsp;</td>
</tr>
<!-- Build config with builds, or builds whose build config has since been deleted -->
@@ -98,7 +98,7 @@ <h1>Builds</h1>
<td>{{build.spec.strategy.type}}</td>
<td>
<span ng-if="build.spec.source">
<span ng-if="build.spec.source.type == 'Git'" ng-bind-html='build.spec.source.git.uri | githubLink | linky'></span>
<span ng-if="build.spec.source.type == 'Git'" ng-bind-html='build.spec.source.git.uri | githubLink : build.spec.source.git.ref : build.spec.source.contextDir | linky'></span>
</span>
</td>
<td>