Skip to content

Commit 1036758

Browse files
authored
Merge pull request #164 from buggregator/hotfix/profiler-stat-board
Fixed Profiler popup Stat-board issues:
2 parents 9d1d152 + e132fb2 commit 1036758

File tree

3 files changed

+55
-14
lines changed

3 files changed

+55
-14
lines changed

src/screens/profiler/ui/call-stat-board/call-stat-board.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ defineProps<Props>();
1616
{{ edge.callee }}
1717
</h4>
1818

19-
<StatBoard class="call-stat-board__body" :cost="edge.cost" />
19+
<StatBoard class="call-stat-board__body" :cost="edge.cost" size="sm" />
2020
</div>
2121
</template>
2222

@@ -26,7 +26,7 @@ defineProps<Props>();
2626
}
2727
2828
.call-stat-board__title {
29-
@apply px-4 py-2 font-bold truncate text-gray-300;
29+
@apply p-2 text-xs font-bold truncate text-gray-300;
3030
}
3131
3232
.call-stat-board__body {

src/screens/profiler/ui/flame-graph/flame-graph.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ const renderChart = async () => {
5252
cost: data.data.source.cost,
5353
5454
position: {
55-
x: mouse?.x || 0,
56-
y: mouse?.y || 0,
55+
x: mouse?.x + 20 || 0,
56+
y: mouse?.y - 20 || 0,
5757
},
5858
});
5959
}
@@ -83,6 +83,10 @@ onMounted(() => {
8383
renderChart();
8484
});
8585
});
86+
87+
onBeforeUnmount(() => {
88+
emit("hide");
89+
});
8690
</script>
8791

8892
<template>

src/shared/ui/stat-board/stat-board.vue

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ const { formatDuration, formatFileSize } = useFormats();
77
88
type Props = {
99
cost: ProfilerCost;
10+
size: 'sm' | 'md' | 'lg';
1011
};
1112
12-
const props = defineProps<Props>();
13+
const props = withDefaults(defineProps<Props>(), {
14+
size: 'md',
15+
})
1316
1417
const statItems = computed(() => [
1518
{
@@ -41,7 +44,7 @@ const statItems = computed(() => [
4144
</script>
4245

4346
<template>
44-
<section class="stat-board">
47+
<section class="stat-board" :class="[`size-${size}`]">
4548
<div v-for="item in statItems" :key="item.title" class="stat-board__item">
4649
<h4 class="stat-board__item-name">
4750
{{ item.title }}
@@ -65,25 +68,59 @@ const statItems = computed(() => [
6568
@apply flex flex-col sm:flex-row justify-between items-start;
6669
@apply divide-y sm:divide-y-0 sm:divide-x divide-gray-300 dark:divide-gray-500;
6770
@apply bg-gray-200 dark:bg-gray-800;
68-
@apply p-0 sm:p-4 lg:p-6;
6971
}
7072
7173
.stat-board__item {
7274
@apply flex flex-row justify-between sm:flex-col sm:justify-start flex-auto;
7375
@apply w-full sm:w-auto;
74-
@apply py-2 px-2 sm:py-5 sm:px-5;
7576
}
7677
7778
.stat-board__item-name {
78-
@apply text-gray-600 dark:text-gray-300 font-bold text-2xs uppercase truncate;
79-
@apply mb-0 sm:mb-1;
79+
@apply text-gray-600 dark:text-gray-300 font-bold uppercase truncate;
8080
}
8181
82-
.stat-board__item-name-detail {
83-
@apply text-2xs truncate ml-1;
82+
.stat-board__item-name-detail,
83+
.stat-board__item-value {
84+
@apply truncate;
8485
}
8586
86-
.stat-board__item-value {
87-
@apply text-2xs sm:text-xs md:text-base truncate;
87+
.stat-board.size-md {
88+
@apply p-0 sm:p-4 lg:p-6;
89+
90+
.stat-board__item-name-detail {
91+
@apply text-2xs ml-1;
92+
}
93+
94+
.stat-board__item {
95+
@apply py-2 px-2 sm:py-5 sm:px-5;
96+
}
97+
98+
.stat-board__item-name {
99+
@apply mb-0 sm:mb-1 text-2xs;
100+
}
101+
102+
.stat-board__item-value {
103+
@apply text-2xs sm:text-xs md:text-base;
104+
}
105+
}
106+
107+
.stat-board.size-sm {
108+
@apply p-0 border-t border-t-gray-300 dark:border-t-gray-500;
109+
110+
.stat-board__item-name-detail {
111+
@apply text-2xs;
112+
}
113+
114+
.stat-board__item {
115+
@apply px-4 py-2;
116+
}
117+
118+
.stat-board__item-name {
119+
@apply text-2xs;
120+
}
121+
122+
.stat-board__item-value {
123+
@apply text-xs;
124+
}
88125
}
89126
</style>

0 commit comments

Comments
 (0)