fix: workspace list section bugs (#3925)
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
This commit is contained in:
@@ -131,6 +131,7 @@
|
|||||||
<HoppSmartConfirmModal
|
<HoppSmartConfirmModal
|
||||||
:show="confirmRemove"
|
:show="confirmRemove"
|
||||||
:title="t('confirm.remove_team')"
|
:title="t('confirm.remove_team')"
|
||||||
|
:loading-state="loading"
|
||||||
@hide-modal="confirmRemove = false"
|
@hide-modal="confirmRemove = false"
|
||||||
@resolve="deleteTeam()"
|
@resolve="deleteTeam()"
|
||||||
/>
|
/>
|
||||||
@@ -161,6 +162,8 @@ import IconMoreVertical from "~icons/lucide/more-vertical"
|
|||||||
import IconUserX from "~icons/lucide/user-x"
|
import IconUserX from "~icons/lucide/user-x"
|
||||||
import IconUserPlus from "~icons/lucide/user-plus"
|
import IconUserPlus from "~icons/lucide/user-plus"
|
||||||
import IconTrash2 from "~icons/lucide/trash-2"
|
import IconTrash2 from "~icons/lucide/trash-2"
|
||||||
|
import { useService } from "dioc/vue"
|
||||||
|
import { WorkspaceService } from "~/services/workspace.service"
|
||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
|
|
||||||
@@ -173,6 +176,7 @@ const props = defineProps<{
|
|||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: "edit-team"): void
|
(e: "edit-team"): void
|
||||||
(e: "invite-team"): void
|
(e: "invite-team"): void
|
||||||
|
(e: "refetch-teams"): void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
@@ -180,7 +184,12 @@ const toast = useToast()
|
|||||||
const confirmRemove = ref(false)
|
const confirmRemove = ref(false)
|
||||||
const confirmExit = ref(false)
|
const confirmExit = ref(false)
|
||||||
|
|
||||||
|
const loading = ref(false)
|
||||||
|
|
||||||
|
const workspaceService = useService(WorkspaceService)
|
||||||
|
|
||||||
const deleteTeam = () => {
|
const deleteTeam = () => {
|
||||||
|
loading.value = true
|
||||||
pipe(
|
pipe(
|
||||||
backendDeleteTeam(props.teamID),
|
backendDeleteTeam(props.teamID),
|
||||||
TE.match(
|
TE.match(
|
||||||
@@ -188,9 +197,25 @@ const deleteTeam = () => {
|
|||||||
// TODO: Better errors ? We know the possible errors now
|
// TODO: Better errors ? We know the possible errors now
|
||||||
toast.error(`${t("error.something_went_wrong")}`)
|
toast.error(`${t("error.something_went_wrong")}`)
|
||||||
console.error(err)
|
console.error(err)
|
||||||
|
loading.value = false
|
||||||
|
confirmRemove.value = false
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
toast.success(`${t("team.deleted")}`)
|
toast.success(`${t("team.deleted")}`)
|
||||||
|
loading.value = false
|
||||||
|
emit("refetch-teams")
|
||||||
|
|
||||||
|
const currentWorkspace = workspaceService.currentWorkspace.value
|
||||||
|
|
||||||
|
// If the current workspace is the deleted workspace, change the workspace to personal
|
||||||
|
if (
|
||||||
|
currentWorkspace.type === "team" &&
|
||||||
|
currentWorkspace.teamID === props.teamID
|
||||||
|
) {
|
||||||
|
workspaceService.changeWorkspace({ type: "personal" })
|
||||||
|
}
|
||||||
|
|
||||||
|
confirmRemove.value = false
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
)() // Tasks (and TEs) are lazy, so call the function returned
|
)() // Tasks (and TEs) are lazy, so call the function returned
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<HoppButtonSecondary
|
<HoppButtonSecondary
|
||||||
:label="`${t('team.create_new')}`"
|
:label="`${t('team.create_new')}`"
|
||||||
outline
|
outline
|
||||||
|
:icon="IconPlus"
|
||||||
@click="displayModalAdd(true)"
|
@click="displayModalAdd(true)"
|
||||||
/>
|
/>
|
||||||
<div v-if="loading" class="flex flex-col items-center justify-center">
|
<div v-if="loading" class="flex flex-col items-center justify-center">
|
||||||
@@ -16,13 +17,6 @@
|
|||||||
:alt="`${t('empty.teams')}`"
|
:alt="`${t('empty.teams')}`"
|
||||||
:text="`${t('empty.teams')}`"
|
:text="`${t('empty.teams')}`"
|
||||||
>
|
>
|
||||||
<template #body>
|
|
||||||
<HoppButtonSecondary
|
|
||||||
:label="`${t('team.create_new')}`"
|
|
||||||
filled
|
|
||||||
@click="displayModalAdd(true)"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</HoppSmartPlaceholder>
|
</HoppSmartPlaceholder>
|
||||||
<div
|
<div
|
||||||
v-else-if="!loading"
|
v-else-if="!loading"
|
||||||
@@ -39,6 +33,7 @@
|
|||||||
:compact="modal"
|
:compact="modal"
|
||||||
@edit-team="editTeam(team, team.id)"
|
@edit-team="editTeam(team, team.id)"
|
||||||
@invite-team="inviteTeam(team, team.id)"
|
@invite-team="inviteTeam(team, team.id)"
|
||||||
|
@refetch-teams="refetchTeams"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!loading && adapterError" class="flex flex-col items-center">
|
<div v-if="!loading && adapterError" class="flex flex-col items-center">
|
||||||
@@ -76,6 +71,7 @@ import { useReadonlyStream } from "@composables/stream"
|
|||||||
import { useColorMode } from "@composables/theming"
|
import { useColorMode } from "@composables/theming"
|
||||||
import { WorkspaceService } from "~/services/workspace.service"
|
import { WorkspaceService } from "~/services/workspace.service"
|
||||||
import { useService } from "dioc/vue"
|
import { useService } from "dioc/vue"
|
||||||
|
import IconPlus from "~icons/lucide/plus"
|
||||||
|
|
||||||
const t = useI18n()
|
const t = useI18n()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user