Initial Collection State System implementation

Co-authored-by: Liyas Thomas <hi@liyasthomas.com>
This commit is contained in:
Andrew Bastin
2021-05-27 23:22:17 -04:00
parent ac1937f9be
commit eda8c7da41
22 changed files with 872 additions and 487 deletions

View File

@@ -109,7 +109,7 @@
@edit-folder="$emit('edit-folder', $event)"
@edit-request="$emit('edit-request', $event)"
@select="$emit('select', $event)"
@remove-request="removeRequest"
@remove-request="$emit('remove-request', $event)"
/>
</li>
</ul>
@@ -132,7 +132,7 @@
:picked="picked"
@edit-request="editRequest($event)"
@select="$emit('select', $event)"
@remove-request="removeRequest"
@remove-request="$emit('remove-request', $event)"
/>
</li>
</ul>
@@ -253,13 +253,6 @@ export default {
})
this.syncCollections()
},
removeRequest({ collectionIndex, folderName, requestIndex }) {
this.$emit("remove-request", {
collectionIndex,
folderName,
requestIndex,
})
},
},
}
</script>

View File

@@ -47,7 +47,12 @@
v-close-popover
class="icon"
@click="
$emit('edit-folder', { folder, folderIndex, collectionIndex })
$emit('edit-folder', {
folder,
folderIndex,
collectionIndex,
folderPath,
})
"
>
<i class="material-icons">edit</i>
@@ -137,8 +142,8 @@
</template>
<script>
import { fb } from "~/helpers/fb"
import { getSettingSubject } from "~/newstore/settings"
import { removeRESTFolder, removeRESTRequest } from "~/newstore/collections"
export default {
name: "Folder",
@@ -177,14 +182,6 @@ export default {
},
},
methods: {
syncCollections() {
if (fb.currentUser !== null && this.SYNC_COLLECTIONS) {
fb.writeCollections(
JSON.parse(JSON.stringify(this.$store.state.postwoman.collections)),
"collections"
)
}
},
toggleShowChildren() {
if (this.$props.saveRequest)
this.$emit("select", {
@@ -198,13 +195,8 @@ export default {
this.showChildren = !this.showChildren
},
removeFolder() {
this.$store.commit("postwoman/removeFolder", {
collectionIndex: this.$props.collectionIndex,
folderName: this.$props.folder.name,
folderIndex: this.$props.folderIndex,
flag: "rest",
})
this.syncCollections()
removeRESTFolder(this.folderPath)
this.$toast.error(this.$t("deleted"), {
icon: "delete",
})
@@ -217,6 +209,8 @@ export default {
const requestIndex = dataTransfer.getData("requestIndex")
const flag = "rest"
// TODO: Implement for the new collection state system
this.$store.commit("postwoman/moveRequest", {
oldCollectionIndex,
newCollectionIndex: this.$props.collectionIndex,
@@ -229,12 +223,8 @@ export default {
})
this.syncCollections()
},
removeRequest({ collectionIndex, folderName, requestIndex }) {
this.$emit("remove-request", {
collectionIndex,
folderName,
requestIndex,
})
removeRequest({ requestIndex }) {
removeRESTRequest(this.folderPath, requestIndex)
},
},
}

View File

@@ -43,6 +43,7 @@
folderName,
request,
requestIndex,
folderPath,
})
"
>
@@ -132,6 +133,7 @@ export default {
this.$emit("remove-request", {
collectionIndex: this.$props.collectionIndex,
folderName: this.$props.folderName,
folderPath: this.folderPath,
requestIndex: this.$props.requestIndex,
})
},