Skip to content

Commit

Permalink
Make sure API configuration changes are reflected on the UI (#28)
Browse files Browse the repository at this point in the history
Signed-off-by: Siddhant Deshmukh <[email protected]>
  • Loading branch information
deshsidd authored Nov 12, 2024
1 parent 9efdbaf commit 1e70dc6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions public/pages/TopNQueries/TopNQueries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ const TopNQueries = ({
const { latency, cpu, memory } =
resp?.response?.persistent?.search?.insights?.top_queries || {};
if (latency !== undefined && latency.enabled === 'true') {
const [time, timeUnits] = latency.window_size.match(/\D+|\d+/g);
const [time, timeUnits] = latency.window_size
? latency.window_size.match(/\D+|\d+/g)
: ['1', 'm'];
setMetricSettings('latency', {
isEnabled: true,
currTopN: latency.top_n_size,
Expand All @@ -193,7 +195,9 @@ const TopNQueries = ({
});
}
if (cpu !== undefined && cpu.enabled === 'true') {
const [time, timeUnits] = cpu.window_size.match(/\D+|\d+/g);
const [time, timeUnits] = cpu.window_size
? cpu.window_size.match(/\D+|\d+/g)
: ['1', 'm'];
setMetricSettings('cpu', {
isEnabled: true,
currTopN: cpu.top_n_size,
Expand All @@ -202,7 +206,9 @@ const TopNQueries = ({
});
}
if (memory !== undefined && memory.enabled === 'true') {
const [time, timeUnits] = memory.window_size.match(/\D+|\d+/g);
const [time, timeUnits] = memory.window_size
? memory.window_size.match(/\D+|\d+/g)
: ['1', 'm'];
setMetricSettings('memory', {
isEnabled: true,
currTopN: memory.top_n_size,
Expand Down

0 comments on commit 1e70dc6

Please sign in to comment.