selectedRow->Belt.Option.isSome ? setSelectedRow(_ => None) : ()}
+ onDoubleClick={_ => selectedRow->Option.isSome ? setSelectedRow(_ => None) : ()}
onClick={_ =>
setSelectedRow(prev => {
switch prev {
@@ -837,7 +836,7 @@ module RenderMultiDimensionalChart = {
),
legendIndex: i.legendIndex,
name: i.name,
- color: i.color->Belt.Option.getWithDefault("#000000"),
+ color: i.color->Option.getWithDefault("#000000"),
})
)
->ignore
@@ -895,8 +894,8 @@ module LineChart2D = {
) => {
let (groupBy1, groupBy2) = switch groupBy {
| Some(value) => (
- value->Belt.Array.get(0)->Belt.Option.getWithDefault(""),
- value->Belt.Array.get(1)->Belt.Option.getWithDefault(""),
+ value->Belt.Array.get(0)->Option.getWithDefault(""),
+ value->Belt.Array.get(1)->Option.getWithDefault(""),
)
| None => ("", "")
}
@@ -940,9 +939,9 @@ module LineChart3D = {
) => {
let (groupBy1, groupBy2, groupby3) = switch groupBy {
| Some(value) => (
- value->Belt.Array.get(0)->Belt.Option.getWithDefault(""),
- value->Belt.Array.get(1)->Belt.Option.getWithDefault(""),
- value->Belt.Array.get(2)->Belt.Option.getWithDefault(""),
+ value->Belt.Array.get(0)->Option.getWithDefault(""),
+ value->Belt.Array.get(1)->Option.getWithDefault(""),
+ value->Belt.Array.get(2)->Option.getWithDefault(""),
)
| None => ("", "", "")
}
diff --git a/src/components/CustomCharts/LineChartUtils.res b/src/components/CustomCharts/LineChartUtils.res
index dc4e46d67..9d6d5d89d 100644
--- a/src/components/CustomCharts/LineChartUtils.res
+++ b/src/components/CustomCharts/LineChartUtils.res
@@ -111,9 +111,8 @@ let reduceOpacity = str => {
switch match {
| Some(val) => {
- let opacity =
- val->Belt.Array.get(1)->Belt.Option.flatMap(a => a)->Belt.Option.getWithDefault("0")
- let newOpacity = opacity->Belt.Float.fromString->Belt.Option.getWithDefault(0.0) /. 10.0
+ let opacity = val->Belt.Array.get(1)->Option.flatMap(a => a)->Option.getWithDefault("0")
+ let newOpacity = opacity->Belt.Float.fromString->Option.getWithDefault(0.0) /. 10.0
str->String.replace(opacity, newOpacity->Belt.Float.toString)
}
| None => "0"
@@ -131,7 +130,7 @@ let removeDuplicates = (arr: array>) => {
arr->Array.forEach(item => {
let value = item.name
- if uniqueItemsMap->Dict.get(value)->Belt.Option.isNone {
+ if uniqueItemsMap->Dict.get(value)->Option.isNone {
uniqueItemsMap->Dict.set(value, item)
}
})
@@ -283,7 +282,7 @@ let timeSeriesDataMaker = (
let groupByName =
dict->getString(
groupKey,
- Dict.get(dict, groupKey)->Belt.Option.getWithDefault(""->Js.Json.string)->Js.Json.stringify,
+ Dict.get(dict, groupKey)->Option.getWithDefault(""->Js.Json.string)->Js.Json.stringify,
)
let xAxisDataPoint = dict->getString(xAxis, "")->String.split(" ")->Array.joinWith("T") ++ "Z" // right now it is time string
let yAxisDataPoint = dict->getFloat(yAxis, 0.)
@@ -321,7 +320,7 @@ let timeSeriesDataMaker = (
let trafficValue =
value *.
100. /.
- groupedByTime->Dict.get(key->Belt.Float.toString)->Belt.Option.getWithDefault(1.)
+ groupedByTime->Dict.get(key->Belt.Float.toString)->Option.getWithDefault(1.)
(key, trafficValue, secondryMetrix)
})
->Js.Array2.sortInPlaceWith(chartDataSortBasedOnTime)
@@ -330,17 +329,17 @@ let timeSeriesDataMaker = (
let color = switch colors->Array.find(item => item.name == key) {
| Some(val) => val.color
| None =>
- legendColor[mod(index, legendColor->Array.length)]->Belt.Option.getWithDefault(defaultColor)
+ legendColor[mod(index, legendColor->Array.length)]->Option.getWithDefault(defaultColor)
}
let fillColor = switch legendColorGradients(topGradient, bottomGradient)->Array.find(item =>
- item.color->Belt.Option.getWithDefault("#000000") == color
+ item.color->Option.getWithDefault("#000000") == color
) {
| Some(val) => val
| None =>
legendColorGradients(topGradient, bottomGradient)[
mod(index, legendColor->Array.length)
- ]->Belt.Option.getWithDefault(defaultLegendColorGradients(topGradient, bottomGradient))
+ ]->Option.getWithDefault(defaultLegendColorGradients(topGradient, bottomGradient))
}
let value: timeSeriesDictWithSecondryMetrics = {
color: Some(color),
@@ -367,7 +366,7 @@ let getLegendDataForCurrentMetrix = (
getString(
dict,
activeTab,
- Dict.get(dict, activeTab)->Belt.Option.getWithDefault(""->Js.Json.string)->Js.Json.stringify,
+ Dict.get(dict, activeTab)->Option.getWithDefault(""->Js.Json.string)->Js.Json.stringify,
)
})
timeSeriesData->Belt.Array.forEach(item => {
@@ -377,9 +376,7 @@ let getLegendDataForCurrentMetrix = (
getString(
dict,
activeTab,
- Dict.get(dict, activeTab)
- ->Belt.Option.getWithDefault(""->Js.Json.string)
- ->Js.Json.stringify,
+ Dict.get(dict, activeTab)->Option.getWithDefault(""->Js.Json.string)->Js.Json.stringify,
),
time_overall_statsAtTime,
)
@@ -397,7 +394,7 @@ let getLegendDataForCurrentMetrix = (
->Array.map(item => {
let (_, value) = item
let (_, currentVal) =
- value->Belt.Array.get(value->Array.length - 1)->Belt.Option.getWithDefault(("", 0.))
+ value->Belt.Array.get(value->Array.length - 1)->Option.getWithDefault(("", 0.))
currentVal
})
->AnalyticsUtils.sumOfArrFloat
@@ -409,7 +406,7 @@ let getLegendDataForCurrentMetrix = (
let sortedValueBasedOnTime = value->Js.Array2.sortInPlaceWith(sortBasedOnTimeLegend)
let arrLen = sortedValueBasedOnTime->Array.length
let (_, currentVal) =
- sortedValueBasedOnTime->Belt.Array.get(arrLen - 1)->Belt.Option.getWithDefault(("", 1.0))
+ sortedValueBasedOnTime->Belt.Array.get(arrLen - 1)->Option.getWithDefault(("", 1.0))
let overall =
sortedValueBasedOnTime
@@ -447,18 +444,18 @@ let getLegendDataForCurrentMetrix = (
let (metricsName, value) = item
let sortedValueBasedOnTime = value->Js.Array2.sortInPlaceWith(sortBasedOnTimeLegend)
let arrLen = sortedValueBasedOnTime->Array.length
- let (_, currentVal) = sortedValueBasedOnTime[arrLen - 1]->Belt.Option.getWithDefault(("", 0.))
+ let (_, currentVal) = sortedValueBasedOnTime[arrLen - 1]->Option.getWithDefault(("", 0.))
// the avg stat won't work correct for Sr case have to find another way or avoid using the avg for Sr
let overall = if metrixType === Traffic {
- (currentOverall->Dict.get(metricsName)->Belt.Option.getWithDefault(0.) *.
+ (currentOverall->Dict.get(metricsName)->Option.getWithDefault(0.) *.
100. /.
Js.Math.max_float(totalOverall, 1.))
->Js.Float.toFixedWithPrecision(~digits=2)
->removeTrailingZero
->Belt.Float.fromString
- ->Belt.Option.getWithDefault(0.)
+ ->Option.getWithDefault(0.)
} else {
- currentOverall->Dict.get(metricsName)->Belt.Option.getWithDefault(0.)
+ currentOverall->Dict.get(metricsName)->Option.getWithDefault(0.)
}
let currentVal = if metrixType === Traffic {
currentVal *. 100. /. currentValueOverallSum
@@ -491,7 +488,7 @@ let barChartDataMaker = (~yAxis: string, ~rawData: array, ~activeTab:
let selectedSegmentVal = getString(
dict,
activeTab,
- Dict.get(dict, activeTab)->Belt.Option.getWithDefault(""->Js.Json.string)->Js.Json.stringify,
+ Dict.get(dict, activeTab)->Option.getWithDefault(""->Js.Json.string)->Js.Json.stringify,
) // groupby/ selected segment
let stats = getFloat(dict, yAxis, 0.) // overall metrics
@@ -593,7 +590,7 @@ let getTooltipHTML = (metrics, data, onCursorName) => {
| Some(secondryMetrics) =>
`${formatStatsAccToMetrix(
secondryMetrics.metric_type,
- secondry_metrix->Belt.Option.getWithDefault(0.),
+ secondry_metrix->Option.getWithDefault(0.),
)}`
| None => ""
}
@@ -619,10 +616,10 @@ let tooltipFormatter = (
let dataArr = if ["run_date", "run_month", "run_week"]->Array.includes(groupKey) {
let x = points->getString("name", "")
- xAxisMapInfo->Dict.get(x)->Belt.Option.getWithDefault([])
+ xAxisMapInfo->Dict.get(x)->Option.getWithDefault([])
} else {
let x = points->getFloat("x", 0.)
- xAxisMapInfo->Dict.get(x->Js.Float.toString)->Belt.Option.getWithDefault([])
+ xAxisMapInfo->Dict.get(x->Js.Float.toString)->Option.getWithDefault([])
}
let onCursorName = series->getString("name", "")
diff --git a/src/components/CustomExpandableTable.res b/src/components/CustomExpandableTable.res
index 6854aa1e6..67e1b39fa 100644
--- a/src/components/CustomExpandableTable.res
+++ b/src/components/CustomExpandableTable.res
@@ -23,7 +23,7 @@ let make = (
let isMobileView = MatchMedia.useMobileChecker()
- let filterPresent = heading->Array.find(head => head.showFilter)->Js.Option.isSome
+ let filterPresent = heading->Array.find(head => head.showFilter)->Option.isSome
let highlightEnabledFieldsArray = heading->Array.reduceWithIndex([], (acc, item, index) => {
if item.highlightCellOnHover {
let _ = Array.push(acc, index)
@@ -147,13 +147,13 @@ let make = (
{if item.showFilter {
let (options, selected) =
filterObj
- ->Belt.Option.flatMap(obj =>
+ ->Option.flatMap(obj =>
switch obj[i] {
| Some(ele) => (ele.options, ele.selected)
| None => ([], [])
}->Some
)
- ->Belt.Option.getWithDefault(([], []))
+ ->Option.getWithDefault(([], []))
if options->Array.length > 1 {
let filterInput: ReactFinalForm.fieldRenderPropsInput = {
diff --git a/src/components/DatePicker.res b/src/components/DatePicker.res
index 46d360840..2e909cc0a 100644
--- a/src/components/DatePicker.res
+++ b/src/components/DatePicker.res
@@ -32,9 +32,9 @@ let make = (
let (date, setDate) = React.useState(_ => {
if selectedDate !== "" {
let date = String.split(selectedDate, "-")
- let dateDay = date->Belt.Array.get(2)->Belt.Option.getWithDefault("1")
- let dateMonth = date->Belt.Array.get(1)->Belt.Option.getWithDefault("1")
- let dateYear = date->Belt.Array.get(0)->Belt.Option.getWithDefault("1970")
+ let dateDay = date->Belt.Array.get(2)->Option.getWithDefault("1")
+ let dateMonth = date->Belt.Array.get(1)->Option.getWithDefault("1")
+ let dateYear = date->Belt.Array.get(0)->Option.getWithDefault("1970")
let timeSplit =
switch input.value->Js.Json.decodeString {
@@ -44,11 +44,9 @@ let make = (
->DateRangePicker.getTimeStringForValue(isoStringToCustomTimeZone)
->String.split(":")
- let timeHour = timeSplit->Belt.Array.get(0)->Belt.Option.getWithDefault(currentDateHourFormat)
- let timeMinute =
- timeSplit->Belt.Array.get(1)->Belt.Option.getWithDefault(currentDateMinuteFormat)
- let timeSecond =
- timeSplit->Belt.Array.get(2)->Belt.Option.getWithDefault(currentDateSecondsFormat)
+ let timeHour = timeSplit->Belt.Array.get(0)->Option.getWithDefault(currentDateHourFormat)
+ let timeMinute = timeSplit->Belt.Array.get(1)->Option.getWithDefault(currentDateMinuteFormat)
+ let timeSecond = timeSplit->Belt.Array.get(2)->Option.getWithDefault(currentDateSecondsFormat)
let dateTimeCheck = customTimezoneToISOString(
dateYear,
dateMonth,
@@ -76,9 +74,9 @@ let make = (
setSelectedDate(_ => str)
let currentDateSplit = String.split(str, "-")
- let currentDateDay = currentDateSplit->Belt.Array.get(2)->Belt.Option.getWithDefault("1")
- let currentDateYear = currentDateSplit->Belt.Array.get(0)->Belt.Option.getWithDefault("1970")
- let currentDateMonth = currentDateSplit->Belt.Array.get(1)->Belt.Option.getWithDefault("1")
+ let currentDateDay = currentDateSplit->Belt.Array.get(2)->Option.getWithDefault("1")
+ let currentDateYear = currentDateSplit->Belt.Array.get(0)->Option.getWithDefault("1970")
+ let currentDateMonth = currentDateSplit->Belt.Array.get(1)->Option.getWithDefault("1")
let currentDateTimeCheck = customTimezoneToISOString(
currentDateYear,
@@ -132,12 +130,10 @@ let make = (
? `${currentDateHourFormat}:${currentDateMinuteFormat}${showSeconds
? ":" ++ currentDateSecondsFormat
: ""}`
- : splitTime->Belt.Array.get(0)->Belt.Option.getWithDefault("NA") ++
+ : splitTime->Belt.Array.get(0)->Option.getWithDefault("NA") ++
":" ++
- splitTime->Belt.Array.get(1)->Belt.Option.getWithDefault("NA") ++ (
- showSeconds
- ? ":" ++ splitTime->Belt.Array.get(2)->Belt.Option.getWithDefault("NA")
- : ""
+ splitTime->Belt.Array.get(1)->Option.getWithDefault("NA") ++ (
+ showSeconds ? ":" ++ splitTime->Belt.Array.get(2)->Option.getWithDefault("NA") : ""
)}`
}
startDateStr
@@ -158,7 +154,7 @@ let make = (
| Some(icon) => icon
| None => FontAwesome("calendar")
}
- let fullLengthWidthClass = fullLength->Belt.Option.getWithDefault(false) ? "2xl:w-full" : ""
+ let fullLengthWidthClass = fullLength->Option.getWithDefault(false) ? "2xl:w-full" : ""
let startTimeInput: ReactFinalForm.fieldRenderPropsInput = {
name: "string",
@@ -175,16 +171,15 @@ let make = (
timeVal
}
let date = String.split(selectedDate, "-")
- let dateDay = date->Belt.Array.get(2)->Belt.Option.getWithDefault("1")
- let dateMonth = date->Belt.Array.get(1)->Belt.Option.getWithDefault("1")
- let dateYear = date->Belt.Array.get(0)->Belt.Option.getWithDefault("1970")
+ let dateDay = date->Belt.Array.get(2)->Option.getWithDefault("1")
+ let dateMonth = date->Belt.Array.get(1)->Option.getWithDefault("1")
+ let dateYear = date->Belt.Array.get(0)->Option.getWithDefault("1970")
let timeSplit = String.split(timeVal, ":")
- let timeHour =
- timeSplit->Belt.Array.get(0)->Belt.Option.getWithDefault(currentDateHourFormat)
+ let timeHour = timeSplit->Belt.Array.get(0)->Option.getWithDefault(currentDateHourFormat)
let timeMinute =
- timeSplit->Belt.Array.get(1)->Belt.Option.getWithDefault(currentDateMinuteFormat)
+ timeSplit->Belt.Array.get(1)->Option.getWithDefault(currentDateMinuteFormat)
let timeSecond =
- timeSplit->Belt.Array.get(2)->Belt.Option.getWithDefault(currentDateSecondsFormat)
+ timeSplit->Belt.Array.get(2)->Option.getWithDefault(currentDateSecondsFormat)
let dateTimeCheck = customTimezoneToISOString(
dateYear,
dateMonth,
diff --git a/src/components/DateRangePicker.res b/src/components/DateRangePicker.res
index f425b7fa0..290bb0a08 100644
--- a/src/components/DateRangePicker.res
+++ b/src/components/DateRangePicker.res
@@ -64,11 +64,11 @@ let getFormattedDate = (date, format) => {
let isStartBeforeEndDate = (start, end) => {
let getDate = date => {
let datevalue = Js.Date.makeWithYMD(
- ~year=Js.Float.fromString(date[0]->Belt.Option.getWithDefault("")),
+ ~year=Js.Float.fromString(date[0]->Option.getWithDefault("")),
~month=Js.Float.fromString(
- String.make(Js.Float.fromString(date[1]->Belt.Option.getWithDefault("")) -. 1.0),
+ String.make(Js.Float.fromString(date[1]->Option.getWithDefault("")) -. 1.0),
),
- ~date=Js.Float.fromString(date[2]->Belt.Option.getWithDefault("")),
+ ~date=Js.Float.fromString(date[2]->Option.getWithDefault("")),
(),
)
datevalue
@@ -291,9 +291,9 @@ module Base = {
setEndDateVal(_ => "")
} else {
let endDateSplit = String.split(ele, "-")
- let endDateDate = endDateSplit[2]->Belt.Option.getWithDefault("")
- let endDateYear = endDateSplit[0]->Belt.Option.getWithDefault("")
- let endDateMonth = endDateSplit[1]->Belt.Option.getWithDefault("")
+ let endDateDate = endDateSplit[2]->Option.getWithDefault("")
+ let endDateYear = endDateSplit[0]->Option.getWithDefault("")
+ let endDateMonth = endDateSplit[1]->Option.getWithDefault("")
let splitTime = switch time {
| Some(val) => val
| None =>
@@ -305,9 +305,9 @@ module Base = {
}
let timeSplit = String.split(splitTime, ":")
- let timeHour = timeSplit->Belt.Array.get(0)->Belt.Option.getWithDefault("00")
- let timeMinute = timeSplit->Belt.Array.get(1)->Belt.Option.getWithDefault("00")
- let timeSecond = timeSplit->Belt.Array.get(2)->Belt.Option.getWithDefault("00")
+ let timeHour = timeSplit->Belt.Array.get(0)->Option.getWithDefault("00")
+ let timeMinute = timeSplit->Belt.Array.get(1)->Option.getWithDefault("00")
+ let timeSecond = timeSplit->Belt.Array.get(2)->Option.getWithDefault("00")
let endDateTimeCheck = customTimezoneToISOString(
endDateYear,
endDateMonth,
@@ -322,9 +322,9 @@ module Base = {
let changeStartDate = (ele, isFromCustomInput, time) => {
let setDate = str => {
let startDateSplit = String.split(str, "-")
- let startDateDay = startDateSplit[2]->Belt.Option.getWithDefault("")
- let startDateYear = startDateSplit[0]->Belt.Option.getWithDefault("")
- let startDateMonth = startDateSplit[1]->Belt.Option.getWithDefault("")
+ let startDateDay = startDateSplit[2]->Option.getWithDefault("")
+ let startDateYear = startDateSplit[0]->Option.getWithDefault("")
+ let startDateMonth = startDateSplit[1]->Option.getWithDefault("")
let splitTime = switch time {
| Some(val) => val
| None =>
@@ -335,9 +335,9 @@ module Base = {
}
}
let timeSplit = String.split(splitTime, ":")
- let timeHour = timeSplit->Belt.Array.get(0)->Belt.Option.getWithDefault("00")
- let timeMinute = timeSplit->Belt.Array.get(1)->Belt.Option.getWithDefault("00")
- let timeSecond = timeSplit->Belt.Array.get(2)->Belt.Option.getWithDefault("00")
+ let timeHour = timeSplit->Belt.Array.get(0)->Option.getWithDefault("00")
+ let timeMinute = timeSplit->Belt.Array.get(1)->Option.getWithDefault("00")
+ let timeSecond = timeSplit->Belt.Array.get(2)->Option.getWithDefault("00")
let startDateTimeCheck = customTimezoneToISOString(
startDateYear,
startDateMonth,
@@ -507,17 +507,17 @@ module Base = {
let endTimeStr = {
let timeArr = endTimeStr->String.split(":")
- let endTimeTxt = `${timeArr[0]->Belt.Option.getWithDefault(
+ let endTimeTxt = `${timeArr[0]->Option.getWithDefault(
"00",
- )}:${timeArr[1]->Belt.Option.getWithDefault("00")}`
- showSeconds ? `${endTimeTxt}:${timeArr[2]->Belt.Option.getWithDefault("00")}` : endTimeTxt
+ )}:${timeArr[1]->Option.getWithDefault("00")}`
+ showSeconds ? `${endTimeTxt}:${timeArr[2]->Option.getWithDefault("00")}` : endTimeTxt
}
let startTimeStr = {
let timeArr = startTimeStr->String.split(":")
- let startTimeTxt = `${timeArr[0]->Belt.Option.getWithDefault(
+ let startTimeTxt = `${timeArr[0]->Option.getWithDefault(
"00",
- )}:${timeArr[1]->Belt.Option.getWithDefault("00")}`
- showSeconds ? `${startTimeTxt}:${timeArr[2]->Belt.Option.getWithDefault("00")}` : startTimeTxt
+ )}:${timeArr[1]->Option.getWithDefault("00")}`
+ showSeconds ? `${startTimeTxt}:${timeArr[2]->Option.getWithDefault("00")}` : startTimeTxt
}
let buttonText = {
@@ -615,7 +615,7 @@ module Base = {
None
}, (startDate, endDate, localStartDate, localEndDate))
- let btnStyle = customButtonStyle->Belt.Option.getWithDefault("")
+ let btnStyle = customButtonStyle->Option.getWithDefault("")
let customStyleForBtn = btnStyle->String.length > 0 ? btnStyle : ""
@@ -791,7 +791,7 @@ module Base = {
} else if showMsg {
let msg = `Date Range should not exceed ${dateRangeLimit
- ->Belt.Option.getWithDefault(0)
+ ->Option.getWithDefault(0)
->Belt.Int.toString} days`
@@ -867,7 +867,7 @@ module Base = {
let useStateForInput = (input: ReactFinalForm.fieldRenderPropsInput) => {
React.useMemo1(() => {
- let val = input.value->Js.Json.decodeString->Belt.Option.getWithDefault("")
+ let val = input.value->Js.Json.decodeString->Option.getWithDefault("")
let onChange = fn => {
let newVal = fn(val)
input.onChange(newVal->Identity.stringToFormReactEvent)
diff --git a/src/components/DynamicChart.res b/src/components/DynamicChart.res
index bf646e583..160ec2e3d 100644
--- a/src/components/DynamicChart.res
+++ b/src/components/DynamicChart.res
@@ -39,7 +39,7 @@ let getTimeSeriesChart = (chartEntity: chartEntity) => {
~endDateTime=chartEntity.end_time,
~cardinality=chartEntity.cardinality,
~mode=chartEntity.mode,
- ~customFilter=chartEntity.customFilter->Belt.Option.getWithDefault(""),
+ ~customFilter=chartEntity.customFilter->Option.getWithDefault(""),
~prefix=chartEntity.prefix,
~source=chartEntity.source,
(),
@@ -63,7 +63,7 @@ let getLegendBody = (chartEntity: chartEntity) => {
~endDateTime=chartEntity.end_time,
~cardinality=chartEntity.cardinality,
~mode=chartEntity.mode,
- ~customFilter=chartEntity.customFilter->Belt.Option.getWithDefault(""),
+ ~customFilter=chartEntity.customFilter->Option.getWithDefault(""),
~prefix=chartEntity.prefix,
~source=chartEntity.source,
(),
@@ -329,8 +329,8 @@ let make = (
->Belt.Array.keepMap(item => {
let (key, value) = item
let keyArr = key->String.split(".")
- let prefix = keyArr->Belt.Array.get(0)->Belt.Option.getWithDefault("")
- let fitlerName = keyArr->Belt.Array.get(1)->Belt.Option.getWithDefault("")
+ let prefix = keyArr->Belt.Array.get(0)->Option.getWithDefault("")
+ let fitlerName = keyArr->Belt.Array.get(1)->Option.getWithDefault("")
// when chart id is not there then there won't be any prefix so the prefix will the filter name
if chartId === "" {
@@ -351,7 +351,7 @@ let make = (
->Belt.Array.keepMap(item => {
let (key, value) = item
let keyArr = key->String.split(".")
- let prefix = keyArr->Belt.Array.get(0)->Belt.Option.getWithDefault("")
+ let prefix = keyArr->Belt.Array.get(0)->Option.getWithDefault("")
if prefix === chartId && prefix !== "" {
None
@@ -369,7 +369,7 @@ let make = (
let {allFilterDimension, dateFilterKeys, currentMetrics, uriConfig, source} = entity
- let enableLoaders = entity.enableLoaders->Belt.Option.getWithDefault(true)
+ let enableLoaders = entity.enableLoaders->Option.getWithDefault(true)
let entityAllMetrics = uriConfig->Array.reduce([], (acc, item) =>
Array.concat(
@@ -387,7 +387,7 @@ let make = (
let chartType =
getChartCompFilters->LogicUtils.getString(
"chartType",
- entity.chartTypes->Belt.Array.get(0)->Belt.Option.getWithDefault(Line)->chartMapper,
+ entity.chartTypes->Belt.Array.get(0)->Option.getWithDefault(Line)->chartMapper,
)
let chartTopMetric =
getChartCompFilters->LogicUtils.getString("chartTopMetric", currentTopMatrix)
@@ -403,10 +403,7 @@ let make = (
} else if cardinalityArr->Array.includes("TOP_5") {
dict->Dict.set("cardinality", "TOP_5")
} else {
- dict->Dict.set(
- "cardinality",
- cardinalityArr->Belt.Array.get(0)->Belt.Option.getWithDefault(""),
- )
+ dict->Dict.set("cardinality", cardinalityArr->Belt.Array.get(0)->Option.getWithDefault(""))
}
chartTypeArr->Array.includes(chartType)
? dict->Dict.set("chartType", chartType)
@@ -417,10 +414,7 @@ let make = (
} else if chartMatrixArr->Array.includes(currentTopMatrix) {
dict->Dict.set("chartTopMetric", currentTopMatrix)
} else {
- dict->Dict.set(
- "chartTopMetric",
- chartMatrixArr->Belt.Array.get(0)->Belt.Option.getWithDefault(""),
- )
+ dict->Dict.set("chartTopMetric", chartMatrixArr->Belt.Array.get(0)->Option.getWithDefault(""))
}
if chartMatrixArr->Array.includes(chartBottomMetric) {
@@ -430,7 +424,7 @@ let make = (
} else {
dict->Dict.set(
"chartBottomMetric",
- chartMatrixArr->Belt.Array.get(0)->Belt.Option.getWithDefault(""),
+ chartMatrixArr->Belt.Array.get(0)->Option.getWithDefault(""),
)
}
@@ -547,13 +541,13 @@ let make = (
React.useEffect2(() => {
setGranularity(prev => {
- current_granularity->Array.includes(prev->Belt.Option.getWithDefault(""))
+ current_granularity->Array.includes(prev->Option.getWithDefault(""))
? prev
: current_granularity->Belt.Array.get(0)
})
None
}, (startTimeFromUrl, endTimeFromUrl))
- let selectedTabStr = selectedTab->Belt.Option.getWithDefault([])->Array.joinWith("")
+ let selectedTabStr = selectedTab->Option.getWithDefault([])->Array.joinWith("")
let updatedChartConfigArr = React.useMemo7(() => {
uriConfig->Array.map(item => {
@@ -570,10 +564,7 @@ let make = (
)
->Dict.fromArray
let activeTab =
- selectedTab
- ->Belt.Option.getWithDefault([])
- ->Belt.Array.get(0)
- ->Belt.Option.getWithDefault("")
+ selectedTab->Option.getWithDefault([])->Belt.Array.get(0)->Option.getWithDefault("")
let granularity = if activeTab === "run_date" {
"G_ONEHOUR"->Some
} else if activeTab === "run_week" {
@@ -623,7 +614,7 @@ let make = (
url: item.uri,
body: item.timeSeriesBody(chartconfig),
legendBody: ?(
- chartconfig.groupByNames->Belt.Option.getWithDefault([])->Array.length === 1
+ chartconfig.groupByNames->Option.getWithDefault([])->Array.length === 1
? legendBody
: None
),
@@ -642,12 +633,12 @@ let make = (
let (groupKeyFromTab, titleKey) = React.useMemo1(() => {
switch (tabTitleMapper, selectedTab) {
| (Some(dict), Some(arr)) => {
- let groupKey = arr->Belt.Array.get(0)->Belt.Option.getWithDefault("")
- (groupKey, dict->Dict.get(groupKey)->Belt.Option.getWithDefault(groupKey))
+ let groupKey = arr->Belt.Array.get(0)->Option.getWithDefault("")
+ (groupKey, dict->Dict.get(groupKey)->Option.getWithDefault(groupKey))
}
| (None, Some(arr)) => (
- arr->Belt.Array.get(0)->Belt.Option.getWithDefault(""),
- arr->Belt.Array.get(0)->Belt.Option.getWithDefault(""),
+ arr->Belt.Array.get(0)->Option.getWithDefault(""),
+ arr->Belt.Array.get(0)->Option.getWithDefault(""),
)
| _ => ("", "")
}
@@ -656,7 +647,7 @@ let make = (
let setRawChartData = (data: array) => {
let chartData = data->Array.map(mappedData => {
let rawdata = mappedData.rawData->Array.map(item => {
- let dict = item->Js.Json.decodeObject->Belt.Option.getWithDefault(Dict.make())
+ let dict = item->Js.Json.decodeObject->Option.getWithDefault(Dict.make())
switch dict->Dict.get("time_range") {
| Some(jsonObj) => {
@@ -664,7 +655,7 @@ let make = (
switch timeDict->Dict.get("startTime") {
| Some(startValue) => {
- let sTime = startValue->Js.Json.decodeString->Belt.Option.getWithDefault("")
+ let sTime = startValue->Js.Json.decodeString->Option.getWithDefault("")
if sTime->String.length > 0 {
let {date, hour, minute, month, second, year} =
@@ -683,14 +674,14 @@ let make = (
}
selectedTab
- ->Belt.Option.getWithDefault([])
+ ->Option.getWithDefault([])
->Array.forEach(
tabName => {
let metric =
Dict.get(dict, tabName)
- ->Belt.Option.getWithDefault(""->Js.Json.string)
+ ->Option.getWithDefault(""->Js.Json.string)
->Js.Json.decodeString
- ->Belt.Option.getWithDefault("")
+ ->Option.getWithDefault("")
let label = metric == "" ? "other" : metric
Dict.set(dict, tabName, label->Js.Json.string)
@@ -700,9 +691,9 @@ let make = (
if key->String.includes("amount") {
let amount =
Dict.get(dict, key)
- ->Belt.Option.getWithDefault(Js.Json.number(0.0))
+ ->Option.getWithDefault(Js.Json.number(0.0))
->Js.Json.decodeNumber
- ->Belt.Option.getWithDefault(0.0)
+ ->Option.getWithDefault(0.0)
let amount = (amount /. 100.0)->Js.Float.toFixedWithPrecision(~digits=2)
@@ -751,13 +742,13 @@ let make = (
let chartType =
getChartCompFilters->LogicUtils.getString(
"chartType",
- entity.chartTypes->Belt.Array.get(0)->Belt.Option.getWithDefault(Line)->chartMapper,
+ entity.chartTypes->Belt.Array.get(0)->Option.getWithDefault(Line)->chartMapper,
)
if (
startTimeFromUrl !== "" &&
endTimeFilterKey !== "" &&
- (granularity->Belt.Option.isSome || chartType !== "Line Chart") &&
- current_granularity->Array.includes(granularity->Belt.Option.getWithDefault(""))
+ (granularity->Option.isSome || chartType !== "Line Chart") &&
+ current_granularity->Array.includes(granularity->Option.getWithDefault(""))
) {
setChartLoading(_ => enableLoaders)
fetchChartData(updatedChartBody, setRawChartData)
@@ -886,7 +877,7 @@ let make = (
let (data, legendData, timeCol) = switch metricsUri {
| Some(val) =>
switch rawChartData
- ->Belt.Option.getWithDefault([])
+ ->Option.getWithDefault([])
->Array.find(item => item.metricsUrl === val.uri) {
| Some(dataVal) => (dataVal.rawData, dataVal.legendData, val.timeCol)
| None => ([], [], "")
@@ -982,7 +973,7 @@ let make = (
let (data, legendData, timeCol) = switch metricsUri {
| Some(val) =>
switch rawChartData
- ->Belt.Option.getWithDefault([])
+ ->Option.getWithDefault([])
->Array.find(item => item.metricsUrl === val.uri) {
| Some(dataVal) => (dataVal.rawData, dataVal.legendData, val.timeCol)
| None => ([], [], "")
diff --git a/src/components/DynamicFilter.res b/src/components/DynamicFilter.res
index c27dda177..f0a004eb6 100644
--- a/src/components/DynamicFilter.res
+++ b/src/components/DynamicFilter.res
@@ -51,7 +51,7 @@ module CustomFilters = {
->String.replaceRegExp(%re("/ LIKE /gi"), "@@")
->String.split("@@")
- let firstEle = Belt.Array.get(mArr, 0)->Belt.Option.getWithDefault("")
+ let firstEle = Belt.Array.get(mArr, 0)->Option.getWithDefault("")
if (
firstEle != "" && tabNames->Array.indexOf(firstEle->String.trim->String.toLowerCase) < 0
) {
@@ -164,15 +164,14 @@ let make = (
~hideFiltersDefaultValue=?,
~refreshFilters=true,
) => {
- let localFilters = initialFilters->Array.filter(item => item.localFilter->Js.Option.isSome)
- let remoteOptions = options->Array.filter(item => item.localFilter->Js.Option.isNone)
+ let localFilters = initialFilters->Array.filter(item => item.localFilter->Option.isSome)
+ let remoteOptions = options->Array.filter(item => item.localFilter->Option.isNone)
let defaultFilters = ""->Js.Json.string
let (showModal, setShowModal) = React.useState(_ => false)
let {updateExistingKeys, filterValue, removeKeys} = React.useContext(FilterContext.filterContext)
- let currentCustomFilterValue =
- filterValue->Dict.get(customFilterKey)->Belt.Option.getWithDefault("")
+ let currentCustomFilterValue = filterValue->Dict.get(customFilterKey)->Option.getWithDefault("")
let setCustomFilter = customFilter => {
updateExistingKeys(Dict.fromArray([(customFilterKey, customFilter)]))
diff --git a/src/components/DynamicSingleStat.res b/src/components/DynamicSingleStat.res
index a585c2159..22a562b9a 100644
--- a/src/components/DynamicSingleStat.res
+++ b/src/components/DynamicSingleStat.res
@@ -100,7 +100,7 @@ let deltaTimeRangeMapper: array => deltaRange = (arrJson: arrayDict.get("currentSr")
- ->Belt.Option.getWithDefault({
+ ->Option.getWithDefault({
fromTime: "",
toTime: "",
}),
@@ -139,7 +139,7 @@ let make = (
->Belt.Array.keepMap(item => {
let (key, value) = item
let keyArr = key->String.split(".")
- let prefix = keyArr->Belt.Array.get(0)->Belt.Option.getWithDefault("")
+ let prefix = keyArr->Belt.Array.get(0)->Option.getWithDefault("")
if prefix === moduleName && prefix !== "" {
None
} else {
@@ -159,14 +159,14 @@ let make = (
| _ => "BATCH"
}
- let enableLoaders = entity.enableLoaders->Belt.Option.getWithDefault(true)
+ let enableLoaders = entity.enableLoaders->Option.getWithDefault(true)
let customFilterKey = switch entity {
| {customFilterKey} => customFilterKey
| _ => ""
}
let allFilterKeys = Array.concat(
- [startTimeFilterKey, endTimeFilterKey, mode->Belt.Option.getWithDefault("")],
+ [startTimeFilterKey, endTimeFilterKey, mode->Option.getWithDefault("")],
filterKeys,
)
@@ -222,7 +222,7 @@ let make = (
let homePageCss = isHomePage || chartAlignment === #row ? "flex-col" : "flex-row"
let wrapperClass =
- wrapperClass->Belt.Option.getWithDefault(
+ wrapperClass->Option.getWithDefault(
`flex mt-5 flex-col md:${homePageCss} flex-wrap justify-start items-stretch relative`,
)
@@ -263,7 +263,7 @@ let make = (
entity.urlConfig
->Array.map(urlConfig => {
let {uri, metrics} = urlConfig
- let domain = String.split("/", uri)->Belt.Array.get(4)->Belt.Option.getWithDefault("")
+ let domain = String.split("/", uri)->Belt.Array.get(4)->Option.getWithDefault("")
let startTime = if domain === "mandate" {
(endTimeFromUrl->DayJs.getDayJsForString).subtract(.
1,
@@ -285,7 +285,7 @@ let make = (
prefix: ?urlConfig.prefix,
}
let singleStatBodyMakerFn =
- urlConfig.singleStatBody->Belt.Option.getWithDefault(singleStatBodyMake)
+ urlConfig.singleStatBody->Option.getWithDefault(singleStatBodyMake)
let singleStatBody = singleStatBodyMakerFn(singleStatBodyEntity)
fetchApi(
@@ -296,7 +296,7 @@ let make = (
(),
)
->addLogsAroundFetch(~logTitle="SingleStat Data Api")
- ->then(json => resolve((`${urlConfig.prefix->Belt.Option.getWithDefault("")}${uri}`, json)))
+ ->then(json => resolve((`${urlConfig.prefix->Option.getWithDefault("")}${uri}`, json)))
->catch(_err => resolve(("", Js.Json.object_(Dict.make()))))
})
->Promise.all
@@ -312,7 +312,7 @@ let make = (
->LogicUtils.getJsonObjectFromDict("queryData")
->LogicUtils.getArrayFromJson([])
->Belt.Array.get(0)
- ->Belt.Option.getWithDefault(Js.Json.object_(Dict.make()))
+ ->Option.getWithDefault(Js.Json.object_(Dict.make()))
->LogicUtils.getDictFromJsonObject
->Dict.toArray
->Array.find(
@@ -325,11 +325,7 @@ let make = (
| Some(data) => {
let (_key, value) = data
setTotalVolume(
- _ =>
- value
- ->Js.Json.decodeNumber
- ->Belt.Option.getWithDefault(0.)
- ->Belt.Float.toInt,
+ _ => value->Js.Json.decodeNumber->Option.getWithDefault(0.)->Belt.Float.toInt,
)
}
@@ -367,7 +363,7 @@ let make = (
entity.urlConfig
->Array.map(urlConfig => {
let {uri, metrics} = urlConfig
- let domain = String.split("/", uri)->Belt.Array.get(4)->Belt.Option.getWithDefault("")
+ let domain = String.split("/", uri)->Belt.Array.get(4)->Option.getWithDefault("")
let startTime = if domain === "mandate" {
(endTimeFromUrl->DayJs.getDayJsForString).subtract(.
1,
@@ -391,7 +387,7 @@ let make = (
prefix: ?urlConfig.prefix,
}
let singleStatBodyMakerFn =
- urlConfig.singleStatTimeSeriesBody->Belt.Option.getWithDefault(singleStatBodyMake)
+ urlConfig.singleStatTimeSeriesBody->Option.getWithDefault(singleStatBodyMake)
fetchApi(
uri,
~method_=Post,
@@ -402,7 +398,7 @@ let make = (
->addLogsAroundFetch(~logTitle="SingleStatTimeseries Data Api")
->then(
json => {
- resolve((`${urlConfig.prefix->Belt.Option.getWithDefault("")}${uri}`, json))
+ resolve((`${urlConfig.prefix->Option.getWithDefault("")}${uri}`, json))
},
)
->catch(
@@ -437,7 +433,7 @@ let make = (
let uri = col->entity.matrixUriMapper
let timeSeriesData =
singlestatDataCombined.singleStatTimeData
- ->Belt.Option.getWithDefault([("--", [])])
+ ->Option.getWithDefault([("--", [])])
->Belt.Array.keepMap(
item => {
let (timeSectionName, timeSeriesObj) = item
@@ -463,7 +459,7 @@ let make = (
timeSeriesData,
data.deltaTime,
col,
- mode->Belt.Option.getWithDefault("ORDER"),
+ mode->Option.getWithDefault("ORDER"),
)
Belt.Option.getWithDefault(false)
+ prefixAddition->Option.getWithDefault(false)
? title->String.replaceRegExp(_, %re("/ /g"), "-")->String.toLowerCase->Some
: None
let (defaultFilters, setDefaultFilters) = React.useState(() => entity.defaultFilters)
@@ -129,19 +129,15 @@ let make = (
let searchParams = disableURIdecode ? url.search : url.search->Js.Global.decodeURI
let (refreshData, _setRefreshData) = React.useContext(RefreshStateContext.refreshStateContext)
let (offset, setOffset) = React.useState(() => 0)
- let remoteFilters = initialFilters->Array.filter(item => item.localFilter->Js.Option.isNone)
+ let remoteFilters = initialFilters->Array.filter(item => item.localFilter->Option.isNone)
let filtersFromUrl = LogicUtils.getDictFromUrlSearchParams(searchParams)
- let localFilters = initialFilters->Array.filter(item => item.localFilter->Js.Option.isSome)
+ let localFilters = initialFilters->Array.filter(item => item.localFilter->Option.isSome)
let showToast = ToastState.useShowToast()
let localOptions =
- Array.concat(options, popupFilterFields)->Array.filter(item =>
- item.localFilter->Js.Option.isSome
- )
+ Array.concat(options, popupFilterFields)->Array.filter(item => item.localFilter->Option.isSome)
let remoteOptions =
- Array.concat(options, popupFilterFields)->Array.filter(item =>
- item.localFilter->Js.Option.isNone
- )
+ Array.concat(options, popupFilterFields)->Array.filter(item => item.localFilter->Option.isNone)
let remoteFiltersFromUrl = useRemoteFilter(
~searchParams,
~remoteFilters,
@@ -201,7 +197,7 @@ let make = (
}
setData(prevData => {
- let newData = prevData->Belt.Option.getWithDefault([])->Array.concat(sampleRes)
+ let newData = prevData->Option.getWithDefault([])->Array.concat(sampleRes)
Some(newData)
})
}
@@ -216,9 +212,7 @@ let make = (
let x =
filtersFromUrl
->Dict.get(val)
- ->Belt.Option.getWithDefault(
- searchValueDict->Dict.get(val)->Belt.Option.getWithDefault(""),
- )
+ ->Option.getWithDefault(searchValueDict->Dict.get(val)->Option.getWithDefault(""))
if requireDateFormatting && (val == "startTime" || val == "endTime") {
(x->DayJs.getDayJsForString).format(. "YYYY-MM-DD+HH:mm:ss")
} else if requireDateFormatting && (val == "start_date" || val == "end_date") {
@@ -301,15 +295,15 @@ let make = (
setRefetchCounter(p => p + 1)
}, [setRefetchCounter])
- let visibleColumns = visibleColumnsProp->Belt.Option.getWithDefault(defaultColumns)
+ let visibleColumns = visibleColumnsProp->Option.getWithDefault(defaultColumns)
let handleRefetch = () => {
- let rowFetched = data->Belt.Option.getWithDefault([])->Array.length
+ let rowFetched = data->Option.getWithDefault([])->Array.length
if rowFetched !== summary.totalCount {
setTableDataLoading(_ => true)
let newDefaultFilter =
defaultFilters
->Js.Json.decodeObject
- ->Belt.Option.getWithDefault(Dict.make())
+ ->Option.getWithDefault(Dict.make())
->Dict.toArray
->Dict.fromArray
@@ -320,14 +314,14 @@ let make = (
let showLocalFilter =
(localFilters->Array.length > 0 || localOptions->Array.length > 0) &&
- (applyFilters ? finalData : data)->Belt.Option.getWithDefault([])->Array.length > 0
+ (applyFilters ? finalData : data)->Option.getWithDefault([])->Array.length > 0
let showRemoteFilter = remoteFilters->Array.length > 0 || remoteOptions->Array.length > 0
let filters = {
if (
(Array.length(initialFilters) > 0 || Array.length(options) > 0) &&
(showLocalFilter || showRemoteFilter) &&
- (!hideFiltersOnNoData || data->Belt.Option.getWithDefault([])->Array.length > 0)
+ (!hideFiltersOnNoData || data->Option.getWithDefault([])->Array.length > 0)
) {
let children =
@@ -422,7 +416,7 @@ let make = (
for i in 0 to cols->Array.length - 1 {
checkLength :=
checkLength.contents &&
- switch obj[cols[i]->Belt.Option.getWithDefault(0)] {
+ switch obj[cols[i]->Option.getWithDefault(0)] {
| Some(ele) => Array.length(ele.selected) > 0
| None => false
}
@@ -473,9 +467,7 @@ let make = (
currrentFetchCount
}
let customizeColumn = if (
- activeColumnsAtom->Js.Option.isSome &&
- entity.allColumns->Js.Option.isSome &&
- totalResults > 0
+ activeColumnsAtom->Option.isSome && entity.allColumns->Option.isSome && totalResults > 0
) {