Skip to content

Machine-translated – improvements welcome. Suggest an improvement

Versions

Fassungen and GeloeschteEintraege (#1006) show who changed what and when on an entry of the Workbench: a list like the history of a folder, compare two versions, restore an earlier one. Every editor with versions uses the same component – folder type, view, number sequence, stamp template, mailbox, package settings, automation.

What it is for

For every entry of the Workbench that has versions: as the last area in the editor, plus GeloeschteEintraege below the list of entries. The history of a folder in the Library and the runs of automations and workflow templates use the same list (Eintragsliste).

Matching patterns in the pattern catalogue: E3 · Visibility creates trust, E2 · Updates change nothing secretly, B4 · Confirmations in Ablago's own dialog, D3 · Sentences that are true.

How to use it

With How it works
Mouse A click on a version expands it: all changes and the buttons “Select for comparison” and “Restore this version”. Two selected versions are compared above the list. “Expand all” / “Collapse all” act on the whole list. Restoring asks first (Confirmation) and shows what changes.
Keyboard Tab reaches every version; Enter or Space expand it. The buttons inside follow with Tab.
Touch The buttons are small buttons with a 44 × 44 px touch area; a version expands with one tap.

Behaviour

  • List: per version the time, who (readable from the server, e.g. “Package Household 1.4.0 (by Markus)”), the first changes; Current, Deleted or from version n as a tag. Expanded: all changes and the buttons.
  • Compare: select two versions; above the list it says what changed from the older to the newer one.
  • Restore: first the preview (GET …/fassungen/:nr) – the confirmation names the changes compared with now and notes (fields with values, folders that no longer match). Then POST …/fassungen/:nr/wiederherstellen with the state of the preview (conflict protection). If the server answers with a question of the normal save (details.niemand, details.zusammengesetzt, details.adresse), the component asks and sends the confirmation along.
  • The changes are written by the server in the person's language (shared/src/fassungsvergleich.ts); the interface computes nothing itself.

What it means

Every row is a state of the entry, the newest at the top. Current (green) is the state that applies now; Deleted (red) means the entry was deleted afterwards; from version n means this state is a restore. The changes are sentences (“‘Amount’ is no longer required”), not technical differences. Restoring creates a new version – nothing is lost.

States

State How it comes about How it looks
list versions exist per row time, who, first change and tag
expanded click on a version all changes, “Select for comparison” and “Restore this version”
selected “Select for comparison” button pressed (aria-pressed), “Stop comparing”
comparison two versions selected changes from the older to the newer one above the list
empty no version yet a quiet sentence (“No version yet.”)
deleted entries GeloeschteEintraege list of deleted entries below the entries

“Versions” section of the pattern page: three versions, an empty list and deleted entries

“Versions” section, dark

Accessibility

  • Every version is a <details> with <summary> – keyboard and screen readers know it as expandable.
  • “Select for comparison” is a button with aria-pressed; the comparison is a region with a name (“From version 2 to version 3”).
  • Result and error of restoring are shown as role="status" or role="alert" below the list and are announced.
  • The tags “Current” and “Deleted” say it in words, not only in colour.

Code

Using it

import { Fassungen, GeloeschteEintraege } from '../bausteine';

// In the editor, as the last area (in the BereichListe: ['fassungen', t('oberflaeche.fassungen.titel')], only after creating):
{gespeichert && <Fassungen art="typ" eintrag={gespeichert.id} stand={gespeichert.geaendert} nachher={() => d.neuLaden()} klappe={klappe('fassungen')} />}

// Below the list of entries:
<GeloeschteEintraege art="typ" />
Prop Purpose
art, eintrag kind of entry (FassungArt from shared/src/fassungen.ts) and the id or key of the entry
klappe as for every area; without a jump bar { offen: true, umschalten() {}, fest: true }
stand changes with every save (geaendert, version …) – then the list reloads
nachher after restoring: reload the entry. The editor takes over the new state with useGespeichertNachziehen (Speicherleiste.tsx) as long as nothing in the draft has changed
quelle where the versions come from; defaults to the API. The pattern page and tests pass a fixed source (FassungenQuelle)

Connecting a new kind of entry

  1. Add the kind to FASSUNG_ARTEN, FASSUNG_BEREICH and FASSUNG_PFAD (shared/src/fassungen.ts) and to the CHECK of the table fassungen (migration).
  2. Describe changes in shared/src/fassungsvergleich.ts (beschreibeAenderungen) – sentences, no JSON. Never put secrets into the state.
  3. On the server, register a Gegenstand (dienst.fassungen.registriere): stand, alle, stelleHer through the normal save, ideally hinweise and kontext.
  4. After every save kern.fassungen.halte(art, id), when deleting kern.fassungen.geloescht(art, id, loesche) – unless the entry lives in the repo and is covered by the wrapper (server/src/fassungen/huelle.ts).
  5. Add the area to the editor and GeloeschteEintraege below the list; update the admin manual.

Files and tests

  • Building block: web/src/bausteine/fassungen/Fassungen.tsx, list: Eintragsliste.tsx, look: Fassungen.module.css
  • Pattern page: web/src/bausteine/fassungen/muster.tsx
  • Logic: shared/src/fassungen.ts, shared/src/fassungsvergleich.ts; server: server/src/fassungen/