Drag and Drop for GraphQL requests in Collections pane
This commit is contained in:
@@ -148,7 +148,10 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from "vue"
|
import Vue from "vue"
|
||||||
import { removeGraphqlCollection } from "~/newstore/collections"
|
import {
|
||||||
|
removeGraphqlCollection,
|
||||||
|
moveGraphqlRequest,
|
||||||
|
} from "~/newstore/collections"
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
props: {
|
props: {
|
||||||
@@ -203,25 +206,10 @@ export default Vue.extend({
|
|||||||
dropEvent({ dataTransfer }: any) {
|
dropEvent({ dataTransfer }: any) {
|
||||||
this.dragging = !this.dragging
|
this.dragging = !this.dragging
|
||||||
|
|
||||||
// TODO: Fix this
|
const folderPath = dataTransfer.getData("folderPath")
|
||||||
|
|
||||||
const oldCollectionIndex = dataTransfer.getData("oldCollectionIndex")
|
|
||||||
const oldFolderIndex = dataTransfer.getData("oldFolderIndex")
|
|
||||||
const oldFolderName = dataTransfer.getData("oldFolderName")
|
|
||||||
const requestIndex = dataTransfer.getData("requestIndex")
|
const requestIndex = dataTransfer.getData("requestIndex")
|
||||||
const flag = "graphql"
|
|
||||||
|
|
||||||
this.$store.commit("postwoman/moveRequest", {
|
moveGraphqlRequest(folderPath, requestIndex, `${this.collectionIndex}`)
|
||||||
oldCollectionIndex,
|
|
||||||
newCollectionIndex: this.$props.collectionIndex,
|
|
||||||
newFolderIndex: -1,
|
|
||||||
newFolderName: this.$props.collection.name,
|
|
||||||
oldFolderIndex,
|
|
||||||
oldFolderName,
|
|
||||||
requestIndex,
|
|
||||||
flag,
|
|
||||||
})
|
|
||||||
// this.syncCollections()
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -97,6 +97,7 @@
|
|||||||
:request="request"
|
:request="request"
|
||||||
:collection-index="collectionIndex"
|
:collection-index="collectionIndex"
|
||||||
:folder-index="folderIndex"
|
:folder-index="folderIndex"
|
||||||
|
:folder-path="folderPath"
|
||||||
:folder-name="folder.name"
|
:folder-name="folder.name"
|
||||||
:request-index="index"
|
:request-index="index"
|
||||||
:doc="doc"
|
:doc="doc"
|
||||||
@@ -132,7 +133,7 @@
|
|||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Vue from "vue"
|
import Vue from "vue"
|
||||||
import { removeGraphqlFolder } from "~/newstore/collections"
|
import { removeGraphqlFolder, moveGraphqlRequest } from "~/newstore/collections"
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
name: "Folder",
|
name: "Folder",
|
||||||
@@ -187,25 +188,10 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
dropEvent({ dataTransfer }: any) {
|
dropEvent({ dataTransfer }: any) {
|
||||||
this.dragging = !this.dragging
|
this.dragging = !this.dragging
|
||||||
const oldCollectionIndex = dataTransfer.getData("oldCollectionIndex")
|
const folderPath = dataTransfer.getData("folderPath")
|
||||||
const oldFolderIndex = dataTransfer.getData("oldFolderIndex")
|
|
||||||
const oldFolderName = dataTransfer.getData("oldFolderName")
|
|
||||||
const requestIndex = dataTransfer.getData("requestIndex")
|
const requestIndex = dataTransfer.getData("requestIndex")
|
||||||
const flag = "graphql"
|
|
||||||
|
|
||||||
// TODO: Discuss
|
moveGraphqlRequest(folderPath, requestIndex, this.folderPath)
|
||||||
|
|
||||||
this.$store.commit("postwoman/moveRequest", {
|
|
||||||
oldCollectionIndex,
|
|
||||||
newCollectionIndex: this.$props.collectionIndex,
|
|
||||||
newFolderIndex: this.$props.folderIndex,
|
|
||||||
newFolderName: this.$props.folder.name,
|
|
||||||
oldFolderIndex,
|
|
||||||
oldFolderName,
|
|
||||||
requestIndex,
|
|
||||||
flag,
|
|
||||||
})
|
|
||||||
// this.syncCollections()
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -117,11 +117,9 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
dragStart({ dataTransfer }: any) {
|
dragStart({ dataTransfer }: any) {
|
||||||
this.dragging = !this.dragging
|
this.dragging = !this.dragging
|
||||||
// TODO: Discuss
|
|
||||||
dataTransfer.setData("oldCollectionIndex", this.$props.collectionIndex)
|
dataTransfer.setData("folderPath", this.folderPath)
|
||||||
dataTransfer.setData("oldFolderIndex", this.$props.folderIndex)
|
dataTransfer.setData("requestIndex", this.requestIndex)
|
||||||
dataTransfer.setData("oldFolderName", this.$props.folderName)
|
|
||||||
dataTransfer.setData("requestIndex", this.$props.requestIndex)
|
|
||||||
},
|
},
|
||||||
removeRequest() {
|
removeRequest() {
|
||||||
removeGraphqlRequest(this.folderPath, this.requestIndex)
|
removeGraphqlRequest(this.folderPath, this.requestIndex)
|
||||||
|
|||||||
Reference in New Issue
Block a user