Machine-translated – improvements welcome. Suggest an improvement
Adding something new¶
Checklists for the most common extensions. Most gaps are already reported by npm run typecheck and the tests named here – the lists tell you where to look before they turn red. Where the files are is shown on the map.
New page in the workbench¶
All workbench pages are in one list: EINTRAEGE in shared/src/werkbankansicht.ts (#1281). Sidebar, permission in the interface (darfSeite), middle column, numbers, help and the tables in the administrator manual read from it.
- Entry in the list
EINTRAEGE, at the place where the page should appear in the sidebar:pfad– at the same time address (/werkbank/<pfad>), identifier and administration permission;gruppe– group of the sidebar (ablage,benutzer,datenschutz,post,sichern,einstellungen,wartung);ab– from which level the page appears in the sidebar;hilfe– key of the help location inHILFE(shared/src/hilfe.ts), for example'werkbank.<pfad>': admin('<seite>/', '<Titel>');- if needed
mitte(list in the middle),auchMit(further areas whose permission opens the page) andzaehler(number in the sidebar until the page has loaded – thenserver/src/werkbank/werkbankzahlen.tsdelivers this number).
- Component in the partial table of its group (
web/src/werkbank/rahmen/inhalt.tsx,inhalt-ablage.tsxorinhalt-betrieb.tsx);rahmen/seiten.tsputs them together. An identifier the list does not know is reported by tsc. - Building blocks instead of parts of your own: actions with
Knopf(special forms withart="eigen"), ways withKnopfLinkorLink, labels withEtikett, inputs inFeld, plusReiter,Aufklapper,Zahl,Kachel… (design and building blocks). Classes of your own go into the stylesheet of the area, colours only via tokens,z-indexonly as a level--ebene-…(style). - Texts de and en:
werkbank.bereich.<pfad>.nameand.wanninshared/src/sprachen/<sprache>/werkbank/rahmen.json, the other texts of the page in the partial file of its group (where a new key belongs). - Routes of the page with
zugang: 'admin'and one rule each inREGELNinserver/src/werkbank/verwaltungsbereiche.ts(R(…), withauchMitS(…)); see new route. - Phone: if the page belongs to what people really do on the go, it goes into
HANDY_SCHWERPUNKTafter agreement; if it is for building things up and tedious on a phone, intoHANDY_BEQUEMER(hint "Easier on a computer or tablet."). Both inshared/src/werkbankansicht.ts. - Manual de and en: a page in the administrator manual (
docs/handbuch/admin/docs/<seite>.mdanddocs-en/<seite>.md) in the menu of both languages (mkdocs.ymlandmkdocs.en.yml). The tables of the areas inuebersicht.mdare rewritten bypython3 docs/handbuch/werkzeuge/werkbank_bereiche.py. - Anchors: the entry in the sidebar carries
werkbank.bereich:<pfad>by itself. Further targets for tours and tips are added as new anchors (anchor points) – never rename existing ones. - Smoke test in the matching area under
web/rauchtest/bereiche/(for examplewerkbank.mjs) if the page brings a new way to a result (smoke tests). - Check:
npm run typecheck,npm run test:datei -w server -- test/werkbank-liste.test.ts(texts, manual including menu, routes, counters) andnpm run test:datei -w web -- test/werkbank-liste.test.ts(a component for every entry).
New route¶
- Place: into the route file of the subject folder,
server/src/<ordner>/<ordner>.routen.ts, as an entry of a function(k: RoutenKontext) => Route[]. Types fromhttp/routen-typen.ts, helpers fromhttp/routen-hilfen.tsandhttp/routen-kontext.ts– never fromhttp/routen.ts. A new function goes at the end of the listBEREICHEinhttp/routen.ts(registering new routes). - State the access:
zugang: 'angemeldet'is the normal case.'admin'means workbench: only in administration mode and only with a rule inserver/src/werkbank/verwaltungsbereiche.ts– otherwise only people with "Full administration" may use it, andverwaltungsmodus.test.tsfails. Sensitive actions that need a fresh sign-in are additionally listed there inheikleHandlung.'offen'(without sign-in) only with a good reason: the route goes into the listOFFENinserver/test/routen-liste.test.tswith one sentence of justification. - No business logic in the route: the handler reads the input, gets the access (
await zg(a)) and calls the subject service (dienst.<fach>.…). The subject service checks permissions via checking permissions; understandable errors withFachfehler(status, t('meldungen.…')), texts inshared/src/sprachen/<sprache>/meldungen/. - Data: if the route needs a new method on the repo, it goes into the interface (
server/src/repo/schnittstelle/) and into the same subject file ofrepo/pg/andrepo/speicher/(repos twice). New tables or columns only via a new migration inserver/migrations/; never change existing migrations. - Public API: if the route should also be there for programs, it gets an entry in the table of
/api/v1(server/src/http/api-v1/tabelle-*.ts, with a schema inschemas-*.ts); the OpenAPI description is made from it. - Interface: the request as a function in the module of the subject area under
web/src/api/(viaanfrage()); components call this function, notfetch. - Tests: a test under
server/test/, in memory and – where something is stored – also against PostgreSQL (tests with PostgreSQL). Also rewrite the route table:CHARAKTER_SCHREIBEN=1 npm run test:datei -w server -- test/routen-tabelle-charakter.test.ts, then check the difference inserver/test/charakter/routen-tabelle.json– the new route appears there as a line of its own with its access level. There is no longer a route count to raise (#1665).
Before the pull request¶
What every contribution brings along – tests, manual de and en, release snippet docs/releases/neu/<branch>.md – is under Submitting a contribution.