From b0c72fd295797246056c1739273cf041f56a0cb0 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Tue, 13 Feb 2024 16:28:43 +0530 Subject: [PATCH] feat: indicate request opened in the tab from the collection tree --- .../new-collections/rest/Request.vue | 6 ++---- .../components/new-collections/rest/index.vue | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/packages/hoppscotch-common/src/components/new-collections/rest/Request.vue b/packages/hoppscotch-common/src/components/new-collections/rest/Request.vue index 4314f5157..a240d76e0 100644 --- a/packages/hoppscotch-common/src/components/new-collections/rest/Request.vue +++ b/packages/hoppscotch-common/src/components/new-collections/rest/Request.vue @@ -24,7 +24,7 @@ {{ requestView.request.name }} () @@ -152,9 +153,6 @@ const emit = defineEmits<{ const tippyActions = ref(null) const options = ref(null) -// TODO: implement -const isActive = ref(true) - const requestLabelColor = computed(() => getMethodLabelColorClassOf(props.requestView.request) ) diff --git a/packages/hoppscotch-common/src/components/new-collections/rest/index.vue b/packages/hoppscotch-common/src/components/new-collections/rest/index.vue index 07bde3f44..46be887bf 100644 --- a/packages/hoppscotch-common/src/components/new-collections/rest/index.vue +++ b/packages/hoppscotch-common/src/components/new-collections/rest/index.vue @@ -46,6 +46,7 @@ /> { const indexPath = pathToIndex(id) return indexPath.length === 1 } + +const isActiveRequest = (requestID: string) => { + if ( + tabs.currentActiveTab.value.document.saveContext?.originLocation !== + "workspace-user-collection" + ) { + return false + } + + const requestHandle = ref( + tabs.currentActiveTab.value.document.saveContext?.requestHandle + ) + + if (requestHandle.value.type === "invalid") { + return false + } + return requestHandle.value.data.request.id === requestID +}