mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
Fleet UI: Filter by low disk space hosts on various platforms (#8647)
This commit is contained in:
parent
139a462ebe
commit
3a9f45d6f8
7 changed files with 25 additions and 3 deletions
1
changes/bug-8546-low-disk-space-by-platform-filter
Normal file
1
changes/bug-8546-low-disk-space-by-platform-filter
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
* UI allows for filtering low disk space hosts by platform!
|
||||||
|
|
@ -413,6 +413,7 @@ const DashboardPage = (): JSX.Element => {
|
||||||
lowDiskSpaceCount={lowDiskSpaceCount}
|
lowDiskSpaceCount={lowDiskSpaceCount}
|
||||||
isLoadingHosts={isHostSummaryFetching}
|
isLoadingHosts={isHostSummaryFetching}
|
||||||
showHostsUI={showHostsUI}
|
showHostsUI={showHostsUI}
|
||||||
|
selectedPlatformLabelId={selectedPlatformLabelId}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ interface IHostSummaryProps {
|
||||||
lowDiskSpaceCount: number;
|
lowDiskSpaceCount: number;
|
||||||
isLoadingHosts: boolean;
|
isLoadingHosts: boolean;
|
||||||
showHostsUI: boolean;
|
showHostsUI: boolean;
|
||||||
|
selectedPlatformLabelId?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const LowDiskSpaceHosts = ({
|
const LowDiskSpaceHosts = ({
|
||||||
|
|
@ -19,6 +20,7 @@ const LowDiskSpaceHosts = ({
|
||||||
lowDiskSpaceCount,
|
lowDiskSpaceCount,
|
||||||
isLoadingHosts,
|
isLoadingHosts,
|
||||||
showHostsUI,
|
showHostsUI,
|
||||||
|
selectedPlatformLabelId,
|
||||||
}: IHostSummaryProps): JSX.Element => {
|
}: IHostSummaryProps): JSX.Element => {
|
||||||
// build the manage hosts URL filtered by low disk space only
|
// build the manage hosts URL filtered by low disk space only
|
||||||
// currently backend cannot filter by both low disk space and label
|
// currently backend cannot filter by both low disk space and label
|
||||||
|
|
@ -26,7 +28,9 @@ const LowDiskSpaceHosts = ({
|
||||||
low_disk_space: lowDiskSpaceGb,
|
low_disk_space: lowDiskSpaceGb,
|
||||||
};
|
};
|
||||||
const queryString = buildQueryStringFromParams(queryParams);
|
const queryString = buildQueryStringFromParams(queryParams);
|
||||||
const endpoint = PATHS.MANAGE_HOSTS;
|
const endpoint = selectedPlatformLabelId
|
||||||
|
? PATHS.MANAGE_HOSTS_LABEL(selectedPlatformLabelId)
|
||||||
|
: PATHS.MANAGE_HOSTS;
|
||||||
const path = `${endpoint}?${queryString}`;
|
const path = `${endpoint}?${queryString}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -1560,6 +1560,13 @@ const ManageHostsPage = ({
|
||||||
) {
|
) {
|
||||||
const renderFilterPill = () => {
|
const renderFilterPill = () => {
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
// backend allows for pill combos label x low disk space
|
||||||
|
case showSelectedLabel && !!lowDiskSpaceHosts:
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{renderLabelFilterPill()} {renderLowDiskSpaceFilterBlock()}
|
||||||
|
</>
|
||||||
|
);
|
||||||
case showSelectedLabel:
|
case showSelectedLabel:
|
||||||
return renderLabelFilterPill();
|
return renderLabelFilterPill();
|
||||||
case !!policyId:
|
case !!policyId:
|
||||||
|
|
|
||||||
|
|
@ -242,6 +242,7 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: $pad-medium;
|
margin-bottom: $pad-medium;
|
||||||
|
gap: $pad-small; // between multiple filter pills
|
||||||
}
|
}
|
||||||
|
|
||||||
&__policies-filter-pill {
|
&__policies-filter-pill {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,10 @@ const FilterPill = ({
|
||||||
aria-label={`hosts filtered by ${label}`}
|
aria-label={`hosts filtered by ${label}`}
|
||||||
>
|
>
|
||||||
<>
|
<>
|
||||||
<span data-tip={tooltipDescription} data-for="filter-pill-tooltip">
|
<span
|
||||||
|
data-tip={tooltipDescription}
|
||||||
|
data-for={`filter-pill-tooltip-${label}`}
|
||||||
|
>
|
||||||
<div className={labelClasses}>
|
<div className={labelClasses}>
|
||||||
{icon && <img src={icon} alt="" />}
|
{icon && <img src={icon} alt="" />}
|
||||||
{label}
|
{label}
|
||||||
|
|
@ -55,7 +58,7 @@ const FilterPill = ({
|
||||||
place="bottom"
|
place="bottom"
|
||||||
effect="solid"
|
effect="solid"
|
||||||
backgroundColor="#3e4771"
|
backgroundColor="#3e4771"
|
||||||
id="filter-pill-tooltip"
|
id={`filter-pill-tooltip-${label}`}
|
||||||
data-html
|
data-html
|
||||||
>
|
>
|
||||||
<span>{tooltipDescription}</span>
|
<span>{tooltipDescription}</span>
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,11 @@ export const reconcileMutuallyExclusiveHostParams = ({
|
||||||
osVersion,
|
osVersion,
|
||||||
}: IMutuallyExclusiveHostParams): Record<string, unknown> => {
|
}: IMutuallyExclusiveHostParams): Record<string, unknown> => {
|
||||||
if (label) {
|
if (label) {
|
||||||
|
// backend api now allows label x low disk space
|
||||||
|
// all other params are still mutually exclusive
|
||||||
|
if (lowDiskSpaceHosts) {
|
||||||
|
return { low_disk_space: lowDiskSpaceHosts };
|
||||||
|
}
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue