Skip to content

Commit 1f6be9d

Browse files
committed
Enhance UI and Functionality for Profiler and Event Cards
1. Enhanced UI for Profiler Top Functions: Profiler now fetches table schema from the backend. 2. Improved UI for Profiler Call Graph: Profiler now retrieves the toolbar from the backend. 3. Restored links on event preview cards for SMTP, Sentry, Profiler, and Inspector. 4. Various visual improvements to the UI.
1 parent bc27e68 commit 1f6be9d

File tree

15 files changed

+290
-208
lines changed

15 files changed

+290
-208
lines changed

pages/profiler/[id].vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ onMounted(getEvent);
6363
</div>
6464

6565
<div class="profiler-event__body">
66-
<ProfilerPage v-if="event" :event="event" />
66+
<ProfilerPage v-if="event" :event="event" class="p-5"/>
6767
</div>
6868
</main>
6969
</template>
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts" setup>
2-
import { defineProps } from "vue";
2+
import { computed, defineProps } from "vue";
33
import type { NormalizedEvent } from "~/src/shared/types";
44
import { PreviewCard } from "~/src/shared/ui";
55
import type { Inspector } from "../../types";
@@ -9,14 +9,16 @@ type Props = {
99
event: NormalizedEvent<Inspector>;
1010
};
1111
12-
defineProps<Props>();
12+
const props = defineProps<Props>();
13+
14+
const eventLink = computed(() => `/inspector/${props.event.id}`);
1315
</script>
1416

1517
<template>
1618
<PreviewCard class="preview-card" :event="event">
17-
<div class="preview-card__content">
18-
<InspectorStatBoard :transaction="event.payload[0]" />
19-
</div>
19+
<NuxtLink :to="eventLink" class="preview-card__link">
20+
<InspectorStatBoard :transaction="event.payload[0]"/>
21+
</NuxtLink>
2022
</PreviewCard>
2123
</template>
2224

@@ -27,7 +29,7 @@ defineProps<Props>();
2729
@apply flex flex-col;
2830
}
2931
30-
.preview-card__content {
31-
@apply pb-2 flex-grow;
32+
.preview-card__link {
33+
@apply flex-grow cursor-pointer rounded-md overflow-hidden mb-2 border dark:border-gray-500;
3234
}
3335
</style>

src/entities/profiler/ui/preview-card/preview-card.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ type Props = {
77
event: NormalizedEvent<Profiler>;
88
};
99
10-
defineProps<Props>();
10+
const props = defineProps<Props>();
11+
const eventLink = computed(() => `/profiler/${props.event.id}`);
1112
</script>
1213

1314
<template>
1415
<PreviewCard class="profiler-preview" :event="event">
15-
<div class="profiler-preview__link">
16-
<StatBoard :cost="event.payload.peaks" />
17-
</div>
16+
<NuxtLink tag="div" :to="eventLink" class="profiler-preview__link">
17+
<StatBoard :cost="event.payload.peaks"/>
18+
</NuxtLink>
1819
</PreviewCard>
1920
</template>
2021

@@ -26,6 +27,6 @@ defineProps<Props>();
2627
}
2728
2829
.profiler-preview__link {
29-
@apply pb-2 flex-grow;
30+
@apply flex-grow rounded-md overflow-hidden mb-2 border dark:border-gray-500;
3031
}
3132
</style>

src/entities/sentry/ui/preview-card/preview-card.vue

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const props = withDefaults(defineProps<Props>(), {
1515
maxFrames: 3,
1616
});
1717
18+
const eventLink = computed(() => `/sentry/${props.event.id}`);
19+
1820
const exceptionValues = computed(
1921
() => props.event?.payload?.exception?.values || []
2022
);
@@ -27,12 +29,12 @@ const exception: Ref<Exception> = computed(() =>
2729
exceptionValues.value.length > 0
2830
? exceptionValues.value[0]
2931
: {
30-
type: "Unknown",
31-
value: "Something went wrong",
32-
stacktrace: {
33-
frames: [],
34-
},
35-
}
32+
type: "Unknown",
33+
value: "Something went wrong",
34+
stacktrace: {
35+
frames: [],
36+
},
37+
}
3638
);
3739
</script>
3840

