Skip to content

Commit

Permalink
Merge pull request #20 from juspay/chore/system-metrics
Browse files Browse the repository at this point in the history
system metrics changes
  • Loading branch information
JeevaRamu0104 authored Nov 24, 2023
2 parents 54616fc + 04e39b4 commit 240d009
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
10 changes: 6 additions & 4 deletions src/entryPoints/hyperswitch/HyperSwitchApp.res
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ let make = () => {
let getEnumDetails = EnumVariantHook.useFetchEnumDetails()
let verificationDays = getFromMerchantDetails("verification")->LogicUtils.getIntFromString(-1)
let userRole = getFromUserDetails("user_role")

let modeText = featureFlagDetails.testLiveMode ? "Live Mode" : "Test Mode"
let titleComingSoonMessage = "Coming Soon!"
let subtitleComingSoonMessage = "We are currently working on this page."
Expand All @@ -65,6 +64,7 @@ let make = () => {
let hyperSwitchAppSidebars = SidebarValues.getHyperSwitchAppSidebars(
~isReconEnabled,
~featureFlagDetails,
~userRole,
(),
)

Expand Down Expand Up @@ -315,9 +315,11 @@ let make = () => {
| list{"monitoring"} => comingSoonPage
| list{"developer-api-keys"} => <KeyManagement.KeysManagement />
| list{"developer-system-metrics"} =>
<AnalyticsUrlUpdaterContext key="SystemMetrics">
<SystemMetricsAnalytics />
</AnalyticsUrlUpdaterContext>
<UIUtils.RenderIf condition={userRole->Js.String2.includes("internal_")}>
<AnalyticsUrlUpdaterContext key="SystemMetrics">
<SystemMetricsAnalytics />
</AnalyticsUrlUpdaterContext>
</UIUtils.RenderIf>
| list{"webhooks", ...remainingPath} =>
<EntityScaffold
entityName="WebHooks"
Expand Down
10 changes: 7 additions & 3 deletions src/entryPoints/hyperswitch/SidebarValues.res
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,18 @@ let webhooks = SubLevelLink({
searchOptions: [("View Webhooks", "")],
})

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

isDevelopersEnabled
? Section({
name: "Developers",
icon: "developer",
showSection: true,
links: [apiKeys, webhooks, systemMetrics],
links: isInternalUser ? [apiKeys, webhooks, systemMetrics] : [apiKeys, webhooks],
})
: emptyComponent
}

// * PRO Features

Expand Down Expand Up @@ -276,6 +279,7 @@ let reconTag = (recon, isReconEnabled) =>
let getHyperSwitchAppSidebars = (
~isReconEnabled=false,
~featureFlagDetails: FeatureFlagUtils.featureFlag,
~userRole,
(),
) => {
let {productionAccess, frm, payOut, recon, default, userManagement} = featureFlagDetails
Expand All @@ -286,7 +290,7 @@ let getHyperSwitchAppSidebars = (
default->analytics,
default->connectors,
default->workflow,
default->developers,
default->developers(~userRole),
default->settings,
[frm, payOut, recon]->Js.Array2.includes(true)->proFeatures,
frm->fraudAndRisk,
Expand Down
2 changes: 2 additions & 0 deletions src/screens/HyperSwitch/Utils/HSwitchGlobalSearchBar.res
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ let make = () => {
->LogicUtils.safeParse
->FeatureFlagUtils.featureFlagType
let merchentDetails = HSwitchUtils.useMerchantDetailsValue()
let userRole = HSLocalStorage.getFromUserDetails("user_role")
let isReconEnabled =
(merchentDetails->HSwitchMerchantAccountUtils.getMerchantDetails).recon_status === Active

let hswitchTabs = SidebarValues.getHyperSwitchAppSidebars(
~isReconEnabled,
~featureFlagDetails,
~userRole,
(),
)
let url = RescriptReactRouter.useUrl()
Expand Down

0 comments on commit 240d009

Please sign in to comment.