-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#131 create blank pages for var and ray dumbs
- Loading branch information
Showing
5 changed files
with
242 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
<script lang="ts" setup> | ||
import { computed, onMounted, ref } from "vue"; | ||
import { useFetch, useHead, useNuxtApp, useRoute, useRouter } from "#app"; // eslint-disable-line @conarti/feature-sliced/layers-slices | ||
import { PageHeader } from "~/src/widgets/ui"; | ||
import { useProfiler } from "~/src/entities/profiler"; | ||
import type { Profiler } from "~/src/entities/profiler/types"; | ||
import { useEvents } from "~/src/shared/lib/use-events"; | ||
import type { EventId, ServerEvent } from "~/src/shared/types"; | ||
const { normalizeProfilerEvent } = useProfiler(); | ||
const { params } = useRoute(); | ||
const { $authToken } = useNuxtApp(); | ||
const router = useRouter(); | ||
const eventId = params.id as EventId; | ||
useHead({ | ||
title: `Ray Dump > ${eventId} | Buggregator`, | ||
}); | ||
const { events } = useEvents(); | ||
const isLoading = ref(false); | ||
const serverEvent = ref<Event | null>(null); | ||
const event = computed(() => | ||
serverEvent.value | ||
? normalizeProfilerEvent( | ||
serverEvent.value as unknown as ServerEvent<Profiler> | ||
) | ||
: null | ||
); | ||
const onDelete = () => { | ||
events.removeById(eventId); | ||
router.push("/"); | ||
}; | ||
const getEvent = async () => { | ||
isLoading.value = true; | ||
await useFetch(events.getUrl(eventId), { | ||
headers: { "X-Auth-Token": $authToken.token || "" }, | ||
onResponse({ response: { _data } }) { | ||
serverEvent.value = _data; | ||
isLoading.value = false; | ||
}, | ||
onResponseError() { | ||
router.push("/404"); | ||
}, | ||
onRequestError() { | ||
router.push("/404"); | ||
}, | ||
}); | ||
}; | ||
onMounted(getEvent); | ||
</script> | ||
|
||
<template> | ||
<main class="ray-dump"> | ||
<PageHeader | ||
class="ray-dump__head" | ||
button-title="Delete event" | ||
@delete="onDelete" | ||
> | ||
<NuxtLink to="/">Home</NuxtLink> / | ||
<NuxtLink to="/ray-dump">Ray Dump</NuxtLink> / | ||
<NuxtLink :disabled="true">{{ eventId }}</NuxtLink> | ||
</PageHeader> | ||
|
||
<div v-if="isLoading && !event" class="ray-dump__loading"> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
</div> | ||
|
||
<div class="ray-dump__body"> | ||
{{ JSON.stringify(event) }} | ||
</div> | ||
</main> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
@import "src/assets/mixins"; | ||
.ray-dump { | ||
@include layout; | ||
} | ||
.ray-dump__head { | ||
@include layout-head; | ||
} | ||
.ray-dump__loading { | ||
@include loading; | ||
@include layout-body; | ||
} | ||
.ray-dump__body { | ||
@include layout-body; | ||
} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<script lang="ts" setup> | ||
import { PageLayout } from "~/src/widgets/ui/page-layout"; | ||
import { PAGE_TYPES } from "~/src/shared/constants"; | ||
</script> | ||
|
||
<template> | ||
<PageLayout :type="PAGE_TYPES.RAY_DUMP" title="Ray Dumps" /> | ||
</template> |
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,104 @@ | ||
<script lang="ts" setup> | ||
import { computed, onMounted, ref } from "vue"; | ||
import { useFetch, useHead, useNuxtApp, useRoute, useRouter } from "#app"; // eslint-disable-line @conarti/feature-sliced/layers-slices | ||
import { PageHeader } from "~/src/widgets/ui"; | ||
import { useProfiler } from "~/src/entities/profiler"; | ||
import type { Profiler } from "~/src/entities/profiler/types"; | ||
import { useEvents } from "~/src/shared/lib/use-events"; | ||
import type { EventId, ServerEvent } from "~/src/shared/types"; | ||
const { normalizeProfilerEvent } = useProfiler(); | ||
const { params } = useRoute(); | ||
const { $authToken } = useNuxtApp(); | ||
const router = useRouter(); | ||
const eventId = params.id as EventId; | ||
useHead({ | ||
title: `Var Dump > ${eventId} | Buggregator`, | ||
}); | ||
const { events } = useEvents(); | ||
const isLoading = ref(false); | ||
const serverEvent = ref<Event | null>(null); | ||
const event = computed(() => | ||
serverEvent.value | ||
? normalizeProfilerEvent( | ||
serverEvent.value as unknown as ServerEvent<Profiler> | ||
) | ||
: null | ||
); | ||
const onDelete = () => { | ||
events.removeById(eventId); | ||
router.push("/"); | ||
}; | ||
const getEvent = async () => { | ||
isLoading.value = true; | ||
await useFetch(events.getUrl(eventId), { | ||
headers: { "X-Auth-Token": $authToken.token || "" }, | ||
onResponse({ response: { _data } }) { | ||
serverEvent.value = _data; | ||
isLoading.value = false; | ||
}, | ||
onResponseError() { | ||
router.push("/404"); | ||
}, | ||
onRequestError() { | ||
router.push("/404"); | ||
}, | ||
}); | ||
}; | ||
onMounted(getEvent); | ||
</script> | ||
|
||
<template> | ||
<main class="var-dump"> | ||
<PageHeader | ||
class="var-dump__head" | ||
button-title="Delete event" | ||
@delete="onDelete" | ||
> | ||
<NuxtLink to="/">Home</NuxtLink> / | ||
<NuxtLink to="/var-dump">Var Dump</NuxtLink> / | ||
<NuxtLink :disabled="true">{{ eventId }}</NuxtLink> | ||
</PageHeader> | ||
|
||
<div v-if="isLoading && !event" class="var-dump__loading"> | ||
<div></div> | ||
<div></div> | ||
<div></div> | ||
</div> | ||
|
||
<div class="var-dump__body"> | ||
{{ JSON.stringify(event) }} | ||
</div> | ||
</main> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
@import "src/assets/mixins"; | ||
.var-dump { | ||
@include layout; | ||
} | ||
.var-dump__head { | ||
@include layout-head; | ||
} | ||
.var-dump__loading { | ||
@include loading; | ||
@include layout-body; | ||
} | ||
.var-dump__body { | ||
@include layout-body; | ||
} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<script lang="ts" setup> | ||
import { PageLayout } from "~/src/widgets/ui/page-layout"; | ||
import { PAGE_TYPES } from "~/src/shared/constants"; | ||
</script> | ||
|
||
<template> | ||
<PageLayout :type="PAGE_TYPES.VAR_DUMP" title="Var Dumps" /> | ||
</template> |
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