Browse Source

fix: In OSS, base members count is not being displayed

pull/7148/head
Ramesh Mane 1 year ago
parent
commit
3579845f04
  1. 35
      packages/nc-gui/components/project/View.vue
  2. 2
      packages/nc-gui/store/bases.ts

35
packages/nc-gui/components/project/View.vue

@ -1,9 +1,12 @@
<script lang="ts" setup>
import { useTitle } from '@vueuse/core'
import NcLayout from '~icons/nc-icons/layout'
const { openedProject } = storeToRefs(useBases())
const basesStore = useBases()
const { getProjectUsers } = basesStore
const { openedProject, activeProjectId, baseUserCount } = storeToRefs(basesStore)
const { activeTables } = storeToRefs(useTablesStore())
const { activeWorkspace, workspaceUserCount } = storeToRefs(useWorkspace())
import { isEeUI } from '#imports'
const { navigateToProjectPage } = useBase()
@ -26,6 +29,21 @@ const { isMobileMode } = useGlobal()
const baseSettingsState = ref('')
const updateBaseUserCount = async () => {
try {
const { totalRows } = await getProjectUsers({
baseId: activeProjectId.value!,
page: 1,
searchText: undefined,
limit: 20,
})
baseUserCount.value = totalRows
} catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e))
}
}
watch(
() => route.value.query?.page,
(newVal, oldVal) => {
@ -57,6 +75,17 @@ watch(projectPageTab, () => {
}
})
watch(
() => route.value.params.baseId,
(newVal, oldVal) => {
if (newVal && oldVal === undefined) {
updateBaseUserCount()
}
return
},
{ immediate: true },
)
watch(
() => openedProject.value?.title,
() => {
@ -119,14 +148,14 @@ watch(
<GeneralIcon icon="users" class="!h-3.5 !w-3.5" />
<div>{{ $t('labels.members') }}</div>
<div
v-if="workspaceUserCount"
v-if="`${isEeUI ? workspaceUserCount : baseUserCount}`"
class="tab-info"
:class="{
'bg-primary-selected': projectPageTab === 'collaborator',
'bg-gray-50': projectPageTab !== 'collaborator',
}"
>
{{ workspaceUserCount }}
{{ isEeUI ? workspaceUserCount : baseUserCount }}
</div>
</div>
</template>

2
packages/nc-gui/store/bases.ts

@ -12,6 +12,7 @@ export const useBases = defineStore('basesStore', () => {
const bases = ref<Map<string, NcProject>>(new Map())
const basesList = computed<NcProject[]>(() => Array.from(bases.value.values()).sort((a, b) => a.updated_at - b.updated_at))
const baseUserCount = ref<number | undefined>(undefined)
const router = useRouter()
const route = router.currentRoute
@ -294,6 +295,7 @@ export const useBases = defineStore('basesStore', () => {
return {
bases,
basesList,
baseUserCount,
loadProjects,
loadProject,
getSqlUi,

Loading…
Cancel
Save