chore: merge hoppscotch/staging into self-hosted/main

This commit is contained in:
Andrew Bastin
2023-04-07 03:16:27 +05:30
8 changed files with 114 additions and 100 deletions

View File

@@ -234,6 +234,7 @@ import {
getFoldersByPath,
resolveSaveContextOnCollectionReorder,
updateSaveContextForAffectedRequests,
resetTeamRequestsContext,
} from "~/helpers/collection/collection"
import { currentReorderingStatus$ } from "~/newstore/reordering"
@@ -990,10 +991,10 @@ const removeCollection = (id: string) => {
* since folder is treated as collection in the BE.
* @param collectionID - ID of the collection or folder to be deleted.
*/
const removeTeamCollectionOrFolder = (collectionID: string) => {
const removeTeamCollectionOrFolder = async (collectionID: string) => {
modalLoadingState.value = true
pipe(
await pipe(
deleteCollection(collectionID),
TE.match(
(err: GQLError<string>) => {
@@ -1047,7 +1048,9 @@ const onRemoveCollection = () => {
emit("select", null)
}
removeTeamCollectionOrFolder(collectionID)
removeTeamCollectionOrFolder(collectionID).then(() => {
resetTeamRequestsContext()
})
}
}
@@ -1099,7 +1102,9 @@ const onRemoveFolder = () => {
emit("select", null)
}
removeTeamCollectionOrFolder(collectionID)
removeTeamCollectionOrFolder(collectionID).then(() => {
resetTeamRequestsContext()
})
}
}

View File

@@ -255,15 +255,6 @@ watch(
}
)
watch(
() => environmentType.value.selectedTeam,
(newTeam) => {
if (newTeam) {
adapter.changeTeamID(newTeam.id)
}
}
)
const switchToMyEnvironments = () => {
environmentType.value.selectedTeam = undefined
updateEnvironmentType("my-environments")
@@ -282,17 +273,10 @@ const updateEnvironmentType = (newEnvironmentType: EnvironmentType) => {
}
watch(
() => environmentType.value.selectedTeam?.id,
(newTeamID) => {
adapter.changeTeamID(newTeamID)
}
)
watch(
() => currentUser.value,
(newValue) => {
if (!newValue) {
switchToMyEnvironments()
() => environmentType.value.selectedTeam,
(newTeam) => {
if (newTeam) {
adapter.changeTeamID(newTeam.id)
}
}
)
@@ -320,6 +304,15 @@ watch(
}
)
watch(
() => currentUser.value,
(newValue) => {
if (!newValue) {
switchToMyEnvironments()
}
}
)
const showModalDetails = ref(false)
const action = ref<"new" | "edit">("edit")
const editingEnvironmentIndex = ref<"Global" | null>(null)

View File

@@ -125,14 +125,14 @@ import { useColorMode } from "~/composables/theming"
import IconPlus from "~icons/lucide/plus"
import IconArchive from "~icons/lucide/archive"
import IconHelpCircle from "~icons/lucide/help-circle"
import { Team } from "~/helpers/backend/graphql"
import { defineActionHandler } from "~/helpers/actions"
import { GetMyTeamsQuery } from "~/helpers/backend/graphql"
const t = useI18n()
const colorMode = useColorMode()
type SelectedTeam = Team | undefined
type SelectedTeam = GetMyTeamsQuery["myTeams"][number] | undefined
const props = defineProps<{
team: SelectedTeam