feat: embeds (#3627)

Co-authored-by: Liyas Thomas <liyascthomas@gmail.com>
This commit is contained in:
Nivedin
2023-12-07 15:03:49 +05:30
committed by GitHub
parent ab7c29d228
commit 2bf0106aa2
23 changed files with 783 additions and 145 deletions

View File

@@ -5,13 +5,18 @@
render-inactive-tabs
>
<HoppSmartTab
v-if="properties ? properties.includes('parameters') : true"
:id="'params'"
:label="`${t('tab.parameters')}`"
:info="`${newActiveParamsCount$}`"
>
<HttpParameters v-model="request.params" />
</HoppSmartTab>
<HoppSmartTab :id="'bodyParams'" :label="`${t('tab.body')}`">
<HoppSmartTab
v-if="properties ? properties.includes('body') : true"
:id="'bodyParams'"
:label="`${t('tab.body')}`"
>
<HttpBody
v-model:headers="request.headers"
v-model:body="request.body"
@@ -19,16 +24,22 @@
/>
</HoppSmartTab>
<HoppSmartTab
v-if="properties ? properties.includes('headers') : true"
:id="'headers'"
:label="`${t('tab.headers')}`"
:info="`${newActiveHeadersCount$}`"
>
<HttpHeaders v-model="request" @change-tab="changeOptionTab" />
</HoppSmartTab>
<HoppSmartTab :id="'authorization'" :label="`${t('tab.authorization')}`">
<HoppSmartTab
v-if="properties ? properties.includes('authorization') : true"
:id="'authorization'"
:label="`${t('tab.authorization')}`"
>
<HttpAuthorization v-model="request.auth" />
</HoppSmartTab>
<HoppSmartTab
v-if="properties ? properties.includes('preRequestScript') : true"
:id="'preRequestScript'"
:label="`${t('tab.pre_request_script')}`"
:indicator="
@@ -40,6 +51,7 @@
<HttpPreRequestScript v-model="request.preRequestScript" />
</HoppSmartTab>
<HoppSmartTab
v-if="properties ? properties.includes('tests') : true"
:id="'tests'"
:label="`${t('tab.tests')}`"
:indicator="
@@ -76,6 +88,7 @@ const props = withDefaults(
defineProps<{
modelValue: HoppRESTRequest
optionTab: RESTOptionTabs
properties?: string[]
}>(),
{
optionTab: "params",

View File

@@ -1,6 +1,6 @@
<template>
<div class="relative flex flex-1 flex-col">
<HttpResponseMeta :response="doc.response" />
<HttpResponseMeta :response="doc.response" :is-embed="isEmbed" />
<LensesResponseBodyRenderer
v-if="!loading && hasResponse"
v-model:document="doc"
@@ -15,6 +15,7 @@ import { HoppRESTDocument } from "~/helpers/rest/document"
const props = defineProps<{
document: HoppRESTDocument
isEmbed: boolean
}>()
const emit = defineEmits<{

View File

@@ -2,8 +2,20 @@
<div
class="sticky top-0 z-10 flex flex-shrink-0 items-center justify-center overflow-auto overflow-x-auto whitespace-nowrap bg-primary p-4"
>
<AppShortcutsPrompt v-if="response == null" class="flex-1" />
<div v-else class="flex flex-1 flex-col">
<AppShortcutsPrompt v-if="response == null && !isEmbed" class="flex-1" />
<div v-if="response == null && isEmbed">
<HoppButtonSecondary
:label="`${t('app.documentation')}`"
to="https://docs.hoppscotch.io/documentation/features/rest-api-testing#response"
:icon="IconExternalLink"
blank
outline
reverse
/>
</div>
<div v-else-if="response" class="flex flex-1 flex-col">
<div
v-if="response.type === 'loading'"
class="flex flex-col items-center justify-center"
@@ -105,6 +117,7 @@ import { getStatusCodeReasonPhrase } from "~/helpers/utils/statusCodes"
import { useService } from "dioc/vue"
import { InspectionService } from "~/services/inspection"
import { RESTTabService } from "~/services/tab/rest"
import IconExternalLink from "~icons/lucide/external-link"
const t = useI18n()
const colorMode = useColorMode()
@@ -112,6 +125,7 @@ const tabs = useService(RESTTabService)
const props = defineProps<{
response: HoppRESTResponse | null | undefined
isEmbed?: boolean
}>()
/**