Compare commits
4 Commits
refactor/w
...
refactor/w
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
73a5f4657c | ||
|
|
4ba53a8bf3 | ||
|
|
2374ceb808 | ||
|
|
17169e1c46 |
@@ -36,7 +36,7 @@
|
||||
"@hoppscotch/codemirror-lang-graphql": "workspace:^",
|
||||
"@hoppscotch/data": "workspace:^",
|
||||
"@hoppscotch/js-sandbox": "workspace:^",
|
||||
"@hoppscotch/ui": "0.1.0",
|
||||
"@hoppscotch/ui": "0.1.4",
|
||||
"@hoppscotch/vue-toasted": "0.1.0",
|
||||
"@lezer/highlight": "1.2.0",
|
||||
"@unhead/vue": "1.8.8",
|
||||
|
||||
@@ -19,29 +19,28 @@ import { UrlSource } from "~/helpers/import-export/import/import-sources/UrlSour
|
||||
import IconFile from "~icons/lucide/file"
|
||||
|
||||
import {
|
||||
hoppRESTImporter,
|
||||
hoppInsomniaImporter,
|
||||
hoppPostmanImporter,
|
||||
toTeamsImporter,
|
||||
hoppOpenAPIImporter,
|
||||
hoppPostmanImporter,
|
||||
hoppRESTImporter,
|
||||
toTeamsImporter,
|
||||
} from "~/helpers/import-export/import/importers"
|
||||
|
||||
import { defineStep } from "~/composables/step-components"
|
||||
|
||||
import MyCollectionImport from "~/components/importExport/ImportExportSteps/MyCollectionImport.vue"
|
||||
import { useI18n } from "~/composables/i18n"
|
||||
import { useToast } from "~/composables/toast"
|
||||
import { restCollections$ } from "~/newstore/collections"
|
||||
import MyCollectionImport from "~/components/importExport/ImportExportSteps/MyCollectionImport.vue"
|
||||
|
||||
import IconFolderPlus from "~icons/lucide/folder-plus"
|
||||
import IconOpenAPI from "~icons/lucide/file"
|
||||
import IconPostman from "~icons/hopp/postman"
|
||||
import IconInsomnia from "~icons/hopp/insomnia"
|
||||
import IconPostman from "~icons/hopp/postman"
|
||||
import IconOpenAPI from "~icons/lucide/file"
|
||||
import IconFolderPlus from "~icons/lucide/folder-plus"
|
||||
import IconGithub from "~icons/lucide/github"
|
||||
import IconLink from "~icons/lucide/link"
|
||||
|
||||
import IconUser from "~icons/lucide/user"
|
||||
import { useReadonlyStream } from "~/composables/stream"
|
||||
import IconUser from "~icons/lucide/user"
|
||||
|
||||
import { getTeamCollectionJSON } from "~/helpers/backend/helpers"
|
||||
|
||||
@@ -51,9 +50,9 @@ import { initializeDownloadFile } from "~/helpers/import-export/export"
|
||||
import { gistExporter } from "~/helpers/import-export/export/gist"
|
||||
import { teamCollectionsExporter } from "~/helpers/import-export/export/teamCollections"
|
||||
|
||||
import { GistSource } from "~/helpers/import-export/import/import-sources/GistSource"
|
||||
import { ImporterOrExporter } from "~/components/importExport/types"
|
||||
import { useService } from "dioc/vue"
|
||||
import { ImporterOrExporter } from "~/components/importExport/types"
|
||||
import { GistSource } from "~/helpers/import-export/import/import-sources/GistSource"
|
||||
import { NewWorkspaceService } from "~/services/new-workspace"
|
||||
import { TeamWorkspace } from "~/services/workspace.service"
|
||||
|
||||
@@ -83,8 +82,6 @@ const currentUser = useReadonlyStream(
|
||||
platform.auth.getCurrentUser()
|
||||
)
|
||||
|
||||
const myCollections = useReadonlyStream(restCollections$, [])
|
||||
|
||||
const workspaceService = useService(NewWorkspaceService)
|
||||
|
||||
const activeWorkspaceHandle = workspaceService.activeWorkspaceHandle
|
||||
@@ -96,7 +93,7 @@ const showImportFailedError = () => {
|
||||
const handleImportToStore = async (collections: HoppCollection[]) => {
|
||||
if (props.collectionsType.type === "my-collections") {
|
||||
if (!activeWorkspaceHandle.value) {
|
||||
return
|
||||
return E.left("INVALID_WORKSPACE_HANDLE")
|
||||
}
|
||||
|
||||
const collectionHandleResult = await workspaceService.importRESTCollections(
|
||||
@@ -413,23 +410,25 @@ const HoppMyCollectionsExporter: ImporterOrExporter = {
|
||||
isLoading: isHoppMyCollectionExporterInProgress,
|
||||
},
|
||||
action: async () => {
|
||||
if (!myCollections.value.length) {
|
||||
return toast.error(t("error.no_collections_to_export"))
|
||||
}
|
||||
|
||||
if (!activeWorkspaceHandle.value) {
|
||||
return
|
||||
return toast.error("error.something_went_wrong")
|
||||
}
|
||||
|
||||
isHoppMyCollectionExporterInProgress.value = true
|
||||
|
||||
const result = await workspaceService.exportRESTCollections(
|
||||
activeWorkspaceHandle.value,
|
||||
myCollections.value
|
||||
activeWorkspaceHandle.value
|
||||
)
|
||||
|
||||
// INVALID_COLLECTION_HANDLE | NO_COLLECTIONS_TO_EXPORT
|
||||
if (E.isLeft(result)) {
|
||||
// INVALID_WORKSPACE_HANDLE
|
||||
isHoppMyCollectionExporterInProgress.value = false
|
||||
|
||||
if (result.left.error === "NO_COLLECTIONS_TO_EXPORT") {
|
||||
return toast.error(t("error.no_collections_to_export"))
|
||||
}
|
||||
|
||||
return toast.error(t("error.something_went_wrong"))
|
||||
}
|
||||
|
||||
toast.success(t("state.download_started"))
|
||||
|
||||
@@ -75,7 +75,7 @@ import {
|
||||
import { useVModel } from "@vueuse/core"
|
||||
import { useService } from "dioc/vue"
|
||||
import { clone } from "lodash-es"
|
||||
import { ref, toRefs, watch } from "vue"
|
||||
import { ref, watch } from "vue"
|
||||
|
||||
import { HoppInheritedProperty } from "~/helpers/types/HoppInheritedProperties"
|
||||
import { PersistenceService } from "~/services/persistence"
|
||||
@@ -182,24 +182,15 @@ watch(
|
||||
const saveEditedCollection = () => {
|
||||
if (!props.editingProperties) return
|
||||
const finalCollection = clone(editableCollection.value)
|
||||
delete finalCollection.body
|
||||
|
||||
const { path } = toRefs(props.editingProperties)
|
||||
|
||||
const collection = {
|
||||
path: path.value,
|
||||
path: props.editingProperties.path,
|
||||
collection: {
|
||||
...props.editingProperties.collection,
|
||||
...finalCollection,
|
||||
},
|
||||
isRootCollection: props.editingProperties.isRootCollection,
|
||||
}
|
||||
|
||||
const data = props.emitWithFullCollection
|
||||
? collection
|
||||
: { ...finalCollection, collIndexPath: path.value }
|
||||
emit("set-collection-properties", data as EditingProperties)
|
||||
|
||||
emit("set-collection-properties", collection as EditingProperties)
|
||||
persistenceService.removeLocalConfig("unsaved_collection_properties")
|
||||
}
|
||||
|
||||
|
||||
@@ -468,11 +468,11 @@
|
||||
@hide-modal="displayModalImportExport(false)"
|
||||
/>
|
||||
|
||||
<!-- TODO: Remove the `emitWithFullCollection` prop after porting all usages of the below component -->
|
||||
<CollectionsProperties
|
||||
v-model="collectionPropertiesModalActiveTab"
|
||||
:show="showModalEditProperties"
|
||||
:editing-properties="editingProperties"
|
||||
:emit-with-full-collection="false"
|
||||
source="REST"
|
||||
@hide-modal="displayModalEditProperties(false)"
|
||||
@set-collection-properties="setCollectionProperties"
|
||||
/>
|
||||
@@ -481,11 +481,13 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { HoppCollection, HoppRESTAuth, HoppRESTRequest } from "@hoppscotch/data"
|
||||
import { HoppCollection, HoppRESTRequest } from "@hoppscotch/data"
|
||||
import { useService } from "dioc/vue"
|
||||
import * as E from "fp-ts/lib/Either"
|
||||
import { cloneDeep, isEqual } from "lodash-es"
|
||||
import { markRaw, nextTick, ref, watchEffect } from "vue"
|
||||
import { markRaw, nextTick, onMounted, ref, watchEffect } from "vue"
|
||||
import { EditingProperties } from "~/components/collections/Properties.vue"
|
||||
import { RESTOptionTabs } from "~/components/http/RequestOptions.vue"
|
||||
|
||||
import { useI18n } from "~/composables/i18n"
|
||||
import { useReadonlyStream } from "~/composables/stream"
|
||||
@@ -494,7 +496,6 @@ import { useToast } from "~/composables/toast"
|
||||
import { invokeAction } from "~/helpers/actions"
|
||||
import { WorkspaceRESTSearchCollectionTreeAdapter } from "~/helpers/adapters/WorkspaceRESTCollectionSearchTreeAdapter"
|
||||
import { WorkspaceRESTCollectionTreeAdapter } from "~/helpers/adapters/WorkspaceRESTCollectionTreeAdapter"
|
||||
import { TeamCollection } from "~/helpers/backend/graphql"
|
||||
import {
|
||||
getFoldersByPath,
|
||||
updateInheritedPropertiesForAffectedRequests,
|
||||
@@ -513,6 +514,8 @@ import { NewWorkspaceService } from "~/services/new-workspace"
|
||||
import { Handle } from "~/services/new-workspace/handle"
|
||||
import { RESTCollectionViewRequest } from "~/services/new-workspace/view"
|
||||
import { Workspace } from "~/services/new-workspace/workspace"
|
||||
import { PersistedOAuthConfig } from "~/services/oauth/oauth.service"
|
||||
import { PersistenceService } from "~/services/persistence"
|
||||
import { RESTTabService } from "~/services/tab/rest"
|
||||
import IconImport from "~icons/lucide/folder-down"
|
||||
import IconHelpCircle from "~icons/lucide/help-circle"
|
||||
@@ -524,6 +527,7 @@ const toast = useToast()
|
||||
|
||||
const tabs = useService(RESTTabService)
|
||||
const workspaceService = useService(NewWorkspaceService)
|
||||
const persistenceService = useService(PersistenceService)
|
||||
|
||||
const currentReorderingStatus = useReadonlyStream(currentReorderingStatus$, {
|
||||
type: "collection",
|
||||
@@ -573,12 +577,7 @@ const onSessionEnd = ref<() => void>()
|
||||
|
||||
const filteredCollections = ref<HoppCollection[]>([])
|
||||
|
||||
const editingProperties = ref<{
|
||||
collection: Omit<HoppCollection, "v"> | TeamCollection | null
|
||||
isRootCollection: boolean
|
||||
path: string
|
||||
inheritedProperties?: HoppInheritedProperty
|
||||
}>({
|
||||
const editingProperties = ref<EditingProperties>({
|
||||
collection: null,
|
||||
isRootCollection: false,
|
||||
path: "",
|
||||
@@ -587,6 +586,51 @@ const editingProperties = ref<{
|
||||
|
||||
const confirmModalTitle = ref<string | null>(null)
|
||||
|
||||
const collectionPropertiesModalActiveTab = ref<RESTOptionTabs>("headers")
|
||||
|
||||
onMounted(() => {
|
||||
const localOAuthTempConfig =
|
||||
persistenceService.getLocalConfig("oauth_temp_config")
|
||||
|
||||
if (!localOAuthTempConfig) {
|
||||
return
|
||||
}
|
||||
|
||||
const { context, source, token }: PersistedOAuthConfig =
|
||||
JSON.parse(localOAuthTempConfig)
|
||||
|
||||
if (source === "GraphQL") {
|
||||
return
|
||||
}
|
||||
|
||||
if (context?.type === "collection-properties") {
|
||||
// load the unsaved editing properties
|
||||
const unsavedCollectionPropertiesString = persistenceService.getLocalConfig(
|
||||
"unsaved_collection_properties"
|
||||
)
|
||||
|
||||
if (unsavedCollectionPropertiesString) {
|
||||
const unsavedCollectionProperties: EditingProperties = JSON.parse(
|
||||
unsavedCollectionPropertiesString
|
||||
)
|
||||
|
||||
const auth = unsavedCollectionProperties.collection?.auth
|
||||
|
||||
if (auth?.authType === "oauth-2") {
|
||||
const grantTypeInfo = auth.grantTypeInfo
|
||||
|
||||
grantTypeInfo && (grantTypeInfo.token = token ?? "")
|
||||
}
|
||||
|
||||
editingProperties.value = unsavedCollectionProperties
|
||||
}
|
||||
|
||||
persistenceService.removeLocalConfig("oauth_temp_config")
|
||||
collectionPropertiesModalActiveTab.value = "authorization"
|
||||
showModalEditProperties.value = true
|
||||
}
|
||||
})
|
||||
|
||||
watchEffect(async () => {
|
||||
if (!searchText.value) {
|
||||
filteredCollections.value = []
|
||||
@@ -1360,15 +1404,21 @@ const editCollectionProperties = async (collectionIndexPath: string) => {
|
||||
}
|
||||
|
||||
const setCollectionProperties = async (updatedCollectionProps: {
|
||||
auth: HoppRESTAuth
|
||||
headers: HoppCollection["headers"]
|
||||
collectionIndexPath: string
|
||||
collection: Partial<HoppCollection> | null
|
||||
isRootCollection: boolean
|
||||
path: string
|
||||
}) => {
|
||||
const { collectionIndexPath, auth, headers } = updatedCollectionProps
|
||||
console.error("Setting collection props")
|
||||
|
||||
const { collection, path } = updatedCollectionProps
|
||||
|
||||
if (!collection) {
|
||||
return
|
||||
}
|
||||
|
||||
const collectionHandleResult = await workspaceService.getCollectionHandle(
|
||||
props.workspaceHandle,
|
||||
collectionIndexPath
|
||||
path
|
||||
)
|
||||
|
||||
if (E.isLeft(collectionHandleResult)) {
|
||||
@@ -1385,10 +1435,10 @@ const setCollectionProperties = async (updatedCollectionProps: {
|
||||
return
|
||||
}
|
||||
|
||||
const result = await workspaceService.updateRESTCollection(collectionHandle, {
|
||||
auth,
|
||||
headers,
|
||||
})
|
||||
const result = await workspaceService.updateRESTCollection(
|
||||
collectionHandle,
|
||||
collection
|
||||
)
|
||||
|
||||
if (E.isLeft(result)) {
|
||||
// INVALID_COLLECTION_HANDLE
|
||||
@@ -1418,7 +1468,7 @@ const setCollectionProperties = async (updatedCollectionProps: {
|
||||
|
||||
nextTick(() => {
|
||||
updateInheritedPropertiesForAffectedRequests(
|
||||
collectionIndexPath,
|
||||
path,
|
||||
{
|
||||
auth: cascadedAuth,
|
||||
headers: cascadedHeaders,
|
||||
@@ -1452,18 +1502,10 @@ const exportCollection = async (collectionIndexPath: string) => {
|
||||
return
|
||||
}
|
||||
|
||||
const collection = navigateToFolderWithIndexPath(
|
||||
restCollectionState.value,
|
||||
collectionIndexPath.split("/").map((id) => parseInt(id))
|
||||
) as HoppCollection
|
||||
|
||||
const result = await workspaceService.exportRESTCollection(
|
||||
collectionHandle,
|
||||
collection
|
||||
)
|
||||
const result = await workspaceService.exportRESTCollection(collectionHandle)
|
||||
|
||||
if (E.isLeft(result)) {
|
||||
// INVALID_COLLECTION_HANDLE
|
||||
// INVALID_COLLECTION_HANDLE | COLLECTION_NOT_FOUND
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -1912,7 +1954,6 @@ const updateRequestOrder = async (
|
||||
|
||||
const result = await workspaceService.reorderRESTRequest(
|
||||
requestHandle,
|
||||
destinationCollectionIndex,
|
||||
destinationRequestIndex
|
||||
)
|
||||
|
||||
|
||||
@@ -439,8 +439,7 @@ export class NewWorkspaceService extends Service {
|
||||
}
|
||||
|
||||
public async exportRESTCollections(
|
||||
workspaceHandle: Handle<Workspace>,
|
||||
collections: HoppCollection[]
|
||||
workspaceHandle: Handle<Workspace>
|
||||
): Promise<
|
||||
E.Either<WorkspaceError<"INVALID_HANDLE" | "INVALID_PROVIDER">, void>
|
||||
> {
|
||||
@@ -458,10 +457,7 @@ export class NewWorkspaceService extends Service {
|
||||
return E.left({ type: "SERVICE_ERROR", error: "INVALID_PROVIDER" })
|
||||
}
|
||||
|
||||
const result = await provider.exportRESTCollections(
|
||||
workspaceHandle,
|
||||
collections
|
||||
)
|
||||
const result = await provider.exportRESTCollections(workspaceHandle)
|
||||
|
||||
if (E.isLeft(result)) {
|
||||
return E.left({ type: "PROVIDER_ERROR", error: result.left })
|
||||
@@ -471,8 +467,7 @@ export class NewWorkspaceService extends Service {
|
||||
}
|
||||
|
||||
public async exportRESTCollection(
|
||||
collectionHandle: Handle<WorkspaceCollection>,
|
||||
collection: HoppCollection
|
||||
collectionHandle: Handle<WorkspaceCollection>
|
||||
): Promise<
|
||||
E.Either<WorkspaceError<"INVALID_HANDLE" | "INVALID_PROVIDER">, void>
|
||||
> {
|
||||
@@ -490,10 +485,7 @@ export class NewWorkspaceService extends Service {
|
||||
return E.left({ type: "SERVICE_ERROR", error: "INVALID_PROVIDER" })
|
||||
}
|
||||
|
||||
const result = await provider.exportRESTCollection(
|
||||
collectionHandle,
|
||||
collection
|
||||
)
|
||||
const result = await provider.exportRESTCollection(collectionHandle)
|
||||
|
||||
if (E.isLeft(result)) {
|
||||
return E.left({ type: "PROVIDER_ERROR", error: result.left })
|
||||
@@ -568,7 +560,6 @@ export class NewWorkspaceService extends Service {
|
||||
|
||||
public async reorderRESTRequest(
|
||||
requestHandle: Handle<WorkspaceRequest>,
|
||||
destinationCollectionID: string,
|
||||
destinationRequestID: string | null
|
||||
): Promise<
|
||||
E.Either<WorkspaceError<"INVALID_HANDLE" | "INVALID_PROVIDER">, void>
|
||||
@@ -589,7 +580,6 @@ export class NewWorkspaceService extends Service {
|
||||
|
||||
const result = await provider.reorderRESTRequest(
|
||||
requestHandle,
|
||||
destinationCollectionID,
|
||||
destinationRequestID
|
||||
)
|
||||
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import { Ref } from "vue"
|
||||
import * as E from "fp-ts/Either"
|
||||
import { Ref } from "vue"
|
||||
|
||||
import { HoppCollection, HoppRESTRequest } from "@hoppscotch/data"
|
||||
import { Handle } from "./handle"
|
||||
import {
|
||||
RESTCollectionChildrenView,
|
||||
RESTCollectionJSONView,
|
||||
RESTCollectionLevelAuthHeadersView,
|
||||
RESTSearchResultsView,
|
||||
RootRESTCollectionView,
|
||||
} from "./view"
|
||||
import {
|
||||
Workspace,
|
||||
WorkspaceCollection,
|
||||
WorkspaceDecor,
|
||||
WorkspaceRequest,
|
||||
} from "./workspace"
|
||||
import {
|
||||
RESTCollectionLevelAuthHeadersView,
|
||||
RESTCollectionChildrenView,
|
||||
RootRESTCollectionView,
|
||||
RESTSearchResultsView,
|
||||
RESTCollectionJSONView,
|
||||
} from "./view"
|
||||
import { HoppCollection, HoppRESTRequest } from "@hoppscotch/data"
|
||||
|
||||
export interface WorkspaceProvider {
|
||||
providerID: string
|
||||
@@ -83,12 +83,10 @@ export interface WorkspaceProvider {
|
||||
collections: HoppCollection[]
|
||||
): Promise<E.Either<unknown, Handle<WorkspaceCollection>>>
|
||||
exportRESTCollections(
|
||||
workspaceHandle: Handle<Workspace>,
|
||||
collections: HoppCollection[]
|
||||
workspaceHandle: Handle<Workspace>
|
||||
): Promise<E.Either<unknown, void>>
|
||||
exportRESTCollection(
|
||||
collectionHandle: Handle<WorkspaceCollection>,
|
||||
collection: HoppCollection
|
||||
collectionHandle: Handle<WorkspaceCollection>
|
||||
): Promise<E.Either<unknown, void>>
|
||||
|
||||
reorderRESTCollection(
|
||||
@@ -101,7 +99,6 @@ export interface WorkspaceProvider {
|
||||
): Promise<E.Either<unknown, void>>
|
||||
reorderRESTRequest(
|
||||
requestHandle: Handle<WorkspaceRequest>,
|
||||
destinationCollectionID: string,
|
||||
destinationRequestID: string | null
|
||||
): Promise<E.Either<unknown, void>>
|
||||
moveRESTRequest(
|
||||
|
||||
@@ -225,13 +225,11 @@ describe("PersonalWorkspaceProviderService", () => {
|
||||
}),
|
||||
}
|
||||
|
||||
const destinationCollectionID = "1"
|
||||
const destinationRequestID = "1/1"
|
||||
|
||||
const moveRequestResult =
|
||||
await personalWorkspaceProviderService.reorderRESTRequest(
|
||||
requestHandle,
|
||||
destinationCollectionID,
|
||||
destinationRequestID
|
||||
)
|
||||
|
||||
@@ -262,7 +260,7 @@ describe("PersonalWorkspaceProviderService", () => {
|
||||
|
||||
// Request (req-0/0/0/7) dragged from `0/0/0/7` to `0/0/0/2`
|
||||
const draggedRequestID = "0/0/0/7"
|
||||
const destinationCollectionID = "0/0/0"
|
||||
|
||||
const destinationRequestID = "0/0/0/2"
|
||||
|
||||
const draggedRequestHandle =
|
||||
@@ -277,7 +275,6 @@ describe("PersonalWorkspaceProviderService", () => {
|
||||
|
||||
await personalWorkspaceProviderService.reorderRESTRequest(
|
||||
draggedRequestHandle.right,
|
||||
destinationCollectionID,
|
||||
destinationRequestID
|
||||
)
|
||||
|
||||
@@ -328,7 +325,7 @@ describe("PersonalWorkspaceProviderService", () => {
|
||||
|
||||
// Request (req-0/0/0/5) dragged from `0/0/0/5` to `0/0/0/0`
|
||||
const draggedRequestID = "0/0/0/5"
|
||||
const destinationCollectionID = "0/0/0"
|
||||
|
||||
const destinationRequestID = "0/0/0/0"
|
||||
|
||||
const draggedRequestHandle =
|
||||
@@ -343,7 +340,6 @@ describe("PersonalWorkspaceProviderService", () => {
|
||||
|
||||
await personalWorkspaceProviderService.reorderRESTRequest(
|
||||
draggedRequestHandle.right,
|
||||
destinationCollectionID,
|
||||
destinationRequestID
|
||||
)
|
||||
|
||||
@@ -411,7 +407,7 @@ describe("PersonalWorkspaceProviderService", () => {
|
||||
|
||||
// Request (req-0/0/0/3) dragged from `0/0/0/3` to `0/0/0/8`
|
||||
const draggedRequestID = "0/0/0/3"
|
||||
const destinationCollectionID = "0/0/0"
|
||||
|
||||
const destinationRequestID = "0/0/0/8"
|
||||
|
||||
const draggedRequestHandle =
|
||||
@@ -426,7 +422,6 @@ describe("PersonalWorkspaceProviderService", () => {
|
||||
|
||||
await personalWorkspaceProviderService.reorderRESTRequest(
|
||||
draggedRequestHandle.right,
|
||||
destinationCollectionID,
|
||||
destinationRequestID
|
||||
)
|
||||
|
||||
@@ -478,7 +473,7 @@ describe("PersonalWorkspaceProviderService", () => {
|
||||
|
||||
// Request (req-0/0/0/5) dragged from `0/0/0/5` to `0/0/0/9`
|
||||
const draggedRequestID = "0/0/0/5"
|
||||
const destinationCollectionID = "0/0/0"
|
||||
|
||||
// Indicates move to the last position `0/0/0/9`
|
||||
const destinationRequestID = null
|
||||
|
||||
@@ -494,7 +489,6 @@ describe("PersonalWorkspaceProviderService", () => {
|
||||
|
||||
await personalWorkspaceProviderService.reorderRESTRequest(
|
||||
draggedRequestHandle.right,
|
||||
destinationCollectionID,
|
||||
destinationRequestID
|
||||
)
|
||||
|
||||
|
||||
@@ -713,25 +713,32 @@ export class PersonalWorkspaceProviderService
|
||||
}
|
||||
|
||||
public exportRESTCollections(
|
||||
workspaceHandle: Handle<WorkspaceCollection>,
|
||||
collections: HoppCollection[]
|
||||
workspaceHandle: Handle<WorkspaceCollection>
|
||||
): Promise<E.Either<unknown, void>> {
|
||||
const workspaceHandleRef = workspaceHandle.get()
|
||||
|
||||
if (
|
||||
!isValidWorkspaceHandle(workspaceHandleRef, this.providerID, "personal")
|
||||
) {
|
||||
return Promise.resolve(E.left("INVALID_COLLECTION_HANDLE" as const))
|
||||
return Promise.resolve(E.left("INVALID_WORKSPACE_HANDLE" as const))
|
||||
}
|
||||
|
||||
initializeDownloadFile(JSON.stringify(collections, null, 2), "Collections")
|
||||
const collectionsToExport = this.restCollectionState.value.state
|
||||
|
||||
if (collectionsToExport.length === 0) {
|
||||
return Promise.resolve(E.left("NO_COLLECTIONS_TO_EXPORT" as const))
|
||||
}
|
||||
|
||||
initializeDownloadFile(
|
||||
JSON.stringify(collectionsToExport, null, 2),
|
||||
`${workspaceHandleRef.value.data.workspaceID}-collections`
|
||||
)
|
||||
|
||||
return Promise.resolve(E.right(undefined))
|
||||
}
|
||||
|
||||
public exportRESTCollection(
|
||||
collectionHandle: Handle<WorkspaceCollection>,
|
||||
collection: HoppCollection
|
||||
collectionHandle: Handle<WorkspaceCollection>
|
||||
): Promise<E.Either<unknown, void>> {
|
||||
const collectionHandleRef = collectionHandle.get()
|
||||
|
||||
@@ -741,6 +748,17 @@ export class PersonalWorkspaceProviderService
|
||||
return Promise.resolve(E.left("INVALID_COLLECTION_HANDLE" as const))
|
||||
}
|
||||
|
||||
const collection = navigateToFolderWithIndexPath(
|
||||
this.restCollectionState.value.state,
|
||||
collectionHandleRef.value.data.collectionID
|
||||
.split("/")
|
||||
.map((id) => parseInt(id))
|
||||
)
|
||||
|
||||
if (!collection) {
|
||||
return Promise.resolve(E.left("COLLECTION_NOT_FOUND" as const))
|
||||
}
|
||||
|
||||
initializeDownloadFile(JSON.stringify(collection, null, 2), collection.name)
|
||||
|
||||
return Promise.resolve(E.right(undefined))
|
||||
@@ -1090,7 +1108,6 @@ export class PersonalWorkspaceProviderService
|
||||
|
||||
public reorderRESTRequest(
|
||||
requestHandle: Handle<WorkspaceRequest>,
|
||||
destinationCollectionID: string,
|
||||
destinationRequestID: string | null
|
||||
): Promise<E.Either<unknown, void>> {
|
||||
const requestHandleRef = requestHandle.get()
|
||||
@@ -1123,7 +1140,7 @@ export class PersonalWorkspaceProviderService
|
||||
|
||||
const resolvedDestinationRequestID =
|
||||
destinationRequestIndexPos > draggedRequestIndexPos
|
||||
? `${destinationCollectionID}/${resolvedDestinationRequestIDPostfix}`
|
||||
? `${collectionID}/${resolvedDestinationRequestIDPostfix}`
|
||||
: destinationRequestID
|
||||
|
||||
const resolvedDestinationRequestIndexPos =
|
||||
@@ -1167,7 +1184,7 @@ export class PersonalWorkspaceProviderService
|
||||
updateRESTRequestOrder(
|
||||
this.pathToLastIndex(draggedRequestID),
|
||||
destinationRequestID ? destinationRequestIndexPos : null,
|
||||
destinationCollectionID
|
||||
collectionID
|
||||
)
|
||||
|
||||
affectedRequestHandleUpdateInfo.forEach(
|
||||
@@ -1362,7 +1379,7 @@ export class PersonalWorkspaceProviderService
|
||||
if (
|
||||
!isValidWorkspaceHandle(workspaceHandleRef, this.providerID, "personal")
|
||||
) {
|
||||
return Promise.resolve(E.left("INVALID_COLLECTION_HANDLE" as const))
|
||||
return Promise.resolve(E.left("INVALID_WORKSPACE_HANDLE" as const))
|
||||
}
|
||||
|
||||
if (requestID === "") {
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
"@fontsource-variable/roboto-mono": "5.0.16",
|
||||
"@hoppscotch/common": "workspace:^",
|
||||
"@hoppscotch/data": "workspace:^",
|
||||
"@hoppscotch/ui": "0.1.0",
|
||||
"@hoppscotch/ui": "0.1.4",
|
||||
"@import-meta-env/unplugin": "0.4.10",
|
||||
"axios": "1.6.2",
|
||||
"buffer": "6.0.3",
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"@fontsource-variable/material-symbols-rounded": "5.0.5",
|
||||
"@fontsource-variable/roboto-mono": "5.0.6",
|
||||
"@graphql-typed-document-node/core": "3.1.1",
|
||||
"@hoppscotch/ui": "0.1.3",
|
||||
"@hoppscotch/ui": "0.1.4",
|
||||
"@hoppscotch/vue-toasted": "0.1.0",
|
||||
"@intlify/unplugin-vue-i18n": "1.2.0",
|
||||
"@types/cors": "2.8.13",
|
||||
|
||||
68
pnpm-lock.yaml
generated
68
pnpm-lock.yaml
generated
@@ -416,8 +416,8 @@ importers:
|
||||
specifier: workspace:^
|
||||
version: link:../hoppscotch-js-sandbox
|
||||
'@hoppscotch/ui':
|
||||
specifier: file:../../../ui
|
||||
version: file:../ui(eslint@8.57.0)(terser@5.27.0)(vite@4.5.0(@types/node@18.18.8)(sass@1.69.5)(terser@5.27.0))(vue@3.4.27(typescript@5.3.2))
|
||||
specifier: 0.1.4
|
||||
version: 0.1.4(eslint@8.57.0)(terser@5.27.0)(vite@4.5.0(@types/node@18.18.8)(sass@1.69.5)(terser@5.27.0))(vue@3.4.27(typescript@5.3.2))
|
||||
'@hoppscotch/vue-toasted':
|
||||
specifier: 0.1.0
|
||||
version: 0.1.0(vue@3.4.27(typescript@5.3.2))
|
||||
@@ -1101,8 +1101,8 @@ importers:
|
||||
specifier: workspace:^
|
||||
version: link:../hoppscotch-data
|
||||
'@hoppscotch/ui':
|
||||
specifier: 0.1.0
|
||||
version: 0.1.0(eslint@8.55.0)(terser@5.27.0)(vite@4.5.0(@types/node@18.18.8)(sass@1.69.5)(terser@5.27.0))(vue@3.4.27(typescript@5.3.2))
|
||||
specifier: 0.1.4
|
||||
version: 0.1.4(eslint@8.55.0)(terser@5.27.0)(vite@4.5.0(@types/node@18.18.8)(sass@1.69.5)(terser@5.27.0))(vue@3.4.27(typescript@5.3.2))
|
||||
'@import-meta-env/unplugin':
|
||||
specifier: 0.4.10
|
||||
version: 0.4.10(@import-meta-env/cli@0.6.3)(dotenv@16.3.1)
|
||||
@@ -1267,8 +1267,8 @@ importers:
|
||||
specifier: 3.1.1
|
||||
version: 3.1.1(graphql@16.6.0)
|
||||
'@hoppscotch/ui':
|
||||
specifier: 0.1.3
|
||||
version: 0.1.3(eslint@8.57.0)(terser@5.27.0)(vite@3.2.4(@types/node@18.18.8)(sass@1.58.0)(terser@5.27.0))(vue@3.4.27(typescript@4.9.3))
|
||||
specifier: 0.1.4
|
||||
version: 0.1.4(eslint@8.57.0)(terser@5.27.0)(vite@3.2.4(@types/node@18.18.8)(sass@1.58.0)(terser@5.27.0))(vue@3.4.27(typescript@4.9.3))
|
||||
'@hoppscotch/vue-toasted':
|
||||
specifier: 0.1.0
|
||||
version: 0.1.0(vue@3.4.27(typescript@4.9.3))
|
||||
@@ -3392,14 +3392,8 @@ packages:
|
||||
peerDependencies:
|
||||
vue: 3.4.27
|
||||
|
||||
'@hoppscotch/ui@0.1.3':
|
||||
resolution: {integrity: sha512-a1dmqqL+zS2P6cxkCBLdBtd+mD+MnCDSN63TrCPldW5W92rtqpeZ0bmGgiQlzfA2457JRktYpVCBR0Oc0J1jbA==}
|
||||
engines: {node: '>=16'}
|
||||
peerDependencies:
|
||||
vue: 3.4.27
|
||||
|
||||
'@hoppscotch/ui@file:../ui':
|
||||
resolution: {directory: ../ui, type: directory}
|
||||
'@hoppscotch/ui@0.1.4':
|
||||
resolution: {integrity: sha512-TeK65Ne2qAiiUJMnZHvppLe2gEltFP9A650qvfhn47BgYNiYG8HWUQi2Ve4CehgYQPfvnvZ1fJJU4/SD8ecdXg==}
|
||||
engines: {node: '>=16'}
|
||||
peerDependencies:
|
||||
vue: 3.4.27
|
||||
@@ -15357,27 +15351,6 @@ snapshots:
|
||||
dependencies:
|
||||
graphql: 16.8.1
|
||||
|
||||
'@hoppscotch/ui@0.1.0(eslint@8.55.0)(terser@5.27.0)(vite@4.5.0(@types/node@18.18.8)(sass@1.69.5)(terser@5.27.0))(vue@3.4.27(typescript@5.3.2))':
|
||||
dependencies:
|
||||
'@boringer-avatars/vue3': 0.2.1(vue@3.4.27(typescript@5.3.2))
|
||||
'@fontsource-variable/inter': 5.0.15
|
||||
'@fontsource-variable/material-symbols-rounded': 5.0.16
|
||||
'@fontsource-variable/roboto-mono': 5.0.16
|
||||
'@hoppscotch/vue-toasted': 0.1.0(vue@3.4.27(typescript@5.3.2))
|
||||
'@vitejs/plugin-legacy': 2.3.0(terser@5.27.0)(vite@4.5.0(@types/node@18.18.8)(sass@1.69.5)(terser@5.27.0))
|
||||
'@vueuse/core': 8.7.5(vue@3.4.27(typescript@5.3.2))
|
||||
fp-ts: 2.16.2
|
||||
lodash-es: 4.17.21
|
||||
path: 0.12.7
|
||||
vite-plugin-eslint: 1.8.1(eslint@8.55.0)(vite@4.5.0(@types/node@18.18.8)(sass@1.69.5)(terser@5.27.0))
|
||||
vue: 3.4.27(typescript@5.3.2)
|
||||
vuedraggable-es: 4.1.1(vue@3.4.27(typescript@5.3.2))
|
||||
transitivePeerDependencies:
|
||||
- '@vue/composition-api'
|
||||
- eslint
|
||||
- terser
|
||||
- vite
|
||||
|
||||
'@hoppscotch/ui@0.1.0(eslint@8.57.0)(terser@5.27.0)(vite@5.0.5(@types/node@17.0.27)(sass@1.69.5)(terser@5.27.0))(vue@3.4.27(typescript@4.9.5))':
|
||||
dependencies:
|
||||
'@boringer-avatars/vue3': 0.2.1(vue@3.4.27(typescript@4.9.5))
|
||||
@@ -15399,7 +15372,28 @@ snapshots:
|
||||
- terser
|
||||
- vite
|
||||
|
||||
'@hoppscotch/ui@0.1.3(eslint@8.57.0)(terser@5.27.0)(vite@3.2.4(@types/node@18.18.8)(sass@1.58.0)(terser@5.27.0))(vue@3.4.27(typescript@4.9.3))':
|
||||
'@hoppscotch/ui@0.1.4(eslint@8.55.0)(terser@5.27.0)(vite@4.5.0(@types/node@18.18.8)(sass@1.69.5)(terser@5.27.0))(vue@3.4.27(typescript@5.3.2))':
|
||||
dependencies:
|
||||
'@boringer-avatars/vue3': 0.2.1(vue@3.4.27(typescript@5.3.2))
|
||||
'@fontsource-variable/inter': 5.0.15
|
||||
'@fontsource-variable/material-symbols-rounded': 5.0.16
|
||||
'@fontsource-variable/roboto-mono': 5.0.16
|
||||
'@hoppscotch/vue-toasted': 0.1.0(vue@3.4.27(typescript@5.3.2))
|
||||
'@vitejs/plugin-legacy': 2.3.0(terser@5.27.0)(vite@4.5.0(@types/node@18.18.8)(sass@1.69.5)(terser@5.27.0))
|
||||
'@vueuse/core': 8.7.5(vue@3.4.27(typescript@5.3.2))
|
||||
fp-ts: 2.16.2
|
||||
lodash-es: 4.17.21
|
||||
path: 0.12.7
|
||||
vite-plugin-eslint: 1.8.1(eslint@8.55.0)(vite@4.5.0(@types/node@18.18.8)(sass@1.69.5)(terser@5.27.0))
|
||||
vue: 3.4.27(typescript@5.3.2)
|
||||
vuedraggable-es: 4.1.1(vue@3.4.27(typescript@5.3.2))
|
||||
transitivePeerDependencies:
|
||||
- '@vue/composition-api'
|
||||
- eslint
|
||||
- terser
|
||||
- vite
|
||||
|
||||
'@hoppscotch/ui@0.1.4(eslint@8.57.0)(terser@5.27.0)(vite@3.2.4(@types/node@18.18.8)(sass@1.58.0)(terser@5.27.0))(vue@3.4.27(typescript@4.9.3))':
|
||||
dependencies:
|
||||
'@boringer-avatars/vue3': 0.2.1(vue@3.4.27(typescript@4.9.3))
|
||||
'@fontsource-variable/inter': 5.0.15
|
||||
@@ -15420,7 +15414,7 @@ snapshots:
|
||||
- terser
|
||||
- vite
|
||||
|
||||
'@hoppscotch/ui@file:../ui(eslint@8.57.0)(terser@5.27.0)(vite@4.5.0(@types/node@18.18.8)(sass@1.69.5)(terser@5.27.0))(vue@3.4.27(typescript@5.3.2))':
|
||||
'@hoppscotch/ui@0.1.4(eslint@8.57.0)(terser@5.27.0)(vite@4.5.0(@types/node@18.18.8)(sass@1.69.5)(terser@5.27.0))(vue@3.4.27(typescript@5.3.2))':
|
||||
dependencies:
|
||||
'@boringer-avatars/vue3': 0.2.1(vue@3.4.27(typescript@5.3.2))
|
||||
'@fontsource-variable/inter': 5.0.15
|
||||
|
||||
Reference in New Issue
Block a user