import { getSettingSubject } from "~/newstore/settings"
import * as teamUtils from "~/helpers/teams/utils"
-import { saveRESTRequestAs, editRESTRequest } from "~/newstore/collections"
+import { saveRESTRequestAs, editRESTRequest, editGraphqlRequest, saveGraphqlRequestAs } from "~/newstore/collections"
export default {
props: {
+ // mode can be either "graphql" or "rest"
+ mode: { type: String, default: "rest" },
show: Boolean,
editingRequest: { type: Object, default: () => {} },
},
@@ -190,6 +203,12 @@ export default {
this.collectionsType.selectedTeam.id,
this.picked.collectionID
)
+ } else if (this.picked.pickedType === "gql-my-request") {
+ editGraphqlRequest(this.picked.folderPath, this.picked.requestIndex, requestUpdated)
+ } else if (this.picked.pickedType === "gql-my-folder") {
+ saveGraphqlRequestAs(this.picked.folderPath, requestUpdated)
+ } else if (this.picked.pickedType === "gql-my-collection") {
+ saveGraphqlRequestAs(`${this.picked.collectionIndex}`, requestUpdated)
}
this.$toast.success("Requested added", {
icon: "done",
diff --git a/components/collections/graphql/Collection.vue b/components/collections/graphql/Collection.vue
index 097a93363..db406c8dc 100644
--- a/components/collections/graphql/Collection.vue
+++ b/components/collections/graphql/Collection.vue
@@ -19,7 +19,12 @@
arrow_drop_down
- folder
+
+ check_circle
+
+ folder
{{ collection.name }}
@@ -31,7 +36,7 @@
>
topic
-
+
@@ -82,6 +87,8 @@
class="ml-8 border-l border-brdColor"
>
@@ -101,13 +109,17 @@
class="ml-8 border-l border-brdColor"
>
@@ -140,6 +152,9 @@ import { removeGraphqlCollection } from "~/newstore/collections"
export default Vue.extend({
props: {
+ picked: { type: Object, default: null },
+ // Whether the viewing context is related to picking (activates 'select' events)
+ savingMode: { type: Boolean, default: false },
collectionIndex: { type: Number, default: null },
collection: { type: Object, default: () => {} },
doc: Boolean,
@@ -153,8 +168,27 @@ export default Vue.extend({
confirmRemove: false,
}
},
+ computed: {
+ isSelected(): boolean {
+ return this.picked &&
+ this.picked.pickedType === "gql-my-collection" &&
+ this.picked.collectionIndex === this.collectionIndex
+ }
+ },
methods: {
+ pick() {
+ this.$emit("select", {
+ picked: {
+ pickedType: "gql-my-collection",
+ collectionIndex: this.collectionIndex
+ }
+ })
+ },
toggleShowChildren() {
+ if (this.savingMode) {
+ this.pick()
+ }
+
this.showChildren = !this.showChildren
},
removeCollection() {
diff --git a/components/collections/graphql/Folder.vue b/components/collections/graphql/Folder.vue
index 2dd74914b..2e7329753 100644
--- a/components/collections/graphql/Folder.vue
+++ b/components/collections/graphql/Folder.vue
@@ -20,11 +20,15 @@
arrow_drop_down
- folder_open
+ check_circle
+
+ folder_open
{{ folder.name }}
-
+
@@ -66,6 +70,8 @@
class="ml-8 border-l border-brdColor"
>
@@ -85,6 +92,8 @@
class="flex ml-8 border-l border-brdColor"
>
@@ -127,6 +137,9 @@ import { removeGraphqlFolder } from "~/newstore/collections"
export default Vue.extend({
name: "Folder",
props: {
+ picked: { type: Object, default: null },
+ // Whether the request is in a selectable mode (activates 'select' event)
+ savingMode: { type: Boolean, default: false },
folder: { type: Object, default: () => {} },
folderIndex: { type: Number, default: null },
collectionIndex: { type: Number, default: null },
@@ -141,8 +154,27 @@ export default Vue.extend({
confirmRemove: false,
}
},
+ computed: {
+ isSelected(): boolean {
+ return this.picked &&
+ this.picked.pickedType === "gql-my-folder" &&
+ this.picked.folderPath === this.folderPath
+ }
+ },
methods: {
+ pick() {
+ this.$emit('select', {
+ picked: {
+ pickedType: "gql-my-folder",
+ folderPath: this.folderPath
+ }
+ })
+ },
toggleShowChildren() {
+ if (this.savingMode) {
+ this.pick()
+ }
+
this.showChildren = !this.showChildren
},
removeFolder() {
diff --git a/components/collections/graphql/Request.vue b/components/collections/graphql/Request.vue
index e3c5ad87f..6b6fc04df 100644
--- a/components/collections/graphql/Request.vue
+++ b/components/collections/graphql/Request.vue
@@ -17,11 +17,16 @@
class="icon"
@click="!doc ? selectRequest() : {}"
>
- description
+
+ check_circle
+
+ description
{{ request.name }}
-
+
@@ -66,6 +71,10 @@ import { removeGraphqlRequest } from "~/newstore/collections"
export default Vue.extend({
props: {
+ // Whether the object is selected (show the tick mark)
+ picked: { type: Object, default: null },
+ // Whether the request is being saved (activate 'select' event)
+ savingMode: { type: Boolean, default: false },
request: { type: Object, default: () => {} },
folderPath: { type: String, default: null },
requestIndex: { type: Number, default: null },
@@ -77,8 +86,30 @@ export default Vue.extend({
confirmRemove: false,
}
},
+ computed: {
+ isSelected(): boolean {
+ return this.picked &&
+ this.picked.pickedType === "gql-my-request" &&
+ this.picked.folderPath === this.folderPath &&
+ this.picked.requestIndex === this.requestIndex
+ }
+ },
methods: {
+ pick() {
+ this.$emit('select', {
+ picked: {
+ pickedType: "gql-my-request",
+ folderPath: this.folderPath,
+ requestIndex: this.requestIndex
+ }
+ })
+ },
selectRequest() {
+ if (this.savingMode) {
+ this.pick()
+ return
+ }
+
this.$store.commit("postwoman/selectGraphqlRequest", {
request: this.request,
})
diff --git a/components/collections/graphql/index.vue b/components/collections/graphql/index.vue
index 462ea509d..1eef03217 100644
--- a/components/collections/graphql/index.vue
+++ b/components/collections/graphql/index.vue
@@ -50,11 +50,11 @@
@hide-modal="displayModalImportExport(false)"
/>
-
@@ -69,16 +69,19 @@
:key="collection.name"
>
@@ -96,7 +99,12 @@ import { graphqlCollections$, addGraphqlFolder } from "~/newstore/collections"
export default {
props: {
- doc: Boolean,
+ // Whether to activate the ability to pick items (activates 'select' events)
+ savingMode: { type: Boolean, default: false },
+ doc: { type: Boolean, default: false },
+ picked: { type: Object, default: null },
+ // Whether to show the 'New' and 'Import/Export' actions
+ showCollActions: { type: Boolean, default: true }
},
data() {
return {
diff --git a/pages/graphql.vue b/pages/graphql.vue
index 4a575ed12..6a3ec843f 100644
--- a/pages/graphql.vue
+++ b/pages/graphql.vue
@@ -467,7 +467,8 @@
-