web: fix stream url from status json

This change removes the legacy url format from the status.json.

Change-Id: I074b3a88a893e04d504e9cf21ced14ba86efc7ec
This commit is contained in:
Tristan Cacqueray 2018-10-10 12:06:12 +00:00
parent be64ed2777
commit d54b67e2ea
5 changed files with 15 additions and 9 deletions

View File

@ -4714,7 +4714,7 @@ For CI problems and help debugging, contact ci@example.org"""
self.assertEqual('gate', job['pipeline'])
self.assertEqual(False, job['retry'])
self.assertEqual(
'stream.html?uuid={uuid}&logfile=console.log'
'stream/{uuid}?logfile=console.log'
.format(uuid=job['uuid']), job['url'])
self.assertEqual(
'finger://{hostname}/{uuid}'.format(

View File

@ -135,7 +135,7 @@ class TestWeb(BaseTestWeb):
self.assertEqual('project-merge', status_jobs[0]['name'])
# TODO(mordred) pull uuids from self.builds
self.assertEqual(
'stream.html?uuid={uuid}&logfile=console.log'.format(
'stream/{uuid}?logfile=console.log'.format(
uuid=status_jobs[0]['uuid']),
status_jobs[0]['url'])
self.assertEqual(
@ -151,7 +151,7 @@ class TestWeb(BaseTestWeb):
status_jobs[0]['report_url'])
self.assertEqual('project-test1', status_jobs[1]['name'])
self.assertEqual(
'stream.html?uuid={uuid}&logfile=console.log'.format(
'stream/{uuid}?logfile=console.log'.format(
uuid=status_jobs[1]['uuid']),
status_jobs[1]['url'])
self.assertEqual(
@ -167,7 +167,7 @@ class TestWeb(BaseTestWeb):
self.assertEqual('project-test2', status_jobs[2]['name'])
self.assertEqual(
'stream.html?uuid={uuid}&logfile=console.log'.format(
'stream/{uuid}?logfile=console.log'.format(
uuid=status_jobs[2]['uuid']),
status_jobs[2]['url'])
self.assertEqual(

View File

@ -223,12 +223,19 @@ class ChangePanel extends React.Component {
name = <a className='zuul-job-name' href={job.report_url}>{job.name}</a>
} else if (job.url !== null) {
let url = job.url
// TODO: remove that first if block when
// I074b3a88a893e04d504e9cf21ced14ba86efc7ec is merged
if (job.url.match('stream.html')) {
const buildUuid = job.url.split('?')[1].split('&')[0].split('=')[1]
const to = (
tenant.linkPrefix + '/stream/' + buildUuid + '?logfile=console.log'
)
name = <Link to={to}>{job.name}</Link>
} else if (job.url.match('stream/')) {
const to = (
tenant.linkPrefix + '/' + job.url
)
name = <Link to={to}>{job.name}</Link>
} else {
name = <a className='zuul-job-name' href={url}>{job.name}</a>
}

View File

@ -26,7 +26,7 @@ const fakeChange = {
project: 'org-project',
jobs: [{
name: 'job-name',
url: 'stream.html?build=42',
url: 'stream/42',
result: null
}]
}
@ -44,7 +44,7 @@ it('change panel render multi tenant links', () => {
const jobLink = ReactTestUtils.findRenderedComponentWithType(
application, Link)
expect(jobLink.props.to).toEqual(
'/t/tenant-one/stream/42?logfile=console.log')
'/t/tenant-one/stream/42')
})
it('change panel render white-label tenant links', () => {
@ -60,5 +60,5 @@ it('change panel render white-label tenant links', () => {
const jobLink = ReactTestUtils.findRenderedComponentWithType(
application, Link)
expect(jobLink.props.to).toEqual(
'/stream/42?logfile=console.log')
'/stream/42')
})

View File

@ -2363,8 +2363,7 @@ class QueueItem(object):
result = build.result
finger_url = build.url
# TODO(tobiash): add support for custom web root
urlformat = 'stream.html?' \
'uuid={build.uuid}&' \
urlformat = 'stream/{build.uuid}?' \
'logfile=console.log'
if websocket_url:
urlformat += '&websocket_url={websocket_url}'