mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-06-30 10:05:43 +00:00
Use the Queryable
component Summary
This commit is contained in:
parent
d55aa2f10b
commit
fb11d566b1
@ -7,6 +7,7 @@ interface Props {
|
|||||||
text: string | number,
|
text: string | number,
|
||||||
query: string,
|
query: string,
|
||||||
updateQuery: any,
|
updateQuery: any,
|
||||||
|
title?: string,
|
||||||
textStyle?: object,
|
textStyle?: object,
|
||||||
wrapperStyle?: object,
|
wrapperStyle?: object,
|
||||||
className?: string,
|
className?: string,
|
||||||
@ -17,7 +18,7 @@ interface Props {
|
|||||||
onClick?: React.EventHandler<React.MouseEvent<HTMLElement>>;
|
onClick?: React.EventHandler<React.MouseEvent<HTMLElement>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Queryable: React.FC<Props> = ({text, query, updateQuery, textStyle, wrapperStyle, className, isPossibleToCopy = true, applyTextEllipsis = true, useTooltip= false, displayIconOnMouseOver = false}) => {
|
const Queryable: React.FC<Props> = ({text, query, updateQuery, title, textStyle, wrapperStyle, className, isPossibleToCopy = true, applyTextEllipsis = true, useTooltip= false, displayIconOnMouseOver = false}) => {
|
||||||
const [showAddedNotification, setAdded] = useState(false);
|
const [showAddedNotification, setAdded] = useState(false);
|
||||||
const [showTooltip, setShowTooltip] = useState(false);
|
const [showTooltip, setShowTooltip] = useState(false);
|
||||||
text = String(text);
|
text = String(text);
|
||||||
@ -38,7 +39,7 @@ const Queryable: React.FC<Props> = ({text, query, updateQuery, textStyle, wrappe
|
|||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
}, [showAddedNotification]);
|
}, [showAddedNotification]);
|
||||||
|
|
||||||
const textElement = <span className={'Queryable-Text'} style={textStyle}>{text}</span>;
|
const textElement = <span title={title} className={'Queryable-Text'} style={textStyle}>{text}</span>;
|
||||||
|
|
||||||
const copyButton = text ? <CopyToClipboard text={text} onCopy={onCopy}>
|
const copyButton = text ? <CopyToClipboard text={text} onCopy={onCopy}>
|
||||||
<span
|
<span
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import miscStyles from "./style/misc.module.sass";
|
import miscStyles from "./style/misc.module.sass";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import styles from './style/Summary.module.sass';
|
import styles from './style/Summary.module.sass';
|
||||||
|
import Queryable from "./Queryable";
|
||||||
|
|
||||||
interface SummaryProps {
|
interface SummaryProps {
|
||||||
method: string
|
method: string
|
||||||
@ -10,23 +11,24 @@ interface SummaryProps {
|
|||||||
|
|
||||||
export const Summary: React.FC<SummaryProps> = ({method, summary, updateQuery}) => {
|
export const Summary: React.FC<SummaryProps> = ({method, summary, updateQuery}) => {
|
||||||
return <div className={styles.container}>
|
return <div className={styles.container}>
|
||||||
{method && <span
|
{method && <Queryable
|
||||||
|
text={method}
|
||||||
|
query={`method == "${method}"`}
|
||||||
|
updateQuery={updateQuery}
|
||||||
title="Method"
|
title="Method"
|
||||||
className={`queryable ${miscStyles.protocol} ${miscStyles.method}`}
|
className={`${miscStyles.protocol} ${miscStyles.method}`}
|
||||||
onClick={() => {
|
wrapperStyle={{height: "14px"}}
|
||||||
updateQuery(`method == "${method}"`)
|
applyTextEllipsis={false}
|
||||||
}}
|
displayIconOnMouseOver={true}
|
||||||
>
|
/>}
|
||||||
{method}
|
{summary && <Queryable
|
||||||
</span>}
|
text={summary}
|
||||||
{summary && <div
|
query={`summary == "${summary}"`}
|
||||||
|
updateQuery={updateQuery}
|
||||||
title="Summary"
|
title="Summary"
|
||||||
className={`queryable ${styles.summary}`}
|
className={`${styles.summary}`}
|
||||||
onClick={() => {
|
applyTextEllipsis={false}
|
||||||
updateQuery(`summary == "${summary}"`)
|
displayIconOnMouseOver={true}
|
||||||
}}
|
/>}
|
||||||
>
|
|
||||||
{summary}
|
|
||||||
</div>}
|
|
||||||
</div>
|
</div>
|
||||||
};
|
};
|
||||||
|
@ -3,6 +3,4 @@
|
|||||||
align-items: center
|
align-items: center
|
||||||
|
|
||||||
.summary
|
.summary
|
||||||
text-overflow: ellipsis
|
|
||||||
overflow: hidden
|
|
||||||
white-space: nowrap
|
white-space: nowrap
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
color: #a0b2ff
|
color: #a0b2ff
|
||||||
font-size: 10px
|
font-size: 10px
|
||||||
|
|
||||||
.noSelect
|
.noSelect
|
||||||
-webkit-touch-callout: none
|
-webkit-touch-callout: none
|
||||||
-webkit-user-select: none
|
-webkit-user-select: none
|
||||||
-khtml-user-select: none
|
-khtml-user-select: none
|
||||||
|
Loading…
Reference in New Issue
Block a user