Fleet UI: Filter by low disk space hosts on various platforms (#8647)

This commit is contained in:
RachelElysia 2022-11-10 09:27:23 -05:00 committed by GitHub
parent 139a462ebe
commit 3a9f45d6f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 3 deletions

View file

@ -0,0 +1 @@
* UI allows for filtering low disk space hosts by platform!

View file

@ -413,6 +413,7 @@ const DashboardPage = (): JSX.Element => {
lowDiskSpaceCount={lowDiskSpaceCount}
isLoadingHosts={isHostSummaryFetching}
showHostsUI={showHostsUI}
selectedPlatformLabelId={selectedPlatformLabelId}
/>
),
});

View file

@ -12,6 +12,7 @@ interface IHostSummaryProps {
lowDiskSpaceCount: number;
isLoadingHosts: boolean;
showHostsUI: boolean;
selectedPlatformLabelId?: number;
}
const LowDiskSpaceHosts = ({
@ -19,6 +20,7 @@ const LowDiskSpaceHosts = ({
lowDiskSpaceCount,
isLoadingHosts,
showHostsUI,
selectedPlatformLabelId,
}: IHostSummaryProps): JSX.Element => {
// build the manage hosts URL filtered by low disk space only
// currently backend cannot filter by both low disk space and label
@ -26,7 +28,9 @@ const LowDiskSpaceHosts = ({
low_disk_space: lowDiskSpaceGb,
};
const queryString = buildQueryStringFromParams(queryParams);
const endpoint = PATHS.MANAGE_HOSTS;
const endpoint = selectedPlatformLabelId
? PATHS.MANAGE_HOSTS_LABEL(selectedPlatformLabelId)
: PATHS.MANAGE_HOSTS;
const path = `${endpoint}?${queryString}`;
return (

View file

@ -1560,6 +1560,13 @@ const ManageHostsPage = ({
) {
const renderFilterPill = () => {
switch (true) {
// backend allows for pill combos label x low disk space
case showSelectedLabel && !!lowDiskSpaceHosts:
return (
<>
{renderLabelFilterPill()} {renderLowDiskSpaceFilterBlock()}
</>
);
case showSelectedLabel:
return renderLabelFilterPill();
case !!policyId:

View file

@ -242,6 +242,7 @@
display: flex;
align-items: center;
margin-bottom: $pad-medium;
gap: $pad-small; // between multiple filter pills
}
&__policies-filter-pill {

View file

@ -35,7 +35,10 @@ const FilterPill = ({
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}>
{icon && <img src={icon} alt="" />}
{label}
@ -55,7 +58,7 @@ const FilterPill = ({
place="bottom"
effect="solid"
backgroundColor="#3e4771"
id="filter-pill-tooltip"
id={`filter-pill-tooltip-${label}`}
data-html
>
<span>{tooltipDescription}</span>

View file

@ -68,6 +68,11 @@ export const reconcileMutuallyExclusiveHostParams = ({
osVersion,
}: IMutuallyExclusiveHostParams): Record<string, unknown> => {
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 {};
}