fix: specify correct request index with update action
This commit is contained in:
@@ -71,7 +71,7 @@
|
|||||||
|
|
||||||
<NewCollectionsRestRequest
|
<NewCollectionsRestRequest
|
||||||
v-else-if="node.data.type === 'request'"
|
v-else-if="node.data.type === 'request'"
|
||||||
:is-active="isActiveRequest(node.data.value.request.id)"
|
:is-active="isActiveRequest(node.data.value)"
|
||||||
:is-selected="
|
:is-selected="
|
||||||
isSelected(getRequestIndexPathArgs(node.data.value.requestID))
|
isSelected(getRequestIndexPathArgs(node.data.value.requestID))
|
||||||
"
|
"
|
||||||
@@ -168,6 +168,7 @@ import { WorkspaceRESTCollectionTreeAdapter } from "~/helpers/adapters/Workspace
|
|||||||
import { TeamCollection } from "~/helpers/backend/graphql"
|
import { TeamCollection } from "~/helpers/backend/graphql"
|
||||||
import { updateInheritedPropertiesForAffectedRequests } from "~/helpers/collection/collection"
|
import { updateInheritedPropertiesForAffectedRequests } from "~/helpers/collection/collection"
|
||||||
import { HoppInheritedProperty } from "~/helpers/types/HoppInheritedProperties"
|
import { HoppInheritedProperty } from "~/helpers/types/HoppInheritedProperties"
|
||||||
|
import { Picked } from "~/helpers/types/HoppPicked"
|
||||||
import {
|
import {
|
||||||
navigateToFolderWithIndexPath,
|
navigateToFolderWithIndexPath,
|
||||||
restCollections$,
|
restCollections$,
|
||||||
@@ -175,12 +176,12 @@ import {
|
|||||||
} from "~/newstore/collections"
|
} from "~/newstore/collections"
|
||||||
import { NewWorkspaceService } from "~/services/new-workspace"
|
import { NewWorkspaceService } from "~/services/new-workspace"
|
||||||
import { HandleRef } from "~/services/new-workspace/handle"
|
import { HandleRef } from "~/services/new-workspace/handle"
|
||||||
|
import { RESTCollectionViewRequest } from "~/services/new-workspace/view"
|
||||||
import { Workspace } from "~/services/new-workspace/workspace"
|
import { Workspace } from "~/services/new-workspace/workspace"
|
||||||
import { RESTTabService } from "~/services/tab/rest"
|
import { RESTTabService } from "~/services/tab/rest"
|
||||||
import IconImport from "~icons/lucide/folder-down"
|
import IconImport from "~icons/lucide/folder-down"
|
||||||
import IconHelpCircle from "~icons/lucide/help-circle"
|
import IconHelpCircle from "~icons/lucide/help-circle"
|
||||||
import IconPlus from "~icons/lucide/plus"
|
import IconPlus from "~icons/lucide/plus"
|
||||||
import { Picked } from "~/helpers/types/HoppPicked"
|
|
||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
@@ -749,9 +750,6 @@ const selectRequest = async (requestIndexPath: string) => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there is a request with this save context, switch into it
|
|
||||||
let possibleTab = null
|
|
||||||
|
|
||||||
const cascadingAuthHeadersHandleResult =
|
const cascadingAuthHeadersHandleResult =
|
||||||
await workspaceService.getRESTCollectionLevelAuthHeadersView(
|
await workspaceService.getRESTCollectionLevelAuthHeadersView(
|
||||||
collectionHandle
|
collectionHandle
|
||||||
@@ -771,16 +769,18 @@ const selectRequest = async (requestIndexPath: string) => {
|
|||||||
|
|
||||||
const { auth, headers } = cascadingAuthHeadersHandle.value.data
|
const { auth, headers } = cascadingAuthHeadersHandle.value.data
|
||||||
|
|
||||||
possibleTab = tabs.getTabRefWithSaveContext({
|
// If there is a request with this save context, switch into it
|
||||||
|
const possibleTab = tabs.getTabRefWithSaveContext({
|
||||||
originLocation: "workspace-user-collection",
|
originLocation: "workspace-user-collection",
|
||||||
requestHandle,
|
requestHandle,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (possibleTab) {
|
if (possibleTab) {
|
||||||
tabs.setActiveTab(possibleTab.value.id)
|
tabs.setActiveTab(possibleTab.value.id)
|
||||||
} else {
|
} else {
|
||||||
// If not, open the request in a new tab
|
// If not, open the request in a new tab
|
||||||
tabs.createNewTab({
|
tabs.createNewTab({
|
||||||
request: cloneDeep(requestHandle.value.data.request),
|
request: requestHandle.value.data.request,
|
||||||
isDirty: false,
|
isDirty: false,
|
||||||
saveContext: {
|
saveContext: {
|
||||||
originLocation: "workspace-user-collection",
|
originLocation: "workspace-user-collection",
|
||||||
@@ -1075,7 +1075,7 @@ const isAlreadyInRoot = (id: string) => {
|
|||||||
return indexPath.length === 1
|
return indexPath.length === 1
|
||||||
}
|
}
|
||||||
|
|
||||||
const isActiveRequest = (requestID: string) => {
|
const isActiveRequest = (requestView: RESTCollectionViewRequest) => {
|
||||||
if (
|
if (
|
||||||
tabs.currentActiveTab.value.document.saveContext?.originLocation !==
|
tabs.currentActiveTab.value.document.saveContext?.originLocation !==
|
||||||
"workspace-user-collection"
|
"workspace-user-collection"
|
||||||
@@ -1090,7 +1090,10 @@ const isActiveRequest = (requestID: string) => {
|
|||||||
if (requestHandle.value.type === "invalid") {
|
if (requestHandle.value.type === "invalid") {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return requestHandle.value.data.request.id === requestID
|
return (
|
||||||
|
requestHandle.value.data.requestID === requestView.requestID &&
|
||||||
|
requestHandle.value.data.request.id === requestView.request.id
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onSelectPick = (payload: Picked | null) => {
|
const onSelectPick = (payload: Picked | null) => {
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ export class PersonalWorkspaceProviderService
|
|||||||
const { collectionID, requestID, request } = requestHandle.value.data
|
const { collectionID, requestID, request } = requestHandle.value.data
|
||||||
|
|
||||||
const newRequest: HoppRESTRequest = merge(request, updatedRequest)
|
const newRequest: HoppRESTRequest = merge(request, updatedRequest)
|
||||||
const requestIndex = parseInt(requestID)
|
const requestIndex = parseInt(requestID.split("/").slice(-1)[0])
|
||||||
editRESTRequest(collectionID, requestIndex, newRequest)
|
editRESTRequest(collectionID, requestIndex, newRequest)
|
||||||
|
|
||||||
platform.analytics?.logEvent({
|
platform.analytics?.logEvent({
|
||||||
|
|||||||
Reference in New Issue
Block a user