You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: adminforth/documentation/docs/tutorial/03-Customization/03-virtualColumns.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,6 +53,10 @@ columns: [
53
53
```
54
54
55
55
This field will be displayed in show and list views with custom component `CountryFlag.vue`.
56
+
57
+
:::tip Enriching a virtual column from a hook
58
+
If you fill a virtual column from a hook (e.g. [`afterDatasourceResponse`](./04-hooks.md#modify-record-after-it-is-returned-from-database)) instead of a custom component, write the enriched value into a field with **the same name as the virtual column**. This keeps the value addressable by column name everywhere — most importantly, the [Agent plugin](/docs/tutorial/Plugins/agent/) selects records by column name, so a mismatched field name makes it select the (empty) virtual column and miss your enriched data.
59
+
:::
56
60
Create file `CountryFlag.vue` in `custom` folder of your project:
Copy file name to clipboardExpand all lines: adminforth/documentation/docs/tutorial/03-Customization/04-hooks.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -199,6 +199,12 @@ Also you can use this hook to enrich the returned records list with some additio
199
199
}
200
200
```
201
201
202
+
:::tip Name enriched fields after the virtual column
203
+
When you enrich records with extra fields for display, declare a matching [virtual column](./03-virtualColumns.md) and use **the same name** for the field you add in the hook (e.g. add a `priceWithTax` virtual column and write `r.priceWithTax` in the hook).
204
+
205
+
Reusing the same name keeps the enriched value tied to a column the rest of AdminForth knows about. In particular, the [Agent plugin](/docs/tutorial/Plugins/agent/) selects records by column name when answering questions — if the hook writes to a different field than the virtual column, the agent selects the (empty) virtual column and never sees your enriched value.
206
+
:::
207
+
202
208
### Dropdown list of foreignResource
203
209
204
210
By default if there is `foreignResource` like we use for demo on `realtor_id` column, the filter will suggest a
Copy file name to clipboardExpand all lines: adminforth/documentation/docs/tutorial/06-Adapters/04-storage-adapters.md
+6-4Lines changed: 6 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,10 +55,12 @@ If you don't want to use a key/value adapter and you don't need to clean up file
55
55
56
56
Since the adapter uses a key/value adapter to store keys for deletion, it is important to use persistent storage, so the data will be safe:
57
57
58
-
- (⛔️) [RAM adapter](07-key-value-adapters.md#ram-adapter) - not recommended, because after a server restart all data will be lost
59
-
- (✅) [Redis adapter](07-key-value-adapters.md#redis-adapter) - Redis itself stores data in-memory, but you can set it up to write data to an `.rdb` file so the database is restored on server restart. However, it requires regular database snapshots and persistent Docker storage setup
60
-
- (✅✅) [LevelDB adapter](07-key-value-adapters.md#leveldb-adapter) - can be used, but you need to set up persistent storage in your Docker container, so data won't be lost between restarts
61
-
- (✅✅✅) [Resource adapter](07-key-value-adapters.md#resource-based-adapter) - uses a database to store key/value pairs, so data will be safe between restarts, but you need to create an extra table for this storage
58
+
- (⛔️) [RAM adapter](07-key-value-adapters.md#ram-adapter) - not recommended, because after an admin process restart (e.g. redeployment) all data and orphan file tracking info will be lost (and files will not be cleaned up)
59
+
- (✅) [LevelDB adapter](07-key-value-adapters.md#leveldb-adapter) - can be used, but you need to set up persistent storage in your Docker container by monting leveldb data directory into a volume, so data won't be lost between restarts
60
+
- (✅✅) [Redis adapter](07-key-value-adapters.md#redis-adapter) - Redis itself stores data in RAM memory but modern versions also able to persist it into disk. If you are running Redis in docker we recommend you to ensure that CI/CD pipeline does not force it to restarts during each redeployment, also ensure that you mount `/data` dir into volume. ()
61
+
- (✅✅✅) [Resource adapter](07-key-value-adapters.md#resource-based-adapter) - uses a database to store key/value pairs, so data will be safe between restarts, but you need to create an extra table for this storage.
62
+
63
+
Please note that one adapter instance can be also reused for any other purposes or plugins, so if your application need KV adapter to multiple purposes, you can instantiate it once in dedicated utility file and reuse this instance in other places. Internally each KV method exposes 'collection' parameter which allows to separate data for different purposes or by different plugins.
0 commit comments