Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: logs change #45

Merged
merged 5 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/entryPoints/hyperswitch/HyperSwitchApp.res
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,9 @@ let make = () => {
| list{"monitoring"} => comingSoonPage
| list{"developer-api-keys"} => <KeyManagement.KeysManagement />
| list{"developer-system-metrics"} =>
<UIUtils.RenderIf condition={userRole->Js.String2.includes("internal_")}>
<UIUtils.RenderIf
condition={userRole->Js.String2.includes("internal_") &&
featureFlagDetails.systemMetrics}>
<AnalyticsUrlUpdaterContext key="SystemMetrics">
<SystemMetricsAnalytics />
</AnalyticsUrlUpdaterContext>
Expand Down
20 changes: 15 additions & 5 deletions src/entryPoints/hyperswitch/SidebarValues.res
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ let apiKeys = SubLevelLink({
searchOptions: [("View API Keys", "")],
})

let systemMetrics = SubLevelLink({
let systemMetric = SubLevelLink({
name: "System Metrics",
link: `/developer-system-metrics`,
access: ReadWrite,
Expand All @@ -210,15 +210,17 @@ let webhooks = SubLevelLink({
searchOptions: [("View Webhooks", "")],
})

let developers = (isDevelopersEnabled, ~userRole) => {
let developers = (isDevelopersEnabled, userRole, systemMetrics) => {
let isInternalUser = userRole->Js.String2.includes("internal_")

isDevelopersEnabled
? Section({
name: "Developers",
icon: "developer",
showSection: true,
links: isInternalUser ? [apiKeys, webhooks, systemMetrics] : [apiKeys, webhooks],
links: isInternalUser && systemMetrics
? [apiKeys, webhooks, systemMetric]
: [apiKeys, webhooks],
})
: emptyComponent
}
Expand Down Expand Up @@ -282,15 +284,23 @@ let getHyperSwitchAppSidebars = (
~userRole,
(),
) => {
let {productionAccess, frm, payOut, recon, default, userManagement} = featureFlagDetails
let {
productionAccess,
frm,
payOut,
recon,
default,
userManagement,
systemMetrics,
} = featureFlagDetails
let sidebar = [
productionAccess->productionAccessComponent,
default->home,
default->operations(userManagement),
default->analytics,
default->connectors,
default->workflow,
default->developers(~userRole),
default->developers(userRole, systemMetrics),
default->settings,
[frm, payOut, recon]->Js.Array2.includes(true)->proFeatures,
frm->fraudAndRisk,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,20 @@ module OverviewInfo = {

@react.component
let make = () => {
let {systemMetrics} =
HyperswitchAtom.featureFlagAtom
->Recoil.useRecoilValueFromAtom
->LogicUtils.safeParse
->FeatureFlagUtils.featureFlagType

<div className="flex flex-col gap-4">
<p className=headingStyle> {"Overview"->React.string} </p>
<div className="grid grid-cols-1 md:grid-cols-3 w-full gap-4">
<ConnectorOverview />
<PaymentOverview />
<SystemMetricsInsights />
<UIUtils.RenderIf condition={systemMetrics}>
<SystemMetricsInsights />
</UIUtils.RenderIf>
</div>
<OverviewInfo />
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/screens/HyperSwitch/PaymentLogs/PaymentLogs.res
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ module PrettyPrintJson = {

let parseJsonValue = () => {
try {
let parsedValue = Window.getParsedJson(jsonToDisplay)->Js.Json.stringifyWithSpace(3)
let parsedValue = jsonToDisplay->Js.Json.parseExn->Js.Json.stringifyWithSpace(3)
setParsedJson(_ => parsedValue)
} catch {
| _ => setParsedJson(_ => "")
| _ => setParsedJson(_ => jsonToDisplay)
}
}
React.useEffect1(() => {
Expand Down Expand Up @@ -97,7 +97,7 @@ module ApiDetailsComponent = {
let headerStyle = "text-fs-13 font-medium text-grey-700 break-all"
let logType = paymentDetailsValue->Js.Dict.get("request_id")->Belt.Option.isSome ? Payment : Sdk
let apiName = switch logType {
| Payment => paymentDetailsValue->getString("api_name", "default value")
| Payment => paymentDetailsValue->getString("api_flow", "default value")->camelCaseToTitle
| Sdk => paymentDetailsValue->getString("event_name", "default value")
}->PaymentUtils.nameToURLMapper(~payment_id=paymentId, ())
let createdTime = paymentDetailsValue->getString("created_at", "00000")
Expand Down
Loading