Skip to content

Commit

Permalink
Merge branch 'main' into bugfix/sdk-refresh-issue-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
JeevaRamu0104 authored Dec 1, 2023
2 parents e3608c3 + 6ad919c commit 5f9107f
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 7 deletions.
4 changes: 1 addition & 3 deletions src/components/Paginator.res
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,10 @@ let make = (
setOffset(_ => newOffset)
}, (setOffset, resultsPerPage, currrentFetchCount, url.search, totalResults))

let borderClass = !isMobileView ? "border-b border-x border-jp-2-light-gray-300 rounded-b-lg" : ""
let marginClass = "mt-4 md:mr-0"

if totalResults >= resultsPerPage {
<div
className={`flex ${flexDirection} justify-between ${marginClass} ${paginationClass} ${borderClass}`}>
<div className={`flex ${flexDirection} justify-between ${marginClass} ${paginationClass} `}>
<div className={`flex flex-row w-full ${justify}`}>
<UIUtils.RenderIf condition={!isMobileView && showResultsPerPageSelector}>
<div
Expand Down
3 changes: 2 additions & 1 deletion src/screens/HyperSwitch/Routing/RoutingTypes.res
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ type operator =
| EQUAL_TO
| CONTAINS
| NOT_CONTAINS
| NOT_EQUAL_TO
| UnknownOperator(string)
type variantType = Number | Enum_variant | Metadata_value | UnknownVariant(string)
type variantType = Number | Enum_variant | Metadata_value | String_value | UnknownVariant(string)
type logicalOperator = AND | OR | UnknownLogicalOperator(string)
type val = StringArray(array<string>) | String(string) | Int(int)
type logic = {
Expand Down
6 changes: 6 additions & 0 deletions src/screens/HyperSwitch/Routing/RoutingUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ let operatorMapper = value => {
| "GREATER THAN" => GREATER_THAN
| "LESS THAN" => LESS_THAN
| "EQUAL TO" => EQUAL_TO
| "NOT EQUAL_TO" => NOT_EQUAL_TO
| _ => UnknownOperator("")
}
}
Expand All @@ -47,6 +48,7 @@ let variantTypeMapper = variantType => {
| "number" => Number
| "enum_variant" => Enum_variant
| "metadata_value" => Metadata_value
| "str_value" => String_value
| _ => UnknownVariant("")
}
}
Expand Down Expand Up @@ -99,6 +101,7 @@ let operatorTypeToStringMapper = operator => {
| GREATER_THAN => "GREATER THAN"
| LESS_THAN => "LESS THAN"
| EQUAL_TO => "EQUAL TO"
| NOT_EQUAL_TO => "NOT EQUAL_TO"
| UnknownOperator(str) => str
}
}
Expand Down Expand Up @@ -210,6 +213,7 @@ let advanceRoutingConditionMapper = (dict, wasm) => {
| EQUAL_TO => "equal"
| GREATER_THAN => "greater_than"
| LESS_THAN => "less_than"
| NOT_EQUAL_TO => "not_equal"
| UnknownOperator(str) => str
},
value: {
Expand All @@ -224,6 +228,7 @@ let advanceRoutingConditionMapper = (dict, wasm) => {
| _ => ""
}
| Metadata_value => "metadata_variant"
| String_value => "str_value"
| _ => ""
}->Js.Json.string,
"value": switch variantType->variantTypeMapper {
Expand All @@ -243,6 +248,7 @@ let advanceRoutingConditionMapper = (dict, wasm) => {
let value = dict->getString("value", "")->Js.String2.trim->Js.Json.string
Js.Dict.fromArray([("key", key), ("value", value)])->Js.Json.object_
}
| String_value => dict->getString("value", "")->Js.Json.string
| _ => ""->Js.Json.string
},
},
Expand Down
3 changes: 2 additions & 1 deletion src/screens/HyperSwitch/RoutingRevamp/AdvancedRouting.res
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,8 @@ let make = (~routingRuleId, ~isActive, ~setCurrentRouting) => {
| EQUAL_TO
| CONTAINS => "equal"
| IS_NOT
| NOT_CONTAINS => "not_equal"
| NOT_CONTAINS
| NOT_EQUAL_TO => "not_equal"
| GREATER_THAN => "greater_than"
| LESS_THAN => "less_than"
| UnknownOperator(str) => str
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type routing = SINGLE | PRIORITY | VOLUME_SPLIT | ADVANCED | COST | DEFAULTFALLBACK | NO_ROUTING
type variantType = Number | Enum_variant | Metadata_value | UnknownVariant(string)
type variantType = Number | Enum_variant | Metadata_value | String_value | UnknownVariant(string)
type pageState = Preview | Create | Edit
type formState = CreateConfig | EditConfig | EditReplica | ViewConfig

Expand All @@ -11,6 +11,7 @@ type operator =
| EQUAL_TO
| CONTAINS
| NOT_CONTAINS
| NOT_EQUAL_TO
| UnknownOperator(string)

type connector = {
Expand Down
12 changes: 11 additions & 1 deletion src/screens/HyperSwitch/RoutingRevamp/AdvancedRoutingUIUtils.res
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ module OperatorInp = {
| Enum_variant => ["IS", "CONTAINS", "IS_NOT", "NOT_CONTAINS"]
| Number => ["EQUAL TO", "GREATER THAN", "LESS THAN"]
| Metadata_value => ["EQUAL TO"]
| String_value => ["EQUAL TO", "NOT EQUAL_TO"]
| _ => []
}

Expand Down Expand Up @@ -128,6 +129,8 @@ module ValueInp = {
typeField.onChange(
if keyType->variantTypeMapper === Metadata_value {
"metadata_variant"
} else if keyType->variantTypeMapper === String_value {
"str_value"
} else {
switch opField.value->LogicUtils.getStringFromJson("")->operatorMapper {
| IS
Expand Down Expand Up @@ -174,8 +177,15 @@ module ValueInp = {
fixedDropDownDirection=SelectBox.TopRight
/>
}
| EQUAL_TO =>
switch keyType->variantTypeMapper {
| String_value => <TextInput input placeholder="Enter value" />
| _ => <NumericTextInput placeholder={"Enter value"} input />
}

| NOT_EQUAL_TO => <TextInput input placeholder="Enter value" />
| LESS_THAN | GREATER_THAN => <NumericTextInput placeholder={"Enter value"} input />

| EQUAL_TO | LESS_THAN | GREATER_THAN => <NumericTextInput placeholder={"Enter Value"} input />
| _ => React.null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ let operatorMapper: string => AdvancedRoutingTypes.operator = value => {
| "GREATER THAN" => GREATER_THAN
| "LESS THAN" => LESS_THAN
| "EQUAL TO" => EQUAL_TO
| "NOT EQUAL_TO" => NOT_EQUAL_TO
| _ => UnknownOperator("")
}
}
Expand Down Expand Up @@ -91,6 +92,7 @@ let variantTypeMapper: string => AdvancedRoutingTypes.variantType = variantType
| "number" => Number
| "enum_variant" => Enum_variant
| "metadata_value" => Metadata_value
| "str_value" => String_value
| _ => UnknownVariant("")
}
}
Expand Down Expand Up @@ -228,12 +230,14 @@ let getOperatorFromComparisonType = (comparison, variantType) => {
switch variantType {
| "enum_variant" => "IS"
| "enum_variant_array" => "CONTAINS"
| "str_value" => "EQUAL_TO"
| _ => "IS"
}
| "not_equal" =>
switch variantType {
| "enum_variant_array" => "NOT_CONTAINS"
| "enum_variant" => "IS_NOT"
| "str_value" => "NOT EQUAL_TO"
| _ => "IS_NOT"
}
| "greater_than" => "GREATER_THAN"
Expand Down

0 comments on commit 5f9107f

Please sign in to comment.