2021-01-28 07:39:31 +00:00
|
|
|
<template>
|
2021-07-17 17:40:28 +00:00
|
|
|
<div class="bg-primary flex p-4 top-0 z-10 sticky items-center">
|
2021-07-15 04:10:45 +00:00
|
|
|
<div
|
2021-07-16 15:04:35 +00:00
|
|
|
v-if="response == null"
|
2021-07-15 04:10:45 +00:00
|
|
|
class="
|
2021-07-17 17:40:28 +00:00
|
|
|
flex flex-col flex-1
|
2021-07-16 15:04:35 +00:00
|
|
|
text-secondaryLight
|
2021-07-17 17:40:28 +00:00
|
|
|
items-center
|
2021-07-16 15:04:35 +00:00
|
|
|
justify-center
|
2021-07-15 04:10:45 +00:00
|
|
|
"
|
|
|
|
|
>
|
2021-08-01 17:33:54 +00:00
|
|
|
<ButtonSecondary
|
2021-08-18 18:40:57 +00:00
|
|
|
:label="$t('app.documentation')"
|
2021-08-01 17:33:54 +00:00
|
|
|
to="https://docs.hoppscotch.io"
|
2021-08-28 00:17:33 +00:00
|
|
|
svg="external-link"
|
2021-08-01 17:33:54 +00:00
|
|
|
blank
|
|
|
|
|
outline
|
2021-08-13 11:14:02 +00:00
|
|
|
reverse
|
2021-08-01 17:33:54 +00:00
|
|
|
/>
|
2021-07-16 15:04:35 +00:00
|
|
|
</div>
|
2021-08-15 06:27:20 +00:00
|
|
|
<div v-else class="flex flex-col flex-1">
|
|
|
|
|
<div v-if="response.type === 'loading'">
|
|
|
|
|
<i class="animate-spin material-icons"> refresh </i>
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
v-if="response.type === 'network_fail'"
|
|
|
|
|
class="
|
|
|
|
|
flex flex-col flex-1
|
|
|
|
|
text-secondaryLight
|
|
|
|
|
p-4
|
|
|
|
|
items-center
|
|
|
|
|
justify-center
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<i class="opacity-75 pb-2 material-icons">cloud_off</i>
|
|
|
|
|
<span class="text-center pb-2">
|
|
|
|
|
{{ $t("error.network_fail") }}
|
|
|
|
|
</span>
|
|
|
|
|
<span class="text-center pb-4">
|
|
|
|
|
{{ $t("helpers.network_fail") }}
|
|
|
|
|
</span>
|
|
|
|
|
<ButtonSecondary
|
|
|
|
|
outline
|
|
|
|
|
:label="$t('action.learn_more')"
|
|
|
|
|
to="https://docs.hoppscotch.io"
|
|
|
|
|
blank
|
2021-08-28 00:17:33 +00:00
|
|
|
svg="external-link"
|
2021-08-15 06:27:20 +00:00
|
|
|
reverse
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2021-07-16 15:04:35 +00:00
|
|
|
<div
|
2021-08-15 06:27:20 +00:00
|
|
|
v-if="response.type === 'success' || 'fail'"
|
2021-07-16 15:04:35 +00:00
|
|
|
:class="statusCategory.className"
|
2021-08-13 11:14:02 +00:00
|
|
|
class="font-semibold space-x-4"
|
2021-07-16 15:04:35 +00:00
|
|
|
>
|
2021-07-15 04:10:45 +00:00
|
|
|
<span v-if="response.statusCode">
|
2021-08-16 17:45:06 +00:00
|
|
|
<span class="text-secondary"> {{ $t("response.status") }}: </span>
|
2021-08-18 18:40:57 +00:00
|
|
|
{{ response.statusCode || $t("state.waiting_send_request") }}
|
2021-07-15 04:10:45 +00:00
|
|
|
</span>
|
2021-07-25 20:03:32 +00:00
|
|
|
<span v-if="response.meta && response.meta.responseDuration">
|
2021-08-16 17:45:06 +00:00
|
|
|
<span class="text-secondary"> {{ $t("response.time") }}: </span>
|
2021-07-15 04:10:45 +00:00
|
|
|
{{ `${response.meta.responseDuration} ms` }}
|
|
|
|
|
</span>
|
2021-07-25 20:03:32 +00:00
|
|
|
<span v-if="response.meta && response.meta.responseSize">
|
2021-08-16 17:45:06 +00:00
|
|
|
<span class="text-secondary"> {{ $t("response.size") }}: </span>
|
2021-07-15 04:10:45 +00:00
|
|
|
{{ `${response.meta.responseSize} B` }}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
2021-07-13 07:18:57 +00:00
|
|
|
</div>
|
2021-01-28 07:39:31 +00:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
2021-09-09 12:17:27 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { computed } from "@nuxtjs/composition-api"
|
2021-01-28 07:39:31 +00:00
|
|
|
import findStatusGroup from "~/helpers/findStatusGroup"
|
2021-09-09 12:17:27 +00:00
|
|
|
import { HoppRESTResponse } from "~/helpers/types/HoppRESTResponse"
|
|
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
|
response: HoppRESTResponse
|
|
|
|
|
}>()
|
2021-01-28 07:39:31 +00:00
|
|
|
|
2021-09-09 12:17:27 +00:00
|
|
|
const statusCategory = computed(() => {
|
|
|
|
|
if (
|
|
|
|
|
props.response.type === "loading" ||
|
|
|
|
|
props.response.type === "network_fail"
|
|
|
|
|
)
|
|
|
|
|
return ""
|
|
|
|
|
return findStatusGroup(props.response.statusCode)
|
2021-08-24 03:44:46 +00:00
|
|
|
})
|
2021-01-28 07:39:31 +00:00
|
|
|
</script>
|
2021-08-02 04:30:50 +00:00
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.shortcut-key {
|
|
|
|
|
@apply bg-dividerLight;
|
|
|
|
|
@apply rounded;
|
|
|
|
|
@apply ml-2;
|
|
|
|
|
@apply py-1;
|
|
|
|
|
@apply px-2;
|
|
|
|
|
@apply inline-flex;
|
|
|
|
|
}
|
|
|
|
|
</style>
|