Skip to content

Commit

Permalink
Filter history stats by location
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejandro Fernández Gómez committed Nov 17, 2022
1 parent 7e7d557 commit 3ab6f1c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import React from 'react';
import { ReportTypes } from '@kbn/observability-plugin/public';
import { ClientPluginsStart } from '../../../../../plugin';
import { useMonitorQueryId } from '../hooks/use_monitor_query_id';
import { useSelectedLocation } from '../hooks/use_selected_location';

interface MonitorCompleteCountProps {
from: string;
Expand All @@ -22,8 +23,9 @@ export const MonitorCompleteCount = (props: MonitorCompleteCountProps) => {
const { ExploratoryViewEmbeddable } = observability;

const monitorId = useMonitorQueryId();
const selectedLocation = useSelectedLocation();

if (!monitorId) {
if (!monitorId || !selectedLocation) {
return null;
}

Expand All @@ -34,7 +36,10 @@ export const MonitorCompleteCount = (props: MonitorCompleteCountProps) => {
attributes={[
{
time: props,
reportDefinitions: { config_id: [monitorId] },
reportDefinitions: {
'monitor.id': [monitorId],
'observer.geo.name': [selectedLocation.label],
},
dataType: 'synthetics',
selectedMetricField: 'monitor_complete',
name: 'synthetics-series-1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import React from 'react';
import { useEuiTheme } from '@elastic/eui';
import { ClientPluginsStart } from '../../../../../plugin';
import { useMonitorQueryId } from '../hooks/use_monitor_query_id';
import { useSelectedLocation } from '../hooks/use_selected_location';

interface Props {
from: string;
Expand All @@ -21,10 +22,11 @@ export const MonitorCompleteSparklines = (props: Props) => {
const { ExploratoryViewEmbeddable } = observability;

const monitorId = useMonitorQueryId();
const selectedLocation = useSelectedLocation();

const { euiTheme } = useEuiTheme();

if (!monitorId) {
if (!monitorId || !selectedLocation) {
return null;
}

Expand All @@ -38,7 +40,10 @@ export const MonitorCompleteSparklines = (props: Props) => {
{
seriesType: 'area',
time: props,
reportDefinitions: { 'monitor.id': [monitorId] },
reportDefinitions: {
'monitor.id': [monitorId],
'observer.geo.name': [selectedLocation.label],
},
dataType: 'synthetics',
selectedMetricField: 'state.id',
name: 'Monitor complete',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import React from 'react';
import { ReportTypes } from '@kbn/observability-plugin/public';
import { ClientPluginsStart } from '../../../../../plugin';
import { useMonitorQueryId } from '../hooks/use_monitor_query_id';
import { useSelectedLocation } from '../hooks/use_selected_location';

interface MonitorTotalRunsCountProps {
from: string;
Expand All @@ -22,8 +23,9 @@ export const MonitorTotalRunsCount = (props: MonitorTotalRunsCountProps) => {
const { ExploratoryViewEmbeddable } = observability;

const monitorId = useMonitorQueryId();
const selectedLocation = useSelectedLocation();

if (!monitorId) {
if (!monitorId || !selectedLocation) {
return null;
}

Expand All @@ -34,7 +36,10 @@ export const MonitorTotalRunsCount = (props: MonitorTotalRunsCountProps) => {
attributes={[
{
time: props,
reportDefinitions: { config_id: [monitorId] },
reportDefinitions: {
'monitor.id': [monitorId],
'observer.geo.name': [selectedLocation.label],
},
dataType: 'synthetics',
selectedMetricField: 'monitor_total_runs',
name: 'synthetics-series-1',
Expand Down

0 comments on commit 3ab6f1c

Please sign in to comment.