diff --git a/CHANGELOG.md b/CHANGELOG.md index 5cf8015b1..14e199d8f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ NOTE: As semantic versioning states all 0.y.z releases can contain breaking chan - [#127](https://github.com/kobsio/kobs/pull/127): Allow `ILIKE` queries for ClickHouse logs, using the new `=~` operator. - [#128](https://github.com/kobsio/kobs/pull/128): Allow users to specify dashboards within a Team or Application via the new `inline` property. - [#131](https://github.com/kobsio/kobs/pull/131): Add chart which shows the distribution of the logs lines in the selected time range for the ClickHouse plugin. +- [#132](https://github.com/kobsio/kobs/pull/132): Support the download of log lines in their JSON representation in the ClickHouse and Elasticsearch plugin. ### Fixed diff --git a/plugins/clickhouse/src/components/panel/details/Actions.tsx b/plugins/clickhouse/src/components/panel/details/Actions.tsx new file mode 100644 index 000000000..f1a23578b --- /dev/null +++ b/plugins/clickhouse/src/components/panel/details/Actions.tsx @@ -0,0 +1,39 @@ +import { Dropdown, DropdownItem, KebabToggle } from '@patternfly/react-core'; +import React, { useState } from 'react'; + +import { IDocument } from '../../../utils/interfaces'; + +interface IActionsProps { + document: IDocument; +} + +const Actions: React.FunctionComponent = ({ document }: IActionsProps) => { + const [showDropdown, setShowDropdown] = useState(false); + + return ( + + setShowDropdown(!showDropdown)} />} + isOpen={showDropdown} + isPlain={true} + position="right" + dropdownItems={[ + + JSON + + } + />, + ]} + /> + + ); +}; + +export default Actions; diff --git a/plugins/clickhouse/src/components/panel/details/Details.tsx b/plugins/clickhouse/src/components/panel/details/Details.tsx index 95deb1a62..7ee700568 100644 --- a/plugins/clickhouse/src/components/panel/details/Details.tsx +++ b/plugins/clickhouse/src/components/panel/details/Details.tsx @@ -10,11 +10,15 @@ import { DrawerHead, DrawerPanelBody, DrawerPanelContent, + Tab, + TabTitleText, + Tabs, } from '@patternfly/react-core'; -import React from 'react'; +import React, { useState } from 'react'; +import { Editor, Title } from '@kobsio/plugin-core'; +import Actions from './Actions'; import { IDocument } from '../../../utils/interfaces'; -import { Title } from '@kobsio/plugin-core'; import { formatTimeWrapper } from '../../../utils/helpers'; export interface IDetailsProps { @@ -23,6 +27,8 @@ export interface IDetailsProps { } const Details: React.FunctionComponent = ({ document, close }: IDetailsProps) => { + const [activeTab, setActiveTab] = useState('overview'); + return ( @@ -32,23 +38,43 @@ const Details: React.FunctionComponent = ({ document, close }: ID size="lg" /> + - - - - {Object.keys(document).map((key) => ( - - {key} - {document[key]} - - ))} - - - + setActiveTab(tabIndex.toString())} + className="pf-u-mt-md" + isFilled={true} + mountOnEnter={true} + > + Overview}> +
+ + + + {Object.keys(document).map((key) => ( + + {key} + {document[key]} + + ))} + + + +
+
+ JSON}> +
+ + + +
+
+
); diff --git a/plugins/elasticsearch/src/components/panel/details/Actions.tsx b/plugins/elasticsearch/src/components/panel/details/Actions.tsx new file mode 100644 index 000000000..774aaaad3 --- /dev/null +++ b/plugins/elasticsearch/src/components/panel/details/Actions.tsx @@ -0,0 +1,39 @@ +import { Dropdown, DropdownItem, KebabToggle } from '@patternfly/react-core'; +import React, { useState } from 'react'; + +import { IDocument } from '../../../utils/interfaces'; + +interface IActionsProps { + document: IDocument; +} + +const Actions: React.FunctionComponent = ({ document }: IActionsProps) => { + const [showDropdown, setShowDropdown] = useState(false); + + return ( + + setShowDropdown(!showDropdown)} />} + isOpen={showDropdown} + isPlain={true} + position="right" + dropdownItems={[ + + JSON + + } + />, + ]} + /> + + ); +}; + +export default Actions; diff --git a/plugins/elasticsearch/src/components/panel/details/Details.tsx b/plugins/elasticsearch/src/components/panel/details/Details.tsx index 233eb7ba3..c2952f7ab 100644 --- a/plugins/elasticsearch/src/components/panel/details/Details.tsx +++ b/plugins/elasticsearch/src/components/panel/details/Details.tsx @@ -12,6 +12,7 @@ import { import React, { useState } from 'react'; import { Editor, Title } from '@kobsio/plugin-core'; +import Actions from './Actions'; import Document from './Document'; import { IDocument } from '../../../utils/interfaces'; import { formatTimeWrapper } from '../../../utils/helpers'; @@ -35,6 +36,7 @@ const Details: React.FunctionComponent = ({ document, close }: ID size="lg" /> +