Commit 95e1982f authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '4269-follow-up-from-integrated-browser-performance-testing' into 'master'

Resolve "Follow-up from "Integrated Browser Performance Testing""

Closes #4269

See merge request gitlab-org/gitlab!3752
parents 648ec5ba 4ad0a98c
...@@ -5,6 +5,13 @@ ...@@ -5,6 +5,13 @@
*/ */
import ReportLink from '~/reports/components/report_link.vue'; import ReportLink from '~/reports/components/report_link.vue';
function formatScore(value) {
if (Math.floor(value) !== value) {
return parseFloat(value).toFixed(2);
}
return value;
}
export default { export default {
name: 'PerformanceIssueBody', name: 'PerformanceIssueBody',
...@@ -19,12 +26,18 @@ export default { ...@@ -19,12 +26,18 @@ export default {
}, },
}, },
methods: { computed: {
formatScore(value) { issueScore() {
if (Math.floor(value) !== value) { return this.issue.score ? formatScore(this.issue.score) : false;
return parseFloat(value).toFixed(2); },
issueDelta() {
if (!this.issue.delta) {
return false;
} }
return value; if (this.issue.delta >= 0) {
return `+${formatScore(this.issue.delta)}`;
}
return formatScore(this.issue.delta);
}, },
}, },
}; };
...@@ -32,13 +45,14 @@ export default { ...@@ -32,13 +45,14 @@ export default {
<template> <template>
<div class="report-block-list-issue-description prepend-top-5 append-bottom-5"> <div class="report-block-list-issue-description prepend-top-5 append-bottom-5">
<div class="report-block-list-issue-description-text"> <div class="report-block-list-issue-description-text">
{{ issue.name <template v-if="issueScore">
}}<template v-if="issue.score" {{ issue.name }}: <strong>{{ issueScore }}</strong>
>: <strong>{{ formatScore(issue.score) }}</strong></template </template>
> <template v-else>
{{ issue.name }}
<template v-if="issue.delta != null"> </template>
({{ issue.delta >= 0 ? '+' : '' }}{{ formatScore(issue.delta) }}) <template v-if="issueDelta">
({{ issueDelta }})
</template> </template>
</div> </div>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment