Skip to content

Commit

Permalink
fix: hide connector sr
Browse files Browse the repository at this point in the history
  • Loading branch information
sagarnaikjuspay committed Dec 8, 2023
1 parent 0e59c4a commit 1937076
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 15 deletions.
3 changes: 2 additions & 1 deletion config/FeatureFlag.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
"business_profile": false,
"generate_report": false,
"forgot_password": false,
"oss_build": true
"oss_build": true,
"connector_success_rate": false
}
2 changes: 2 additions & 0 deletions src/entryPoints/hyperswitch/FeatureFlagUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type featureFlag = {
verifyConnector: bool,
forgetPassword: bool,
ossBuild: bool,
connector_success_rate: bool,
}

let featureFlagType = (featureFlags: Js.Json.t) => {
Expand Down Expand Up @@ -49,6 +50,7 @@ let featureFlagType = (featureFlags: Js.Json.t) => {
verifyConnector: dict->getBool("verify_connector", false),
forgetPassword: dict->getBool("forgot_password", false),
ossBuild: dict->getBool("oss_build", false),
connector_success_rate: dict->getBool("connector_success_rate", false),
}
typedFeatureFlag
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ let make = () => {
let (metrics, setMetrics) = React.useState(_ => [])
let (dimensions, setDimensions) = React.useState(_ => [])
let fetchDetails = useGetMethod()
let {connector_success_rate} =
HyperswitchAtom.featureFlagAtom
->Recoil.useRecoilValueFromAtom
->LogicUtils.safeParse
->FeatureFlagUtils.featureFlagType

let loadInfo = async () => {
open LogicUtils
Expand Down Expand Up @@ -73,7 +78,7 @@ let make = () => {
tabKeys
tabValues
options
singleStatEntity={getSingleStatEntity(metrics)}
singleStatEntity={getSingleStatEntity(metrics, connector_success_rate)}
getTable={getPaymentTable}
colMapper
tableEntity={paymentTableEntity}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,19 +319,29 @@ type colT =
| RetriesAmountProcessed
| ConnectorSuccessRate

let defaultColumns: array<DynamicSingleStat.columns<colT>> = [
let getColumns: bool => array<DynamicSingleStat.columns<colT>> = connector_success_rate => [
{
sectionName: "",
columns: [
SuccessRate,
Count,
SuccessCount,
ProcessedAmount,
AvgTicketSize,
RetriesCount,
RetriesAmountProcessed,
ConnectorSuccessRate,
],
columns: connector_success_rate
? [
SuccessRate,
Count,
SuccessCount,
ProcessedAmount,
AvgTicketSize,
RetriesCount,
RetriesAmountProcessed,
ConnectorSuccessRate,
]
: [
SuccessRate,
Count,
SuccessCount,
ProcessedAmount,
AvgTicketSize,
RetriesCount,
RetriesAmountProcessed,
],
},
]

Expand Down Expand Up @@ -555,7 +565,7 @@ let getStatData = (
}
}

let getSingleStatEntity: 'a => DynamicSingleStat.entityType<'colType, 't, 't2> = metrics => {
let getSingleStatEntity = (metrics, connector_success_rate) => {
urlConfig: [
{
uri: `${HSwitchGlobalVars.hyperSwitchApiPrefix}/analytics/v1/metrics/${domain}`,
Expand All @@ -564,7 +574,7 @@ let getSingleStatEntity: 'a => DynamicSingleStat.entityType<'colType, 't, 't2> =
],
getObjects: itemToObjMapper,
getTimeSeriesObject: timeSeriesObjMapper,
defaultColumns,
defaultColumns: getColumns(connector_success_rate),
getData: getStatData,
totalVolumeCol: None,
matrixUriMapper: _ => `${HSwitchGlobalVars.hyperSwitchApiPrefix}/analytics/v1/metrics/${domain}`,
Expand Down

0 comments on commit 1937076

Please sign in to comment.