Fixed problems with REST Mock

This commit is contained in:
2023-06-22 13:54:09 +02:00
parent 84389be203
commit 8a7160bfd7
8 changed files with 22 additions and 17 deletions

View File

@@ -8,7 +8,7 @@ import SidebarComponent from '@components/sidebar/SidebarComponent.vue';
<template> <template>
<div id="layout" class="flex h-screen bg-gradient-to-r from-white to-sky-200 dark:from-slate-800 dark:to-indigo-950"> <div id="layout" class="flex h-screen bg-gradient-to-r from-white to-sky-200 dark:from-slate-800 dark:to-indigo-950">
<SidebarComponent /> <SidebarComponent />
<div class="relative p-6 w-full m-4 bg-blue-50 dark:bg-gray-700 rounded-2xl shadow-lg"> <div class="relative p-6 w-full m-4 bg-blue-50 dark:bg-gray-700 rounded-2xl overflow-hidden shadow-lg">
<RouterView></RouterView> <RouterView></RouterView>
</div> </div>
</div> </div>

View File

@@ -9,7 +9,7 @@ const props = defineProps(
</script> </script>
<template> <template>
<span class="text-white text-center h-screen"> <span class="text-white text-center h-screen overflow-x-scroll ">
{{ props.data.replace(/\\n/g,"") }} {{ props.data.replace(/\\n/g,"") }}
</span> </span>
</template> </template>

View File

@@ -42,20 +42,21 @@ function addNewHeader(name : string, value : string){
</script> </script>
<template> <template>
<div class="w-full flex"> <div class="w-full gap-4 flex">
<div class="w-full">Header name</div> <div class="w-full">Header name</div>
<div class="w-full">Header value</div> <div class="w-full">Header value</div>
<div class="w-1/5"></div>
</div> </div>
<div class="flex flex-col gap-4"> <div class="flex flex-col gap-4">
<div class="flex gap-9 flex-row" v-for="(item, index) in headerData" :key="index"> <div class="flex gap-9 flex-row" v-for="(item, index) in headerData" :key="index">
<input type="text" :value="index" class="text-field" /> <input type="text" :value="index" class="text-field" />
<input type="text" :value="item" class="text-field" /> <input type="text" :value="item" class="text-field" />
<button @click="deleteHeader(index)" class="tool-button" :class="setEssentialHeaderStyle(index)">X</button> <button @click="deleteHeader(index)" class="tool-button w-1/5" :class="setEssentialHeaderStyle(index)">Remove</button>
</div> </div>
<div class="flex gap-9 flex-row"> <div class="flex gap-9 flex-row">
<input type="text" v-model="newHeaderName" class="text-field" /> <input type="text" v-model="newHeaderName" class="text-field" />
<input type="text" v-model="newHeaderValue" class="text-field" /> <input type="text" v-model="newHeaderValue" class="text-field" />
<button class="tool-button" @click="addNewHeader(newHeaderName, newHeaderValue)" >+</button> <button class="tool-button w-1/5" @click="addNewHeader(newHeaderName, newHeaderValue)" >Add</button>
</div> </div>
</div> </div>
</template> </template>

View File

@@ -10,11 +10,14 @@ const props = defineProps(
</script> </script>
<template> <template>
<table class="w-full text-center text-white mt-2"> <div class="w-full text-center text-white mt-2 flex flex-col gap-4 ">
<tr> <th>Name</th> <th>Value</th> </tr> <div class="flex flex-row gap-4">
<tr v-for="(value,name) in JSON.parse(data)" :key="name"> <div class="w-full font-bold">Name</div>
<td>{{ name }}</td> <div class="w-full font-bold">Value</div>
<td>{{ value }}</td> </div >
</tr> <div class="flex flex-row gap-4" v-for="(value,name) in JSON.parse(data)" :key="name">
</table> <div class="w-full overflow-hidden">{{ name }}</div>
<div class="w-full overflow-hidden">{{ value }}</div>
</div>
</div>
</template> </template>

View File

@@ -33,7 +33,7 @@ function showHeaders(headers: object, index: number){
<template> <template>
<div class="w-full xl:w-5/12 flex flex-col gap-y-4"> <div class="w-full xl:w-5/12 flex flex-col gap-y-4">
<HistoryRecords @click:show-headers="showHeaders" @click:show-body="showBody"></HistoryRecords> <HistoryRecords class="h-1/3 overflow-y-scroll" @click:show-headers="showHeaders" @click:show-body="showBody"></HistoryRecords>
<BodyDetailComponent :data="currentShownData" v-if="shownDetail == 'body' "></BodyDetailComponent> <BodyDetailComponent :data="currentShownData" v-if="shownDetail == 'body' "></BodyDetailComponent>
<HeadersDetailComponent :data="currentShownData" v-if="shownDetail == 'headers' "></HeadersDetailComponent> <HeadersDetailComponent :data="currentShownData" v-if="shownDetail == 'headers' "></HeadersDetailComponent>
</div> </div>

View File

@@ -1,8 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref} from 'vue'; import { ref } from 'vue';
const emit = defineEmits([ const emit = defineEmits([
'closed:toast_closed' 'closed:toast_closed',
]) ])
const props = defineProps( const props = defineProps(
@@ -22,7 +22,7 @@ function hideToast(){
<template> <template>
<div id="toast-success" :class="visible" class="flex items-center w-full max-w-xs p-4 mb-4 text-gray-500 bg-white rounded-lg shadow dark:text-gray-400 dark:bg-gray-800" role="alert"> <div id="toast-success" class="transition-opacity duration-1000 flex items-center w-full max-w-xs p-4 mb-4 text-gray-500 bg-white rounded-lg shadow dark:text-gray-400 dark:bg-gray-800 " :class="visible" role="alert">
<div class="inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-green-500 bg-green-100 rounded-lg dark:bg-green-800 dark:text-green-200"> <div class="inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-green-500 bg-green-100 rounded-lg dark:bg-green-800 dark:text-green-200">
<svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"></path></svg> <svg aria-hidden="true" class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z" clip-rule="evenodd"></path></svg>
<span class="sr-only">Check icon</span> <span class="sr-only">Check icon</span>

View File

@@ -27,6 +27,7 @@ function prepareAndSendData(){
function showToast(){ function showToast(){
visible.value = "visible"; visible.value = "visible";
setTimeout( () => { visible.value = "opacity-0" } , 1500 )
} }
function hideToast(){ function hideToast(){

View File

@@ -6,7 +6,7 @@ import HistoryComponent from '@components/mock/HistoryComponent.vue'
<template> <template>
<div class="flex flex-col xl:flex-row gap-6 w-full h-full"> <div class="flex flex-col xl:flex-row gap-6 w-full overflow-hidden h-full">
<RestMockMessageComponent></RestMockMessageComponent> <RestMockMessageComponent></RestMockMessageComponent>
<HistoryComponent></HistoryComponent> <HistoryComponent></HistoryComponent>
</div> </div>