From 1005cc7099bf4ed6d6fdadd9f843c1937b733fe2 Mon Sep 17 00:00:00 2001 From: Sagar naik Date: Tue, 19 Dec 2023 14:57:52 +0530 Subject: [PATCH] feat: added path and api method in audit logs (#112) --- .../HyperSwitch/PaymentLogs/PaymentLogs.res | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res b/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res index 89b94d128..743a990df 100644 --- a/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res +++ b/src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res @@ -130,11 +130,6 @@ module ApiDetailsComponent = { let (key, _) = entry filteredKeys->Js.Array2.includes(key)->not }) - // ->Js.Array2.sortInPlaceWith((e1, e2) => { - // let (key1, _) = e1 - // let (key2, _) = e2 - // key1 > key2 ? 1 : key1 === key2 ? 0 : -1 - // }) ->Js.Dict.fromArray ->Js.Json.object_ ->Js.Json.stringify @@ -149,10 +144,20 @@ module ApiDetailsComponent = { } let statusCode = switch logType { - | Payment => paymentDetailsValue->getString("status_code", "200") + | Payment => paymentDetailsValue->getInt("status_code", 200)->Belt.Int.toString | Sdk => paymentDetailsValue->getString("log_type", "INFO") } + let method = switch logType { + | Payment => paymentDetailsValue->getString("http_method", "") + | Sdk => "" + } + + let apiPath = switch logType { + | Payment => paymentDetailsValue->getString("url_path", "") + | Sdk => "" + } + let background_color = switch (logType, statusCode) { | (Sdk, "INFO") => "blue-700" | (Payment, "200") => "green-700" @@ -190,7 +195,16 @@ module ApiDetailsComponent = {

{statusCode->React.string}

-

{apiName->React.string}

+ {switch logType { + | Sdk =>

{apiName->React.string}

+ | Payment => +

+ + {method->Js.String2.toUpperCase->React.string} + + {apiPath->React.string} +

+ }}
{createdTime->Js.Date.fromString->Js.Date.toUTCString->React.string}