From 2d51e781c06f04bc11294ed5a225ef08da2b3e45 Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Thu, 27 Apr 2023 21:18:39 +0100 Subject: [PATCH] make filters UI work --- .../Monitor/MonitorSteps/CriteriaFilter.tsx | 49 +++++++++++++------ .../Monitor/MonitorSteps/CriteriaFilters.tsx | 10 ++-- 2 files changed, 39 insertions(+), 20 deletions(-) diff --git a/Dashboard/src/Components/Monitor/MonitorSteps/CriteriaFilter.tsx b/Dashboard/src/Components/Monitor/MonitorSteps/CriteriaFilter.tsx index 1bdaeb26b8..74cc270c14 100644 --- a/Dashboard/src/Components/Monitor/MonitorSteps/CriteriaFilter.tsx +++ b/Dashboard/src/Components/Monitor/MonitorSteps/CriteriaFilter.tsx @@ -1,4 +1,5 @@ -import { CriteriaFilter } from 'Common/Types/Monitor/CriteriaFilter'; + +import { CheckOn, CriteriaFilter, FilterType } from 'Common/Types/Monitor/CriteriaFilter'; import React, { FunctionComponent, ReactElement } from 'react'; export interface ComponentProps { @@ -8,23 +9,39 @@ export interface ComponentProps { const CriteriaFilterElement: FunctionComponent = ( props: ComponentProps ): ReactElement => { + + let text: string = "Check if this resource, "; + + if(props.criteriaFilter?.checkOn === CheckOn.IsOnline){ + if(props.criteriaFilter?.filterType === FilterType.True){ + text+= " is online. "; + }else{ + text+= " is offline. "; + } + }else{ + text+= props.criteriaFilter?.checkOn.toString().toLowerCase()+" "; + } + + if(props.criteriaFilter?.filterType && props.criteriaFilter?.checkOn !== CheckOn.IsOnline){ + text+="is "+props.criteriaFilter?.filterType.toString().toLowerCase()+" "; + } + + if(props.criteriaFilter?.value!== undefined){ + text+=props.criteriaFilter?.value.toString(); + } + + return ( -
- {props.criteriaFilter?.checkOn && ( -
-
{props.criteriaFilter?.checkOn}
+
+
+ +

+ + {text} + {' '} +

- )} - {props.criteriaFilter?.filterType && ( -
-
{props.criteriaFilter?.filterType}
-
- )} - {props.criteriaFilter?.value && ( -
-
{props.criteriaFilter?.value}
-
- )} +
); }; diff --git a/Dashboard/src/Components/Monitor/MonitorSteps/CriteriaFilters.tsx b/Dashboard/src/Components/Monitor/MonitorSteps/CriteriaFilters.tsx index a2b147a493..5c418c89fc 100644 --- a/Dashboard/src/Components/Monitor/MonitorSteps/CriteriaFilters.tsx +++ b/Dashboard/src/Components/Monitor/MonitorSteps/CriteriaFilters.tsx @@ -10,16 +10,18 @@ const CriteriaFilters: FunctionComponent = ( props: ComponentProps ): ReactElement => { return ( -
+
    {props.criteriaFilters.map( (i: CriteriaFilter, index: number) => { + + const isLastItem = index === props.criteriaFilters.length - 1; return (
  • -
    + {!isLastItem &&
    -
    -
    +
    } +