English
detail.logs.render.before
About 531 wordsAbout 2 min
2026-07-20
Promise-style hook
Configures request parameter processing and log data processing functions before the first operation log request.
This hook runs before operation logs are rendered on the detail page.
Parameters
functional registers the hook callback. The host passes the following parameters when executing the hook:
| Parameter | Description | Type | Allowed Values | Default |
|---|---|---|---|---|
| context | Event context containing common parameters | Object | -- | -- |
| plugin | Current plugin runtime information; business logic normally does not need it | Object | -- | -- |
Return Value
The hook may return a configuration object or Promise<Object>. The host waits for the Promise to resolve before requesting operation logs. If the hook fails, the host ignores the extension and continues with default behavior.
| Parameter | Description | Type | Allowed Values | Default |
|---|---|---|---|---|
| formatRequestParam | Operation log request parameter processor | Function | -- | -- |
| parseData | Operation log list data processor | Function | -- | -- |
formatRequestParam(params)
This function runs synchronously before every operation log request. It may mutate params and return nothing, or return a new request parameter object. When it returns a falsy value, the host continues using the original params.
| Parameter | Description | Type |
|---|---|---|
| params | Current operation log request parameters | Object |
| params.apiName | Current object API name | String |
| params.objectId | Current detail data ID | String |
| params.pageSize | Number of items per page | Number |
| params.pageNumber | One-based current page number | Number |
| params.operationalType | Log type: system for system logs, otherwise an empty string | String |
| params.bizIds | Business ID condition supplied by the log component | Any |
| params.otherBizIds | Additional business ID condition supplied by the log component | Any |
| params.operationTimeFrom | Start of the time range; absent when time range is disabled | Number | undefined |
| params.operationTimeTo | End of the time range; absent when time range is disabled | Number | undefined |
| params.operationTime | Pagination boundary time; may be absent on the first request | Number | undefined |
| params.needReturnCount | Whether the total count is required; absent in some modes | Boolean | undefined |
| params.turnLogId | Time-range pagination cursor; may be empty on the first request | String | undefined |
The return type is Object | void. A returned object completely replaces params; it is not merged. When changing only some parameters, return { ...params, changedProperties } so required values such as apiName and objectId are retained. The function cannot return a Promise.
parseData(data)
This function runs synchronously after each batch of operation log data is returned, including initial loading, log type changes, and loading more data.
| Parameter | Description | Type |
|---|---|---|
| data | Operation log array returned by the current request | Object[] |
Log item fields vary by log type and interface version. Check whether a target field exists before reading or filtering it.
The return type is Object[] | void. A returned array replaces the current batch. If the function mutates data and returns a falsy value, the host continues using the same array. The function cannot return a Promise.
Basic Examples
Process Request Parameters and Log Data
export default class Plugin {
apply() {
return [{
event: 'detail.logs.render.before',
functional: this.logsRenderBefore.bind(this)
}];
}
logsRenderBefore(context, plugin) {
return Promise.resolve({
formatRequestParam(params) {
return {
...params,
pageSize: 50
};
},
parseData(data) {
return data.map(item => ({
...item,
pluginProcessed: true
}));
}
});
}
}Notes
1. formatRequestParam and parseData run again for subsequent pagination and filter changes, so their processing must be idempotent.
2. The operation log component invokes both processors synchronously. Do not return a Promise from either function.
