fix: save context indicatior + added unplug save on double click

This commit is contained in:
liyasthomas
2021-08-20 20:21:22 +05:30
parent b08b06c4d4
commit 275a7fc113
4 changed files with 125 additions and 245 deletions

View File

@@ -49,8 +49,9 @@
<span
v-if="
active &&
active.folderPath == folderPath &&
active.requestIndex == requestIndex
active.originLocation === 'user-collection' &&
active.folderPath === folderPath &&
active.requestIndex === requestIndex
"
class="rounded-full bg-green-500 h-1.5 mx-3 w-1.5"
></span>
@@ -120,7 +121,11 @@
import { defineComponent } from "@nuxtjs/composition-api"
import { translateToNewRequest } from "~/helpers/types/HoppRESTRequest"
import { useReadonlyStream } from "~/helpers/utils/composables"
import { restSaveContext$, setRESTRequest } from "~/newstore/RESTSession"
import {
restSaveContext$,
setRESTRequest,
setRESTSaveContext,
} from "~/newstore/RESTSession"
export default defineComponent({
props: {
@@ -137,7 +142,7 @@ export default defineComponent({
picked: { type: Object, default: () => {} },
},
setup() {
const active = useReadonlyStream(restSaveContext$)
const active = useReadonlyStream(restSaveContext$, null)
return {
active,
}
@@ -167,6 +172,15 @@ export default defineComponent({
},
methods: {
selectRequest() {
if (
this.active &&
this.active.originLocation === "user-collection" &&
this.active.folderPath === this.folderPath &&
this.active.requestIndex === this.requestIndex
) {
setRESTSaveContext(null)
return
}
if (this.$props.saveRequest)
this.$emit("select", {
picked: {

View File

@@ -40,7 +40,11 @@
>
<span class="truncate"> {{ request.name }} </span>
<span
v-if="active && active.requestIndex == requestIndex"
v-if="
active &&
active.originLocation === 'team-collection' &&
active.requestID === requestIndex
"
class="rounded-full bg-green-500 h-1.5 mx-3 w-1.5"
></span>
</span>
@@ -109,7 +113,11 @@
import { defineComponent } from "@nuxtjs/composition-api"
import { translateToNewRequest } from "~/helpers/types/HoppRESTRequest"
import { useReadonlyStream } from "~/helpers/utils/composables"
import { restSaveContext$, setRESTRequest } from "~/newstore/RESTSession"
import {
restSaveContext$,
setRESTRequest,
setRESTSaveContext,
} from "~/newstore/RESTSession"
export default defineComponent({
props: {
@@ -125,7 +133,7 @@ export default defineComponent({
picked: { type: Object, default: () => {} },
},
setup() {
const active = useReadonlyStream(restSaveContext$)
const active = useReadonlyStream(restSaveContext$, null)
return {
active,
}
@@ -153,6 +161,14 @@ export default defineComponent({
},
methods: {
selectRequest() {
if (
this.active &&
this.active.originLocation === "team-collection" &&
this.active.requestID === this.requestIndex
) {
setRESTSaveContext(null)
return
}
if (this.$props.saveRequest)
this.$emit("select", {
picked: {