-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
177 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
site/frontend/src/pages/compare/compile/table/compile-sections-chart.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<script setup lang="ts"> | ||
import {CompilationSections} from "./detail-resolver"; | ||
import {computed} from "vue"; | ||
import {prettifyRawNumber} from "./utils"; | ||
const props = defineProps<{ | ||
sections: CompilationSections; | ||
label: string; | ||
total_duration: number; | ||
}>(); | ||
const total = computed( | ||
() => props.sections.frontend + props.sections.backend + props.sections.linker | ||
); | ||
function width(value: number): string { | ||
const fraction = value / props.total_duration; | ||
return `${(fraction * 100).toFixed(2)}%`; | ||
} | ||
function title(name: string, value: number): string { | ||
const percent = (value / total.value) * 100; | ||
return `${name}: ${percent.toFixed(2)}% (${prettifyRawNumber(value)})`; | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="wrapper"> | ||
<span class="label">{{ props.label }}</span> | ||
<div class="part-wrapper"> | ||
<div | ||
class="part frontend" | ||
:title="title('Frontend', props.sections.frontend)" | ||
:style="{width: width(props.sections.frontend)}" | ||
></div> | ||
<div | ||
class="part backend" | ||
:title="title('Backend', props.sections.backend)" | ||
:style="{width: width(props.sections.backend)}" | ||
></div> | ||
<div | ||
class="part linker" | ||
:title="title('Linker', props.sections.linker)" | ||
:style="{width: width(props.sections.linker)}" | ||
></div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
.wrapper { | ||
display: flex; | ||
justify-content: flex-end; | ||
width: 300px; | ||
margin-bottom: 10px; | ||
} | ||
.label { | ||
margin-right: 5px; | ||
align-self: center; | ||
} | ||
.part-wrapper { | ||
width: 220px; | ||
display: flex; | ||
flex-direction: row; | ||
border-right: 1px dashed #333333; | ||
} | ||
.part { | ||
height: 30px; | ||
&:hover { | ||
box-shadow: inset 0 0 1px 2px #000; | ||
} | ||
} | ||
.frontend { | ||
border-radius: 5px 0 0 5px; | ||
background-color: #ffcf96; | ||
} | ||
.backend { | ||
background-color: #ff8080; | ||
} | ||
.linker { | ||
border-radius: 0 5px 5px 0; | ||
background-color: #29adb2; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters