Skip to content

Commit

Permalink
Merge branch 'main' of github.com:juspay/hyperswitch-control-center i…
Browse files Browse the repository at this point in the history
…nto page-heading-addition
  • Loading branch information
Pritish Budhiraja committed Dec 1, 2023
2 parents 21a4072 + 5310ae8 commit 8664190
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
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
12 changes: 7 additions & 5 deletions src/entryPoints/hyperswitch/SidebarValues.res
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,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 @@ -244,15 +244,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 @@ -325,16 +327,16 @@ let getHyperSwitchAppSidebars = (
userManagement,
sampleData,
businessProfile,
systemMetrics,
} = featureFlagDetails

let sidebar = [
productionAccess->productionAccessComponent,
default->home,
default->operations,
default->analytics,
default->connectors,
default->workflow,
default->developers(~userRole),
default->developers(userRole, systemMetrics),
settings(
~isSettingsEnabled=default,
~isUserManagementEnabled=userManagement,
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

0 comments on commit 8664190

Please sign in to comment.