Skip to content

Commit

Permalink
Merge pull request #3058 from tardyp/console_revlink
Browse files Browse the repository at this point in the history
use change.revlink instead of trying to build links
  • Loading branch information
tardyp committed Mar 21, 2017
2 parents 2e95c8f + 6052b56 commit 4f10cd9
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 49 deletions.
1 change: 1 addition & 0 deletions master/buildbot/newsfragments/console_revlink.bugfix
@@ -0,0 +1 @@
``console_view`` now properly uses ``revlink`` metadata to link to changes.
Expand Up @@ -22,16 +22,6 @@ class _changeRow extends Controller
$scope.$on 'showAllInfo', (event, value) =>
@infoIsCollapsed = value

$scope.$watch 'width', (@width) =>
$scope.$watch 'cellWidth', (@cellWidth) =>
$scope.$watch 'change', (@change) =>
if @change
if angular.isString(@change.repository)
@createLink()

createLink: ->
repository = @change.repository.replace('.git', '')
@change.link = "#{repository}/commit/#{@change.revision}"

selectBuild: (build) ->
modal = @$uibModal.open
Expand All @@ -41,9 +31,5 @@ class _changeRow extends Controller
resolve:
selectedBuild: -> build

createFileLink: (file) ->
repository = @change.repository.replace('.git', '')
return "#{repository}/blob/#{@change.revision}/#{file}"

toggleInfo: ->
@infoIsCollapsed = !@infoIsCollapsed
Expand Up @@ -27,36 +27,3 @@ describe 'Change row directive controller', ->
controllerData = element.isolateScope().cr

beforeEach(inject(injected))


it 'should create a correct github link', ->
$scope.change =
builds: []
repository: 'https://github.com/buildbot/buildbot.git'
revision: 'a55049bc2e1320e5c4c8dba11e09079e8005668f'
$scope.$digest()
expect(controllerData.change.link).toBe('https://github.com/buildbot/buildbot/commit/a55049bc2e1320e5c4c8dba11e09079e8005668f')

it 'should create correct github file links', ->
$scope.change =
builds: []
repository: 'https://github.com/buildbot/buildbot.git'
revision: 'a55049bc2e1320e5c4c8dba11e09079e8005668f'
files = [
'master/contrib/github_buildbot.py'
'master/docs/developer/mq.rst'
]
$scope.$digest()
for file in files
expect(controllerData.createFileLink(file)).toBe("https://github.com/buildbot/buildbot/blob/a55049bc2e1320e5c4c8dba11e09079e8005668f/#{file}")

it 'should watch data changes', ->
$scope.change =
builds: []
$scope.$digest()
state1 = controllerData.change
$scope.change =
builds: [{}]
$scope.$digest()
state2 = controllerData.change
expect(state1).not.toEqual(state2)
Expand Up @@ -28,9 +28,9 @@
.info
i.fa.fa-link
p
a(ng-href='{{ cr.change.link }}' target='_blank') {{ cr.change.revision | limitTo: 10 }}
a(ng-href='{{ cr.change.revlink }}' target='_blank') {{ cr.change.revision | limitTo: 10 }}
// Changed files
.info
i.fa.fa-file-o
p(ng-repeat='file in cr.change.files')
a(ng-href='{{ cr.createFileLink(file) }}' target='_blank') {{ file }}
| {{ file }}

0 comments on commit 4f10cd9

Please sign in to comment.