-
Notifications
You must be signed in to change notification settings - Fork 8.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Inventory][ECO] Entities table #193272
Merged
cauemarcondes
merged 22 commits into
elastic:main
from
cauemarcondes:inventory-entities-list-2
Sep 18, 2024
Merged
[Inventory][ECO] Entities table #193272
Changes from 18 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
941df5c
cleaning up
cauemarcondes 0b8b973
inventory page and grid base
cauemarcondes 05e3991
server
cauemarcondes bd3ab6c
Merge remote-tracking branch 'origin/inventory-entities-list' into in…
cauemarcondes 1b0f65c
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine 8fc47e7
Merge remote-tracking branch 'origin/inventory-entities-list' into in…
cauemarcondes 36e9611
fixing deps
cauemarcondes 2803cf0
Merge remote-tracking branch 'origin/inventory-entities-list' into in…
cauemarcondes 218b977
refactoring and adding esql
cauemarcondes 51ee09c
entities grid
cauemarcondes ca2856a
Merge branch 'main' of github.com:elastic/kibana into inventory-entit…
cauemarcondes 1a7e3d9
removing apm
cauemarcondes 7448e2e
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine d99030b
fixing ci
cauemarcondes 0def3e0
PR comments
cauemarcondes df5b7db
adding i18n
cauemarcondes ce7946d
pr comments
cauemarcondes caccca2
Merge branch 'inventory-entities-list-2' of github.com:cauemarcondes/…
cauemarcondes 6ab74f1
adding tootilp to grid
cauemarcondes b2b47c5
tooltip impro
cauemarcondes 6a29a5e
pr comments
cauemarcondes 30cfb14
pr comments
cauemarcondes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
20 changes: 20 additions & 0 deletions
20
x-pack/packages/observability/observability_utils/es/utils/esql_result_to_plain_objects.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,20 @@ | ||
/* | ||
* 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 type { ESQLSearchResponse } from '@kbn/es-types'; | ||
|
||
export function esqlResultToPlainObjects<T extends Record<string, any>>( | ||
result: ESQLSearchResponse | ||
): T[] { | ||
return result.values.map((row) => { | ||
return row.reduce<Record<string, unknown>>((acc, value, index) => { | ||
const column = result.columns[index]; | ||
acc[column.name] = value; | ||
return acc; | ||
}, {}); | ||
}) as T[]; | ||
} |
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
12 changes: 12 additions & 0 deletions
12
x-pack/plugins/observability_solution/inventory/common/es_fields/entities.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,12 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export const ENTITY_LAST_SEEN = 'entity.lastSeenTimestamp'; | ||
export const ENTITY_ID = 'entity.id'; | ||
export const ENTITY_TYPE = 'entity.type'; | ||
export const ENTITY_DISPLAY_NAME = 'entity.displayName'; | ||
export const ENTITY_DEFINITION_ID = 'entity.definitionId'; |
65 changes: 65 additions & 0 deletions
65
...bservability_solution/inventory/public/components/entities_grid/entities_grid.stories.tsx
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,65 @@ | ||
/* | ||
cauemarcondes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* 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 { EuiDataGridSorting } from '@elastic/eui'; | ||
import { Meta, Story } from '@storybook/react'; | ||
import React, { useMemo, useState } from 'react'; | ||
import { orderBy } from 'lodash'; | ||
import { EntitiesGrid } from '.'; | ||
import { ENTITY_LAST_SEEN } from '../../../common/es_fields/entities'; | ||
import { entitiesMock } from './mock/entities_mock'; | ||
|
||
const stories: Meta<{}> = { | ||
title: 'app/inventory/entities_grid', | ||
component: EntitiesGrid, | ||
}; | ||
export default stories; | ||
|
||
export const Example: Story<{}> = () => { | ||
const [pageIndex, setPageIndex] = useState(0); | ||
const [sort, setSort] = useState<EuiDataGridSorting['columns'][0]>({ | ||
id: ENTITY_LAST_SEEN, | ||
direction: 'desc', | ||
}); | ||
|
||
const sortedItems = useMemo( | ||
() => orderBy(entitiesMock, sort.id, sort.direction), | ||
[sort.direction, sort.id] | ||
); | ||
|
||
return ( | ||
<EntitiesGrid | ||
entities={sortedItems} | ||
loading={false} | ||
sortDirection={sort.direction} | ||
sortField={sort.id} | ||
onChangePage={setPageIndex} | ||
onChangeSort={setSort} | ||
pageIndex={pageIndex} | ||
/> | ||
); | ||
}; | ||
|
||
export const EmptyGridExample: Story<{}> = () => { | ||
const [pageIndex, setPageIndex] = useState(0); | ||
const [sort, setSort] = useState<EuiDataGridSorting['columns'][0]>({ | ||
id: ENTITY_LAST_SEEN, | ||
direction: 'desc', | ||
}); | ||
|
||
return ( | ||
<EntitiesGrid | ||
entities={[]} | ||
cauemarcondes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
loading={false} | ||
sortDirection={sort.direction} | ||
sortField={sort.id} | ||
onChangePage={setPageIndex} | ||
onChangeSort={setSort} | ||
pageIndex={pageIndex} | ||
/> | ||
); | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(not now) but we might want to consider migrating to zod?
cc @crespocarlos