Skip to content

Commit

Permalink
fix(comms): change LogCategory filter based upon searchField
Browse files Browse the repository at this point in the history
The filter passed to WsLogaccess.GetLogs should change the "LogCategory"
request parameter based upon the field that is being searched.
(eg, HPCC-31896)

Also, corrects TargetAudience.Programmer value to "PRO", see
https://github.com/hpcc-systems/HPCC-Platform/blob/master/esp/scm/ws_logaccess.ecm#L145

Signed-off-by: Jeremy Clements <[email protected]>
  • Loading branch information
jeclrsg committed Jun 12, 2024
1 parent 492a0c7 commit 0d30644
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions packages/comms/src/services/wsLogaccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const enum LogType {
export const enum TargetAudience {
Operator = "OPR",
User = "USR",
Programmer = "PRG",
Programmer = "PRO",
Audit = "ADT"
}

Expand Down Expand Up @@ -112,18 +112,24 @@ export class LogaccessService extends LogaccessServiceBase {
if (key in columnMap) {
searchField = columnMap[key];
}
let logCategory = WsLogaccess.LogAccessType.ByFieldName;
if (searchField) {
switch (searchField) {
case "hpcc.log.audience":
logCategory = WsLogaccess.LogAccessType.ByTargetAudience;
break;
}
if (Array.isArray(request[key])) {
request[key].forEach(value => {
filters.push({
LogCategory: WsLogaccess.LogAccessType.ByFieldName,
LogCategory: logCategory,
SearchField: searchField,
SearchByValue: value
});
});
} else {
filters.push({
LogCategory: WsLogaccess.LogAccessType.ByFieldName,
LogCategory: logCategory,
SearchField: searchField,
SearchByValue: request[key]
});
Expand Down Expand Up @@ -173,7 +179,7 @@ export class LogaccessService extends LogaccessServiceBase {
getLogsRequest.Filter.Operator = WsLogaccess.LogAccessFilterOperator.OR;
}
getLogsRequest.Filter.rightFilter = {
LogCategory: filters[0]?.LogCategory,
LogCategory: filters[1]?.LogCategory,
SearchField: filters[1]?.SearchField,
SearchByValue: filters[1]?.SearchByValue
};
Expand Down

0 comments on commit 0d30644

Please sign in to comment.