From 07a505c3657d18df623d9f37fa18e7fdad312594 Mon Sep 17 00:00:00 2001 From: s-r-x Date: Tue, 15 Jun 2021 15:25:19 +0500 Subject: [PATCH 1/2] fix: broken gql collection request editor --- components/collections/graphql/index.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/components/collections/graphql/index.vue b/components/collections/graphql/index.vue index b733c6274..d8fa81903 100644 --- a/components/collections/graphql/index.vue +++ b/components/collections/graphql/index.vue @@ -224,7 +224,9 @@ export default { folderName, request, requestIndex, + folderPath, } = payload + this.$data.editingFolderPath = folderPath this.$data.editingCollectionIndex = collectionIndex this.$data.editingFolderIndex = folderIndex this.$data.editingFolderName = folderName From 0921cccb4c572585b2d98c986beb94752559f0d8 Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Tue, 15 Jun 2021 08:26:01 -0400 Subject: [PATCH 2/2] Reset save req selection when selected item is deleted --- components/collections/graphql/Collection.vue | 4 +++ components/collections/graphql/Folder.vue | 5 ++++ components/collections/graphql/Request.vue | 5 ++++ components/collections/index.vue | 28 +++++++++++++++++++ components/collections/my/Folder.vue | 15 ++++++++++ components/collections/teams/Folder.vue | 5 ++++ 6 files changed, 62 insertions(+) diff --git a/components/collections/graphql/Collection.vue b/components/collections/graphql/Collection.vue index 968bc61be..022657f00 100644 --- a/components/collections/graphql/Collection.vue +++ b/components/collections/graphql/Collection.vue @@ -197,6 +197,10 @@ export default Vue.extend({ this.showChildren = !this.showChildren }, removeCollection() { + // Cancel pick if picked collection is deleted + if (this.picked && this.picked.pickedType === "gql-my-collection" && this.picked.collectionIndex === this.collectionIndex) { + this.$emit("select", { picked: null }) + } removeGraphqlCollection(this.collectionIndex) this.$toast.error(this.$t("deleted").toString(), { diff --git a/components/collections/graphql/Folder.vue b/components/collections/graphql/Folder.vue index a3ebf90ae..c7850e1b0 100644 --- a/components/collections/graphql/Folder.vue +++ b/components/collections/graphql/Folder.vue @@ -181,6 +181,11 @@ export default Vue.extend({ this.showChildren = !this.showChildren }, removeFolder() { + // Cancel pick if the picked folder is deleted + if (this.picked && this.picked.pickedType === "gql-my-folder" && this.picked.folderPath === this.folderPath) { + this.$emit("select", { picked: null }) + } + removeGraphqlFolder(this.folderPath) this.$toast.error(this.$t("deleted").toString(), { icon: "delete", diff --git a/components/collections/graphql/Request.vue b/components/collections/graphql/Request.vue index 0aede5b7d..35ce14937 100644 --- a/components/collections/graphql/Request.vue +++ b/components/collections/graphql/Request.vue @@ -122,6 +122,11 @@ export default Vue.extend({ dataTransfer.setData("requestIndex", this.requestIndex) }, removeRequest() { + // Cancel pick if the picked request is deleted + if (this.picked && this.picked.pickedType === "gql-my-request" && this.picked.folderPath === this.folderPath && this.picked.requestIndex === this.requestIndex) { + this.$emit("select", { picked: null }) + } + removeGraphqlRequest(this.folderPath, this.requestIndex) this.$toast.error(this.$t("deleted").toString(), { icon: "delete", diff --git a/components/collections/index.vue b/components/collections/index.vue index 62b88d110..08d4605d5 100644 --- a/components/collections/index.vue +++ b/components/collections/index.vue @@ -531,12 +531,22 @@ export default { }, removeCollection({ collectionsType, collectionIndex, collectionID }) { if (collectionsType.type === "my-collections") { + // Cancel pick if picked collection is deleted + if (this.picked && this.picked.pickedType === "my-collection" && this.picked.collectionIndex === collectionIndex) { + this.$emit("select", { picked: null }) + } + removeRESTCollection(collectionIndex) this.$toast.error(this.$t("deleted"), { icon: "delete", }) } else if (collectionsType.type === "team-collections") { + // Cancel pick if picked collection is deleted + if (this.picked && this.picked.pickedType === "teams-collection" && this.picked.collectionID === collectionID) { + this.$emit("select", { picked: null }) + } + if (collectionsType.selectedTeam.myRole !== "VIEWER") { this.$apollo .mutate({ @@ -569,12 +579,30 @@ export default { }, removeRequest({ requestIndex, folderPath }) { if (this.collectionsType.type === "my-collections") { + // Cancel pick if the picked item is being deleted + if ( + this.picked && + this.picked.pickedType === "my-request" && + this.picked.folderPath === folderPath && + this.picked.requestIndex === requestIndex + ) { + this.$emit("select", { picked: null }) + } removeRESTRequest(folderPath, requestIndex) this.$toast.error(this.$t("deleted"), { icon: "delete", }) } else if (this.collectionsType.type === "team-collections") { + // Cancel pick if the picked item is being deleted + if ( + this.picked && + this.picked.pickedType === "teams-request" && + this.picked.requestID === requestIndex + ) { + this.$emit("select", { picked: null }) + } + teamUtils .deleteRequest(this.$apollo, requestIndex) .then(() => { diff --git a/components/collections/my/Folder.vue b/components/collections/my/Folder.vue index 459c37c17..e999c3bbf 100644 --- a/components/collections/my/Folder.vue +++ b/components/collections/my/Folder.vue @@ -193,6 +193,11 @@ export default { this.showChildren = !this.showChildren }, removeFolder() { + // TODO: Bubble it up ? + // Cancel pick if picked folder was deleted + if (this.picked && this.picked.pickedType === "my-folder" && this.picked.folderPath === this.folderPath) { + this.$emit("select", { picked: null }) + } removeRESTFolder(this.folderPath) this.$toast.error(this.$t("deleted"), { @@ -206,6 +211,16 @@ export default { moveRESTRequest(folderPath, requestIndex, this.folderPath) }, removeRequest({ requestIndex }) { + // TODO: Bubble it up to root ? + // Cancel pick if the picked item is being deleted + if ( + this.picked && + this.picked.pickedType === "my-request" && + this.picked.folderPath === this.folderPath && + this.picked.requestIndex === requestIndex + ) { + this.$emit("select", { picked: null }) + } removeRESTRequest(this.folderPath, requestIndex) }, }, diff --git a/components/collections/teams/Folder.vue b/components/collections/teams/Folder.vue index 836c67d78..e5d0c951e 100644 --- a/components/collections/teams/Folder.vue +++ b/components/collections/teams/Folder.vue @@ -189,6 +189,11 @@ export default { }, removeFolder() { if (this.collectionsType.selectedTeam.myRole !== "VIEWER") { + // Cancel pick if picked collection folder was deleted + if (this.picked && this.picked.pickedType === "teams-folder" && this.picked.folderID === this.folder.id) { + this.$emit("select", { picked: null }) + } + teamUtils .deleteCollection(this.$apollo, this.folder.id) .then(() => {