Commit 4ad0a98c authored by Mike Greiling's avatar Mike Greiling

Clean up formatting in performance issue body template

parent 698370aa
...@@ -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;
}
if (this.issue.delta >= 0) {
return `+${formatScore(this.issue.delta)}`;
} }
return value; 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