summaryrefslogtreecommitdiff
path: root/src/client/components/taskmanager.api-window.vue
blob: c9b2c43413181ea073856e26c0441adf1b8cc1fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<template>
<XWindow ref="window"
	:initial-width="370"
	:initial-height="450"
	:can-resize="true"
	@close="$refs.window.close()"
	@closed="$emit('closed')"
>
	<template #header>Req Viewer</template>

	<div class="rlkneywz">
		<MkTab v-model:value="tab" style="border-bottom: solid 0.5px var(--divider);">
			<option value="req">Request</option>
			<option value="res">Response</option>
		</MkTab>

		<code v-if="tab === 'req'" class="_monospace">{{ reqStr }}</code>
		<code v-if="tab === 'res'" class="_monospace">{{ resStr }}</code>
	</div>
</XWindow>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import * as JSON5 from 'json5';
import XWindow from '@client/components/ui/window.vue';
import MkTab from '@client/components/tab.vue';

export default defineComponent({
	components: {
		XWindow,
		MkTab,
	},

	props: {
		req: {
			required: true,
		}
	},

	emits: ['closed'],

	data() {
		return {
			tab: 'req',
			reqStr: JSON5.stringify(this.req.req, null, '\t'),
			resStr: JSON5.stringify(this.req.res, null, '\t'),
		}
	},

	methods: {
	}
});
</script>

<style lang="scss" scoped>
.rlkneywz {
	display: flex;
	flex-direction: column;
	height: 100%;

	> code {
		display: block;
		flex: 1;
		padding: 8px;
		overflow: auto;
		font-size: 0.9em;
		tab-size: 2;
		white-space: pre;
	}
}
</style>