Skip to content

Commit

Permalink
Merge pull request #197 from buggregator/issue/#103-extend-sentry-report
Browse files Browse the repository at this point in the history
Issue/#103 extend sentry report
  • Loading branch information
butschster authored Jul 11, 2024
2 parents f12dbf8 + 97a4104 commit 63b5e54
Show file tree
Hide file tree
Showing 8 changed files with 293 additions and 86 deletions.
6 changes: 5 additions & 1 deletion src/entities/sentry/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export type SentryContexts = Omit<SentryTypes.Contexts, 'device' | 'app'> & {
}

export interface Sentry extends Omit<SentryTypes.Event, 'request' | 'exception' | 'breadcrumbs' | 'level' | 'contexts'> {
platform?: string,
contexts?: SentryContexts,
request?: SentryRequest,
exception?: {
Expand All @@ -50,5 +51,8 @@ export interface Sentry extends Omit<SentryTypes.Event, 'request' | 'exception'
breadcrumbs?: {
values: SentryBreadcrumb[]
},
level?: SentryLevel
level?: SentryLevel,
modules?: {
[key: string]: string
}
}
3 changes: 3 additions & 0 deletions src/screens/sentry/ui/sentry-page-extra/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import SentryPageExtra from './sentry-page-extra.vue'

export { SentryPageExtra }
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import type { Meta, StoryObj } from "@storybook/vue3";
import { useSentry } from "~/src/entities/sentry";
import { sentryLaravelMock, sentrySpiralMock } from '~/src/entities/sentry/mocks';
import SentryPageExtra from './sentry-page-extra.vue';

const { normalizeSentryEvent } = useSentry();

export default {
title: "Screens/sentry/SentryPageExtra",
component: SentryPageExtra
} as Meta<typeof SentryPageExtra>;

export const Laravel: StoryObj<typeof SentryPageExtra> = {
args: {
extra: normalizeSentryEvent(sentryLaravelMock).payload.extra,
}
};

export const Spiral: StoryObj<typeof SentryPageExtra> = {
args: {
extra: normalizeSentryEvent(sentrySpiralMock).payload.extra,
}
};
113 changes: 113 additions & 0 deletions src/screens/sentry/ui/sentry-page-extra/sentry-page-extra.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<script lang="ts" setup>
import { ref } from "vue";
import type { Sentry } from "~/src/entities/sentry/types";
import { IconSvg, TableBase, TableBaseRow } from "~/src/shared/ui";
type Props = {
extra: Sentry["extra"];
};
const props = defineProps<Props>();
const ddStates = ref(
Object.keys(props.extra || {}).reduce(
(acc, key) => {
acc[key] = false;
return acc;
},
{} as Record<string, boolean>,
),
);
</script>

<template>
<section class="sentry-page-extra">
<h3 class="sentry-page-extra__head">Extra</h3>

<div class="sentry-page-extra__in">
<div
v-for="(value, key) in extra"
:key="key"
class="sentry-page-extra__wrapper"
:class="{
'sentry-page-extra__wrapper--open': ddStates[key],
}"
>
<h3
class="sentry-page-extra__title"
@click="ddStates[key] = !ddStates[key]"
>
{{ key }}

<IconSvg
class="sentry-page-extra__title-dd"
:class="{
'sentry-page-extra__title-dd--open': ddStates[key],
}"
name="dd"
/>
</h3>

<TableBase v-if="value" class="sentry-page-extra__content">
<TableBaseRow
v-for="(v, t) in value"
:key="t"
:title="String(t || '')"
>
{{ JSON.stringify(v) }}
</TableBaseRow>
</TableBase>
</div>
</div>
</section>
</template>

<style lang="scss" scoped>
@import "src/assets/mixins";
.sentry-page-extra {
}
.sentry-page-extra__wrapper {
@apply dark:bg-gray-900 bg-gray-100 p-3 border border-purple-300 dark:border-gray-400;
&:first-child {
@apply rounded-t-md;
}
&:last-child {
@apply rounded-b-md;
}
}
.sentry-page-extra__head {
@include text-muted;
@apply font-bold uppercase text-sm flex justify-between mb-3;
}
.sentry-page-extra__title {
@include text-muted;
@apply font-bold uppercase text-sm flex justify-between;
}
.sentry-page-extra__url {
@apply mb-1 text-lg font-medium;
}
.sentry-page-extra__title-dd {
@apply ml-2 w-5 ml-auto transform rotate-180;
}
.sentry-page-extra__title-dd--open {
@apply rotate-0;
}
.sentry-page-extra__content {
display: none;
@apply mt-3;
.sentry-page-extra__wrapper--open & {
display: block;
}
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const normalizeHeaderValue = (value: unknown) =>
<TableBaseRow
v-for="(value, title) in request.headers"
:key="title"
:title="title"
:title="String(title)"
>
{{ normalizeHeaderValue(value) }}
</TableBaseRow>
Expand Down
Loading

0 comments on commit 63b5e54

Please sign in to comment.