mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 03:15:53 +08:00
chore: fix visibility toggle in host filters (#6976)
This commit is contained in:
parent
6dfea14219
commit
ffd72cf406
@ -1,7 +1,7 @@
|
|||||||
import './InfraMonitoring.styles.scss';
|
import './InfraMonitoring.styles.scss';
|
||||||
|
|
||||||
import { VerticalAlignTopOutlined } from '@ant-design/icons';
|
import { VerticalAlignTopOutlined } from '@ant-design/icons';
|
||||||
import { Tooltip, Typography } from 'antd';
|
import { Button, Tooltip, Typography } from 'antd';
|
||||||
import logEvent from 'api/common/logEvent';
|
import logEvent from 'api/common/logEvent';
|
||||||
import { HostListPayload } from 'api/infraMonitoring/getHostLists';
|
import { HostListPayload } from 'api/infraMonitoring/getHostLists';
|
||||||
import HostMetricDetail from 'components/HostMetricsDetail';
|
import HostMetricDetail from 'components/HostMetricsDetail';
|
||||||
@ -11,6 +11,7 @@ import { usePageSize } from 'container/InfraMonitoringK8s/utils';
|
|||||||
import { useGetHostList } from 'hooks/infraMonitoring/useGetHostList';
|
import { useGetHostList } from 'hooks/infraMonitoring/useGetHostList';
|
||||||
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
|
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
|
||||||
import { useQueryOperations } from 'hooks/queryBuilder/useQueryBuilderOperations';
|
import { useQueryOperations } from 'hooks/queryBuilder/useQueryBuilderOperations';
|
||||||
|
import { Filter } from 'lucide-react';
|
||||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { AppState } from 'store/reducers';
|
import { AppState } from 'store/reducers';
|
||||||
@ -140,7 +141,21 @@ function HostsList(): JSX.Element {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="hosts-list-table-container">
|
<div className="hosts-list-table-container">
|
||||||
|
<div className="hosts-list-table-header">
|
||||||
|
{!showFilters && (
|
||||||
|
<div className="quick-filters-toggle-container">
|
||||||
|
<Button
|
||||||
|
className="periscope-btn ghost"
|
||||||
|
type="text"
|
||||||
|
size="small"
|
||||||
|
onClick={handleFilterVisibilityChange}
|
||||||
|
>
|
||||||
|
<Filter size={14} />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
<HostsListControls handleFiltersChange={handleFiltersChange} />
|
<HostsListControls handleFiltersChange={handleFiltersChange} />
|
||||||
|
</div>
|
||||||
<HostsListTable
|
<HostsListTable
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
isFetching={isFetching}
|
isFetching={isFetching}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.hosts-list-controls {
|
.hosts-list-controls {
|
||||||
|
flex: 1;
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -73,6 +74,16 @@
|
|||||||
|
|
||||||
.hosts-list-table-container {
|
.hosts-list-table-container {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
|
||||||
|
.hosts-list-table-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.quick-filters-toggle-container {
|
||||||
|
padding: 0 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.hosts-list-table {
|
.hosts-list-table {
|
||||||
|
@ -37,6 +37,25 @@ function K8sFiltersSidePanel({
|
|||||||
}
|
}
|
||||||
}, [searchValue]);
|
}, [searchValue]);
|
||||||
|
|
||||||
|
// Close side panel when clicking outside of it
|
||||||
|
useEffect(() => {
|
||||||
|
const handleClickOutside = (event: MouseEvent) => {
|
||||||
|
if (
|
||||||
|
sidePanelRef.current &&
|
||||||
|
!sidePanelRef.current.contains(event.target as Node)
|
||||||
|
) {
|
||||||
|
onClose();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
document.addEventListener('mousedown', handleClickOutside);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
document.removeEventListener('mousedown', handleClickOutside);
|
||||||
|
};
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="k8s-filters-side-panel-container">
|
<div className="k8s-filters-side-panel-container">
|
||||||
<div className="k8s-filters-side-panel" ref={sidePanelRef}>
|
<div className="k8s-filters-side-panel" ref={sidePanelRef}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user