@@ -5,6 +5,7 @@ import InputLabel from '@material-ui/core/InputLabel';
55import Select from '@material-ui/core/NativeSelect/NativeSelect' ;
66import { EntryType , StatsInterval } from '../../gql/__generated__/globalTypes' ;
77import { TagKeySelector } from '../../tag/TagKeySelector' ;
8+ import { TagFilterSelector } from '../../tag/TagFilterSelector' ;
89import { Dashboards_dashboards_items , Dashboards_dashboards_items_statsSelection_range } from '../../gql/__generated__/Dashboards' ;
910import { RelativeDateTimeSelector } from '../../common/RelativeDateTimeSelector' ;
1011import { parseRelativeTime } from '../../utils/time' ;
@@ -31,6 +32,27 @@ export const isValidDashboardEntry = (item: Dashboards_dashboards_items): boolea
3132export const DashboardEntryForm : React . FC < EditPopupProps > = ( { entry, onChange : setEntry , disabled = false , ranges} ) => {
3233 const [ staticRange , setStaticRange ] = React . useState ( ! entry . statsSelection . rangeId ) ;
3334
35+ const [ excludeTags , setExcludeTags ] = React . useState (
36+ ( entry . statsSelection . excludeTags || [ ] ) . map ( ( tag ) => ( {
37+ tag : {
38+ key : tag . key ,
39+ color : '' ,
40+ __typename : 'TagDefinition' as 'TagDefinition' ,
41+ } ,
42+ value : tag . value ,
43+ } ) )
44+ ) ;
45+ const [ includeTags , setIncludeTags ] = React . useState (
46+ ( entry . statsSelection . includeTags || [ ] ) . map ( ( tag ) => ( {
47+ tag : {
48+ key : tag . key ,
49+ color : '' ,
50+ __typename : 'TagDefinition' as 'TagDefinition' ,
51+ } ,
52+ value : tag . value ,
53+ } ) )
54+ ) ;
55+
3456 const range : Dashboards_dashboards_items_statsSelection_range = entry . statsSelection . range
3557 ? entry . statsSelection . range
3658 : {
@@ -189,6 +211,32 @@ export const DashboardEntryForm: React.FC<EditPopupProps> = ({entry, onChange: s
189211 setEntry ( entry ) ;
190212 } }
191213 />
214+ < TagFilterSelector
215+ type = "Exclude"
216+ value = { excludeTags }
217+ onChange = { ( tags ) => {
218+ setExcludeTags ( tags ) ;
219+ entry . statsSelection . excludeTags = tags . map ( ( tag ) => ( {
220+ key : tag . tag . key ,
221+ value : tag . value ,
222+ __typename : 'TimeSpanTag' ,
223+ } ) ) ;
224+ setEntry ( entry ) ;
225+ } }
226+ />
227+ < TagFilterSelector
228+ type = "Include"
229+ value = { includeTags }
230+ onChange = { ( tags ) => {
231+ setIncludeTags ( tags ) ;
232+ entry . statsSelection . includeTags = tags . map ( ( tag ) => ( {
233+ key : tag . tag . key ,
234+ value : tag . value ,
235+ __typename : 'TimeSpanTag' ,
236+ } ) ) ;
237+ setEntry ( entry ) ;
238+ } }
239+ />
192240 </ >
193241 ) ;
194242} ;
0 commit comments