@@ -41,52 +41,51 @@
-
diff --git a/packages/hoppscotch-common/src/components/collections/AddRequest.vue b/packages/hoppscotch-common/src/components/collections/AddRequest.vue
index 68f76c892..fba4fe5d9 100644
--- a/packages/hoppscotch-common/src/components/collections/AddRequest.vue
+++ b/packages/hoppscotch-common/src/components/collections/AddRequest.vue
@@ -48,23 +48,20 @@ import { getRESTRequest } from "~/newstore/RESTSession"
const toast = useToast()
const t = useI18n()
-const props = defineProps<{
- show: boolean
- loadingState: boolean
- folder?: object
- folderPath?: string
-}>()
+const props = withDefaults(
+ defineProps<{
+ show: boolean
+ loadingState: boolean
+ }>(),
+ {
+ show: false,
+ loadingState: false,
+ }
+)
const emit = defineEmits<{
- (e: "hide-modal"): void
- (
- e: "add-request",
- v: {
- name: string
- folder: object | undefined
- path: string | undefined
- }
- ): void
+ (event: "hide-modal"): void
+ (event: "add-request", name: string): void
}>()
const name = ref("")
@@ -79,15 +76,11 @@ watch(
)
const addRequest = () => {
- if (!name.value) {
+ if (name.value.trim() === "") {
toast.error(`${t("error.empty_req_name")}`)
return
}
- emit("add-request", {
- name: name.value,
- folder: props.folder,
- path: props.folderPath,
- })
+ emit("add-request", name.value)
}
const hideModal = () => {
diff --git a/packages/hoppscotch-common/src/components/collections/ChooseType.vue b/packages/hoppscotch-common/src/components/collections/ChooseType.vue
deleted file mode 100644
index 52974141a..000000000
--- a/packages/hoppscotch-common/src/components/collections/ChooseType.vue
+++ /dev/null
@@ -1,162 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- {
- updateSelectedTeam(team)
- hide()
- }
- "
- />
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/hoppscotch-common/src/components/collections/Collection.vue b/packages/hoppscotch-common/src/components/collections/Collection.vue
new file mode 100644
index 000000000..7a96c7387
--- /dev/null
+++ b/packages/hoppscotch-common/src/components/collections/Collection.vue
@@ -0,0 +1,252 @@
+
+
+
+
+
+
+
+
+ {{ collectionName }}
+
+
+
+
+
+
+
+
+
+
+ {
+ emit('add-request')
+ hide()
+ }
+ "
+ />
+ {
+ emit('add-folder')
+ hide()
+ }
+ "
+ />
+ {
+ emit('edit-collection')
+ hide()
+ }
+ "
+ />
+ {
+ emit('export-data'),
+ collectionsType === 'my-collections' ? hide() : null
+ }
+ "
+ />
+ {
+ emit('remove-collection')
+ hide()
+ }
+ "
+ />
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/hoppscotch-common/src/components/collections/Edit.vue b/packages/hoppscotch-common/src/components/collections/Edit.vue
index 803838281..65b348977 100644
--- a/packages/hoppscotch-common/src/components/collections/Edit.vue
+++ b/packages/hoppscotch-common/src/components/collections/Edit.vue
@@ -41,46 +41,52 @@
-
diff --git a/packages/hoppscotch-common/src/components/collections/EditFolder.vue b/packages/hoppscotch-common/src/components/collections/EditFolder.vue
index 659986fc3..58ec7549c 100644
--- a/packages/hoppscotch-common/src/components/collections/EditFolder.vue
+++ b/packages/hoppscotch-common/src/components/collections/EditFolder.vue
@@ -3,7 +3,7 @@
v-if="show"
dialog
:title="t('folder.edit')"
- @close="$emit('hide-modal')"
+ @close="emit('hide-modal')"
>
@@ -41,46 +41,52 @@
-
diff --git a/packages/hoppscotch-common/src/components/collections/EditRequest.vue b/packages/hoppscotch-common/src/components/collections/EditRequest.vue
index 22ab6df3b..f08e8fbf1 100644
--- a/packages/hoppscotch-common/src/components/collections/EditRequest.vue
+++ b/packages/hoppscotch-common/src/components/collections/EditRequest.vue
@@ -9,13 +9,13 @@
@@ -46,6 +46,7 @@
@@ -61,99 +62,75 @@
diff --git a/packages/hoppscotch-common/src/components/collections/TeamCollections.vue b/packages/hoppscotch-common/src/components/collections/TeamCollections.vue
new file mode 100644
index 000000000..1d9477073
--- /dev/null
+++ b/packages/hoppscotch-common/src/components/collections/TeamCollections.vue
@@ -0,0 +1,625 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {
+ toggleChildren(),
+ saveRequest &&
+ emit('select', {
+ pickedType: 'teams-collection',
+ collectionID: node.id,
+ })
+ }
+ "
+ />
+ {
+ toggleChildren(),
+ saveRequest &&
+ emit('select', {
+ pickedType: 'teams-folder',
+ folderID: node.data.data.data.id,
+ })
+ }
+ "
+ />
+
+
+
+
+
+
![]()
+
+ {{ t("empty.collections") }}
+
+
+
+
+
+
+
![]()
+
+ {{ t("empty.collection") }}
+
+
+
+
+
+
![]()
+
+ {{ t("empty.folder") }}
+
+
+
+
+
+
+
+
+
diff --git a/packages/hoppscotch-common/src/components/collections/TeamSelect.vue b/packages/hoppscotch-common/src/components/collections/TeamSelect.vue
new file mode 100644
index 000000000..8721081e7
--- /dev/null
+++ b/packages/hoppscotch-common/src/components/collections/TeamSelect.vue
@@ -0,0 +1,167 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ t("state.loading") }}
+
+
+ {
+ updateSelectedTeam(team)
+ hide()
+ }
+ "
+ />
+
+ {
+ displayTeamModalAdd(true)
+ hide()
+ }
+ "
+ />
+
+
+
![]()
+
+ {{ t("empty.teams") }}
+
+
{
+ displayTeamModalAdd(true)
+ hide()
+ }
+ "
+ />
+
+
+
+
+
+
+
+
+
diff --git a/packages/hoppscotch-common/src/components/collections/index.vue b/packages/hoppscotch-common/src/components/collections/index.vue
index 0ed8a3db4..1c7482491 100644
--- a/packages/hoppscotch-common/src/components/collections/index.vue
+++ b/packages/hoppscotch-common/src/components/collections/index.vue
@@ -1,190 +1,134 @@
-
-
-
-
-
-
+
+
+
+
+
-
-
-
+
-
-
-
-
-
-
-
-
-
- {{ t("state.loading") }}
-
-
-
![]()
-
- {{ t("empty.collections") }}
-
-
-
-
-
-
-
- {{ t("state.nothing_found") }} "{{ filterText }}"
-
-
+
+
+
+
-
+
-
+
+
+
+
-
diff --git a/packages/hoppscotch-common/src/components/collections/my/Collection.vue b/packages/hoppscotch-common/src/components/collections/my/Collection.vue
deleted file mode 100644
index fec1b8fa2..000000000
--- a/packages/hoppscotch-common/src/components/collections/my/Collection.vue
+++ /dev/null
@@ -1,354 +0,0 @@
-
-
-
-
-
-
-
-
- {{ collection.name }}
-
-
-
-
-
-
-
-
-
-
- {
- $emit('add-request', {
- path: `${collectionIndex}`,
- })
- hide()
- }
- "
- />
- {
- $emit('add-folder', {
- folder: collection,
- path: `${collectionIndex}`,
- })
- hide()
- }
- "
- />
- {
- $emit('edit-collection')
- hide()
- }
- "
- />
- {
- exportCollection()
- hide()
- }
- "
- />
- {
- removeCollection()
- hide()
- }
- "
- />
-
-
-
-
-
-
-
-
-
-
-
-
-
![]()
-
- {{ t("empty.collection") }}
-
-
-
-
-
-
-
-
diff --git a/packages/hoppscotch-common/src/components/collections/my/Folder.vue b/packages/hoppscotch-common/src/components/collections/my/Folder.vue
deleted file mode 100644
index bb99aed85..000000000
--- a/packages/hoppscotch-common/src/components/collections/my/Folder.vue
+++ /dev/null
@@ -1,340 +0,0 @@
-
-
-
-
-
-
-
-
- {{ folder.name ? folder.name : folder.title }}
-
-
-
-
-
-
-
-
-
-
- {
- $emit('add-request', { path: folderPath })
- hide()
- }
- "
- />
- {
- $emit('add-folder', { folder, path: folderPath })
- hide()
- }
- "
- />
- {
- $emit('edit-folder', {
- folder,
- folderIndex,
- collectionIndex,
- folderPath,
- })
- hide()
- }
- "
- />
- {
- exportFolder()
- hide()
- }
- "
- />
- {
- removeFolder()
- hide()
- }
- "
- />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
![]()
-
- {{ t("empty.folder") }}
-
-
-
-
-
-
-
-
diff --git a/packages/hoppscotch-common/src/components/collections/my/Request.vue b/packages/hoppscotch-common/src/components/collections/my/Request.vue
deleted file mode 100644
index eba24530c..000000000
--- a/packages/hoppscotch-common/src/components/collections/my/Request.vue
+++ /dev/null
@@ -1,433 +0,0 @@
-
-
-
-
-
-
- {{ request.method }}
-
-
-
-
- {{ request.name }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {
- emit('edit-request', {
- collectionIndex,
- folderIndex,
- folderName,
- request,
- requestIndex,
- folderPath,
- })
- hide()
- }
- "
- />
- {
- emit('duplicate-request', {
- collectionIndex,
- folderIndex,
- folderName,
- request,
- requestIndex,
- folderPath,
- })
- hide()
- }
- "
- />
- {
- removeRequest()
- hide()
- }
- "
- />
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/hoppscotch-common/src/components/collections/teams/Collection.vue b/packages/hoppscotch-common/src/components/collections/teams/Collection.vue
deleted file mode 100644
index 45df63dc2..000000000
--- a/packages/hoppscotch-common/src/components/collections/teams/Collection.vue
+++ /dev/null
@@ -1,408 +0,0 @@
-
-
-
-
-
-
-
-
- {{ collection.title }}
-
-
-
-
-
-
-
-
-
-
- {
- $emit('add-request', {
- folder: collection,
- path: `${collectionIndex}`,
- })
- hide()
- }
- "
- />
- {
- $emit('add-folder', {
- folder: collection,
- path: `${collectionIndex}`,
- })
- hide()
- }
- "
- />
- {
- $emit('edit-collection')
- hide()
- }
- "
- />
-
- {
- removeCollection()
- hide()
- }
- "
- />
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ t("state.loading") }}
-
-
-
![]()
-
- {{ t("empty.collection") }}
-
-
-
-
-
-
-
-
diff --git a/packages/hoppscotch-common/src/components/collections/teams/Folder.vue b/packages/hoppscotch-common/src/components/collections/teams/Folder.vue
deleted file mode 100644
index d5eee2df0..000000000
--- a/packages/hoppscotch-common/src/components/collections/teams/Folder.vue
+++ /dev/null
@@ -1,383 +0,0 @@
-
-
-
-
-
-
-
-
- {{ folder.name ? folder.name : folder.title }}
-
-
-
-
-
-
-
-
-
-
- {
- $emit('add-request', { folder, path: folderPath })
- hide()
- }
- "
- />
- {
- $emit('add-folder', { folder, path: folderPath })
- hide()
- }
- "
- />
- {
- $emit('edit-folder', {
- folder,
- folderIndex,
- collectionIndex,
- folderPath: '',
- })
- hide()
- }
- "
- />
-
- {
- removeFolder()
- hide()
- }
- "
- />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ t("state.loading") }}
-
-
-
![]()
-
- {{ t("empty.folder") }}
-
-
-
-
-
-
-
-
diff --git a/packages/hoppscotch-common/src/components/collections/teams/Request.vue b/packages/hoppscotch-common/src/components/collections/teams/Request.vue
deleted file mode 100644
index 84308b711..000000000
--- a/packages/hoppscotch-common/src/components/collections/teams/Request.vue
+++ /dev/null
@@ -1,405 +0,0 @@
-
-
-
-
-
-
- {{ request.method }}
-
-
-
-
- {{ request.name }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {
- emit('edit-request', {
- collectionIndex,
- folderIndex,
- folderName,
- request,
- requestIndex,
- })
- hide()
- }
- "
- />
- {
- emit('duplicate-request', {
- request,
- requestIndex,
- collectionID,
- })
- hide()
- }
- "
- />
- {
- removeRequest()
- hide()
- }
- "
- />
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/hoppscotch-common/src/components/history/index.vue b/packages/hoppscotch-common/src/components/history/index.vue
index 462150c3c..43f40e33a 100644
--- a/packages/hoppscotch-common/src/components/history/index.vue
+++ b/packages/hoppscotch-common/src/components/history/index.vue
@@ -331,14 +331,25 @@ const setRestReq = (request: HoppRESTRequest | null | undefined) => {
// (That is not a really good behaviour tho ¯\_(ツ)_/¯)
const useHistory = (entry: RESTHistoryEntry) => {
const currentFullReq = getRESTRequest()
+
+ const currentReqWithNoChange = getRESTSaveContext()?.req
+
+ // checks if the current request is the same as the save context request if present
+ if (
+ currentReqWithNoChange &&
+ isEqualHoppRESTRequest(currentReqWithNoChange, currentFullReq)
+ ) {
+ props.page === "rest" && setRestReq(entry.request)
+ clickedHistory.value = entry
+ }
// Initial state trigers a popup
- if (!clickedHistory.value) {
+ else if (!clickedHistory.value) {
clickedHistory.value = entry
confirmChange.value = true
return
}
// Checks if there are any change done in current request and the history request
- if (
+ else if (
!isEqualHoppRESTRequest(
currentFullReq,
clickedHistory.value.request as HoppRESTRequest
@@ -347,7 +358,7 @@ const useHistory = (entry: RESTHistoryEntry) => {
clickedHistory.value = entry
confirmChange.value = true
} else {
- props.page === "rest" && setRestReq(entry.request as HoppRESTRequest)
+ props.page === "rest" && setRestReq(entry.request)
clickedHistory.value = entry
}
}
diff --git a/packages/hoppscotch-common/src/components/http/ReqChangeConfirmModal.vue b/packages/hoppscotch-common/src/components/http/ReqChangeConfirmModal.vue
index 7908a63ab..d4f9a02fe 100644
--- a/packages/hoppscotch-common/src/components/http/ReqChangeConfirmModal.vue
+++ b/packages/hoppscotch-common/src/components/http/ReqChangeConfirmModal.vue
@@ -16,14 +16,15 @@
()
const emit = defineEmits<{
@@ -51,11 +53,11 @@ const emit = defineEmits<{
(e: "hide-modal"): void
}>()
-const saveApiChange = () => {
+const saveChange = () => {
emit("save-change")
}
-const discardApiChange = () => {
+const discardChange = () => {
emit("discard-change")
}
diff --git a/packages/hoppscotch-common/src/components/smart/Tree.vue b/packages/hoppscotch-common/src/components/smart/Tree.vue
new file mode 100644
index 000000000..d51deb658
--- /dev/null
+++ b/packages/hoppscotch-common/src/components/smart/Tree.vue
@@ -0,0 +1,65 @@
+
+
+
+
+
+ {{ t("state.loading") }}
+
+
+
+
+
+
+
+
diff --git a/packages/hoppscotch-common/src/components/smart/TreeBranch.vue b/packages/hoppscotch-common/src/components/smart/TreeBranch.vue
new file mode 100644
index 000000000..547d204d2
--- /dev/null
+++ b/packages/hoppscotch-common/src/components/smart/TreeBranch.vue
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ t("state.loading") }}
+
+
+
+
+
+
+
+
diff --git a/packages/hoppscotch-common/src/helpers/backend/helpers.ts b/packages/hoppscotch-common/src/helpers/backend/helpers.ts
index 3b1eac7bc..6a101ecb3 100644
--- a/packages/hoppscotch-common/src/helpers/backend/helpers.ts
+++ b/packages/hoppscotch-common/src/helpers/backend/helpers.ts
@@ -12,6 +12,7 @@ import { TeamCollection } from "../teams/TeamCollection"
import { TeamRequest } from "../teams/TeamRequest"
import { GQLError, runGQLQuery } from "./GQLClient"
import {
+ ExportAsJsonDocument,
GetCollectionChildrenIDsDocument,
GetCollectionRequestsDocument,
GetCollectionTitleDocument,
@@ -125,3 +126,23 @@ export const teamCollToHoppRESTColl = (
folders: coll.children?.map(teamCollToHoppRESTColl) ?? [],
requests: coll.requests?.map((x) => x.request) ?? [],
})
+
+/**
+ * Get the JSON string of all the collection of the specified team
+ * @param teamID - ID of the team
+ * @returns Either of the JSON string of the collection or the error
+ */
+export const getTeamCollectionJSON = async (teamID: string) => {
+ const data = await runGQLQuery({
+ query: ExportAsJsonDocument,
+ variables: {
+ teamID,
+ },
+ })
+
+ if (E.isLeft(data)) {
+ return E.left(data.left)
+ }
+
+ return E.right(data.right)
+}
diff --git a/packages/hoppscotch-common/src/helpers/backend/mutations/TeamCollection.ts b/packages/hoppscotch-common/src/helpers/backend/mutations/TeamCollection.ts
new file mode 100644
index 000000000..87b818236
--- /dev/null
+++ b/packages/hoppscotch-common/src/helpers/backend/mutations/TeamCollection.ts
@@ -0,0 +1,76 @@
+import { runMutation } from "../GQLClient"
+import {
+ CreateChildCollectionDocument,
+ CreateChildCollectionMutation,
+ CreateChildCollectionMutationVariables,
+ CreateNewRootCollectionDocument,
+ CreateNewRootCollectionMutation,
+ CreateNewRootCollectionMutationVariables,
+ DeleteCollectionDocument,
+ DeleteCollectionMutation,
+ DeleteCollectionMutationVariables,
+ ImportFromJsonDocument,
+ ImportFromJsonMutation,
+ ImportFromJsonMutationVariables,
+ RenameCollectionDocument,
+ RenameCollectionMutation,
+ RenameCollectionMutationVariables,
+} from "../graphql"
+
+type CreateNewRootCollectionError = "team_coll/short_title"
+type CreateChildCollectionError = "team_coll/short_title"
+type RenameCollectionError = "team_coll/short_title"
+type DeleteCollectionError = "team/invalid_coll_id"
+
+export const createNewRootCollection = (title: string, teamID: string) =>
+ runMutation<
+ CreateNewRootCollectionMutation,
+ CreateNewRootCollectionMutationVariables,
+ CreateNewRootCollectionError
+ >(CreateNewRootCollectionDocument, {
+ title,
+ teamID,
+ })
+
+export const createChildCollection = (
+ childTitle: string,
+ collectionID: string
+) =>
+ runMutation<
+ CreateChildCollectionMutation,
+ CreateChildCollectionMutationVariables,
+ CreateChildCollectionError
+ >(CreateChildCollectionDocument, {
+ childTitle,
+ collectionID,
+ })
+
+/** Can be used to rename both collection and folder (considered same in BE) */
+export const renameCollection = (collectionID: string, newTitle: string) =>
+ runMutation<
+ RenameCollectionMutation,
+ RenameCollectionMutationVariables,
+ RenameCollectionError
+ >(RenameCollectionDocument, {
+ collectionID,
+ newTitle,
+ })
+
+/** Can be used to delete both collection and folder (considered same in BE) */
+export const deleteCollection = (collectionID: string) =>
+ runMutation<
+ DeleteCollectionMutation,
+ DeleteCollectionMutationVariables,
+ DeleteCollectionError
+ >(DeleteCollectionDocument, {
+ collectionID,
+ })
+
+export const importJSONToTeam = (collectionJSON: string, teamID: string) =>
+ runMutation(
+ ImportFromJsonDocument,
+ {
+ jsonString: collectionJSON,
+ teamID,
+ }
+ )
diff --git a/packages/hoppscotch-common/src/helpers/backend/mutations/TeamRequest.ts b/packages/hoppscotch-common/src/helpers/backend/mutations/TeamRequest.ts
index 430ecaf55..7346a66c5 100644
--- a/packages/hoppscotch-common/src/helpers/backend/mutations/TeamRequest.ts
+++ b/packages/hoppscotch-common/src/helpers/backend/mutations/TeamRequest.ts
@@ -1,14 +1,66 @@
import { runMutation } from "../GQLClient"
import {
+ CreateRequestInCollectionDocument,
+ CreateRequestInCollectionMutation,
+ CreateRequestInCollectionMutationVariables,
+ DeleteRequestDocument,
+ DeleteRequestMutation,
+ DeleteRequestMutationVariables,
MoveRestTeamRequestDocument,
MoveRestTeamRequestMutation,
MoveRestTeamRequestMutationVariables,
+ UpdateRequestDocument,
+ UpdateRequestMutation,
+ UpdateRequestMutationVariables,
} from "../graphql"
type MoveRestTeamRequestErrors =
| "team_req/not_found"
| "team_req/invalid_target_id"
+type DeleteRequestErrors = "team_req/not_found"
+
+export const createRequestInCollection = (
+ collectionID: string,
+ data: {
+ request: string
+ teamID: string
+ title: string
+ }
+) =>
+ runMutation<
+ CreateRequestInCollectionMutation,
+ CreateRequestInCollectionMutationVariables,
+ ""
+ >(CreateRequestInCollectionDocument, {
+ collectionID,
+ data,
+ })
+
+export const updateTeamRequest = (
+ requestID: string,
+ data: {
+ request: string
+ title: string
+ }
+) =>
+ runMutation(
+ UpdateRequestDocument,
+ {
+ requestID,
+ data,
+ }
+ )
+
+export const deleteTeamRequest = (requestID: string) =>
+ runMutation<
+ DeleteRequestMutation,
+ DeleteRequestMutationVariables,
+ DeleteRequestErrors
+ >(DeleteRequestDocument, {
+ requestID,
+ })
+
export const moveRESTTeamRequest = (requestID: string, collectionID: string) =>
runMutation<
MoveRestTeamRequestMutation,
diff --git a/packages/hoppscotch-common/src/helpers/gist.ts b/packages/hoppscotch-common/src/helpers/gist.ts
new file mode 100644
index 000000000..9f854952c
--- /dev/null
+++ b/packages/hoppscotch-common/src/helpers/gist.ts
@@ -0,0 +1,34 @@
+import axios from "axios"
+import * as TE from "fp-ts/TaskEither"
+
+/**
+ * Create an gist on GitHub with the collection JSON
+ * @param collectionJSON - JSON string of the collection
+ * @param accessToken - GitHub access token
+ * @returns Either of the response of the GitHub Gist API or the error
+ */
+export const createCollectionGists = (
+ collectionJSON: string,
+ accessToken: string
+) => {
+ return TE.tryCatch(
+ async () =>
+ axios.post(
+ "https://api.github.com/gists",
+ {
+ files: {
+ "hoppscotch-collections.json": {
+ content: collectionJSON,
+ },
+ },
+ },
+ {
+ headers: {
+ Authorization: `token ${accessToken}`,
+ Accept: "application/vnd.github.v3+json",
+ },
+ }
+ ),
+ (reason) => reason
+ )
+}
diff --git a/packages/hoppscotch-common/src/helpers/treeAdapter.ts b/packages/hoppscotch-common/src/helpers/treeAdapter.ts
new file mode 100644
index 000000000..98e611ce5
--- /dev/null
+++ b/packages/hoppscotch-common/src/helpers/treeAdapter.ts
@@ -0,0 +1,34 @@
+import { Ref } from "vue"
+
+/**
+ * Representation of a tree node in the SmartTreeAdapter.
+ */
+export type TreeNode = {
+ id: string
+ data: T
+}
+
+/**
+ * Representation of children result from a tree node when there will be a loading state.
+ */
+export type ChildrenResult =
+ | {
+ status: "loading"
+ }
+ | {
+ status: "loaded"
+ data: Array>
+ }
+
+/**
+ * A tree adapter that can be used with the SmartTree component.
+ * @template T The type of data that is stored in the tree.
+ */
+export interface SmartTreeAdapter {
+ /**
+ *
+ * @param nodeID - id of the node to get children for
+ * @returns - Ref that contains the children of the node. It is reactive and will be updated when the children are changed.
+ */
+ getChildren: (nodeID: string | null) => Ref>
+}
diff --git a/packages/hoppscotch-common/src/helpers/types/HoppPicked.ts b/packages/hoppscotch-common/src/helpers/types/HoppPicked.ts
new file mode 100644
index 000000000..a41bb7a0a
--- /dev/null
+++ b/packages/hoppscotch-common/src/helpers/types/HoppPicked.ts
@@ -0,0 +1,47 @@
+/**
+ * Picked is used to defrentiate
+ * the select item in the save request dialog
+ * The save request dialog can be used
+ * to save a request, folder or a collection
+ * seperately for my and teams for REST.
+ * also for graphQL collections
+ */
+export type Picked =
+ | {
+ pickedType: "my-request"
+ folderPath: string
+ requestIndex: number
+ }
+ | {
+ pickedType: "my-folder"
+ folderPath: string
+ }
+ | {
+ pickedType: "my-collection"
+ collectionIndex: number
+ }
+ | {
+ pickedType: "teams-request"
+ requestID: string
+ }
+ | {
+ pickedType: "teams-folder"
+ folderID: string
+ }
+ | {
+ pickedType: "teams-collection"
+ collectionID: string
+ }
+ | {
+ pickedType: "gql-my-request"
+ folderPath: string
+ requestIndex: number
+ }
+ | {
+ pickedType: "gql-my-folder"
+ folderPath: string
+ }
+ | {
+ pickedType: "gql-my-collection"
+ collectionIndex: number
+ }
diff --git a/packages/hoppscotch-common/tsconfig.json b/packages/hoppscotch-common/tsconfig.json
index f1e163598..f97577f92 100644
--- a/packages/hoppscotch-common/tsconfig.json
+++ b/packages/hoppscotch-common/tsconfig.json
@@ -36,5 +36,9 @@
"src/**/*.d.ts",
"src/**/*.tsx",
"src/**/*.vue",
- ]
+ ],
+ "vueCompilerOptions": {
+ "jsxTemplates": true,
+ "experimentalRfc436": true
+ }
}
diff --git a/packages/hoppscotch-common/windi.config.ts b/packages/hoppscotch-common/windi.config.ts
index 161a85969..0cd760e88 100644
--- a/packages/hoppscotch-common/windi.config.ts
+++ b/packages/hoppscotch-common/windi.config.ts
@@ -23,6 +23,7 @@ export default defineConfig({
lowerSecondaryStickyFold: "var(--lower-secondary-sticky-fold)",
lowerTertiaryStickyFold: "var(--lower-tertiary-sticky-fold)",
sidebarPrimaryStickyFold: "var(--sidebar-primary-sticky-fold)",
+ sidebarSecondaryStickyFold: "var(--line-height-body)",
},
colors: {
primary: "var(--primary-color)",
diff --git a/packages/hoppscotch-ui/src/components.d.ts b/packages/hoppscotch-ui/src/components.d.ts
deleted file mode 100644
index e52ba9d2d..000000000
--- a/packages/hoppscotch-ui/src/components.d.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-// generated by unplugin-vue-components
-// We suggest you to commit this file into source control
-// Read more: https://github.com/vuejs/core/pull/3399
-import '@vue/runtime-core'
-
-export {}
-
-declare module '@vue/runtime-core' {
- export interface GlobalComponents {
- ButtonPrimary: typeof import('./components/button/Primary.vue')['default']
- ButtonSecondary: typeof import('./components/button/Secondary.vue')['default']
- IconLucideLoader: typeof import('~icons/lucide/loader')['default']
- RouterLink: typeof import('vue-router')['RouterLink']
- RouterView: typeof import('vue-router')['RouterView']
- SmartAnchor: typeof import('./components/smart/Anchor.vue')['default']
- SmartAutoComplete: typeof import('./components/smart/AutoComplete.vue')['default']
- SmartCheckbox: typeof import('./components/smart/Checkbox.vue')['default']
- SmartConfirmModal: typeof import('./components/smart/ConfirmModal.vue')['default']
- SmartExpand: typeof import('./components/smart/Expand.vue')['default']
- SmartFileChip: typeof import('./components/smart/FileChip.vue')['default']
- SmartIntersection: typeof import('./components/smart/Intersection.vue')['default']
- SmartItem: typeof import('./components/smart/Item.vue')['default']
- SmartLink: typeof import('./components/smart/Link.vue')['default']
- SmartModal: typeof import('./components/smart/Modal.vue')['default']
- SmartProgressRing: typeof import('./components/smart/ProgressRing.vue')['default']
- SmartRadio: typeof import('./components/smart/Radio.vue')['default']
- SmartRadioGroup: typeof import('./components/smart/RadioGroup.vue')['default']
- SmartSlideOver: typeof import('./components/smart/SlideOver.vue')['default']
- SmartSpinner: typeof import('./components/smart/Spinner.vue')['default']
- SmartTab: typeof import('./components/smart/Tab.vue')['default']
- SmartTabs: typeof import('./components/smart/Tabs.vue')['default']
- SmartToggle: typeof import('./components/smart/Toggle.vue')['default']
- SmartWindow: typeof import('./components/smart/Window.vue')['default']
- SmartWindows: typeof import('./components/smart/Windows.vue')['default']
- }
-
-}
diff --git a/packages/hoppscotch-ui/src/components/smart/Item.vue b/packages/hoppscotch-ui/src/components/smart/Item.vue
index 97c63d0e3..9ecd84e28 100644
--- a/packages/hoppscotch-ui/src/components/smart/Item.vue
+++ b/packages/hoppscotch-ui/src/components/smart/Item.vue
@@ -63,78 +63,82 @@
-
diff --git a/packages/hoppscotch-ui/src/components/smart/Modal.vue b/packages/hoppscotch-ui/src/components/smart/Modal.vue
index 23278c348..716a40d4d 100644
--- a/packages/hoppscotch-ui/src/components/smart/Modal.vue
+++ b/packages/hoppscotch-ui/src/components/smart/Modal.vue
@@ -106,36 +106,25 @@ import { HoppUIPluginOptions, HOPP_UI_OPTIONS } from "./../../index"
const { t, onModalOpen, onModalClose } =
inject(HOPP_UI_OPTIONS) ?? {}
-defineProps({
- dialog: {
- type: Boolean,
- default: false,
- },
- title: {
- type: String,
- default: "",
- },
- dimissible: {
- type: Boolean,
- default: true,
- },
- placement: {
- type: String,
- default: "top",
- },
- fullWidth: {
- type: Boolean,
- default: false,
- },
- styles: {
- type: String,
- default: "sm:max-w-lg",
- },
- closeText: {
- type: String,
- default: null,
- },
-})
+withDefaults(
+ defineProps<{
+ dialog: boolean,
+ title: string,
+ dimissible: boolean,
+ placement: string,
+ fullWidth: boolean,
+ styles: string,
+ closeText: string | null,
+ }>(), {
+ dialog: false,
+ title: "",
+ dimissible: true,
+ placement: "top",
+ fullWidth: false,
+ styles: "sm:max-w-lg",
+ closeText: null
+ }
+)
const emit = defineEmits<{
(e: "close"): void
diff --git a/packages/hoppscotch-ui/src/components/smart/Spinner.vue b/packages/hoppscotch-ui/src/components/smart/Spinner.vue
index bf24540f5..4f36d40af 100644
--- a/packages/hoppscotch-ui/src/components/smart/Spinner.vue
+++ b/packages/hoppscotch-ui/src/components/smart/Spinner.vue
@@ -1,3 +1,9 @@
+
+