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.
[Log UI] Flyout for Log Events (elastic#28885) (elastic#29729)
* Adding flyout to log viewer * Adding filtering * Fixing typescript errors * Adding a test for graphql; fixing test data for 7.0.0 * Adding terminate_after:1 to logItem request * fixing test data * Switching back to old data * Fixing data for tests * Adding i18n translations * changing label from add to set * Make flyout call more robust; fixing typings * Adding loading screen to flyout * Fixing linting errors * Update x-pack/plugins/infra/public/components/logging/log_flyout.tsx Co-Authored-By: simianhacker <[email protected]> * Fixing visible mis-spelling * Fixing types * Change withLogFlyout to be conditional; Add icon instead of onClick for flyout * Adding dark mode support * Adding user-select:none to icon div * Removing remnants of a failed experiment * Adding aria-label to view details button * Fixing padding on date element * Removing unused variable that somehow got past the linters * Fixing empty_kibana * Fixing data for infra * Fixing merge weirdness
- Loading branch information
1 parent
5c19a8f
commit bb7a67a
Showing
35 changed files
with
1,170 additions
and
56 deletions.
There are no files selected for viewing
114 changes: 114 additions & 0 deletions
114
x-pack/plugins/infra/public/components/logging/log_flyout.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,114 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { | ||
EuiBasicTable, | ||
EuiButtonIcon, | ||
EuiFlyout, | ||
EuiFlyoutBody, | ||
EuiFlyoutHeader, | ||
EuiTitle, | ||
EuiToolTip, | ||
} from '@elastic/eui'; | ||
import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react'; | ||
import React from 'react'; | ||
import styled from 'styled-components'; | ||
import { InfraLogItem, InfraLogItemField } from '../../graphql/types'; | ||
import { InfraLoadingPanel } from '../loading'; | ||
interface Props { | ||
flyoutItem: InfraLogItem | null; | ||
hideFlyout: () => void; | ||
setFilter: (filter: string) => void; | ||
intl: InjectedIntl; | ||
loading: boolean; | ||
} | ||
|
||
export const LogFlyout = injectI18n( | ||
({ flyoutItem, loading, hideFlyout, setFilter, intl }: Props) => { | ||
const handleFilter = (field: InfraLogItemField) => () => { | ||
const filter = `${field.field}:"${field.value}"`; | ||
setFilter(filter); | ||
}; | ||
|
||
const columns = [ | ||
{ | ||
field: 'field', | ||
name: intl.formatMessage({ | ||
defaultMessage: 'Field', | ||
id: 'xpack.infra.logFlyout.fieldColumnLabel', | ||
}), | ||
sortable: true, | ||
}, | ||
{ | ||
field: 'value', | ||
name: intl.formatMessage({ | ||
defaultMessage: 'Value', | ||
id: 'xpack.infra.logFlyout.valueColumnLabel', | ||
}), | ||
sortable: true, | ||
render: (name: string, item: InfraLogItemField) => ( | ||
<span> | ||
<EuiToolTip | ||
content={intl.formatMessage({ | ||
id: 'xpack.infra.logFlyout.setFilterTooltip', | ||
defaultMessage: 'Set Filter', | ||
})} | ||
> | ||
<EuiButtonIcon | ||
color="text" | ||
iconType="filter" | ||
aria-label={intl.formatMessage({ | ||
id: 'xpack.infra.logFlyout.filterAriaLabel', | ||
defaultMessage: 'Filter', | ||
})} | ||
onClick={handleFilter(item)} | ||
/> | ||
</EuiToolTip> | ||
{item.value} | ||
</span> | ||
), | ||
}, | ||
]; | ||
return ( | ||
<EuiFlyout onClose={() => hideFlyout()} size="m"> | ||
<EuiFlyoutHeader hasBorder> | ||
<EuiTitle size="s"> | ||
<h3 id="flyoutTitle"> | ||
<FormattedMessage | ||
defaultMessage="Log event document details" | ||
id="xpack.infra.logFlyout.flyoutTitle" | ||
/> | ||
</h3> | ||
</EuiTitle> | ||
</EuiFlyoutHeader> | ||
<EuiFlyoutBody> | ||
{loading || flyoutItem === null ? ( | ||
<InfraFlyoutLoadingPanel> | ||
<InfraLoadingPanel | ||
height="100%" | ||
width="100%" | ||
text={intl.formatMessage({ | ||
id: 'xpack.infra.logFlyout.loadingMessage', | ||
defaultMessage: 'Loading Event', | ||
})} | ||
/> | ||
</InfraFlyoutLoadingPanel> | ||
) : ( | ||
<EuiBasicTable columns={columns} items={flyoutItem.fields} /> | ||
)} | ||
</EuiFlyoutBody> | ||
</EuiFlyout> | ||
); | ||
} | ||
); | ||
|
||
export const InfraFlyoutLoadingPanel = styled.div` | ||
position: absolute; | ||
top: 0; | ||
right: 0; | ||
bottom: 0; | ||
left: 0; | ||
`; |
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
23 changes: 23 additions & 0 deletions
23
x-pack/plugins/infra/public/containers/logs/flyout_item.gql_query.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,23 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import gql from 'graphql-tag'; | ||
|
||
export const flyoutItemQuery = gql` | ||
query FlyoutItemQuery($sourceId: ID!, $itemId: ID!) { | ||
source(id: $sourceId) { | ||
id | ||
logItem(id: $itemId) { | ||
id | ||
index | ||
fields { | ||
field | ||
value | ||
} | ||
} | ||
} | ||
} | ||
`; |
Oops, something went wrong.