Atomic Angular — Doc interne

List and detail

Lay out the workspace list and a single workspace yourself — each says what the user asked for, and your host decides where it goes.

<workspace-list> shows every workspace the user can reach, as a grid or a list; <workspace-detail> shows one workspace and its documents. Use them instead of WorkspacesShell when the two belong in different places of your layout, or when navigation is the router's business.

Minimal example

A list that opens a detail
workspaces.page.ts
import { Component, signal } from "@angular/core";
import { EditWorkspace, UploadTracker, WorkspaceDetail, WorkspaceList } from "@sinequa/atomic-angular/document-workspaces";

@Component({
  selector: "workspaces-page",
  imports: [UploadTracker, WorkspaceDetail, WorkspaceList],
  template: `
    <div class="h-[40rem]">
      @if (workspaceId(); as id) {
        <workspace-detail [workspaceId]="id" uploadEndpoint="/tus" (back)="workspaceId.set(null)" (deleted)="workspaceId.set(null)" />
      } @else {
        <workspace-list (opened)="workspaceId.set($event.id)" (createRequested)="add()" />
      }
    </div>
    <upload-tracker />
  `,
})
export class WorkspacesPage {
  protected readonly workspaceId = signal<string | null>(null);

  protected async add() {
    const result = await EditWorkspace.call({ mode: "add" });
    if (typeof result === "object" && "workspace" in result) this.workspaceId.set((result["workspace"] as { id: string }).id);
  }
}

EditWorkspace.call() without an injector needs provideCallable() from @sinequa/galactik in the application's providers; the components themselves pass their own injector and never do.

How it works

Both read WorkspacesStore, which is shared: the workspace and its documents are cached, so opening the same one twice is instant, and a change made anywhere shows everywhere.

  • The list refreshes each time it is shown — workspaces created by others since the last time appear, and the document counts match the server. The list already on screen stays until the answer lands, and a failure leaves it untouched behind an inline error. It filters by tab (all, editor, reader) and by search, and offers multi-selection and deletion for the workspaces the user can write to.
  • The detail reads the workspace and its documents, with search, multi-selection, upload, edit, share and delete. Only someone who can write to the workspace sees the edit, share, delete, upload and select controls.

Options

Prop

Type

<workspace-list> has two outputs: opened (the Workspace chosen) and createRequested. <workspace-detail> has four: back, deleted (the Workspace), workspaceUpdated (the Workspace as the server now has it) and askFollowUp (AskFollowUp).

Pitfalls

What's next

On this page