Skip to content

Commit cbdb654

Browse files
notKvSKvirajS
andauthored
fix: show argument type on click in GQL documentation view (hoppscotch#5328)
Co-authored-by: Viraj <[email protected]>
1 parent bb25c59 commit cbdb654

File tree

1 file changed

+15
-2
lines changed
  • packages/hoppscotch-common/src/components/graphql

1 file changed

+15
-2
lines changed

packages/hoppscotch-common/src/components/graphql/Argument.vue

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
<template>
22
<template v-if="inline">
3-
<span>
3+
<span class="hopp-doc-explorer-argument" tabindex="0" @click="handleClick">
44
<span class="hopp-doc-explorer-argument-name"> {{ arg.name }} </span>:
55
<GraphqlTypeLink :type="arg.type" />
66
<GraphqlDefaultValue v-if="showDefaultValue !== false" :field="arg" />
77
</span>
88
</template>
99

10-
<div v-else class="hopp-doc-explorer-argument">
10+
<div
11+
v-else
12+
class="hopp-doc-explorer-argument"
13+
tabindex="0"
14+
@click="handleClick"
15+
>
1116
<div class="inline-flex items-center align-bottom">
1217
<span
1318
v-if="showAddButton"
@@ -52,6 +57,7 @@
5257
import type { GraphQLArgument } from "graphql"
5358
import { useQuery } from "~/helpers/graphql/query"
5459
import { debounce } from "lodash-es"
60+
import { useExplorer } from "~/helpers/graphql/explorer"
5561
5662
const { handleAddArgument, isArgumentInOperation } = useQuery()
5763
@@ -85,6 +91,12 @@ const props = withDefaults(defineProps<ArgumentProps>(), {
8591
showAddButton: false,
8692
})
8793
94+
const { push } = useExplorer()
95+
96+
const handleClick = () => {
97+
push({ name: props.arg.name, def: props.arg })
98+
}
99+
88100
const insertQuery = debounce(() => {
89101
handleAddArgument(props.arg)
90102
}, 50)
@@ -93,5 +105,6 @@ const insertQuery = debounce(() => {
93105
<style scoped lang="scss">
94106
.hopp-doc-explorer-argument {
95107
@apply transition hover:bg-primaryLight;
108+
cursor: pointer;
96109
}
97110
</style>

0 commit comments

Comments
 (0)