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:
@@ -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>
|
||||
|
||||
@@ -461,10 +461,17 @@ defineActionHandler("rest.request.open", ({ doc }) => {
|
||||
createNewTab(doc)
|
||||
})
|
||||
|
||||
defineActionHandler("rest.request.rename", openReqRenameModal)
|
||||
defineActionHandler("request.duplicate-tab", ({ tabID }) => {
|
||||
duplicateTab(tabID)
|
||||
defineActionHandler("request.rename", openReqRenameModal)
|
||||
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)
|
||||
|
||||
useService(HeaderInspectorService)
|
||||
useService(EnvironmentInspectorService)
|
||||
|
||||
Reference in New Issue
Block a user