Skip to content

MongocampDashboard ​

Landing page for admins: a welcome heading with the connected server name/version, three linked stat cards (collections, users, roles), a refresh button, and an error alert with retry when counting fails. Content for your own app goes in the default slot, below the cards.

Counting calls listUsers, listRoles and listCollections, so it needs an admin session (or an api key in server proxy mode) — wrap it in your own role check.

Usage ​

vue
<template>
  <MongocampDashboard v-if="isAdmin" />
</template>

With extra content, and a re-count after your own code changes data:

vue
<script setup>
const dashboard = ref(null)
async function afterImport() {
  await dashboard.value?.refresh()
}
</script>

<template>
  <MongocampDashboard ref="dashboard" users-path="/admin/people">
    <MyImportCard @done="afterImport" />
  </MongocampDashboard>
</template>

Props ​

PropTypeDefaultDescription
collectionsPathstring/secured/admin/collectionsLink target of the Collections card
usersPathstring/secured/admin/usersLink target of the Users card
rolesPathstring/secured/admin/rolesLink target of the Roles card

Slots ​

SlotDescription
defaultRendered below the stat cards

Exposed ​

MemberDescription
refresh()Re-counts and updates the cards

Released under the MIT License.