Merge remote-tracking branch 'upstream/main' into newstate/firebase

This commit is contained in:
Andrew Bastin
2021-06-19 20:41:25 -04:00
41 changed files with 1568 additions and 3022 deletions

View File

@@ -232,6 +232,7 @@ export default {
this.hideModal()
},
hideModal() {
this.picked = null
this.$emit("hide-modal")
},
},

View File

@@ -36,7 +36,7 @@
>
<i class="material-icons">topic</i>
</button>
<v-popover v-if="!savingMode">
<v-popover>
<button v-tooltip.left="$t('more')" class="tooltip-target icon">
<i class="material-icons">more_vert</i>
</button>
@@ -197,6 +197,14 @@ 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(), {

View File

@@ -28,7 +28,7 @@
<span>{{ folder.name }}</span>
</button>
</div>
<v-popover v-if="!savingMode">
<v-popover>
<button v-tooltip.left="$t('more')" class="tooltip-target icon">
<i class="material-icons">more_vert</i>
</button>
@@ -181,6 +181,15 @@ 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",

View File

@@ -25,7 +25,7 @@
<span>{{ request.name }}</span>
</button>
</div>
<v-popover v-if="!savingMode">
<v-popover>
<button v-tooltip="$t('more')" class="tooltip-target icon">
<i class="material-icons">more_vert</i>
</button>
@@ -122,6 +122,16 @@ 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",

View File

@@ -1,12 +1,8 @@
<template>
<AppSection
ref="collections"
class="yellow"
:label="$t('collections')"
no-legend
>
<AppSection ref="collections" :label="$t('collections')">
<div class="show-on-large-screen">
<input
v-if="showCollActions"
v-model="filterText"
aria-label="Search"
type="search"
@@ -50,11 +46,7 @@
@hide-modal="displayModalImportExport(false)"
/>
<div class="border-b row-wrapper border-divider">
<button
v-if="showCollActions"
class="icon"
@click="displayModalAdd(true)"
>
<button class="icon" @click="displayModalAdd(true)">
<i class="material-icons">add</i>
<span>{{ $t("new") }}</span>
</button>
@@ -178,24 +170,6 @@ export default {
return filteredCollections
},
},
mounted() {
this._keyListener = function (e) {
if (e.key === "Escape") {
e.preventDefault()
this.showModalAdd =
this.showModalEdit =
this.showModalImportExport =
this.showModalAddFolder =
this.showModalEditFolder =
this.showModalEditRequest =
false
}
}
document.addEventListener("keydown", this._keyListener.bind(this))
},
beforeDestroy() {
document.removeEventListener("keydown", this._keyListener)
},
methods: {
displayModalAdd(shouldDisplay) {
this.showModalAdd = shouldDisplay
@@ -250,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

View File

@@ -1,5 +1,5 @@
<template>
<AppSection ref="collections" :label="$t('collections')" no-legend>
<AppSection ref="collections" :label="$t('collections')">
<div class="show-on-large-screen">
<input
v-if="!saveRequest"
@@ -57,8 +57,7 @@
v-if="
collectionsType.type == 'team-collections' &&
(collectionsType.selectedTeam == undefined ||
collectionsType.selectedTeam.myRole == 'VIEWER') &&
!saveRequest
collectionsType.selectedTeam.myRole == 'VIEWER')
"
class="icon"
disabled
@@ -69,11 +68,7 @@
<span>{{ $t("new") }}</span>
</div>
</button>
<button
v-else-if="!saveRequest"
class="icon"
@click="displayModalAdd(true)"
>
<button v-else class="icon" @click="displayModalAdd(true)">
<i class="material-icons">add</i>
<span>{{ $t("new") }}</span>
</button>
@@ -261,27 +256,10 @@ export default {
},
},
mounted() {
this._keyListener = function (e) {
if (e.key === "Escape") {
e.preventDefault()
this.showModalAdd =
this.showModalEdit =
this.showModalImportExport =
this.showModalAddFolder =
this.showModalEditFolder =
this.showModalEditRequest =
false
}
}
document.addEventListener("keydown", this._keyListener.bind(this))
this.$subscribeTo(this.teamCollectionAdapter.collections$, (colls) => {
this.teamCollectionsNew = cloneDeep(colls)
})
},
beforeDestroy() {
document.removeEventListener("keydown", this._keyListener)
},
methods: {
updateTeamCollections() {
// TODO: Remove this at some point
@@ -554,12 +532,30 @@ 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({
@@ -592,12 +588,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(() => {

View File

@@ -44,7 +44,7 @@
>
<i class="material-icons">check_box</i>
</button>
<v-popover v-if="!saveRequest">
<v-popover>
<button v-tooltip.left="$t('more')" class="tooltip-target icon">
<i class="material-icons">more_vert</i>
</button>

View File

@@ -27,7 +27,7 @@
<span>{{ folder.name ? folder.name : folder.title }}</span>
</button>
</div>
<v-popover v-if="!saveRequest">
<v-popover>
<button v-tooltip.left="$t('more')" class="tooltip-target icon">
<i class="material-icons">more_vert</i>
</button>
@@ -193,6 +193,15 @@ 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 +215,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)
},
},

View File

@@ -27,7 +27,7 @@
<span>{{ request.name }}</span>
</button>
</div>
<v-popover v-if="!saveRequest">
<v-popover>
<button v-tooltip="$t('more')" class="tooltip-target icon">
<i class="material-icons">more_vert</i>
</button>

View File

@@ -33,7 +33,7 @@
>
<i class="material-icons">check_box</i>
</button>
<v-popover v-if="!saveRequest">
<v-popover>
<button
v-if="collectionsType.selectedTeam.myRole !== 'VIEWER'"
v-tooltip.left="$t('more')"

View File

@@ -18,7 +18,7 @@
<span>{{ folder.name ? folder.name : folder.title }}</span>
</button>
</div>
<v-popover v-if="!saveRequest">
<v-popover>
<button
v-if="collectionsType.selectedTeam.myRole !== 'VIEWER'"
v-tooltip.left="$t('more')"
@@ -189,6 +189,15 @@ 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(() => {

View File

@@ -17,7 +17,7 @@
<span>{{ request.name }}</span>
</button>
</div>
<v-popover v-if="!saveRequest">
<v-popover>
<button
v-if="collectionsType.selectedTeam.myRole !== 'VIEWER'"
v-tooltip="$t('more')"