Skip to content

Commit

Permalink
fix: Move disabled connectors at bottom (#1949)
Browse files Browse the repository at this point in the history
Co-authored-by: Susritha Sabbini <[email protected]>
  • Loading branch information
susrithasabbini and Susritha Sabbini authored Dec 24, 2024
1 parent 3baac29 commit c278fbd
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/screens/Connectors/ConnectorUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -1794,3 +1794,12 @@ let updateMetaData = (~metaData) => {
| false => ()
}
}

let sortByDisableField = (arr: array<'a>, getDisabledStatus: 'a => bool) => {
arr->Array.sort((a, b) =>
LogicUtils.numericArraySortComperator(
getDisabledStatus(a) ? 1.0 : 0.0,
getDisabledStatus(b) ? 1.0 : 0.0,
)
)
}
1 change: 1 addition & 0 deletions src/screens/Connectors/FraudAndRisk/FRMSelect.res
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ let make = () => {
let previousData = frmList->Array.map(ConnectorListMapper.getProcessorPayloadType)
setFilteredFRMData(_ => previousData->Array.map(Nullable.make))
setPreviouslyConnectedData(_ => previousData->Array.map(Nullable.make))
ConnectorUtils.sortByDisableField(previousData, connectorPayload => connectorPayload.disabled)
let arr: array<ConnectorTypes.connectorTypes> = frmList->Array.map(
paymentMethod =>
paymentMethod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ let make = () => {
item.connector_type->ConnectorUtils.connectorTypeStringToTypeMapper === PMAuthProcessor
)

ConnectorUtils.sortByDisableField(connectorsList, connectorPayload => connectorPayload.disabled)

setConfiguredConnectors(_ => connectorsList)
setFilteredConnectorData(_ => connectorsList->Array.map(Nullable.make))
setScreenState(_ => Success)
Expand Down
1 change: 1 addition & 0 deletions src/screens/Connectors/PaymentProcessor/ConnectorList.res
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ let make = () => {
let connectorsList =
connectorListFromRecoil->getProcessorsListFromJson(~removeFromList=ConnectorTypes.FRMPlayer)
connectorsList->Array.reverse
ConnectorUtils.sortByDisableField(connectorsList, connectorPayload => connectorPayload.disabled)
setFilteredConnectorData(_ => connectorsList->Array.map(Nullable.make))
setPreviouslyConnectedData(_ => connectorsList->Array.map(Nullable.make))
setConfiguredConnectors(_ =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ let make = () => {
item.connector_type->ConnectorUtils.connectorTypeStringToTypeMapper === PayoutProcessor
)
connectorsList->Array.reverse
ConnectorUtils.sortByDisableField(connectorsList, connectorPayload => connectorPayload.disabled)
setFilteredConnectorData(_ => connectorsList->Array.map(Nullable.make))
setPreviouslyConnectedData(_ => connectorsList->Array.map(Nullable.make))
setConfiguredConnectors(_ =>
Expand Down
2 changes: 2 additions & 0 deletions src/screens/Connectors/TaxProcessor/TaxProcessorList.res
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ let make = () => {
item.connector_type->ConnectorUtils.connectorTypeStringToTypeMapper === TaxProcessor
)

ConnectorUtils.sortByDisableField(connectorsList, connectorPayload => connectorPayload.disabled)

setConfiguredConnectors(_ => connectorsList)
setFilteredConnectorData(_ => connectorsList->Array.map(Nullable.make))
setScreenState(_ => Success)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ let make = () => {
AuthenticationProcessor
)

ConnectorUtils.sortByDisableField(connectorsList, connectorPayload => connectorPayload.disabled)

setConfiguredConnectors(_ => connectorsList)
setFilteredConnectorData(_ => connectorsList->Array.map(Nullable.make))
setScreenState(_ => Success)
Expand Down

0 comments on commit c278fbd

Please sign in to comment.