newdevs:angularclient:basicadmin
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
newdevs:angularclient:basicadmin [2025/03/28 12:21] – messy first draft sleary | newdevs:angularclient:basicadmin [2025/04/02 15:59] (current) – syntax highlighting sleary | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Using the Basic Admin Page Component ====== | ====== Using the Basic Admin Page Component ====== | ||
- | * creates a basic grid with editing dialog | + | |
- | * most arguments are pass-throughs for the grid and fieldmapper editor | + | * most arguments are pass-throughs for the grid and fieldmapper editor |
- | * the recordLabel input is what gets used on the "New $THING" | + | * the recordLabel input is what gets used on the "New $THING" |
- | * note magic URLs! use them to replace the auto-generated interfaces with your own | + | * note magic URLs! use them to replace the auto-generated interfaces with your own |
- | * * admin/ | + | * admin/ |
- | * * edit admin/local splash or admin/ | + | * edit admin/local splash or admin/ |
- | * you do not need < | + | * you do not need < |
- | * you will have to create an SQL upgrade file + 950.seed data for your grid settings | + | * you will have to create an SQL upgrade file + 950.seed data for your grid settings |
===== Using the Fieldmapper Editor ===== | ===== Using the Fieldmapper Editor ===== | ||
Line 16: | Line 16: | ||
To render a combobox, set that field' | To render a combobox, set that field' | ||
+ | <code html> | ||
| | ||
myFieldName1: | myFieldName1: | ||
| | ||
+ | </ | ||
To render a custom template (with optional context arguments), set: | To render a custom template (with optional context arguments), set: | ||
+ | <code html> | ||
| | ||
| | ||
| | ||
| | ||
+ | </ | ||
for example: | for example: | ||
+ | <code html> | ||
| | ||
event: {customTemplate: | event: {customTemplate: | ||
Line 45: | Line 49: | ||
</ | </ | ||
</ | </ | ||
+ | </ | ||
Always use: | Always use: | ||
Line 56: | Line 61: | ||
Use '' | Use '' | ||
+ | <code JavaScript> | ||
| | ||
+ | </ | ||
Use '' | Use '' | ||
+ | <code JavaScript> | ||
| | ||
+ | </ | ||
Use '' | Use '' | ||
+ | <code JavaScript> | ||
| | ||
for (const org of orgs) { | for (const org of orgs) { | ||
Line 71: | Line 79: | ||
} | } | ||
} ); | } ); | ||
+ | </ | ||
- | + | | |
- | | + | * order_by is an object where the keys are the classnames and the values are strings with the field name, then a space, then the direction ('' |
- | * order_by is an object where the keys are the classnames and the values are strings with the field name, then a space, then the direction (ASC or DESC) | + | |
Record notes example: | Record notes example: | ||
+ | <code JavaScript [enable_line_numbers=" | ||
const where = { | const where = { | ||
record: this.recId, | record: this.recId, | ||
Line 103: | Line 112: | ||
complete: this.emitNoteCount | complete: this.emitNoteCount | ||
})); | })); | ||
+ | </ | ||
==== Fleshing ==== | ==== Fleshing ==== | ||
- | flesh_fields is an object where the keys are the classnames and the values are arrays of field names. | + | '' |
+ | |||
+ | Note that only pcrud is capable of fleshing; cstore is not. This means org unit settings cannot be fleshed! If you need to turn a user or OU ID into a name from settings data, you will need to add some logic to fetch those separately. | ||
+ | |||
+ | ==== IDL vs. Hash ==== | ||
+ | |||
+ | Pcrud returns columns as functions: | ||
+ | |||
+ | <code JavaScript> | ||
+ | | ||
+ | </ | ||
+ | |||
+ | To set a new value, pass the value as an argument: | ||
+ | |||
+ | <code JavaScript> | ||
+ | | ||
+ | </ | ||
+ | |||
+ | The IDL service has a toHash() method that can make this easier to work with if all you're doing is reading data: | ||
+ | |||
+ | <code JavaScript> | ||
+ | idl.toHash(org_unit); | ||
+ | console.debug(" | ||
+ | </ | ||
+ | |||
+ | Note there is an option to flatten the data. | ||
+ | |||
+ | As of 3.15, there is also a way to go from a hash back to a proper IDL object: | ||
+ | |||
+ | <code JavaScript> | ||
+ | idl.fromHash(some_object, | ||
+ | </ | ||
+ | |||
+ | The classname is the second argument. There is an optional third argument to convert booleans from ''' |
newdevs/angularclient/basicadmin.1743178873.txt.gz · Last modified: 2025/03/28 12:21 by sleary