mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-13 02:29:00 +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 { VerticalAlignTopOutlined } from '@ant-design/icons';
|
||||
import { Tooltip, Typography } from 'antd';
|
||||
import { Button, Tooltip, Typography } from 'antd';
|
||||
import logEvent from 'api/common/logEvent';
|
||||
import { HostListPayload } from 'api/infraMonitoring/getHostLists';
|
||||
import HostMetricDetail from 'components/HostMetricsDetail';
|
||||
@ -11,6 +11,7 @@ import { usePageSize } from 'container/InfraMonitoringK8s/utils';
|
||||
import { useGetHostList } from 'hooks/infraMonitoring/useGetHostList';
|
||||
import { useQueryBuilder } from 'hooks/queryBuilder/useQueryBuilder';
|
||||
import { useQueryOperations } from 'hooks/queryBuilder/useQueryBuilderOperations';
|
||||
import { Filter } from 'lucide-react';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { AppState } from 'store/reducers';
|
||||
@ -140,7 +141,21 @@ function HostsList(): JSX.Element {
|
||||
</div>
|
||||
)}
|
||||
<div className="hosts-list-table-container">
|
||||
<HostsListControls handleFiltersChange={handleFiltersChange} />
|
||||
<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} />
|
||||
</div>
|
||||
<HostsListTable
|
||||
isLoading={isLoading}
|
||||
isFetching={isFetching}
|
||||
|
@ -11,6 +11,7 @@
|
||||
}
|
||||
|
||||
.hosts-list-controls {
|
||||
flex: 1;
|
||||
padding: 8px;
|
||||
|
||||
display: flex;
|
||||
@ -73,6 +74,16 @@
|
||||
|
||||
.hosts-list-table-container {
|
||||
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 {
|
||||
|
@ -37,6 +37,25 @@ function K8sFiltersSidePanel({
|
||||
}
|
||||
}, [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 (
|
||||
<div className="k8s-filters-side-panel-container">
|
||||
<div className="k8s-filters-side-panel" ref={sidePanelRef}>
|
||||
|
Loading…
x
Reference in New Issue
Block a user