@@ -43,31 +45,32 @@ const exception: Ref<Exception> = computed(() =>
4345
:exception="exception"
4446
:max-frames="maxFrames"
4547
>
46-
<div class="preview-card__content">
48+
<NuxtLink :to="eventLink" class="preview-card__link">
4749
<h3 class="preview-card__title">
4850
{{ exception.type }}
4951
</h3>
5052

51-
<pre class="preview-card__text" v-html="exception.value" />
52-
</div>
53+
<pre class="preview-card__text" v-html="exception.value"/>
54+
</NuxtLink>
5355
</SentryException>
5456

5557
<div v-if="message">
5658
<div class="preview-card__content">
57-
<pre class="preview-card__text" v-html="message" />
59+
<pre class="preview-card__text" v-html="message"/>
5860
</div>
5961
</div>
6062
</PreviewCard>
6163
</template>
6264

6365
<style lang="scss" scoped>
6466
@import "src/assets/mixins";
67+
6568
.preview-card {
6669
@apply flex flex-col;
6770
}
6871
69-
.preview-card__content {
70-
@apply block dark:bg-gray-900 bg-gray-100 p-3 rounded-t-md border border-purple-300 dark:border-gray-400;
72+
.preview-card__link {
73+
@apply cursor-pointer block dark:bg-gray-800 bg-gray-100 p-3 rounded-t-md border border-purple-300 dark:border-gray-500;
7174
}
7275
7376
.preview-card__title {
@@ -76,10 +79,10 @@ const exception: Ref<Exception> = computed(() =>
7679
7780
.preview-card__text {
7881
@include code-example();
79-
@apply text-sm break-words whitespace-pre-wrap mb-3 overflow-auto text-opacity-60;
82+
@apply text-sm break-words whitespace-pre-wrap mb-3 overflow-auto text-opacity-60 dark:bg-gray-900 p-3;
8083
}
8184
8285
.preview-card__frames {
83-
@apply border border-purple-200 dark:border-gray-600 flex-col justify-center w-full;
86+
@apply border border-purple-200 dark:border-gray-500 flex-col justify-center w-full;
8487
}
8588
</style>

src/entities/sentry/ui/sentry-exception/sentry-exception.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const exceptionFrames = computed(() => {
5858
}
5959
6060
.sentry-exception__header {
61-
@apply dark:bg-gray-900 bg-gray-100 p-3 rounded-t-md border border-purple-300 dark:border-gray-400 border-b-0;
61+
@apply dark:bg-gray-900 bg-gray-100 p-3 rounded-t-md border border-purple-300 dark:border-gray-500 border-b-0;
6262
}
6363
6464
.sentry-exception__title {
@@ -71,6 +71,6 @@ const exceptionFrames = computed(() => {
7171
}
7272
7373
.sentry-exception__frames {
74-
@apply flex-col justify-center w-full border border-purple-300 dark:border-gray-400 border-t-0 rounded-b-md overflow-hidden;
74+
@apply flex-col justify-center w-full border border-purple-300 dark:border-gray-500 border-t-0 rounded-b-md overflow-hidden;
7575
}
7676
</style>

src/entities/smtp/ui/preview-card/preview-card.vue

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ type Props = {
1010
};
1111
1212
const props = defineProps<Props>();
13+
const eventLink = computed(() => `/smtp/${props.event.id}`);
1314
1415
const dateFormat = computed(() => moment(props.event.date).fromNow());
1516
@@ -20,19 +21,19 @@ const emailRecipient = computed(
2021

2122
<template>
2223
<PreviewCard class="smtp-preview" :event="event">
23-
<div class="smtp-preview__link">
24+
<NuxtLink :to="eventLink" class="smtp-preview__link">
2425
<h3 class="smtp-preview__link-title">
2526
{{ event.payload.subject }}
2627
</h3>
2728

2829
<div class="smtp-preview__link-text">
29-
<span v-if="emailRecipient"
30-
><strong>To:</strong> {{ emailRecipient }}
30+
<span v-if="emailRecipient">
31+
<strong>To:</strong> {{ emailRecipient }}
3132
</span>
3233

3334
<span>{{ dateFormat }}</span>
3435
</div>
35-
</div>
36+
</NuxtLink>
3637
</PreviewCard>
3738
</template>
3839

@@ -46,7 +47,7 @@ const emailRecipient = computed(
4647
@apply block flex items-stretch;
4748
@apply p-2 md:p-4;
4849
@apply flex flex-col;
49-
@apply border dark:border-gray-600;
50+
@apply border dark:border-gray-500 rounded-md overflow-hidden;
5051
@apply dark:bg-gray-800 dark:hover:bg-gray-900 hover:bg-white;
5152
}
5253
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<script lang="ts" setup>
2+
import { computed } from "vue";
3+
import { GraphTypes } from "~/src/shared/types";
4+
import { IconSvg } from "~/src/shared/ui";
5+
6+
const emit = defineEmits(['onMetricChange', 'onFullscreen', 'onThresholdChange', 'onPercentChange'])
7+
8+
type Props = {
9+
data: Object;
10+
isFullscreen: boolean;
11+
metric: GraphTypes;
12+
threshold: number;
13+
percent: number;
14+
};
15+
16+
const props = defineProps<Props>();
17+
18+
const fetchToolbar = async function () {
19+
return await props.data.then(response => response.toolbar);
20+
};
21+
22+
const toolbar = await fetchToolbar();
23+
24+
const percentLabel = computed(() =>
25+
props.metric === GraphTypes.CALLS ? "Min calls" : "Percent"
26+
);
27+
</script>
28+
29+
<template>
30+
<div class="call-graph__toolbar-wrapper">
31+
<div class="call-graph__toolbar">
32+
<button title="Full screen" @click="emit('onFullscreen')">
33+
<IconSvg name="fullscreen" class="call-graph__toolbar-icon"/>
34+
</button>
35+
<button
36+
v-for="button in toolbar"
37+
class="call-graph__toolbar-action"
38+
:class="{
39+
'call-graph__toolbar-action--active': metric === button.metric,
40+
}"
41+
:title="button.description"
42+
@click="emit('onMetricChange', button.metric)"
43+
>
44+
{{ button.label }}
45+
</button>
46+
</div>
47+
48+
<div class="call-graph__toolbar call-graph__toolbar--right">
49+
<label
50+
v-if="metric !== GraphTypes.CALLS"
51+
class="call-graph__toolbar-input-wr"
52+
>
53+
Threshold
54+
55+
<input
56+
class="call-graph__toolbar-input"
57+
type="number"
58+
:value="threshold"
59+
:min="0"
60+
:max="10"
61+
:step="0.1"
62+
@input="emit('onThresholdChange', $event.target.value)"
63+
/>
64+
</label>
65+
66+
<label class="call-graph__toolbar-input-wr">
67+
{{ percentLabel }}
68+
69+
<input
70+
class="call-graph__toolbar-input"
71+
type="number"
72+
:value="percent"
73+
:min="metric === GraphTypes.CALLS ? 1 : 0"
74+
:max="metric === GraphTypes.CALLS ? 1000 : 100"
75+
:step="metric === GraphTypes.CALLS ? 10 : 5"
76+
@input="emit('onPercentChange', $event.target.value)"
77+
/>
78+
</label>
79+
</div>
80+
</div>
81+
</template>
82+
83+
<style lang="scss" scoped>
84+
.call-graph--fullscreen {
85+
@apply rounded-none mt-0 top-0 left-0 fixed w-full h-full bg-gray-800 z-[99999];
86+
}
87+
88+
.call-graph__toolbar {
89+
@apply absolute top-5 left-5 flex bg-gray-200 p-2 rounded gap-x-5 shadow-lg;
90+
}
91+
92+
.call-graph__toolbar--right {
93+
@apply right-5 left-auto py-1;
94+
}
95+
96+
.call-graph__toolbar-icon {
97+
@apply w-4 h-4 fill-blue-500;
98+
}
99+
100+
.call-graph__toolbar-action {
101+
@apply text-xs uppercase text-gray-600;
102+
}
103+
104+
.call-graph__toolbar-action--active {
105+
@apply font-bold;
106+
}
107+
108+
.call-graph__toolbar-input-wr {
109+
@apply text-xs uppercase text-gray-600;
110+
}
111+
112+
.call-graph__toolbar-input {
113+
@apply border-gray-600 text-gray-600 w-10 font-bold text-right bg-gray-300 ml-1 py-1 rounded;
114+
}
115+
</style>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as CallGraphToolbar } from "./call-graph-toolbar.vue";

0 commit comments

Comments
 (0)