-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds actions to the log details in the ClickHouse plugin, so that users can filter for values based on the value of a log line and that they can toggle a specific field directly from the details. This commit also improves how we check if a field exists when it is not a default field.
- Loading branch information
1 parent
d3c74c0
commit 578f597
Showing
9 changed files
with
141 additions
and
16 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
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
88 changes: 88 additions & 0 deletions
88
plugins/clickhouse/src/components/panel/LogsDocumentDetailsRow.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,88 @@ | ||
import { Button, Tooltip } from '@patternfly/react-core'; | ||
import { ColumnsIcon, SearchIcon, SearchMinusIcon, SearchPlusIcon } from '@patternfly/react-icons'; | ||
import React, { useState } from 'react'; | ||
import { Td, Tr } from '@patternfly/react-table'; | ||
|
||
export interface ILogsDocumentDetailsRowProps { | ||
documentKey: string; | ||
documentValue: string; | ||
addFilter?: (filter: string) => void; | ||
selectField?: (field: string) => void; | ||
} | ||
|
||
const LogsDocumentDetailsRow: React.FunctionComponent<ILogsDocumentDetailsRowProps> = ({ | ||
documentKey, | ||
documentValue, | ||
addFilter, | ||
selectField, | ||
}: ILogsDocumentDetailsRowProps) => { | ||
const [showActions, setShowActions] = useState<boolean>(false); | ||
|
||
return ( | ||
<Tr onMouseEnter={(): void => setShowActions(true)} onMouseLeave={(): void => setShowActions(false)}> | ||
{addFilter && selectField && ( | ||
<Td noPadding={true} dataLabel="Actions" style={{ width: '75px' }}> | ||
{showActions && ( | ||
<div> | ||
<Tooltip content={<div>Filter for value</div>}> | ||
<Button | ||
style={{ padding: '0', paddingRight: '3px' }} | ||
variant="plain" | ||
aria-label="Filter for value" | ||
isSmall={true} | ||
onClick={(): void => addFilter(` _and_ ${documentKey}='${documentValue}'`)} | ||
> | ||
<SearchPlusIcon /> | ||
</Button> | ||
</Tooltip> | ||
|
||
<Tooltip content={<div>Filter out value</div>}> | ||
<Button | ||
style={{ padding: '0', paddingRight: '3px' }} | ||
variant="plain" | ||
aria-label="Filter out value" | ||
isSmall={true} | ||
onClick={(): void => addFilter(` _and_ ${documentKey}!='${documentValue}'`)} | ||
> | ||
<SearchMinusIcon /> | ||
</Button> | ||
</Tooltip> | ||
|
||
<Tooltip content={<div>Filter for field present</div>}> | ||
<Button | ||
style={{ padding: '0', paddingRight: '3px' }} | ||
variant="plain" | ||
aria-label="Filter for field present" | ||
isSmall={true} | ||
onClick={(): void => addFilter(` _and_ _exists_ ${documentKey}`)} | ||
> | ||
<SearchIcon /> | ||
</Button> | ||
</Tooltip> | ||
|
||
<Tooltip content={<div>Toggle field in table</div>}> | ||
<Button | ||
style={{ padding: '0', paddingRight: '3px' }} | ||
variant="plain" | ||
aria-label="Toggle field in table" | ||
isSmall={true} | ||
onClick={(): void => selectField(documentKey)} | ||
> | ||
<ColumnsIcon /> | ||
</Button> | ||
</Tooltip> | ||
</div> | ||
)} | ||
</Td> | ||
)} | ||
<Td noPadding={true} dataLabel="Key"> | ||
<b>{documentKey}</b> | ||
</Td> | ||
<Td className="pf-u-text-wrap pf-u-text-break-word" noPadding={true} dataLabel="Value"> | ||
<div style={{ whiteSpace: 'pre-wrap' }}>{documentValue}</div> | ||
</Td> | ||
</Tr> | ||
); | ||
}; | ||
|
||
export default LogsDocumentDetailsRow; |
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