fix: spotlight actions on graphql (#3299)

* fix: spotlight actions for graphql

* fix: environment actions

* fix: gql rename request

* fix: graphql spotlight actions

* fix: tab shortcuts not working properly

* fix: only show download and copy response when there is a response

---------

Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com>
This commit is contained in:
Anwarul Islam
2023-08-28 21:10:01 +06:00
committed by GitHub
parent 0eacd6763b
commit b953b32ff4
12 changed files with 240 additions and 108 deletions

View File

@@ -27,7 +27,7 @@
@open-rename-modal="openReqRenameModal(tab)"
@close-tab="removeTab(tab.id)"
@close-other-tabs="closeOtherTabsAction(tab.id)"
@duplicate-tab="duplicateTab(tab)"
@duplicate-tab="duplicateTab(tab.id)"
/>
</template>
@@ -203,12 +203,15 @@ const renameReqName = () => {
showRenamingReqNameModalForTabID.value = undefined
}
const duplicateTab = (tab: HoppGQLTab) => {
const newTab = createNewTab({
request: tab.document.request,
isDirty: true,
})
currentTabID.value = newTab.id
const duplicateTab = (tabID: string) => {
const tab = getTabRef(tabID)
if (tab.value) {
const newTab = createNewTab({
request: tab.value.document.request,
isDirty: true,
})
currentTabID.value = newTab.id
}
}
defineActionHandler("gql.request.open", ({ request, saveContext }) => {
@@ -218,4 +221,19 @@ defineActionHandler("gql.request.open", ({ request, saveContext }) => {
isDirty: false,
})
})
defineActionHandler("request.rename", () => {
openReqRenameModal(getTabRef(currentTabID.value).value!)
})
defineActionHandler("tab.duplicate-tab", ({ tabID }) => {
duplicateTab(tabID ?? currentTabID.value)
})
defineActionHandler("tab.close-current", () => {
removeTab(currentTabID.value)
})
defineActionHandler("tab.close-other", () => {
closeOtherTabs(currentTabID.value)
})
defineActionHandler("tab.open-new", addNewTab)
</script>