nest-my-admin 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -537,6 +537,13 @@ export class OrderAdmin extends AdminResourceBase<Order> {
|
|
|
537
537
|
- **Selections.** A bulk action runs on up to 100 records.
|
|
538
538
|
- By default each record gets its own transaction: the answer is `{ ok, failed: [{ id, code, message }], message? }`, and one failure does not stop the others. The list shows how many ran and why the others did not.
|
|
539
539
|
- `atomic: true` runs them all in one transaction: every record is checked first, and one failure is the answer, with nothing applied. It needs the admin's transactions (boot fails with `transactions: false`). The confirmation says "all or nothing".
|
|
540
|
+
- **A dropdown from live data.** `choices: { field: 'methodName' }` turns an input field into a dropdown whose options a method of the resource gives when the dialog opens: the branches of a repository, the services a provider offers today.
|
|
541
|
+
```ts
|
|
542
|
+
@AdminAction({ target: 'resource', input: DeployDto, choices: { backendRef: 'backendBranches' } })
|
|
543
|
+
async deploy(input: DeployDto) { … }
|
|
544
|
+
async backendBranches(ctx: AdminContext) { return this.github.branches('api'); } // strings, or { value, label }
|
|
545
|
+
```
|
|
546
|
+
The method runs for whoever may run the action (`GET …/actions/:action/choices/:field`), sync or async. A run reads the choices again and refuses a value that is not one of them (422 on the field). The field keeps its `default` while the list loads. Field names are checked against `input` by the types and at boot, and the method must exist.
|
|
540
547
|
- **Picking a record.** `@AdminField({ pickFrom: 'categoryId' })` on an input property shows the same picker as the resource's own relation field `categoryId`; the property receives the chosen id (validate it with `@IsInt()`, and check it exists in the method).
|
|
541
548
|
- **Refusing.** Throw from the method:
|
|
542
549
|
- an `HttpException` below 500 answers with its status and message (409 is `CONFLICT`, 400 is `BUSINESS_RULE`), and the UI shows the message;
|
|
@@ -969,6 +976,10 @@ Things hosts tend to write by hand that the admin already does:
|
|
|
969
976
|
- **Inline children stay out of the sidebar** by default (`nav: false` unless they set `nav`): no extra group to hide them in.
|
|
970
977
|
- **Labels in one language** are plain strings; other languages can come from `translate` (see Languages, theme and branding).
|
|
971
978
|
|
|
979
|
+
## Upgrading to 0.9.1
|
|
980
|
+
|
|
981
|
+
Nothing to change. New: `@AdminAction({ choices })` (see Actions): an input field whose dropdown a resource method fills when the dialog opens, re-checked when the action runs. Every dropdown in the dashboard (forms, filters, sort, page size, inline cell edits, language, roles, audit, debugger, the editor's heading level) is now the dashboard's own list, styled like the rest and right to left in Persian, instead of the browser's native `<select>`. Tests that drove a native select (`selectOption`) click the field, then the option (`getByRole('option', { name })`).
|
|
982
|
+
|
|
972
983
|
## Upgrading to 0.9.0
|
|
973
984
|
|
|
974
985
|
The contracts between the admin and your code are now enforced: the decorators' types refuse a method or class of the wrong shape at compile time, and the admin refuses a wrong value at run time (a 500 with `nest-my-admin: …` in the log, or a boot error) instead of reading it as something else. Code that already followed the docs keeps working; code that compiled only through `any` or plain JavaScript may now fail. What to check:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nest-my-admin",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Django-admin-class admin panel for NestJS + TypeORM: @nest-my-admin/core, /auth and /testing under one name",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@nest-my-admin/auth": "0.9.
|
|
43
|
-
"@nest-my-admin/core": "0.9.
|
|
44
|
-
"@nest-my-admin/testing": "0.9.
|
|
42
|
+
"@nest-my-admin/auth": "0.9.1",
|
|
43
|
+
"@nest-my-admin/core": "0.9.1",
|
|
44
|
+
"@nest-my-admin/testing": "0.9.1"
|
|
45
45
|
}
|
|
46
46
|
}
|