first step to rephrase runindex and ise iteration instead (#2006)

This commit is contained in:
Peter Hedenskog 2018-04-29 16:17:55 +02:00 committed by GitHub
parent 9daff68859
commit 88f6fa2f80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 31 additions and 21 deletions

View File

@ -42,8 +42,8 @@ module.exports = {
let fileName = message.type + '.json';
if (message.url) {
if (Number.isInteger(message.runIndex)) {
fileName = message.type + '-' + message.runIndex + '.json';
if (Number.isInteger(message.iteration)) {
fileName = message.type + '-' + message.iteration + '.json';
}
return this.storageManager.writeDataForUrl(

View File

@ -136,7 +136,8 @@ module.exports = {
JSON.stringify(coachAdvice.errors),
{
url,
runIndex
runIndex,
iteration: runIndex + 1
}
)
);
@ -155,7 +156,8 @@ module.exports = {
make('coach.run', total, {
url,
group,
runIndex
runIndex,
iteration: runIndex + 1
})
)
);
@ -164,7 +166,8 @@ module.exports = {
make('coach.run', coachAdvice, {
url,
group,
runIndex
runIndex,
iteration: runIndex + 1
})
);
}
@ -283,7 +286,8 @@ module.exports = {
make('browsertime.run', run, {
url,
group,
runIndex
runIndex,
iteration: runIndex + 1
})
);
aggregator.addToAggregate(run, group);

View File

@ -43,7 +43,7 @@ module.exports = {
break;
}
case 'coach.run': {
if (message.runIndex === 0) {
if (message.iteration === 1) {
// For now, choose the first run to represent the whole page.
// Later we might want to change the median run (based on some metric) similar to the WPT approach.
const url = message.url;

View File

@ -249,6 +249,7 @@ class HTMLBuilder {
return this._renderUrlPage(url, 'index', data).tap(() =>
Promise.resolve(Object.keys(runPages)).map(runIndex => {
const iteration = Number(runIndex) + 1;
const pugs = {};
const pageInfo = runPages[runIndex];
const runTimestamp = get(
@ -264,7 +265,7 @@ class HTMLBuilder {
let data = {
daurl: url,
daurlAlias,
runIndex,
iteration,
pageInfo,
options,
runPages,

View File

@ -1,8 +1,8 @@
if options.browsertime.video
- var videoPath = 'data/video/' + (runIndex ? (Number(runIndex)+1) : 1) +'.mp4'
- var videoPath = 'data/video/' + (iteration ? iteration : 1) +'.mp4'
a.button.button-download(href=videoPath, download=downloadName + '-video.mp4') Download video
if options.browsertime.chrome && options.browsertime.chrome.timeline
- var tracePath = 'data/trace-' + (runIndex ? (Number(runIndex)+1) : 1) + '.json.gz'
- var tracePath = 'data/trace-' + (iteration ? iteration : 1) + '.json.gz'
a.button.button-download(href=tracePath, download=downloadName + '-timeline.json.gz') Download timeline
if d.browsertime && d.browsertime.har
- var harEnding = options.gzipHAR ? '.har.gz' : '.har'

View File

@ -2,7 +2,7 @@ extends ../../layout.pug
block content
- var d = pageInfo.data
- runNumber = Number(runIndex)+1
- runNumber = iteration
- var daTitle = daurlAlias ? daurlAlias : daurl
- var downloadName = (daTitle + '-' + runNumber + '-' + options.browser + '-' + timestamp).replace(/(https?\:\/\/)|( )|(:)/ig, '')
@ -99,12 +99,12 @@ block content
.one-half.column
if hasScreenShots
- screenshotName = 'data/screenshots/' + (Number(runIndex)+1) + '.' + screenShotType
- screenshotName = 'data/screenshots/' + iteration + '.' + screenShotType
- var width = options.mobile ? 150 : '100%';
a(href=screenshotName)
img.screenshot(src=screenshotName, width=width, alt='Screenshot')
else if !d.browsertime && d.webpagetest
- screenshotName = 'data/screenshots/wpt-' + (Number(runIndex)+1) + '-firstView.png'
- screenshotName = 'data/screenshots/wpt-' + iteration + '-firstView.png'
a(href=screenshotName)
img.screenshot(src=screenshotName, alt='Screenshot')
.downloads

View File

@ -7,7 +7,7 @@ mixin getLink(path, name, metric, type)
if (run[name] === metric[type] && isSet === false)
- isSet = true
td.number(data-title=type)
a(href='./' + index + '.html', title='Go to the run with the ' + type + ' ' + name) #{metric[type]}
a(href='./' + (index+1) + '.html', title='Go to the run with the ' + type + ' ' + name) #{metric[type]}
mixin getLinkTimings(path, name, metric, type)
- isSet = false
@ -18,7 +18,7 @@ mixin getLinkTimings(path, name, metric, type)
if (Number(run.timings[name]).toFixed(0) === Number(metric[name][type]).toFixed(0) && isSet === false)
- isSet = true
td.number(data-title=type)
a(href='./' + index + '.html', title='Go to the run with the ' + type + ' ' + name) #{metric[name][type]}
a(href='./' + (index+1) + '.html', title='Go to the run with the ' + type + ' ' + name) #{metric[name][type]}
mixin getLinkPageTimings(path, name, metric, type)
- isSet = false
@ -29,7 +29,7 @@ mixin getLinkPageTimings(path, name, metric, type)
if (Number(run.timings.pageTimings[name]).toFixed(0) === Number(metric[name][type]).toFixed(0) && isSet === false)
- isSet = true
td.number(data-title=type)
a(href='./' + index + '.html', title='Go to the run with the ' + type + ' ' + name) #{metric[name][type]}
a(href='./' + (index+1) + '.html', title='Go to the run with the ' + type + ' ' + name) #{metric[name][type]}
mixin getUserTimings(path, name, metric, type)
- isSet = false
@ -41,7 +41,7 @@ mixin getUserTimings(path, name, metric, type)
if (marks.name === name && Number(marks.startTime).toFixed(0) === Number(metric[type]).toFixed(0) && isSet === false)
- isSet = true
td.number(data-title=type)
a(href='./' + index + '.html', title='Go to the run with the ' + type + ' ' + name) #{metric[type]}
a(href='./' + (index+1) + '.html', title='Go to the run with the ' + type + ' ' + name) #{metric[type]}
- btStatistics = h.get(pageInfo.data, 'browsertime.pageSummary.statistics')

View File

@ -1,4 +1,4 @@
- var videoIndex = runIndex ? (Number(runIndex)+1) : 1;
- var videoIndex = iteration ? iteration : 1;
- var width = options.mobile ? 'max-width: 400px;' : h.get(options, 'browsertime.chrome.android.package') ? 'max-width: 400px;' : 'width: 100%'
a#video
@ -10,5 +10,5 @@ h3 Video
script(src= rootPath + 'js/video.novtt.min.js')
- var videoPath = 'data/video/' + (runIndex ? (Number(runIndex)+1) : 1) +'.mp4'
- var videoPath = 'data/video/' + (iteration ? iteration : 1) +'.mp4'
a.button.button-download(href=videoPath, download=downloadName + '-video.mp4') Download video

View File

@ -15,7 +15,7 @@ script(type='text/javascript').
showMimeTypeIcon: true,
leftColumnWidth: 30,
legendHolder: legendHolderEl,
selectedPage: #{runIndex || medianRun.runIndex},
selectedPage: #{iteration || medianRun.runIndex},
pageSelector: pageSelectorEl
};

View File

@ -81,7 +81,12 @@ module.exports = {
pageSummary.forEach((run, runIndex) => {
queue.postMessage(
make('pagexray.run', run, { url, group, runIndex })
make('pagexray.run', run, {
url,
group,
runIndex,
iteration: runIndex + 1
})
);
});
}