feat: gql revamp (#2644)

Co-authored-by: Liyas Thomas <liyascthomas@gmail.com>
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
Anwarul Islam
2023-08-22 18:13:43 +06:00
committed by GitHub
parent 191fa376d2
commit 88212e8cfe
41 changed files with 2503 additions and 1702 deletions

View File

@@ -36,7 +36,7 @@
import { ref, watch } from "vue"
import { useI18n } from "@composables/i18n"
import { useToast } from "@composables/toast"
import { getGQLSession } from "~/newstore/GQLSession"
import { currentActiveTab } from "~/helpers/graphql/tab"
const toast = useToast()
const t = useI18n()
@@ -63,7 +63,7 @@ watch(
() => props.show,
(show) => {
if (show) {
editingName.value = getGQLSession().request.name
editingName.value = currentActiveTab.value?.document.request.name
}
}
)

View File

@@ -132,7 +132,7 @@ import { useToast } from "@composables/toast"
import { HoppGQLRequest, makeGQLRequest } from "@hoppscotch/data"
import { cloneDeep } from "lodash-es"
import { removeGraphqlRequest } from "~/newstore/collections"
import { setGQLSession } from "~/newstore/GQLSession"
import { createNewTab } from "~/helpers/graphql/tab"
// Template refs
const tippyActions = ref<any | null>(null)
@@ -179,7 +179,7 @@ const selectRequest = () => {
if (props.saveRequest) {
pick()
} else {
setGQLSession({
createNewTab({
request: cloneDeep(
makeGQLRequest({
name: props.request.name,
@@ -190,8 +190,7 @@ const selectRequest = () => {
auth: props.request.auth,
})
),
schema: "",
response: "",
isDirty: false,
})
}
}

View File

@@ -137,7 +137,6 @@ import {
addGraphqlFolder,
saveGraphqlRequestAs,
} from "~/newstore/collections"
import { getGQLSession, setGQLSession } from "~/newstore/GQLSession"
import IconPlus from "~icons/lucide/plus"
import IconHelpCircle from "~icons/lucide/help-circle"
@@ -146,6 +145,7 @@ import { useI18n } from "@composables/i18n"
import { useReadonlyStream } from "@composables/stream"
import { useColorMode } from "@composables/theming"
import { platform } from "~/platform"
import { createNewTab, currentActiveTab } from "~/helpers/graphql/tab"
export default defineComponent({
props: {
@@ -267,15 +267,15 @@ export default defineComponent({
},
onAddRequest({ name, path }) {
const newRequest = {
...getGQLSession().request,
...currentActiveTab.value.document.request,
name,
}
saveGraphqlRequestAs(path, newRequest)
setGQLSession({
createNewTab({
request: newRequest,
schema: "",
response: "",
isDirty: false,
})
platform.analytics?.logEvent({