feat: expanded search capabilities of spotlight (#3255)

Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
Anwarul Islam
2023-08-21 20:33:51 +06:00
committed by GitHub
parent b0b6edc58e
commit 5a91fb53b2
23 changed files with 1633 additions and 25 deletions

View File

@@ -630,6 +630,13 @@ defineActionHandler("request.method.put", () => updateMethod("PUT"))
defineActionHandler("request.method.delete", () => updateMethod("DELETE"))
defineActionHandler("request.method.head", () => updateMethod("HEAD"))
defineActionHandler("request.import-curl", () => {
showCurlImportModal.value = true
})
defineActionHandler("request.show-code", () => {
showCodegenModal.value = true
})
const isCustomMethod = computed(() => {
return (
tab.value.document.request.method === "CUSTOM" ||

View File

@@ -1,6 +1,6 @@
<template>
<HoppSmartTabs
v-model="selectedRealtimeTab"
v-model="selectedOptionsTab"
styles="sticky overflow-x-auto flex-shrink-0 bg-primary top-upperMobilePrimaryStickyFold sm:top-upperPrimaryStickyFold z-10"
render-inactive-tabs
>
@@ -56,12 +56,15 @@ import { useI18n } from "@composables/i18n"
import { HoppRESTRequest } from "@hoppscotch/data"
import { useVModel } from "@vueuse/core"
import { computed, ref } from "vue"
import { defineActionHandler } from "~/helpers/actions"
export type RequestOptionTabs =
| "params"
| "bodyParams"
| "headers"
| "authorization"
| "preRequestScript"
| "tests"
const t = useI18n()
@@ -73,10 +76,10 @@ const emit = defineEmits<{
const request = useVModel(props, "modelValue", emit)
const selectedRealtimeTab = ref<RequestOptionTabs>("params")
const selectedOptionsTab = ref<RequestOptionTabs>("params")
const changeTab = (e: RequestOptionTabs) => {
selectedRealtimeTab.value = e
selectedOptionsTab.value = e
}
const newActiveParamsCount$ = computed(() => {
@@ -96,4 +99,8 @@ const newActiveHeadersCount$ = computed(() => {
if (e === 0) return null
return `${e}`
})
defineActionHandler("request.open-tab", ({ tab }) => {
selectedOptionsTab.value = tab
})
</script>