mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
190 lines
5.3 KiB
190 lines
5.3 KiB
<script lang="ts" setup> |
|
import { useTitle } from '@vueuse/core' |
|
|
|
const props = defineProps<{ |
|
workspaceId?: string |
|
}>() |
|
|
|
const router = useRouter() |
|
const route = router.currentRoute |
|
|
|
const { isUIAllowed } = useRoles() |
|
|
|
const workspaceStore = useWorkspace() |
|
|
|
const { loadRoles } = useRoles() |
|
const { activeWorkspace: _activeWorkspace, workspaces } = storeToRefs(workspaceStore) |
|
const { loadCollaborators, loadWorkspace } = workspaceStore |
|
|
|
const orgStore = useOrg() |
|
const { orgId, org } = storeToRefs(orgStore) |
|
|
|
const currentWorkspace = computedAsync(async () => { |
|
let ws |
|
if (props.workspaceId) { |
|
ws = workspaces.value.get(props.workspaceId) |
|
if (!ws) { |
|
await loadWorkspace(props.workspaceId) |
|
ws = workspaces.value.get(props.workspaceId) |
|
} |
|
} else { |
|
ws = _activeWorkspace.value |
|
} |
|
await loadRoles(undefined, {}, ws?.id) |
|
return ws |
|
}) |
|
|
|
const tab = computed({ |
|
get() { |
|
return route.value.query?.tab ?? 'collaborators' |
|
}, |
|
set(tab: string) { |
|
if (tab === 'collaborators') loadCollaborators({} as any, props.workspaceId) |
|
router.push({ query: { ...route.value.query, tab } }) |
|
}, |
|
}) |
|
|
|
watch( |
|
() => currentWorkspace.value?.title, |
|
(title) => { |
|
if (!title) return |
|
|
|
const capitalizedTitle = title.charAt(0).toUpperCase() + title.slice(1) |
|
|
|
useTitle(capitalizedTitle) |
|
}, |
|
{ |
|
immediate: true, |
|
}, |
|
) |
|
|
|
onMounted(() => { |
|
until(() => currentWorkspace.value?.id) |
|
.toMatch((v) => !!v) |
|
.then(async () => { |
|
await loadCollaborators({} as any, currentWorkspace.value!.id) |
|
}) |
|
}) |
|
</script> |
|
|
|
<template> |
|
<div v-if="currentWorkspace" class="flex w-full max-w-[97.5rem] flex-col nc-workspace-settings"> |
|
<div v-if="!props.workspaceId" class="min-w-0 pt-2 px-2"> |
|
<div class="nc-breadcrumb nc-workspace-title"> |
|
<div class="nc-breadcrumb-item capitalize"> |
|
{{ currentWorkspace?.title }} |
|
</div> |
|
<GeneralIcon icon="ncSlash1" class="nc-breadcrumb-divider" /> |
|
|
|
<h1 class="nc-breadcrumb-item active"> |
|
{{ $t('title.teamAndSettings') }} |
|
</h1> |
|
</div> |
|
</div> |
|
<template v-else> |
|
<div class="nc-breadcrumb px-2"> |
|
<div class="nc-breadcrumb-item"> |
|
{{ org.title }} |
|
</div> |
|
<GeneralIcon icon="ncSlash1" class="nc-breadcrumb-divider" /> |
|
|
|
<NuxtLink |
|
:href="`/admin/${orgId}/workspaces`" |
|
class="!hover:(text-gray-800 underline-gray-600) flex items-center !text-gray-700 !underline-transparent ml-0.75 max-w-1/4" |
|
> |
|
<div class="nc-breadcrumb-item"> |
|
{{ $t('labels.workspaces') }} |
|
</div> |
|
</NuxtLink> |
|
<GeneralIcon icon="ncSlash1" class="nc-breadcrumb-divider" /> |
|
|
|
<div class="nc-breadcrumb-item active truncate capitalize"> |
|
{{ currentWorkspace?.title }} |
|
</div> |
|
</div> |
|
<NcPageHeader> |
|
<template #icon> |
|
<div class="flex justify-center items-center h-6 w-6"> |
|
<GeneralWorkspaceIcon :workspace="currentWorkspace" hide-label size="small" /> |
|
</div> |
|
</template> |
|
<template #title> |
|
<span data-rec="true" class="capitalize"> |
|
{{ currentWorkspace?.title }} |
|
</span> |
|
</template> |
|
</NcPageHeader> |
|
</template> |
|
|
|
<NcTabs v-model:activeKey="tab"> |
|
<template #leftExtra> |
|
<div class="w-3"></div> |
|
</template> |
|
<template v-if="isUIAllowed('workspaceSettings')"> |
|
<a-tab-pane key="collaborators" class="w-full"> |
|
<template #tab> |
|
<div class="flex flex-row items-center pb-1 pt-2 gap-x-1.5"> |
|
<GeneralIcon icon="users" class="!h-3.5 !w-3.5" /> |
|
Members |
|
</div> |
|
</template> |
|
<WorkspaceCollaboratorsList :workspace-id="currentWorkspace.id" /> |
|
</a-tab-pane> |
|
</template> |
|
|
|
<template v-if="isUIAllowed('workspaceManage')"> |
|
<a-tab-pane key="settings" class="w-full"> |
|
<template #tab> |
|
<div class="flex flex-row items-center pb-1 pt-2 gap-x-1.5" data-testid="nc-workspace-settings-tab-settings"> |
|
<GeneralIcon icon="settings" /> |
|
Settings |
|
</div> |
|
</template> |
|
<WorkspaceSettings :workspace-id="currentWorkspace.id" /> |
|
</a-tab-pane> |
|
</template> |
|
|
|
<template v-if="isUIAllowed('workspaceAuditList') && !props.workspaceId"> |
|
<a-tab-pane key="audit" class="w-full"> |
|
<template #tab> |
|
<div class="flex flex-row items-center pb-1 pt-2 gap-x-1.5"> |
|
<GeneralIcon icon="audit" class="!h-3.5 !w-3.5" /> |
|
Audit Logs |
|
</div> |
|
</template> |
|
<div class="h-[calc(100vh-92px)] px-6"> |
|
<WorkspaceAuditLogs :workspace-id="currentWorkspace.id" /> |
|
</div> |
|
</a-tab-pane> |
|
</template> |
|
</NcTabs> |
|
</div> |
|
</template> |
|
|
|
<style lang="scss" scoped> |
|
.nc-workspace-avatar { |
|
@apply min-w-5 h-5 w-5 rounded-[6px] flex items-center justify-center text-white font-weight-bold uppercase; |
|
font-size: 0.7rem; |
|
} |
|
|
|
.tab { |
|
@apply flex flex-row items-center gap-x-2; |
|
} |
|
|
|
:deep(.ant-tabs-nav) { |
|
@apply !pl-0; |
|
} |
|
|
|
:deep(.ant-tabs-nav-list) { |
|
@apply !gap-5; |
|
} |
|
:deep(.ant-tabs-tab) { |
|
@apply !pt-0 !pb-2.5 !ml-0; |
|
} |
|
.ant-tabs-content { |
|
@apply !h-full; |
|
} |
|
.ant-tabs-content-top { |
|
@apply !h-full; |
|
} |
|
</style>
|
|
|