feat: active request indication in collections

This commit is contained in:
liyasthomas
2021-08-19 23:15:10 +05:30
parent 95547108bf
commit a121445b1e
2 changed files with 36 additions and 6 deletions

View File

@@ -40,11 +40,20 @@
py-2 py-2
pr-2 pr-2
transition transition
items-center
group-hover:text-secondaryDark group-hover:text-secondaryDark
" "
@click="!doc ? selectRequest() : {}" @click="!doc ? selectRequest() : {}"
> >
<span class="truncate"> {{ request.name }} </span> <span class="truncate"> {{ request.name }} </span>
<span
v-if="
active &&
active.folderPath == folderPath &&
active.requestIndex == requestIndex
"
class="rounded-full bg-green-500 h-1.5 mx-3 w-1.5"
></span>
</span> </span>
<div class="flex"> <div class="flex">
<ButtonSecondary <ButtonSecondary
@@ -108,10 +117,12 @@
</template> </template>
<script> <script>
import { defineComponent } from "@nuxtjs/composition-api"
import { translateToNewRequest } from "~/helpers/types/HoppRESTRequest" import { translateToNewRequest } from "~/helpers/types/HoppRESTRequest"
import { setRESTRequest } from "~/newstore/RESTSession" import { useReadonlyStream } from "~/helpers/utils/composables"
import { restSaveContext$, setRESTRequest } from "~/newstore/RESTSession"
export default { export default defineComponent({
props: { props: {
request: { type: Object, default: () => {} }, request: { type: Object, default: () => {} },
collectionIndex: { type: Number, default: null }, collectionIndex: { type: Number, default: null },
@@ -125,6 +136,12 @@ export default {
folderPath: { type: String, default: null }, folderPath: { type: String, default: null },
picked: { type: Object, default: () => {} }, picked: { type: Object, default: () => {} },
}, },
setup() {
const active = useReadonlyStream(restSaveContext$)
return {
active,
}
},
data() { data() {
return { return {
dragging: false, dragging: false,
@@ -188,5 +205,5 @@ export default {
) )
}, },
}, },
} })
</script> </script>

View File

@@ -33,11 +33,16 @@
py-2 py-2
pr-2 pr-2
transition transition
items-center
group-hover:text-secondaryDark group-hover:text-secondaryDark
" "
@click="!doc ? selectRequest() : {}" @click="!doc ? selectRequest() : {}"
> >
<span class="truncate"> {{ request.name }} </span> <span class="truncate"> {{ request.name }} </span>
<span
v-if="active && active.requestIndex == requestIndex"
class="rounded-full bg-green-500 h-1.5 mx-3 w-1.5"
></span>
</span> </span>
<div class="flex"> <div class="flex">
<ButtonSecondary <ButtonSecondary
@@ -101,10 +106,12 @@
</template> </template>
<script> <script>
import { defineComponent } from "@nuxtjs/composition-api"
import { translateToNewRequest } from "~/helpers/types/HoppRESTRequest" import { translateToNewRequest } from "~/helpers/types/HoppRESTRequest"
import { setRESTRequest } from "~/newstore/RESTSession" import { useReadonlyStream } from "~/helpers/utils/composables"
import { restSaveContext$, setRESTRequest } from "~/newstore/RESTSession"
export default { export default defineComponent({
props: { props: {
request: { type: Object, default: () => {} }, request: { type: Object, default: () => {} },
collectionIndex: { type: Number, default: null }, collectionIndex: { type: Number, default: null },
@@ -117,6 +124,12 @@ export default {
collectionsType: { type: Object, default: () => {} }, collectionsType: { type: Object, default: () => {} },
picked: { type: Object, default: () => {} }, picked: { type: Object, default: () => {} },
}, },
setup() {
const active = useReadonlyStream(restSaveContext$)
return {
active,
}
},
data() { data() {
return { return {
requestMethodLabels: { requestMethodLabels: {
@@ -167,5 +180,5 @@ export default {
) )
}, },
}, },
} })
</script> </script>