refactor: update all hoppCollection type to remove generic pattern

This commit is contained in:
nivedin
2023-12-11 17:41:02 +05:30
committed by Andrew Bastin
parent 9d2b7cc03f
commit 95953557de
38 changed files with 201 additions and 257 deletions

View File

@@ -36,7 +36,7 @@
import { ref } from "vue"
import { useToast } from "@composables/toast"
import { useI18n } from "@composables/i18n"
import { HoppGQLRequest, makeCollection } from "@hoppscotch/data"
import { makeCollection } from "@hoppscotch/data"
import { addGraphqlCollection } from "~/newstore/collections"
import { platform } from "~/platform"
@@ -60,7 +60,7 @@ const addNewCollection = () => {
}
addGraphqlCollection(
makeCollection<HoppGQLRequest>({
makeCollection({
name: name.value,
folders: [],
requests: [],

View File

@@ -246,14 +246,14 @@ import { removeGraphqlCollection } from "~/newstore/collections"
import { Picked } from "~/helpers/types/HoppPicked"
import { useService } from "dioc/vue"
import { GQLTabService } from "~/services/tab/graphql"
import { HoppCollection, HoppGQLRequest } from "@hoppscotch/data"
import { HoppCollection } from "@hoppscotch/data"
const props = defineProps<{
picked: Picked | null
// Whether the viewing context is related to picking (activates 'select' events)
saveRequest: boolean
collectionIndex: number | null
collection: HoppCollection<HoppGQLRequest>
collection: HoppCollection
isFiltered: boolean
}>()
@@ -275,7 +275,7 @@ const emit = defineEmits<{
e: "edit-properties",
payload: {
collectionIndex: string | null
collection: HoppCollection<HoppGQLRequest>
collection: HoppCollection
}
): void
(e: "edit-collection"): void

View File

@@ -37,12 +37,12 @@ import { ref, watch } from "vue"
import { editGraphqlCollection } from "~/newstore/collections"
import { useToast } from "@composables/toast"
import { useI18n } from "@composables/i18n"
import { HoppCollection, HoppGQLRequest } from "@hoppscotch/data"
import { HoppCollection } from "@hoppscotch/data"
const props = defineProps<{
show: boolean
editingCollectionIndex: number | null
editingCollection: HoppCollection<HoppGQLRequest> | null
editingCollection: HoppCollection | null
editingCollectionName: string
}>()

View File

@@ -230,7 +230,7 @@ import { computed, ref } from "vue"
import { useService } from "dioc/vue"
import { GQLTabService } from "~/services/tab/graphql"
import { Picked } from "~/helpers/types/HoppPicked"
import { HoppCollection, HoppGQLRequest } from "@hoppscotch/data"
import { HoppCollection } from "@hoppscotch/data"
const toast = useToast()
const t = useI18n()
@@ -242,7 +242,7 @@ const props = defineProps<{
picked: Picked
// Whether the request is in a selectable mode (activates 'select' event)
saveRequest: boolean
folder: HoppCollection<HoppGQLRequest>
folder: HoppCollection
folderIndex: number
collectionIndex: number
folderPath: string

View File

@@ -11,7 +11,7 @@
<script setup lang="ts">
import { useI18n } from "~/composables/i18n"
import { useToast } from "~/composables/toast"
import { HoppCollection, HoppGQLRequest } from "@hoppscotch/data"
import { HoppCollection } from "@hoppscotch/data"
import { ImporterOrExporter } from "~/components/importExport/types"
import { FileSource } from "~/helpers/import-export/import/import-sources/FileSource"
import { GistSource } from "~/helpers/import-export/import/import-sources/GistSource"
@@ -214,9 +214,7 @@ const showImportFailedError = () => {
toast.error(t("import.failed"))
}
const handleImportToStore = async (
gqlCollections: HoppCollection<HoppGQLRequest>[]
) => {
const handleImportToStore = async (gqlCollections: HoppCollection[]) => {
setGraphqlCollections(gqlCollections)
toast.success(t("import.success"))
}

View File

@@ -209,9 +209,9 @@ const showModalEditFolder = ref(false)
const showModalEditRequest = ref(false)
const showModalEditProperties = ref(false)
const editingCollection = ref<HoppCollection<HoppGQLRequest> | null>(null)
const editingCollection = ref<HoppCollection | null>(null)
const editingCollectionIndex = ref<number | null>(null)
const editingFolder = ref<HoppCollection<HoppGQLRequest> | null>(null)
const editingFolder = ref<HoppCollection | null>(null)
const editingFolderName = ref("")
const editingFolderIndex = ref<number | null>(null)
const editingFolderPath = ref("")
@@ -219,7 +219,7 @@ const editingRequest = ref<HoppGQLRequest | null>(null)
const editingRequestIndex = ref<number | null>(null)
const editingProperties = ref<{
collection: HoppCollection<HoppGQLRequest> | null
collection: HoppCollection | null
isRootCollection: boolean
path: string
inheritedProperties?: HoppInheritedProperty
@@ -318,7 +318,7 @@ const displayModalEditProperties = (show: boolean) => {
}
const editCollection = (
collection: HoppCollection<HoppGQLRequest>,
collection: HoppCollection,
collectionIndex: number
) => {
editingCollection.value = collection
@@ -404,7 +404,7 @@ const addFolder = (payload: { path: string }) => {
}
const editFolder = (payload: {
folder: HoppCollection<HoppGQLRequest>
folder: HoppCollection
folderPath: string
}) => {
const { folder, folderPath } = payload
@@ -553,7 +553,7 @@ const editProperties = ({
collection,
}: {
collectionIndex: string | null
collection: HoppCollection<HoppGQLRequest> | null
collection: HoppCollection | null
}) => {
if (collectionIndex === null || collection === null) return
@@ -583,7 +583,7 @@ const editProperties = ({
}
const setCollectionProperties = (newCollection: {
collection: HoppCollection<HoppGQLRequest>
collection: HoppCollection
path: string
isRootCollection: boolean
}) => {