Skip to content

Commit

Permalink
Merge pull request #164 from buggregator/hotfix/profiler-stat-board
Browse files Browse the repository at this point in the history
Fixed Profiler popup Stat-board issues:
  • Loading branch information
Kreezag authored Jun 12, 2024
2 parents 9d1d152 + e132fb2 commit 1036758
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/screens/profiler/ui/call-stat-board/call-stat-board.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defineProps<Props>();
{{ edge.callee }}
</h4>

<StatBoard class="call-stat-board__body" :cost="edge.cost" />
<StatBoard class="call-stat-board__body" :cost="edge.cost" size="sm" />
</div>
</template>

Expand All @@ -26,7 +26,7 @@ defineProps<Props>();
}
.call-stat-board__title {
@apply px-4 py-2 font-bold truncate text-gray-300;
@apply p-2 text-xs font-bold truncate text-gray-300;
}
.call-stat-board__body {
Expand Down
8 changes: 6 additions & 2 deletions src/screens/profiler/ui/flame-graph/flame-graph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ const renderChart = async () => {
cost: data.data.source.cost,
position: {
x: mouse?.x || 0,
y: mouse?.y || 0,
x: mouse?.x + 20 || 0,
y: mouse?.y - 20 || 0,
},
});
}
Expand Down Expand Up @@ -83,6 +83,10 @@ onMounted(() => {
renderChart();
});
});
onBeforeUnmount(() => {
emit("hide");
});
</script>

<template>
Expand Down
57 changes: 47 additions & 10 deletions src/shared/ui/stat-board/stat-board.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ const { formatDuration, formatFileSize } = useFormats();
type Props = {
cost: ProfilerCost;
size: 'sm' | 'md' | 'lg';
};
const props = defineProps<Props>();
const props = withDefaults(defineProps<Props>(), {
size: 'md',
})
const statItems = computed(() => [
{
Expand Down Expand Up @@ -41,7 +44,7 @@ const statItems = computed(() => [
</script>

<template>
<section class="stat-board">
<section class="stat-board" :class="[`size-${size}`]">
<div v-for="item in statItems" :key="item.title" class="stat-board__item">
<h4 class="stat-board__item-name">
{{ item.title }}
Expand All @@ -65,25 +68,59 @@ const statItems = computed(() => [
@apply flex flex-col sm:flex-row justify-between items-start;
@apply divide-y sm:divide-y-0 sm:divide-x divide-gray-300 dark:divide-gray-500;
@apply bg-gray-200 dark:bg-gray-800;
@apply p-0 sm:p-4 lg:p-6;
}
.stat-board__item {
@apply flex flex-row justify-between sm:flex-col sm:justify-start flex-auto;
@apply w-full sm:w-auto;
@apply py-2 px-2 sm:py-5 sm:px-5;
}
.stat-board__item-name {
@apply text-gray-600 dark:text-gray-300 font-bold text-2xs uppercase truncate;
@apply mb-0 sm:mb-1;
@apply text-gray-600 dark:text-gray-300 font-bold uppercase truncate;
}
.stat-board__item-name-detail {
@apply text-2xs truncate ml-1;
.stat-board__item-name-detail,
.stat-board__item-value {
@apply truncate;
}
.stat-board__item-value {
@apply text-2xs sm:text-xs md:text-base truncate;
.stat-board.size-md {
@apply p-0 sm:p-4 lg:p-6;
.stat-board__item-name-detail {
@apply text-2xs ml-1;
}
.stat-board__item {
@apply py-2 px-2 sm:py-5 sm:px-5;
}
.stat-board__item-name {
@apply mb-0 sm:mb-1 text-2xs;
}
.stat-board__item-value {
@apply text-2xs sm:text-xs md:text-base;
}
}
.stat-board.size-sm {
@apply p-0 border-t border-t-gray-300 dark:border-t-gray-500;
.stat-board__item-name-detail {
@apply text-2xs;
}
.stat-board__item {
@apply px-4 py-2;
}
.stat-board__item-name {
@apply text-2xs;
}
.stat-board__item-value {
@apply text-xs;
}
}
</style>

0 comments on commit 1036758

Please sign in to comment.