mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-07-19 18:54:07 +00:00
Entries count changes frequently (#1021)
Co-authored-by: leon-up9 <97597983+leon-up9@users.noreply.github.com>
This commit is contained in:
parent
1624b0d7b9
commit
d834fcc3cb
@ -12,7 +12,7 @@ import TrafficViewerApiAtom from "../../recoil/TrafficViewerApi";
|
|||||||
import TrafficViewerApi from "./TrafficViewerApi";
|
import TrafficViewerApi from "./TrafficViewerApi";
|
||||||
import focusedEntryIdAtom from "../../recoil/focusedEntryId";
|
import focusedEntryIdAtom from "../../recoil/focusedEntryId";
|
||||||
import {toast} from "react-toastify";
|
import {toast} from "react-toastify";
|
||||||
import {TOAST_CONTAINER_ID} from "../../configs/Consts";
|
import {MAX_ENTRIES, TOAST_CONTAINER_ID} from "../../configs/Consts";
|
||||||
import tappingStatusAtom from "../../recoil/tappingStatus";
|
import tappingStatusAtom from "../../recoil/tappingStatus";
|
||||||
import leftOffTopAtom from "../../recoil/leftOffTop";
|
import leftOffTopAtom from "../../recoil/leftOffTop";
|
||||||
|
|
||||||
@ -98,8 +98,8 @@ export const EntriesList: React.FC<EntriesListProps> = ({
|
|||||||
setIsLoadingTop(false);
|
setIsLoadingTop(false);
|
||||||
|
|
||||||
const newEntries = [...data.data.reverse(), ...entries];
|
const newEntries = [...data.data.reverse(), ...entries];
|
||||||
if(newEntries.length > 10000) {
|
if(newEntries.length > MAX_ENTRIES) {
|
||||||
newEntries.splice(10000, newEntries.length - 10000)
|
newEntries.splice(MAX_ENTRIES, newEntries.length - MAX_ENTRIES)
|
||||||
}
|
}
|
||||||
setEntries(newEntries);
|
setEntries(newEntries);
|
||||||
|
|
||||||
@ -125,9 +125,9 @@ export const EntriesList: React.FC<EntriesListProps> = ({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const newEntries = [...entries];
|
const newEntries = [...entries];
|
||||||
if (newEntries.length > 10000) {
|
if (newEntries.length > MAX_ENTRIES) {
|
||||||
setLeftOffTop(newEntries[0].id);
|
setLeftOffTop(newEntries[0].id);
|
||||||
newEntries.splice(0, newEntries.length - 10000)
|
newEntries.splice(0, newEntries.length - MAX_ENTRIES)
|
||||||
setNoMoreDataTop(false);
|
setNoMoreDataTop(false);
|
||||||
setEntries(newEntries);
|
setEntries(newEntries);
|
||||||
}
|
}
|
||||||
@ -209,7 +209,7 @@ export const EntriesList: React.FC<EntriesListProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={styles.footer}>
|
<div className={styles.footer}>
|
||||||
<div>Displaying <b id="entries-length">{entries?.length}</b> results out of <b
|
<div>Displaying <b id="entries-length">{entries?.length > MAX_ENTRIES ? MAX_ENTRIES : entries?.length}</b> results out of <b
|
||||||
id="total-entries">{queriedTotal}</b> total
|
id="total-entries">{queriedTotal}</b> total
|
||||||
</div>
|
</div>
|
||||||
{startTime !== 0 && <div>Started listening at <span style={{
|
{startTime !== 0 && <div>Started listening at <span style={{
|
||||||
|
@ -1 +1,2 @@
|
|||||||
export const TOAST_CONTAINER_ID = "Common";
|
export const TOAST_CONTAINER_ID = "Common";
|
||||||
|
export const MAX_ENTRIES = 10000;
|
||||||
|
Loading…
Reference in New Issue
Block a user