mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 04:05:56 +08:00
chore: infra monitoring fixes (#8066)
This commit is contained in:
parent
c3123a4fa4
commit
1ab6c7177f
@ -7,9 +7,11 @@ import logEvent from 'api/common/logEvent';
|
|||||||
import cx from 'classnames';
|
import cx from 'classnames';
|
||||||
import { DateTimeRangeType } from 'container/TopNav/CustomDateTimeModal';
|
import { DateTimeRangeType } from 'container/TopNav/CustomDateTimeModal';
|
||||||
import {
|
import {
|
||||||
|
CustomTimeType,
|
||||||
FixedDurationSuggestionOptions,
|
FixedDurationSuggestionOptions,
|
||||||
Options,
|
Options,
|
||||||
RelativeDurationSuggestionOptions,
|
RelativeDurationSuggestionOptions,
|
||||||
|
Time,
|
||||||
} from 'container/TopNav/DateTimeSelectionV2/config';
|
} from 'container/TopNav/DateTimeSelectionV2/config';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { isValidTimeFormat } from 'lib/getMinMax';
|
import { isValidTimeFormat } from 'lib/getMinMax';
|
||||||
@ -56,6 +58,10 @@ interface CustomTimePickerProps {
|
|||||||
setCustomDTPickerVisible?: Dispatch<SetStateAction<boolean>>;
|
setCustomDTPickerVisible?: Dispatch<SetStateAction<boolean>>;
|
||||||
onCustomDateHandler?: (dateTimeRange: DateTimeRangeType) => void;
|
onCustomDateHandler?: (dateTimeRange: DateTimeRangeType) => void;
|
||||||
handleGoLive?: () => void;
|
handleGoLive?: () => void;
|
||||||
|
onTimeChange?: (
|
||||||
|
interval: Time | CustomTimeType,
|
||||||
|
dateTimeRange?: [number, number],
|
||||||
|
) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
function CustomTimePicker({
|
function CustomTimePicker({
|
||||||
@ -73,6 +79,7 @@ function CustomTimePicker({
|
|||||||
setCustomDTPickerVisible,
|
setCustomDTPickerVisible,
|
||||||
onCustomDateHandler,
|
onCustomDateHandler,
|
||||||
handleGoLive,
|
handleGoLive,
|
||||||
|
onTimeChange,
|
||||||
}: CustomTimePickerProps): JSX.Element {
|
}: CustomTimePickerProps): JSX.Element {
|
||||||
const [
|
const [
|
||||||
selectedTimePlaceholderValue,
|
selectedTimePlaceholderValue,
|
||||||
@ -336,6 +343,7 @@ function CustomTimePicker({
|
|||||||
setActiveView={setActiveView}
|
setActiveView={setActiveView}
|
||||||
setIsOpenedFromFooter={setIsOpenedFromFooter}
|
setIsOpenedFromFooter={setIsOpenedFromFooter}
|
||||||
isOpenedFromFooter={isOpenedFromFooter}
|
isOpenedFromFooter={isOpenedFromFooter}
|
||||||
|
onTimeChange={onTimeChange}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
content
|
content
|
||||||
@ -405,4 +413,5 @@ CustomTimePicker.defaultProps = {
|
|||||||
onCustomDateHandler: noop,
|
onCustomDateHandler: noop,
|
||||||
handleGoLive: noop,
|
handleGoLive: noop,
|
||||||
onCustomTimeStatusUpdate: noop,
|
onCustomTimeStatusUpdate: noop,
|
||||||
|
onTimeChange: undefined,
|
||||||
};
|
};
|
||||||
|
@ -7,9 +7,11 @@ import cx from 'classnames';
|
|||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
import { DateTimeRangeType } from 'container/TopNav/CustomDateTimeModal';
|
import { DateTimeRangeType } from 'container/TopNav/CustomDateTimeModal';
|
||||||
import {
|
import {
|
||||||
|
CustomTimeType,
|
||||||
LexicalContext,
|
LexicalContext,
|
||||||
Option,
|
Option,
|
||||||
RelativeDurationSuggestionOptions,
|
RelativeDurationSuggestionOptions,
|
||||||
|
Time,
|
||||||
} from 'container/TopNav/DateTimeSelectionV2/config';
|
} from 'container/TopNav/DateTimeSelectionV2/config';
|
||||||
import { Clock, PenLine } from 'lucide-react';
|
import { Clock, PenLine } from 'lucide-react';
|
||||||
import { useTimezone } from 'providers/Timezone';
|
import { useTimezone } from 'providers/Timezone';
|
||||||
@ -35,6 +37,10 @@ interface CustomTimePickerPopoverContentProps {
|
|||||||
setActiveView: Dispatch<SetStateAction<'datetime' | 'timezone'>>;
|
setActiveView: Dispatch<SetStateAction<'datetime' | 'timezone'>>;
|
||||||
isOpenedFromFooter: boolean;
|
isOpenedFromFooter: boolean;
|
||||||
setIsOpenedFromFooter: Dispatch<SetStateAction<boolean>>;
|
setIsOpenedFromFooter: Dispatch<SetStateAction<boolean>>;
|
||||||
|
onTimeChange?: (
|
||||||
|
interval: Time | CustomTimeType,
|
||||||
|
dateTimeRange?: [number, number],
|
||||||
|
) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
// eslint-disable-next-line sonarjs/cognitive-complexity
|
// eslint-disable-next-line sonarjs/cognitive-complexity
|
||||||
@ -51,6 +57,7 @@ function CustomTimePickerPopoverContent({
|
|||||||
setActiveView,
|
setActiveView,
|
||||||
isOpenedFromFooter,
|
isOpenedFromFooter,
|
||||||
setIsOpenedFromFooter,
|
setIsOpenedFromFooter,
|
||||||
|
onTimeChange,
|
||||||
}: CustomTimePickerPopoverContentProps): JSX.Element {
|
}: CustomTimePickerPopoverContentProps): JSX.Element {
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation();
|
||||||
|
|
||||||
@ -143,6 +150,7 @@ function CustomTimePickerPopoverContent({
|
|||||||
setIsOpen={setIsOpen}
|
setIsOpen={setIsOpen}
|
||||||
onCustomDateHandler={onCustomDateHandler}
|
onCustomDateHandler={onCustomDateHandler}
|
||||||
selectedTime={selectedTime}
|
selectedTime={selectedTime}
|
||||||
|
onTimeChange={onTimeChange}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="relative-times-container">
|
<div className="relative-times-container">
|
||||||
@ -181,4 +189,8 @@ function CustomTimePickerPopoverContent({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CustomTimePickerPopoverContent.defaultProps = {
|
||||||
|
onTimeChange: undefined,
|
||||||
|
};
|
||||||
|
|
||||||
export default CustomTimePickerPopoverContent;
|
export default CustomTimePickerPopoverContent;
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
|
/* eslint-disable react/jsx-props-no-spreading */
|
||||||
import './RangePickerModal.styles.scss';
|
import './RangePickerModal.styles.scss';
|
||||||
|
|
||||||
import { DatePicker } from 'antd';
|
import { DatePicker } from 'antd';
|
||||||
import { DATE_TIME_FORMATS } from 'constants/dateTimeFormats';
|
import { DATE_TIME_FORMATS } from 'constants/dateTimeFormats';
|
||||||
import { DateTimeRangeType } from 'container/TopNav/CustomDateTimeModal';
|
import { DateTimeRangeType } from 'container/TopNav/CustomDateTimeModal';
|
||||||
import { LexicalContext } from 'container/TopNav/DateTimeSelectionV2/config';
|
import {
|
||||||
|
CustomTimeType,
|
||||||
|
LexicalContext,
|
||||||
|
Time,
|
||||||
|
} from 'container/TopNav/DateTimeSelectionV2/config';
|
||||||
import dayjs, { Dayjs } from 'dayjs';
|
import dayjs, { Dayjs } from 'dayjs';
|
||||||
import { useTimezone } from 'providers/Timezone';
|
import { useTimezone } from 'providers/Timezone';
|
||||||
import { Dispatch, SetStateAction, useMemo } from 'react';
|
import { Dispatch, SetStateAction, useMemo } from 'react';
|
||||||
@ -19,6 +24,10 @@ interface RangePickerModalProps {
|
|||||||
lexicalContext?: LexicalContext | undefined,
|
lexicalContext?: LexicalContext | undefined,
|
||||||
) => void;
|
) => void;
|
||||||
selectedTime: string;
|
selectedTime: string;
|
||||||
|
onTimeChange?: (
|
||||||
|
interval: Time | CustomTimeType,
|
||||||
|
dateTimeRange?: [number, number],
|
||||||
|
) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
function RangePickerModal(props: RangePickerModalProps): JSX.Element {
|
function RangePickerModal(props: RangePickerModalProps): JSX.Element {
|
||||||
@ -27,6 +36,7 @@ function RangePickerModal(props: RangePickerModalProps): JSX.Element {
|
|||||||
setIsOpen,
|
setIsOpen,
|
||||||
onCustomDateHandler,
|
onCustomDateHandler,
|
||||||
selectedTime,
|
selectedTime,
|
||||||
|
onTimeChange,
|
||||||
} = props;
|
} = props;
|
||||||
const { RangePicker } = DatePicker;
|
const { RangePicker } = DatePicker;
|
||||||
const { maxTime, minTime } = useSelector<AppState, GlobalReducer>(
|
const { maxTime, minTime } = useSelector<AppState, GlobalReducer>(
|
||||||
@ -74,13 +84,22 @@ function RangePickerModal(props: RangePickerModalProps): JSX.Element {
|
|||||||
date.tz(timezone.value).format(DATE_TIME_FORMATS.ISO_DATETIME)
|
date.tz(timezone.value).format(DATE_TIME_FORMATS.ISO_DATETIME)
|
||||||
}
|
}
|
||||||
onOk={onModalOkHandler}
|
onOk={onModalOkHandler}
|
||||||
// eslint-disable-next-line react/jsx-props-no-spreading
|
{...(selectedTime === 'custom' &&
|
||||||
{...(selectedTime === 'custom' && {
|
!onTimeChange && {
|
||||||
value: rangeValue,
|
value: rangeValue,
|
||||||
})}
|
})}
|
||||||
|
// use default value if onTimeChange is provided
|
||||||
|
{...(selectedTime === 'custom' &&
|
||||||
|
onTimeChange && {
|
||||||
|
defaultValue: rangeValue,
|
||||||
|
})}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RangePickerModal.defaultProps = {
|
||||||
|
onTimeChange: undefined,
|
||||||
|
};
|
||||||
|
|
||||||
export default RangePickerModal;
|
export default RangePickerModal;
|
||||||
|
@ -26,6 +26,7 @@ import { useQuery } from 'react-query';
|
|||||||
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
|
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
import { DataSource } from 'types/common/queryBuilder';
|
import { DataSource } from 'types/common/queryBuilder';
|
||||||
|
|
||||||
|
import { VIEWS } from '../constants';
|
||||||
import { getHostTracesQueryPayload, selectedColumns } from './constants';
|
import { getHostTracesQueryPayload, selectedColumns } from './constants';
|
||||||
import { getListColumns } from './utils';
|
import { getListColumns } from './utils';
|
||||||
|
|
||||||
@ -39,7 +40,10 @@ interface Props {
|
|||||||
interval: Time | CustomTimeType,
|
interval: Time | CustomTimeType,
|
||||||
dateTimeRange?: [number, number],
|
dateTimeRange?: [number, number],
|
||||||
) => void;
|
) => void;
|
||||||
handleChangeTracesFilters: (value: IBuilderQuery['filters']) => void;
|
handleChangeTracesFilters: (
|
||||||
|
value: IBuilderQuery['filters'],
|
||||||
|
view: VIEWS,
|
||||||
|
) => void;
|
||||||
tracesFilters: IBuilderQuery['filters'];
|
tracesFilters: IBuilderQuery['filters'];
|
||||||
selectedInterval: Time;
|
selectedInterval: Time;
|
||||||
}
|
}
|
||||||
@ -70,14 +74,16 @@ function HostMetricTraces({
|
|||||||
...currentQuery.builder.queryData[0].aggregateAttribute,
|
...currentQuery.builder.queryData[0].aggregateAttribute,
|
||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
items: [],
|
items: tracesFilters.items.filter(
|
||||||
|
(item) => item.key?.key !== 'host.name',
|
||||||
|
),
|
||||||
op: 'AND',
|
op: 'AND',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
[currentQuery],
|
[currentQuery, tracesFilters.items],
|
||||||
);
|
);
|
||||||
|
|
||||||
const query = updatedCurrentQuery?.builder?.queryData[0] || null;
|
const query = updatedCurrentQuery?.builder?.queryData[0] || null;
|
||||||
@ -153,14 +159,16 @@ function HostMetricTraces({
|
|||||||
{query && (
|
{query && (
|
||||||
<QueryBuilderSearch
|
<QueryBuilderSearch
|
||||||
query={query}
|
query={query}
|
||||||
onChange={handleChangeTracesFilters}
|
onChange={(value): void =>
|
||||||
|
handleChangeTracesFilters(value, VIEWS.TRACES)
|
||||||
|
}
|
||||||
disableNavigationShortcuts
|
disableNavigationShortcuts
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="datetime-section">
|
<div className="datetime-section">
|
||||||
<DateTimeSelectionV2
|
<DateTimeSelectionV2
|
||||||
showAutoRefresh={false}
|
showAutoRefresh
|
||||||
showRefreshText={false}
|
showRefreshText={false}
|
||||||
hideShareModal
|
hideShareModal
|
||||||
isModalTimeSelection={isModalTimeSelection}
|
isModalTimeSelection={isModalTimeSelection}
|
||||||
|
@ -19,6 +19,8 @@ import {
|
|||||||
initialQueryState,
|
initialQueryState,
|
||||||
} from 'constants/queryBuilder';
|
} from 'constants/queryBuilder';
|
||||||
import ROUTES from 'constants/routes';
|
import ROUTES from 'constants/routes';
|
||||||
|
import { getFiltersFromParams } from 'container/InfraMonitoringK8s/commonUtils';
|
||||||
|
import { INFRA_MONITORING_K8S_PARAMS_KEYS } from 'container/InfraMonitoringK8s/constants';
|
||||||
import {
|
import {
|
||||||
CustomTimeType,
|
CustomTimeType,
|
||||||
Time,
|
Time,
|
||||||
@ -93,8 +95,18 @@ function HostMetricsDetails({
|
|||||||
);
|
);
|
||||||
const isDarkMode = useIsDarkMode();
|
const isDarkMode = useIsDarkMode();
|
||||||
|
|
||||||
const initialFilters = useMemo(
|
const initialFilters = useMemo(() => {
|
||||||
() => ({
|
const urlView = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.VIEW);
|
||||||
|
const queryKey =
|
||||||
|
urlView === VIEW_TYPES.LOGS
|
||||||
|
? INFRA_MONITORING_K8S_PARAMS_KEYS.LOG_FILTERS
|
||||||
|
: INFRA_MONITORING_K8S_PARAMS_KEYS.TRACES_FILTERS;
|
||||||
|
const filters = getFiltersFromParams(searchParams, queryKey);
|
||||||
|
if (filters) {
|
||||||
|
return filters;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
op: 'AND',
|
op: 'AND',
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
@ -111,9 +123,8 @@ function HostMetricsDetails({
|
|||||||
value: host?.hostName || '',
|
value: host?.hostName || '',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}),
|
};
|
||||||
[host?.hostName],
|
}, [host?.hostName, searchParams]);
|
||||||
);
|
|
||||||
|
|
||||||
const [logFilters, setLogFilters] = useState<IBuilderQuery['filters']>(
|
const [logFilters, setLogFilters] = useState<IBuilderQuery['filters']>(
|
||||||
initialFilters,
|
initialFilters,
|
||||||
@ -154,7 +165,13 @@ function HostMetricsDetails({
|
|||||||
const handleTabChange = (e: RadioChangeEvent): void => {
|
const handleTabChange = (e: RadioChangeEvent): void => {
|
||||||
setSelectedView(e.target.value);
|
setSelectedView(e.target.value);
|
||||||
if (host?.hostName) {
|
if (host?.hostName) {
|
||||||
setSearchParams({ hostName: host?.hostName, view: e.target.value });
|
setSelectedView(e.target.value);
|
||||||
|
setSearchParams({
|
||||||
|
...Object.fromEntries(searchParams.entries()),
|
||||||
|
[INFRA_MONITORING_K8S_PARAMS_KEYS.VIEW]: e.target.value,
|
||||||
|
[INFRA_MONITORING_K8S_PARAMS_KEYS.LOG_FILTERS]: JSON.stringify(null),
|
||||||
|
[INFRA_MONITORING_K8S_PARAMS_KEYS.TRACES_FILTERS]: JSON.stringify(null),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
logEvent(InfraMonitoringEvents.TabChanged, {
|
logEvent(InfraMonitoringEvents.TabChanged, {
|
||||||
entity: InfraMonitoringEvents.HostEntity,
|
entity: InfraMonitoringEvents.HostEntity,
|
||||||
@ -191,7 +208,7 @@ function HostMetricsDetails({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleChangeLogFilters = useCallback(
|
const handleChangeLogFilters = useCallback(
|
||||||
(value: IBuilderQuery['filters']) => {
|
(value: IBuilderQuery['filters'], view: VIEWS) => {
|
||||||
setLogFilters((prevFilters) => {
|
setLogFilters((prevFilters) => {
|
||||||
const hostNameFilter = prevFilters.items.find(
|
const hostNameFilter = prevFilters.items.find(
|
||||||
(item) => item.key?.key === 'host.name',
|
(item) => item.key?.key === 'host.name',
|
||||||
@ -209,7 +226,7 @@ function HostMetricsDetails({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
const updatedFilters = {
|
||||||
op: 'AND',
|
op: 'AND',
|
||||||
items: [
|
items: [
|
||||||
hostNameFilter,
|
hostNameFilter,
|
||||||
@ -217,6 +234,15 @@ function HostMetricsDetails({
|
|||||||
...(paginationFilter ? [paginationFilter] : []),
|
...(paginationFilter ? [paginationFilter] : []),
|
||||||
].filter((item): item is TagFilterItem => item !== undefined),
|
].filter((item): item is TagFilterItem => item !== undefined),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
setSearchParams({
|
||||||
|
...Object.fromEntries(searchParams.entries()),
|
||||||
|
[INFRA_MONITORING_K8S_PARAMS_KEYS.LOG_FILTERS]: JSON.stringify(
|
||||||
|
updatedFilters,
|
||||||
|
),
|
||||||
|
[INFRA_MONITORING_K8S_PARAMS_KEYS.VIEW]: view,
|
||||||
|
});
|
||||||
|
return updatedFilters;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
@ -224,7 +250,7 @@ function HostMetricsDetails({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleChangeTracesFilters = useCallback(
|
const handleChangeTracesFilters = useCallback(
|
||||||
(value: IBuilderQuery['filters']) => {
|
(value: IBuilderQuery['filters'], view: VIEWS) => {
|
||||||
setTracesFilters((prevFilters) => {
|
setTracesFilters((prevFilters) => {
|
||||||
const hostNameFilter = prevFilters.items.find(
|
const hostNameFilter = prevFilters.items.find(
|
||||||
(item) => item.key?.key === 'host.name',
|
(item) => item.key?.key === 'host.name',
|
||||||
@ -238,13 +264,23 @@ function HostMetricsDetails({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
const updatedFilters = {
|
||||||
op: 'AND',
|
op: 'AND',
|
||||||
items: [
|
items: [
|
||||||
hostNameFilter,
|
hostNameFilter,
|
||||||
...value.items.filter((item) => item.key?.key !== 'host.name'),
|
...value.items.filter((item) => item.key?.key !== 'host.name'),
|
||||||
].filter((item): item is TagFilterItem => item !== undefined),
|
].filter((item): item is TagFilterItem => item !== undefined),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
setSearchParams({
|
||||||
|
...Object.fromEntries(searchParams.entries()),
|
||||||
|
[INFRA_MONITORING_K8S_PARAMS_KEYS.TRACES_FILTERS]: JSON.stringify(
|
||||||
|
updatedFilters,
|
||||||
|
),
|
||||||
|
[INFRA_MONITORING_K8S_PARAMS_KEYS.VIEW]: view,
|
||||||
|
});
|
||||||
|
|
||||||
|
return updatedFilters;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
@ -11,6 +11,7 @@ import { useMemo } from 'react';
|
|||||||
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
|
import { IBuilderQuery } from 'types/api/queryBuilder/queryBuilderData';
|
||||||
import { DataSource } from 'types/common/queryBuilder';
|
import { DataSource } from 'types/common/queryBuilder';
|
||||||
|
|
||||||
|
import { VIEWS } from '../constants';
|
||||||
import HostMetricsLogs from './HostMetricsLogs';
|
import HostMetricsLogs from './HostMetricsLogs';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -23,7 +24,7 @@ interface Props {
|
|||||||
interval: Time | CustomTimeType,
|
interval: Time | CustomTimeType,
|
||||||
dateTimeRange?: [number, number],
|
dateTimeRange?: [number, number],
|
||||||
) => void;
|
) => void;
|
||||||
handleChangeLogFilters: (value: IBuilderQuery['filters']) => void;
|
handleChangeLogFilters: (value: IBuilderQuery['filters'], view: VIEWS) => void;
|
||||||
logFilters: IBuilderQuery['filters'];
|
logFilters: IBuilderQuery['filters'];
|
||||||
selectedInterval: Time;
|
selectedInterval: Time;
|
||||||
}
|
}
|
||||||
@ -51,14 +52,14 @@ function HostMetricLogsDetailedView({
|
|||||||
...currentQuery.builder.queryData[0].aggregateAttribute,
|
...currentQuery.builder.queryData[0].aggregateAttribute,
|
||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
items: [],
|
items: logFilters.items.filter((item) => item.key?.key !== 'host.name'),
|
||||||
op: 'AND',
|
op: 'AND',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
[currentQuery],
|
[currentQuery, logFilters.items],
|
||||||
);
|
);
|
||||||
|
|
||||||
const query = updatedCurrentQuery?.builder?.queryData[0] || null;
|
const query = updatedCurrentQuery?.builder?.queryData[0] || null;
|
||||||
@ -70,14 +71,14 @@ function HostMetricLogsDetailedView({
|
|||||||
{query && (
|
{query && (
|
||||||
<QueryBuilderSearch
|
<QueryBuilderSearch
|
||||||
query={query}
|
query={query}
|
||||||
onChange={handleChangeLogFilters}
|
onChange={(value): void => handleChangeLogFilters(value, VIEWS.LOGS)}
|
||||||
disableNavigationShortcuts
|
disableNavigationShortcuts
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="datetime-section">
|
<div className="datetime-section">
|
||||||
<DateTimeSelectionV2
|
<DateTimeSelectionV2
|
||||||
showAutoRefresh={false}
|
showAutoRefresh
|
||||||
showRefreshText={false}
|
showRefreshText={false}
|
||||||
hideShareModal
|
hideShareModal
|
||||||
isModalTimeSelection={isModalTimeSelection}
|
isModalTimeSelection={isModalTimeSelection}
|
||||||
|
@ -18,7 +18,7 @@ import { useResizeObserver } from 'hooks/useDimensions';
|
|||||||
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
|
import { GetMetricQueryRange } from 'lib/dashboard/getQueryResults';
|
||||||
import { getUPlotChartOptions } from 'lib/uPlotLib/getUplotChartOptions';
|
import { getUPlotChartOptions } from 'lib/uPlotLib/getUplotChartOptions';
|
||||||
import { getUPlotChartData } from 'lib/uPlotLib/utils/getUplotChartData';
|
import { getUPlotChartData } from 'lib/uPlotLib/utils/getUplotChartData';
|
||||||
import { useMemo, useRef } from 'react';
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { useQueries, UseQueryResult } from 'react-query';
|
import { useQueries, UseQueryResult } from 'react-query';
|
||||||
import { SuccessResponse } from 'types/api';
|
import { SuccessResponse } from 'types/api';
|
||||||
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
|
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
|
||||||
@ -68,6 +68,45 @@ function Metrics({
|
|||||||
[queries],
|
[queries],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const [graphTimeIntervals, setGraphTimeIntervals] = useState<
|
||||||
|
{
|
||||||
|
start: number;
|
||||||
|
end: number;
|
||||||
|
}[]
|
||||||
|
>(
|
||||||
|
new Array(queries.length).fill({
|
||||||
|
start: timeRange.startTime,
|
||||||
|
end: timeRange.endTime,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setGraphTimeIntervals(
|
||||||
|
new Array(queries.length).fill({
|
||||||
|
start: timeRange.startTime,
|
||||||
|
end: timeRange.endTime,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [timeRange]);
|
||||||
|
|
||||||
|
const onDragSelect = useCallback(
|
||||||
|
(start: number, end: number, graphIndex: number) => {
|
||||||
|
const startTimestamp = Math.trunc(start);
|
||||||
|
const endTimestamp = Math.trunc(end);
|
||||||
|
|
||||||
|
setGraphTimeIntervals((prev) => {
|
||||||
|
const newIntervals = [...prev];
|
||||||
|
newIntervals[graphIndex] = {
|
||||||
|
start: Math.floor(startTimestamp / 1000),
|
||||||
|
end: Math.floor(endTimestamp / 1000),
|
||||||
|
};
|
||||||
|
return newIntervals;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
const options = useMemo(
|
const options = useMemo(
|
||||||
() =>
|
() =>
|
||||||
queries.map(({ data }, idx) =>
|
queries.map(({ data }, idx) =>
|
||||||
@ -78,12 +117,12 @@ function Metrics({
|
|||||||
yAxisUnit: hostWidgetInfo[idx].yAxisUnit,
|
yAxisUnit: hostWidgetInfo[idx].yAxisUnit,
|
||||||
softMax: null,
|
softMax: null,
|
||||||
softMin: null,
|
softMin: null,
|
||||||
minTimeScale: timeRange.startTime,
|
minTimeScale: graphTimeIntervals[idx].start,
|
||||||
maxTimeScale: timeRange.endTime,
|
maxTimeScale: graphTimeIntervals[idx].end,
|
||||||
enableZoom: true,
|
onDragSelect: (start, end) => onDragSelect(start, end, idx),
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
[queries, isDarkMode, dimensions, timeRange.startTime, timeRange.endTime],
|
[queries, isDarkMode, dimensions, graphTimeIntervals, onDragSelect],
|
||||||
);
|
);
|
||||||
|
|
||||||
const renderCardContent = (
|
const renderCardContent = (
|
||||||
|
@ -58,7 +58,7 @@ function HostsListControls({
|
|||||||
|
|
||||||
<div className="time-selector">
|
<div className="time-selector">
|
||||||
<DateTimeSelectionV2
|
<DateTimeSelectionV2
|
||||||
showAutoRefresh={false}
|
showAutoRefresh
|
||||||
showRefreshText={false}
|
showRefreshText={false}
|
||||||
hideShareModal
|
hideShareModal
|
||||||
/>
|
/>
|
||||||
|
@ -59,11 +59,26 @@ function K8sClustersList({
|
|||||||
(state) => state.globalTime,
|
(state) => state.globalTime,
|
||||||
);
|
);
|
||||||
|
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
|
||||||
|
|
||||||
const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);
|
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
|
|
||||||
|
const [currentPage, setCurrentPage] = useState(() => {
|
||||||
|
const page = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.CURRENT_PAGE);
|
||||||
|
if (page) {
|
||||||
|
return parseInt(page, 10);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
const [filtersInitialised, setFiltersInitialised] = useState(false);
|
||||||
|
const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setSearchParams({
|
||||||
|
...Object.fromEntries(searchParams.entries()),
|
||||||
|
[INFRA_MONITORING_K8S_PARAMS_KEYS.CURRENT_PAGE]: currentPage.toString(),
|
||||||
|
});
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [currentPage]);
|
||||||
|
|
||||||
const [orderBy, setOrderBy] = useState<{
|
const [orderBy, setOrderBy] = useState<{
|
||||||
columnName: string;
|
columnName: string;
|
||||||
order: 'asc' | 'desc';
|
order: 'asc' | 'desc';
|
||||||
@ -115,7 +130,9 @@ function K8sClustersList({
|
|||||||
|
|
||||||
// Reset pagination every time quick filters are changed
|
// Reset pagination every time quick filters are changed
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCurrentPage(1);
|
if (quickFiltersLastUpdated !== -1) {
|
||||||
|
setCurrentPage(1);
|
||||||
|
}
|
||||||
}, [quickFiltersLastUpdated]);
|
}, [quickFiltersLastUpdated]);
|
||||||
|
|
||||||
const createFiltersForSelectedRowData = (
|
const createFiltersForSelectedRowData = (
|
||||||
@ -309,7 +326,11 @@ function K8sClustersList({
|
|||||||
const handleFiltersChange = useCallback(
|
const handleFiltersChange = useCallback(
|
||||||
(value: IBuilderQuery['filters']): void => {
|
(value: IBuilderQuery['filters']): void => {
|
||||||
handleChangeQueryData('filters', value);
|
handleChangeQueryData('filters', value);
|
||||||
setCurrentPage(1);
|
if (filtersInitialised) {
|
||||||
|
setCurrentPage(1);
|
||||||
|
} else {
|
||||||
|
setFiltersInitialised(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (value.items.length > 0) {
|
if (value.items.length > 0) {
|
||||||
logEvent(InfraMonitoringEvents.FilterApplied, {
|
logEvent(InfraMonitoringEvents.FilterApplied, {
|
||||||
@ -319,7 +340,8 @@ function K8sClustersList({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[handleChangeQueryData],
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -61,11 +61,26 @@ function K8sDaemonSetsList({
|
|||||||
(state) => state.globalTime,
|
(state) => state.globalTime,
|
||||||
);
|
);
|
||||||
|
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
|
|
||||||
|
const [currentPage, setCurrentPage] = useState(() => {
|
||||||
|
const page = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.CURRENT_PAGE);
|
||||||
|
if (page) {
|
||||||
|
return parseInt(page, 10);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
const [filtersInitialised, setFiltersInitialised] = useState(false);
|
||||||
const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);
|
const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setSearchParams({
|
||||||
|
...Object.fromEntries(searchParams.entries()),
|
||||||
|
[INFRA_MONITORING_K8S_PARAMS_KEYS.CURRENT_PAGE]: currentPage.toString(),
|
||||||
|
});
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [currentPage]);
|
||||||
|
|
||||||
const [orderBy, setOrderBy] = useState<{
|
const [orderBy, setOrderBy] = useState<{
|
||||||
columnName: string;
|
columnName: string;
|
||||||
order: 'asc' | 'desc';
|
order: 'asc' | 'desc';
|
||||||
@ -117,7 +132,9 @@ function K8sDaemonSetsList({
|
|||||||
|
|
||||||
// Reset pagination every time quick filters are changed
|
// Reset pagination every time quick filters are changed
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCurrentPage(1);
|
if (quickFiltersLastUpdated !== -1) {
|
||||||
|
setCurrentPage(1);
|
||||||
|
}
|
||||||
}, [quickFiltersLastUpdated]);
|
}, [quickFiltersLastUpdated]);
|
||||||
|
|
||||||
const createFiltersForSelectedRowData = (
|
const createFiltersForSelectedRowData = (
|
||||||
@ -313,7 +330,11 @@ function K8sDaemonSetsList({
|
|||||||
const handleFiltersChange = useCallback(
|
const handleFiltersChange = useCallback(
|
||||||
(value: IBuilderQuery['filters']): void => {
|
(value: IBuilderQuery['filters']): void => {
|
||||||
handleChangeQueryData('filters', value);
|
handleChangeQueryData('filters', value);
|
||||||
setCurrentPage(1);
|
if (filtersInitialised) {
|
||||||
|
setCurrentPage(1);
|
||||||
|
} else {
|
||||||
|
setFiltersInitialised(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (value.items.length > 0) {
|
if (value.items.length > 0) {
|
||||||
logEvent(InfraMonitoringEvents.FilterApplied, {
|
logEvent(InfraMonitoringEvents.FilterApplied, {
|
||||||
@ -323,7 +344,8 @@ function K8sDaemonSetsList({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[handleChangeQueryData],
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -61,10 +61,26 @@ function K8sDeploymentsList({
|
|||||||
(state) => state.globalTime,
|
(state) => state.globalTime,
|
||||||
);
|
);
|
||||||
|
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
|
|
||||||
|
const [currentPage, setCurrentPage] = useState(() => {
|
||||||
|
const page = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.CURRENT_PAGE);
|
||||||
|
if (page) {
|
||||||
|
return parseInt(page, 10);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
const [filtersInitialised, setFiltersInitialised] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setSearchParams({
|
||||||
|
...Object.fromEntries(searchParams.entries()),
|
||||||
|
[INFRA_MONITORING_K8S_PARAMS_KEYS.CURRENT_PAGE]: currentPage.toString(),
|
||||||
|
});
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [currentPage]);
|
||||||
|
|
||||||
const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);
|
const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
|
||||||
|
|
||||||
const [orderBy, setOrderBy] = useState<{
|
const [orderBy, setOrderBy] = useState<{
|
||||||
columnName: string;
|
columnName: string;
|
||||||
@ -117,7 +133,9 @@ function K8sDeploymentsList({
|
|||||||
|
|
||||||
// Reset pagination every time quick filters are changed
|
// Reset pagination every time quick filters are changed
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCurrentPage(1);
|
if (quickFiltersLastUpdated !== -1) {
|
||||||
|
setCurrentPage(1);
|
||||||
|
}
|
||||||
}, [quickFiltersLastUpdated]);
|
}, [quickFiltersLastUpdated]);
|
||||||
|
|
||||||
const createFiltersForSelectedRowData = (
|
const createFiltersForSelectedRowData = (
|
||||||
@ -315,7 +333,11 @@ function K8sDeploymentsList({
|
|||||||
const handleFiltersChange = useCallback(
|
const handleFiltersChange = useCallback(
|
||||||
(value: IBuilderQuery['filters']): void => {
|
(value: IBuilderQuery['filters']): void => {
|
||||||
handleChangeQueryData('filters', value);
|
handleChangeQueryData('filters', value);
|
||||||
setCurrentPage(1);
|
if (filtersInitialised) {
|
||||||
|
setCurrentPage(1);
|
||||||
|
} else {
|
||||||
|
setFiltersInitialised(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (value.items.length > 0) {
|
if (value.items.length > 0) {
|
||||||
logEvent(InfraMonitoringEvents.FilterApplied, {
|
logEvent(InfraMonitoringEvents.FilterApplied, {
|
||||||
@ -325,7 +347,8 @@ function K8sDeploymentsList({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[handleChangeQueryData],
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -259,7 +259,7 @@ export default function Events({
|
|||||||
</div>
|
</div>
|
||||||
<div className="datetime-section">
|
<div className="datetime-section">
|
||||||
<DateTimeSelectionV2
|
<DateTimeSelectionV2
|
||||||
showAutoRefresh={false}
|
showAutoRefresh
|
||||||
showRefreshText={false}
|
showRefreshText={false}
|
||||||
hideShareModal
|
hideShareModal
|
||||||
isModalTimeSelection={isModalTimeSelection}
|
isModalTimeSelection={isModalTimeSelection}
|
||||||
|
@ -86,7 +86,7 @@ function EntityLogsDetailedView({
|
|||||||
</div>
|
</div>
|
||||||
<div className="datetime-section">
|
<div className="datetime-section">
|
||||||
<DateTimeSelectionV2
|
<DateTimeSelectionV2
|
||||||
showAutoRefresh={false}
|
showAutoRefresh
|
||||||
showRefreshText={false}
|
showRefreshText={false}
|
||||||
hideShareModal
|
hideShareModal
|
||||||
isModalTimeSelection={isModalTimeSelection}
|
isModalTimeSelection={isModalTimeSelection}
|
||||||
|
@ -23,7 +23,7 @@ import {
|
|||||||
} from 'lib/dashboard/getQueryResults';
|
} from 'lib/dashboard/getQueryResults';
|
||||||
import { getUPlotChartOptions } from 'lib/uPlotLib/getUplotChartOptions';
|
import { getUPlotChartOptions } from 'lib/uPlotLib/getUplotChartOptions';
|
||||||
import { getUPlotChartData } from 'lib/uPlotLib/utils/getUplotChartData';
|
import { getUPlotChartData } from 'lib/uPlotLib/utils/getUplotChartData';
|
||||||
import { useMemo, useRef } from 'react';
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { useQueries, UseQueryResult } from 'react-query';
|
import { useQueries, UseQueryResult } from 'react-query';
|
||||||
import { SuccessResponse } from 'types/api';
|
import { SuccessResponse } from 'types/api';
|
||||||
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
|
import { MetricRangePayloadProps } from 'types/api/metrics/getQueryRange';
|
||||||
@ -94,6 +94,45 @@ function EntityMetrics<T>({
|
|||||||
[queries],
|
[queries],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const [graphTimeIntervals, setGraphTimeIntervals] = useState<
|
||||||
|
{
|
||||||
|
start: number;
|
||||||
|
end: number;
|
||||||
|
}[]
|
||||||
|
>(
|
||||||
|
new Array(queries.length).fill({
|
||||||
|
start: timeRange.startTime,
|
||||||
|
end: timeRange.endTime,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setGraphTimeIntervals(
|
||||||
|
new Array(queries.length).fill({
|
||||||
|
start: timeRange.startTime,
|
||||||
|
end: timeRange.endTime,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [timeRange]);
|
||||||
|
|
||||||
|
const onDragSelect = useCallback(
|
||||||
|
(start: number, end: number, graphIndex: number) => {
|
||||||
|
const startTimestamp = Math.trunc(start);
|
||||||
|
const endTimestamp = Math.trunc(end);
|
||||||
|
|
||||||
|
setGraphTimeIntervals((prev) => {
|
||||||
|
const newIntervals = [...prev];
|
||||||
|
newIntervals[graphIndex] = {
|
||||||
|
start: Math.floor(startTimestamp / 1000),
|
||||||
|
end: Math.floor(endTimestamp / 1000),
|
||||||
|
};
|
||||||
|
return newIntervals;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
const options = useMemo(
|
const options = useMemo(
|
||||||
() =>
|
() =>
|
||||||
queries.map(({ data }, idx) => {
|
queries.map(({ data }, idx) => {
|
||||||
@ -108,9 +147,9 @@ function EntityMetrics<T>({
|
|||||||
yAxisUnit: entityWidgetInfo[idx].yAxisUnit,
|
yAxisUnit: entityWidgetInfo[idx].yAxisUnit,
|
||||||
softMax: null,
|
softMax: null,
|
||||||
softMin: null,
|
softMin: null,
|
||||||
minTimeScale: timeRange.startTime,
|
minTimeScale: graphTimeIntervals[idx].start,
|
||||||
maxTimeScale: timeRange.endTime,
|
maxTimeScale: graphTimeIntervals[idx].end,
|
||||||
enableZoom: true,
|
onDragSelect: (start, end) => onDragSelect(start, end, idx),
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
[
|
[
|
||||||
@ -118,8 +157,8 @@ function EntityMetrics<T>({
|
|||||||
isDarkMode,
|
isDarkMode,
|
||||||
dimensions,
|
dimensions,
|
||||||
entityWidgetInfo,
|
entityWidgetInfo,
|
||||||
timeRange.startTime,
|
graphTimeIntervals,
|
||||||
timeRange.endTime,
|
onDragSelect,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ function EntityTraces({
|
|||||||
</div>
|
</div>
|
||||||
<div className="datetime-section">
|
<div className="datetime-section">
|
||||||
<DateTimeSelectionV2
|
<DateTimeSelectionV2
|
||||||
showAutoRefresh={false}
|
showAutoRefresh
|
||||||
showRefreshText={false}
|
showRefreshText={false}
|
||||||
hideShareModal
|
hideShareModal
|
||||||
isModalTimeSelection={isModalTimeSelection}
|
isModalTimeSelection={isModalTimeSelection}
|
||||||
|
@ -60,11 +60,26 @@ function K8sJobsList({
|
|||||||
const { maxTime, minTime } = useSelector<AppState, GlobalReducer>(
|
const { maxTime, minTime } = useSelector<AppState, GlobalReducer>(
|
||||||
(state) => state.globalTime,
|
(state) => state.globalTime,
|
||||||
);
|
);
|
||||||
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
|
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
const [currentPage, setCurrentPage] = useState(() => {
|
||||||
|
const page = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.CURRENT_PAGE);
|
||||||
|
if (page) {
|
||||||
|
return parseInt(page, 10);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
const [filtersInitialised, setFiltersInitialised] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setSearchParams({
|
||||||
|
...Object.fromEntries(searchParams.entries()),
|
||||||
|
[INFRA_MONITORING_K8S_PARAMS_KEYS.CURRENT_PAGE]: currentPage.toString(),
|
||||||
|
});
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [currentPage]);
|
||||||
|
|
||||||
const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);
|
const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
|
||||||
|
|
||||||
const [orderBy, setOrderBy] = useState<{
|
const [orderBy, setOrderBy] = useState<{
|
||||||
columnName: string;
|
columnName: string;
|
||||||
@ -112,7 +127,9 @@ function K8sJobsList({
|
|||||||
|
|
||||||
// Reset pagination every time quick filters are changed
|
// Reset pagination every time quick filters are changed
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCurrentPage(1);
|
if (quickFiltersLastUpdated !== -1) {
|
||||||
|
setCurrentPage(1);
|
||||||
|
}
|
||||||
}, [quickFiltersLastUpdated]);
|
}, [quickFiltersLastUpdated]);
|
||||||
|
|
||||||
const createFiltersForSelectedRowData = (
|
const createFiltersForSelectedRowData = (
|
||||||
@ -300,7 +317,11 @@ function K8sJobsList({
|
|||||||
const handleFiltersChange = useCallback(
|
const handleFiltersChange = useCallback(
|
||||||
(value: IBuilderQuery['filters']): void => {
|
(value: IBuilderQuery['filters']): void => {
|
||||||
handleChangeQueryData('filters', value);
|
handleChangeQueryData('filters', value);
|
||||||
setCurrentPage(1);
|
if (filtersInitialised) {
|
||||||
|
setCurrentPage(1);
|
||||||
|
} else {
|
||||||
|
setFiltersInitialised(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (value.items.length > 0) {
|
if (value.items.length > 0) {
|
||||||
logEvent(InfraMonitoringEvents.FilterApplied, {
|
logEvent(InfraMonitoringEvents.FilterApplied, {
|
||||||
@ -310,7 +331,8 @@ function K8sJobsList({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[handleChangeQueryData],
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -136,7 +136,7 @@ function K8sHeader({
|
|||||||
|
|
||||||
<div className="k8s-list-controls-right">
|
<div className="k8s-list-controls-right">
|
||||||
<DateTimeSelectionV2
|
<DateTimeSelectionV2
|
||||||
showAutoRefresh={false}
|
showAutoRefresh
|
||||||
showRefreshText={false}
|
showRefreshText={false}
|
||||||
hideShareModal
|
hideShareModal
|
||||||
/>
|
/>
|
||||||
|
@ -60,11 +60,26 @@ function K8sNamespacesList({
|
|||||||
(state) => state.globalTime,
|
(state) => state.globalTime,
|
||||||
);
|
);
|
||||||
|
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
|
||||||
|
|
||||||
const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);
|
const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
|
|
||||||
|
const [currentPage, setCurrentPage] = useState(() => {
|
||||||
|
const page = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.CURRENT_PAGE);
|
||||||
|
if (page) {
|
||||||
|
return parseInt(page, 10);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
const [filtersInitialised, setFiltersInitialised] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setSearchParams({
|
||||||
|
...Object.fromEntries(searchParams.entries()),
|
||||||
|
[INFRA_MONITORING_K8S_PARAMS_KEYS.CURRENT_PAGE]: currentPage.toString(),
|
||||||
|
});
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [currentPage]);
|
||||||
|
|
||||||
const [orderBy, setOrderBy] = useState<{
|
const [orderBy, setOrderBy] = useState<{
|
||||||
columnName: string;
|
columnName: string;
|
||||||
order: 'asc' | 'desc';
|
order: 'asc' | 'desc';
|
||||||
@ -116,7 +131,9 @@ function K8sNamespacesList({
|
|||||||
|
|
||||||
// Reset pagination every time quick filters are changed
|
// Reset pagination every time quick filters are changed
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCurrentPage(1);
|
if (quickFiltersLastUpdated !== -1) {
|
||||||
|
setCurrentPage(1);
|
||||||
|
}
|
||||||
}, [quickFiltersLastUpdated]);
|
}, [quickFiltersLastUpdated]);
|
||||||
|
|
||||||
const createFiltersForSelectedRowData = (
|
const createFiltersForSelectedRowData = (
|
||||||
@ -312,7 +329,11 @@ function K8sNamespacesList({
|
|||||||
const handleFiltersChange = useCallback(
|
const handleFiltersChange = useCallback(
|
||||||
(value: IBuilderQuery['filters']): void => {
|
(value: IBuilderQuery['filters']): void => {
|
||||||
handleChangeQueryData('filters', value);
|
handleChangeQueryData('filters', value);
|
||||||
setCurrentPage(1);
|
if (filtersInitialised) {
|
||||||
|
setCurrentPage(1);
|
||||||
|
} else {
|
||||||
|
setFiltersInitialised(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (value.items.length > 0) {
|
if (value.items.length > 0) {
|
||||||
logEvent(InfraMonitoringEvents.FilterApplied, {
|
logEvent(InfraMonitoringEvents.FilterApplied, {
|
||||||
@ -322,7 +343,8 @@ function K8sNamespacesList({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[handleChangeQueryData],
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -59,12 +59,26 @@ function K8sNodesList({
|
|||||||
const { maxTime, minTime } = useSelector<AppState, GlobalReducer>(
|
const { maxTime, minTime } = useSelector<AppState, GlobalReducer>(
|
||||||
(state) => state.globalTime,
|
(state) => state.globalTime,
|
||||||
);
|
);
|
||||||
|
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
|
||||||
|
|
||||||
const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);
|
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
|
|
||||||
|
const [currentPage, setCurrentPage] = useState(() => {
|
||||||
|
const page = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.CURRENT_PAGE);
|
||||||
|
if (page) {
|
||||||
|
return parseInt(page, 10);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
const [filtersInitialised, setFiltersInitialised] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setSearchParams({
|
||||||
|
...Object.fromEntries(searchParams.entries()),
|
||||||
|
[INFRA_MONITORING_K8S_PARAMS_KEYS.CURRENT_PAGE]: currentPage.toString(),
|
||||||
|
});
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [currentPage]);
|
||||||
|
|
||||||
|
const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);
|
||||||
const [orderBy, setOrderBy] = useState<{
|
const [orderBy, setOrderBy] = useState<{
|
||||||
columnName: string;
|
columnName: string;
|
||||||
order: 'asc' | 'desc';
|
order: 'asc' | 'desc';
|
||||||
@ -111,7 +125,9 @@ function K8sNodesList({
|
|||||||
|
|
||||||
// Reset pagination every time quick filters are changed
|
// Reset pagination every time quick filters are changed
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCurrentPage(1);
|
if (quickFiltersLastUpdated !== -1) {
|
||||||
|
setCurrentPage(1);
|
||||||
|
}
|
||||||
}, [quickFiltersLastUpdated]);
|
}, [quickFiltersLastUpdated]);
|
||||||
|
|
||||||
const createFiltersForSelectedRowData = (
|
const createFiltersForSelectedRowData = (
|
||||||
@ -299,7 +315,11 @@ function K8sNodesList({
|
|||||||
const handleFiltersChange = useCallback(
|
const handleFiltersChange = useCallback(
|
||||||
(value: IBuilderQuery['filters']): void => {
|
(value: IBuilderQuery['filters']): void => {
|
||||||
handleChangeQueryData('filters', value);
|
handleChangeQueryData('filters', value);
|
||||||
setCurrentPage(1);
|
if (filtersInitialised) {
|
||||||
|
setCurrentPage(1);
|
||||||
|
} else {
|
||||||
|
setFiltersInitialised(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (value.items.length > 0) {
|
if (value.items.length > 0) {
|
||||||
logEvent(InfraMonitoringEvents.FilterApplied, {
|
logEvent(InfraMonitoringEvents.FilterApplied, {
|
||||||
@ -309,7 +329,8 @@ function K8sNodesList({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[handleChangeQueryData],
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -64,7 +64,22 @@ function K8sPodsList({
|
|||||||
);
|
);
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
|
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
const [currentPage, setCurrentPage] = useState(() => {
|
||||||
|
const page = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.CURRENT_PAGE);
|
||||||
|
if (page) {
|
||||||
|
return parseInt(page, 10);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
const [filtersInitialised, setFiltersInitialised] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setSearchParams({
|
||||||
|
...Object.fromEntries(searchParams.entries()),
|
||||||
|
[INFRA_MONITORING_K8S_PARAMS_KEYS.CURRENT_PAGE]: currentPage.toString(),
|
||||||
|
});
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [currentPage]);
|
||||||
|
|
||||||
const [addedColumns, setAddedColumns] = useState<IEntityColumn[]>([]);
|
const [addedColumns, setAddedColumns] = useState<IEntityColumn[]>([]);
|
||||||
|
|
||||||
@ -123,7 +138,9 @@ function K8sPodsList({
|
|||||||
|
|
||||||
// Reset pagination every time quick filters are changed
|
// Reset pagination every time quick filters are changed
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCurrentPage(1);
|
if (quickFiltersLastUpdated !== -1) {
|
||||||
|
setCurrentPage(1);
|
||||||
|
}
|
||||||
}, [quickFiltersLastUpdated]);
|
}, [quickFiltersLastUpdated]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -314,7 +331,11 @@ function K8sPodsList({
|
|||||||
const handleFiltersChange = useCallback(
|
const handleFiltersChange = useCallback(
|
||||||
(value: IBuilderQuery['filters']): void => {
|
(value: IBuilderQuery['filters']): void => {
|
||||||
handleChangeQueryData('filters', value);
|
handleChangeQueryData('filters', value);
|
||||||
setCurrentPage(1);
|
if (filtersInitialised) {
|
||||||
|
setCurrentPage(1);
|
||||||
|
} else {
|
||||||
|
setFiltersInitialised(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (value.items.length > 0) {
|
if (value.items.length > 0) {
|
||||||
logEvent(InfraMonitoringEvents.FilterApplied, {
|
logEvent(InfraMonitoringEvents.FilterApplied, {
|
||||||
@ -324,7 +345,8 @@ function K8sPodsList({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[handleChangeQueryData],
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleGroupByChange = useCallback(
|
const handleGroupByChange = useCallback(
|
||||||
|
@ -60,10 +60,26 @@ function K8sStatefulSetsList({
|
|||||||
(state) => state.globalTime,
|
(state) => state.globalTime,
|
||||||
);
|
);
|
||||||
|
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
|
|
||||||
|
const [currentPage, setCurrentPage] = useState(() => {
|
||||||
|
const page = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.CURRENT_PAGE);
|
||||||
|
if (page) {
|
||||||
|
return parseInt(page, 10);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
const [filtersInitialised, setFiltersInitialised] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setSearchParams({
|
||||||
|
...Object.fromEntries(searchParams.entries()),
|
||||||
|
[INFRA_MONITORING_K8S_PARAMS_KEYS.CURRENT_PAGE]: currentPage.toString(),
|
||||||
|
});
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [currentPage]);
|
||||||
|
|
||||||
const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);
|
const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
|
||||||
|
|
||||||
const [orderBy, setOrderBy] = useState<{
|
const [orderBy, setOrderBy] = useState<{
|
||||||
columnName: string;
|
columnName: string;
|
||||||
@ -116,7 +132,9 @@ function K8sStatefulSetsList({
|
|||||||
|
|
||||||
// Reset pagination every time quick filters are changed
|
// Reset pagination every time quick filters are changed
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCurrentPage(1);
|
if (quickFiltersLastUpdated !== -1) {
|
||||||
|
setCurrentPage(1);
|
||||||
|
}
|
||||||
}, [quickFiltersLastUpdated]);
|
}, [quickFiltersLastUpdated]);
|
||||||
|
|
||||||
const createFiltersForSelectedRowData = (
|
const createFiltersForSelectedRowData = (
|
||||||
@ -314,7 +332,11 @@ function K8sStatefulSetsList({
|
|||||||
const handleFiltersChange = useCallback(
|
const handleFiltersChange = useCallback(
|
||||||
(value: IBuilderQuery['filters']): void => {
|
(value: IBuilderQuery['filters']): void => {
|
||||||
handleChangeQueryData('filters', value);
|
handleChangeQueryData('filters', value);
|
||||||
setCurrentPage(1);
|
if (filtersInitialised) {
|
||||||
|
setCurrentPage(1);
|
||||||
|
} else {
|
||||||
|
setFiltersInitialised(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (value.items.length > 0) {
|
if (value.items.length > 0) {
|
||||||
logEvent(InfraMonitoringEvents.FilterApplied, {
|
logEvent(InfraMonitoringEvents.FilterApplied, {
|
||||||
@ -324,7 +346,8 @@ function K8sStatefulSetsList({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[handleChangeQueryData],
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -60,10 +60,26 @@ function K8sVolumesList({
|
|||||||
(state) => state.globalTime,
|
(state) => state.globalTime,
|
||||||
);
|
);
|
||||||
|
|
||||||
const [currentPage, setCurrentPage] = useState(1);
|
const [searchParams, setSearchParams] = useSearchParams();
|
||||||
|
|
||||||
|
const [currentPage, setCurrentPage] = useState(() => {
|
||||||
|
const page = searchParams.get(INFRA_MONITORING_K8S_PARAMS_KEYS.CURRENT_PAGE);
|
||||||
|
if (page) {
|
||||||
|
return parseInt(page, 10);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
});
|
||||||
|
const [filtersInitialised, setFiltersInitialised] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setSearchParams({
|
||||||
|
...Object.fromEntries(searchParams.entries()),
|
||||||
|
[INFRA_MONITORING_K8S_PARAMS_KEYS.CURRENT_PAGE]: currentPage.toString(),
|
||||||
|
});
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, [currentPage]);
|
||||||
|
|
||||||
const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);
|
const [expandedRowKeys, setExpandedRowKeys] = useState<string[]>([]);
|
||||||
const [searchParams, setSearchParams] = useSearchParams();
|
|
||||||
|
|
||||||
const [orderBy, setOrderBy] = useState<{
|
const [orderBy, setOrderBy] = useState<{
|
||||||
columnName: string;
|
columnName: string;
|
||||||
@ -116,7 +132,9 @@ function K8sVolumesList({
|
|||||||
|
|
||||||
// Reset pagination every time quick filters are changed
|
// Reset pagination every time quick filters are changed
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCurrentPage(1);
|
if (quickFiltersLastUpdated !== -1) {
|
||||||
|
setCurrentPage(1);
|
||||||
|
}
|
||||||
}, [quickFiltersLastUpdated]);
|
}, [quickFiltersLastUpdated]);
|
||||||
|
|
||||||
const createFiltersForSelectedRowData = (
|
const createFiltersForSelectedRowData = (
|
||||||
@ -304,7 +322,11 @@ function K8sVolumesList({
|
|||||||
const handleFiltersChange = useCallback(
|
const handleFiltersChange = useCallback(
|
||||||
(value: IBuilderQuery['filters']): void => {
|
(value: IBuilderQuery['filters']): void => {
|
||||||
handleChangeQueryData('filters', value);
|
handleChangeQueryData('filters', value);
|
||||||
setCurrentPage(1);
|
if (filtersInitialised) {
|
||||||
|
setCurrentPage(1);
|
||||||
|
} else {
|
||||||
|
setFiltersInitialised(true);
|
||||||
|
}
|
||||||
|
|
||||||
if (value.items.length > 0) {
|
if (value.items.length > 0) {
|
||||||
logEvent(InfraMonitoringEvents.FilterApplied, {
|
logEvent(InfraMonitoringEvents.FilterApplied, {
|
||||||
@ -314,7 +336,8 @@ function K8sVolumesList({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[handleChangeQueryData],
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -538,4 +538,5 @@ export const INFRA_MONITORING_K8S_PARAMS_KEYS = {
|
|||||||
TRACES_FILTERS: 'tracesFilters',
|
TRACES_FILTERS: 'tracesFilters',
|
||||||
EVENTS_FILTERS: 'eventsFilters',
|
EVENTS_FILTERS: 'eventsFilters',
|
||||||
HOSTS_FILTERS: 'hostsFilters',
|
HOSTS_FILTERS: 'hostsFilters',
|
||||||
|
CURRENT_PAGE: 'currentPage',
|
||||||
};
|
};
|
||||||
|
@ -835,6 +835,7 @@ function DateTimeSelection({
|
|||||||
onCustomDateHandler={onCustomDateHandler}
|
onCustomDateHandler={onCustomDateHandler}
|
||||||
customDateTimeVisible={customDateTimeVisible}
|
customDateTimeVisible={customDateTimeVisible}
|
||||||
setCustomDTPickerVisible={setCustomDTPickerVisible}
|
setCustomDTPickerVisible={setCustomDTPickerVisible}
|
||||||
|
onTimeChange={onTimeChange}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{showAutoRefresh && selectedTime !== 'custom' && (
|
{showAutoRefresh && selectedTime !== 'custom' && (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user