mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-07-19 10:48:59 +00:00
Sort key-value pairs on client-side in EntryTableSection
(#645)
This commit is contained in:
parent
92c7e2b91d
commit
b94098fea6
@ -205,13 +205,27 @@ interface EntrySectionProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const EntryTableSection: React.FC<EntrySectionProps> = ({title, color, arrayToIterate, updateQuery}) => {
|
export const EntryTableSection: React.FC<EntrySectionProps> = ({title, color, arrayToIterate, updateQuery}) => {
|
||||||
|
let arrayToIterateSorted: any[];
|
||||||
|
if (arrayToIterate) {
|
||||||
|
arrayToIterateSorted = arrayToIterate.sort((a, b) => {
|
||||||
|
if (a.name > b.name) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a.name < b.name) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
return <React.Fragment>
|
return <React.Fragment>
|
||||||
{
|
{
|
||||||
arrayToIterate && arrayToIterate.length > 0 ?
|
arrayToIterate && arrayToIterate.length > 0 ?
|
||||||
<EntrySectionContainer title={title} color={color}>
|
<EntrySectionContainer title={title} color={color}>
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
{arrayToIterate.map(({name, value, selector}, index) => <EntryViewLine
|
{arrayToIterateSorted.map(({name, value, selector}, index) => <EntryViewLine
|
||||||
key={index}
|
key={index}
|
||||||
label={name}
|
label={name}
|
||||||
value={value}
|
value={value}
|
||||||
|
Loading…
Reference in New Issue
Block a user