forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Inventory][ECO] Entity type Remove Control groups filter (elastic#20…
…2177) closes elastic#201584 - Removes control group entity types filter - Adds multi-select entity types filer - Add kuery to url - Remove unified entities page - Adding telemetry when entity type is filtered - Refactoring... https://github.com/user-attachments/assets/98fb11ab-76e7-497b-af86-86378c6bfd7f --------- Co-authored-by: Irene Blanco <[email protected]>
- Loading branch information
1 parent
10f5056
commit d8f3f4c
Showing
41 changed files
with
716 additions
and
934 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
x-pack/plugins/observability_solution/inventory/common/rt_types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import { decode, encode } from '@kbn/rison'; | ||
import { isRight } from 'fp-ts/lib/Either'; | ||
import * as t from 'io-ts'; | ||
|
||
const validate = (validationRt: t.Any) => (input: unknown, context: t.Context) => { | ||
switch (typeof input) { | ||
case 'string': { | ||
try { | ||
const decoded = decode(input); | ||
const validation = validationRt.decode(decoded); | ||
if (isRight(validation)) { | ||
return t.success(validation.right); | ||
} | ||
|
||
return t.failure(input, context); | ||
} catch (e) { | ||
return t.failure(input, context); | ||
} | ||
} | ||
|
||
case 'undefined': | ||
return t.success(input); | ||
|
||
default: { | ||
const validation = validationRt.decode(input); | ||
|
||
if (isRight(validation)) { | ||
return t.success(validation.right); | ||
} | ||
|
||
return t.failure(input, context); | ||
} | ||
} | ||
}; | ||
|
||
const entityTypeCheckOptions = t.union([t.literal('on'), t.literal('off'), t.literal('mixed')]); | ||
export type EntityTypeCheckOptions = t.TypeOf<typeof entityTypeCheckOptions>; | ||
|
||
const entityTypeRt = t.record(t.string, entityTypeCheckOptions); | ||
export type EntityType = t.TypeOf<typeof entityTypeRt>; | ||
export const entityTypesRt = new t.Type< | ||
Record<string, 'on' | 'off' | 'mixed'> | undefined, | ||
string, | ||
unknown | ||
>('entityTypesRt', entityTypeRt.is, validate(entityTypeRt), (o) => encode(o)); | ||
|
||
const paginationRt = t.record(t.string, t.number); | ||
export type EntityPagination = t.TypeOf<typeof entityPaginationRt>; | ||
export const entityPaginationRt = new t.Type<Record<string, number> | undefined, string, unknown>( | ||
'entityPaginationRt', | ||
paginationRt.is, | ||
validate(paginationRt), | ||
(o) => encode(o) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.