Skip to content

Embedding Data Views ​

@authup/client-web-components ships the collection views of the admin console as Vue components: a sortable table, a filter panel and pagination per entity (AUsersView, AClientsView, ARolesView, AEventsView, ...). The admin console renders its own pages with them, so an embedded view behaves exactly like the console's.

Embed a view where an entity list belongs inside your own screen, for example the members of a project or the events of one robot. For plain administration (create, edit, delete), link to the admin console instead of rebuilding it.

Install ​

The views build on @authup/client-web-kit, so its install() (HTTP client, store, translator) must already run in the app.

bash
npm install @authup/client-web-components @authup/client-web-components-theme @vuecs/filters

Add the translated labels of the filter components to the defaults you pass to @vuecs/core, inside the app's scope, and install the table (rendered through its global registration) and the overlays (the delete prompt):

typescript
import { buildFilterDefaults } from '@authup/client-web-components';
import { runInAppScope } from '@authup/client-web-kit';
import vuecs from '@vuecs/core';
import installOverlays from '@vuecs/overlays';
import installTable from '@vuecs/table';

app.use(vuecs, {
    // ...
    defaults: {
        ...runInAppScope(app, () => buildFilterDefaults()),
    },
});
app.use(installOverlays);
app.use(installTable);

Mount <VCAlertDialogProvider /> (from @vuecs/overlays) once in your layout, or pass read-only to every view: the delete action asks for confirmation through it.

Import the stylesheet after your main theme:

css
@import "@authup/client-web-theme";

Where a view keeps its state ​

Filters, sort order and folder live in one store per app.

  • Nothing provided: each view keeps its state in memory, and your URL stays yours. This is the default for an embedded view.
  • The route query: provide a route store, and a filtered view survives a reload and can be shared as a link. The admin console does this.
typescript
import { provideDataViewStore } from '@authup/client-web-components';
import { createRouteFilterStore } from '@vuecs/filters/router';

provideDataViewStore(createRouteFilterStore(router), app);

Never write the same route query from a second place: one writer spreading route.query drops the keys of the other.

Props ​

Every entity view accepts:

PropPurpose
filterA condition the view always applies (rapiq ICondition), e.g. the events of one robot. The user's filters narrow it further.
recordTo(row) => string, the details link of a row. Without it a row has no details button.
readOnlyHides every write (delete), whatever the user may do.
placementWhere the filter panel goes: right (default), left, drawer or none.

AEventsView also takes realmScoped (default false): narrow the list to the managed realm and global events, as the admin console's events page does.

The header slot renders above the table, and the view emits deleted with the removed entity.

vue
<script lang="ts">
import { AEventsView } from '@authup/client-web-components';
import { eq } from '@rapiq/core';
import { computed, defineComponent } from 'vue';

export default defineComponent({
    components: { AEventsView },
    props: { robotId: { type: String, required: true } },
    setup(props) {
        return { filter: computed(() => eq('actorId', props.robotId)) };
    },
});
</script>
<template>
    <AEventsView
        :filter="filter"
        placement="drawer"
    />
</template>

Permissions ​

A view asks the API with the signed-in user's token, so it lists only what that user may read. Actions follow the user's permissions: a button the user may not use is disabled, and readOnly hides the writes altogether.