Skip to content

Commit

Permalink
Revert "feat(RHINENG-9687): create system type filter (#2190)"
Browse files Browse the repository at this point in the history
This reverts commit a14c486.
  • Loading branch information
adonispuente committed May 7, 2024
1 parent c544d89 commit 4c9d70f
Show file tree
Hide file tree
Showing 8 changed files with 3 additions and 142 deletions.
12 changes: 0 additions & 12 deletions src/Utilities/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export const REGISTERED_CHIP = 'registered_with';
export const OS_CHIP = 'operating_system';
export const RHCD_FILTER_KEY = 'rhc_client_id';
export const UPDATE_METHOD_KEY = 'system_update_method';
export const SYSTEM_TYPE_KEY = 'system_type';
export const LAST_SEEN_CHIP = 'last_seen';
export const HOST_GROUP_CHIP = 'group_name'; // use the same naming as for the back end parameter
//REPORTERS
Expand Down Expand Up @@ -105,17 +104,6 @@ const initUpdateMethodOptions = [

export const updateMethodOptions = initUpdateMethodOptions;

export const systemTypeOptions = [
{
label: 'Package mode',
value: 'nil',
},
{
label: 'Image mode',
value: 'not_nil',
},
];

export function filterToGroup(filter = [], valuesKey = 'values') {
return filter.reduce(
(accGroup, group) => ({
Expand Down
14 changes: 0 additions & 14 deletions src/api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export const calculateSystemProfile = ({
rhcdFilter,
updateMethodFilter,
hostTypeFilter,
systemTypeFilter,
}) => {
let systemProfile = {};
const osFilterValues = Array.isArray(osFilter)
Expand Down Expand Up @@ -167,16 +166,6 @@ export const calculateSystemProfile = ({
systemProfile['host_type'] = 'nil';
}

if (systemTypeFilter?.length) {
systemProfile.bootc_status = {
booted: {
image_digest: {
is: systemTypeFilter,
},
},
};
}

return generateFilter({
system_profile: systemProfile,
});
Expand All @@ -200,9 +189,6 @@ export const filtersReducer = (acc, filter = {}) => ({
...('hostGroupFilter' in filter && {
hostGroupFilter: filter.hostGroupFilter,
}),
...('systemTypeFilter' in filter && {
systemTypeFilter: filter.systemTypeFilter,
}),
});

export async function getEntities(
Expand Down
35 changes: 0 additions & 35 deletions src/components/InventoryTable/EntityTableToolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
TEXT_FILTER,
TagsModal,
UPDATE_METHOD_KEY,
SYSTEM_TYPE_KEY,
arrayToSelection,
reduceFilters,
} from '../../Utilities/index';
Expand Down Expand Up @@ -61,9 +60,6 @@ import {
useTagsFilter,
useTextFilter,
useUpdateMethodFilter,
useSystemTypeFilter,
systemTypeFilterReducer,
systemTypeFilterState,
} from '../filters';
import useOperatingSystemFilter from '../filters/useOperatingSystemFilter';
import useFeatureFlag from '../../Utilities/useFeatureFlag';
Expand Down Expand Up @@ -97,7 +93,6 @@ const EntityTableToolbar = ({
onRefreshData,
loaded,
showTagModal,
showSystemTypeFilter,
showCentosVersions,
...props
}) => {
Expand All @@ -113,7 +108,6 @@ const EntityTableToolbar = ({
lastSeenFilterReducer,
updateMethodFilterReducer,
groupFilterReducer,
systemTypeFilterReducer,
]),
{
...textFilterState,
Expand All @@ -124,7 +118,6 @@ const EntityTableToolbar = ({
...updateMethodFilterState,
...lastSeenFilterState,
...groupFilterState,
...systemTypeFilterState,
}
);
const filters = useSelector(
Expand Down Expand Up @@ -192,12 +185,6 @@ const EntityTableToolbar = ({
reducer
);

const [
systemTypeConfig,
systemTypeChips,
systemTypeValue,
setSystemTypeValue,
] = useSystemTypeFilter(reducer);
/**
* Debounced function for fetching all tags.
*/
Expand Down Expand Up @@ -243,9 +230,6 @@ const EntityTableToolbar = ({
hostGroupFilter:
!(hideFilters.all && hideFilters.hostGroupFilter !== false) &&
!hideFilters.hostGroupFilter,
systemTypeFilter:
!(hideFilters.all && hideFilters.systemTypeFilter !== false) &&
!hideFilters.systemTypeFilter,
};

/**
Expand Down Expand Up @@ -298,7 +282,6 @@ const EntityTableToolbar = ({
lastSeenFilter,
updateMethodFilter,
hostGroupFilter,
systemTypeFilter,
} = reduceFilters([...(filters || []), ...(customFilters?.filters || [])]);

debouncedRefresh();
Expand All @@ -313,7 +296,6 @@ const EntityTableToolbar = ({
setUpdateMethodValue(updateMethodFilter);
enabledFilters.lastSeenFilter && setLastSeenFilterValue(lastSeenFilter);
enabledFilters.hostGroupFilter && setHostGroupValue(hostGroupFilter);
enabledFilters.systemTypeFilter && setHostGroupValue(systemTypeFilter);
}, []);

/**
Expand Down Expand Up @@ -420,12 +402,6 @@ const EntityTableToolbar = ({
}
}, [hostGroupValue]);

useEffect(() => {
if (shouldReload && enabledFilters.systemTypeFilter) {
onSetFilter(systemTypeValue, 'systemTypeFilter', debouncedRefresh);
}
}, [systemTypeValue]);

/**
* Mapper to simplify removing of any filter.
*/
Expand Down Expand Up @@ -461,8 +437,6 @@ const EntityTableToolbar = ({
setUpdateMethodValue(onDeleteFilter(deleted, updateMethodValue)),
[HOST_GROUP_CHIP]: (deleted) =>
setHostGroupValue(onDeleteFilter(deleted, hostGroupValue)),
[SYSTEM_TYPE_KEY]: (deleted) =>
setSystemTypeValue(onDeleteFilter(deleted, systemTypeValue)),
};
/**
* Function to reset all filters with 'Reset Filter' is clicked
Expand All @@ -477,7 +451,6 @@ const EntityTableToolbar = ({
enabledFilters.lastSeenFilter && setLastSeenFilterValue([]);
enabledFilters.updateMethodFilter && setUpdateMethodValue([]);
enabledFilters.hostGroupFilter && setHostGroupValue([]);
enabledFilters.systemTypeFilter && setSystemTypeValue([]);
setEndDate();
setStartDate(oldestDate);
dispatch(setFilter([]));
Expand All @@ -502,9 +475,6 @@ const EntityTableToolbar = ({
: []),
...(!hasItems && enabledFilters.lastSeenFilter ? lastSeenChip : []),
...(!hasItems && enabledFilters.hostGroupFilter ? hostGroupChips : []),
...(showSystemTypeFilter && !hasItems && enabledFilters.systemTypeFilter
? systemTypeChips
: []),
...(activeFiltersConfig?.filters || []),
],
onDelete: (e, [deleted, ...restDeleted], isAll) => {
Expand Down Expand Up @@ -533,9 +503,6 @@ const EntityTableToolbar = ({
...(enabledFilters.updateMethodFilter ? [updateMethodConfig] : []),
...(enabledFilters.lastSeenFilter ? [lastSeenFilter] : []),
...(enabledFilters.hostGroupFilter ? [hostGroupConfig] : []),
...(showSystemTypeFilter && enabledFilters.systemTypeFilter
? [systemTypeConfig]
: []),
...(showTags && enabledFilters.tags ? [tagsFilter] : []),
]
: []),
Expand Down Expand Up @@ -668,7 +635,6 @@ EntityTableToolbar.propTypes = {
lastSeen: PropTypes.bool,
updateMethodFilter: PropTypes.bool,
hostGroupFilter: PropTypes.bool,
systemTypeFilter: PropTypes.bool,
all: PropTypes.bool,
}),
paginationProps: PropTypes.object,
Expand All @@ -683,7 +649,6 @@ EntityTableToolbar.propTypes = {
disableDefaultColumns: PropTypes.any,
showCentosVersions: PropTypes.bool,
showNoGroupOption: PropTypes.bool,
showSystemTypeFilter: PropTypes.bool,
};

EntityTableToolbar.defaultProps = {
Expand Down
6 changes: 1 addition & 5 deletions src/components/InventoryTable/TitleColumn.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ const TitleColumn = ({ children, id, item, ...props }) => (
<FontAwesomeImageIcon
fill="var(--pf-v5-global--icon--Color--light)"
margin="0px"
aria-label="Image mode icon"
/>
</Icon>
</Popover>
Expand All @@ -78,10 +77,7 @@ const TitleColumn = ({ children, id, item, ...props }) => (
}
>
<Icon style={{ marginRight: '8px' }}>
<BundleIcon
color="var(--pf-v5-global--icon--Color--light)"
aria-label="Package mode icon"
/>
<BundleIcon color="var(--pf-v5-global--icon--Color--light)" />
</Icon>
</Popover>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ exports[`TitleColumn should render correctly with NO data 1`] = `
>
<svg
aria-hidden="true"
aria-label="Package mode icon"
class="pf-v5-svg"
color="var(--pf-v5-global--icon--Color--light)"
fill="currentColor"
Expand Down Expand Up @@ -84,7 +83,6 @@ exports[`TitleColumn should render correctly with data 1`] = `
>
<svg
aria-hidden="true"
aria-label="Package mode icon"
class="pf-v5-svg"
color="var(--pf-v5-global--icon--Color--light)"
fill="currentColor"
Expand Down Expand Up @@ -133,7 +131,6 @@ exports[`TitleColumn should render correctly with href 1`] = `
>
<svg
aria-hidden="true"
aria-label="Package mode icon"
class="pf-v5-svg"
color="var(--pf-v5-global--icon--Color--light)"
fill="currentColor"
Expand Down Expand Up @@ -185,7 +182,6 @@ exports[`TitleColumn should render correctly with os_release 1`] = `
>
<svg
aria-hidden="true"
aria-label="Package mode icon"
class="pf-v5-svg"
color="var(--pf-v5-global--icon--Color--light)"
fill="currentColor"
Expand Down Expand Up @@ -234,7 +230,6 @@ exports[`TitleColumn should render correctly with to 1`] = `
>
<svg
aria-hidden="true"
aria-label="Package mode icon"
class="pf-v5-svg"
color="var(--pf-v5-global--icon--Color--light)"
fill="currentColor"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import React, {
Fragment,
useContext,
useEffect,
useRef,
useState,
} from 'react';
import React, { Fragment, useEffect, useRef, useState } from 'react';
import PropTypes from 'prop-types';
import { shallowEqual, useDispatch, useSelector } from 'react-redux';
import * as actions from '../../../store/actions';
Expand Down Expand Up @@ -32,8 +26,6 @@ import uniq from 'lodash/uniq';
import useTableActions from './useTableActions';
import useGlobalFilter from '../../filters/useGlobalFilter';
import useOnRefresh from '../../filters/useOnRefresh';
import useFeatureFlag from '../../../Utilities/useFeatureFlag';
import { AccountStatContext } from '../../../Routes';

const BulkDeleteButton = ({ selectedSystems, ...props }) => {
const requiredPermissions = selectedSystems.map(({ groups }) =>
Expand Down Expand Up @@ -71,7 +63,6 @@ const ConventionalSystemsTab = ({
initialLoading,
hasAccess,
hostGroupFilter,
systemTypeFilter,
}) => {
const chrome = useChrome();
const inventory = useRef(null);
Expand All @@ -87,8 +78,7 @@ const ConventionalSystemsTab = ({
rhcdFilter,
updateMethodFilter,
hostGroupFilter,
lastSeenFilter,
systemTypeFilter
lastSeenFilter
)
);
const [ediOpen, onEditOpen] = useState(false);
Expand Down Expand Up @@ -166,12 +156,9 @@ const ConventionalSystemsTab = ({
setAddHostGroupModalOpen
);

const isBootcEnabled = useFeatureFlag('hbi.ui.bifrost');
const { hasBootcImages } = useContext(AccountStatContext);
return (
<Fragment>
<InventoryTableCmp
showSystemTypeFilter={isBootcEnabled && hasBootcImages}
hasAccess={hasAccess}
isRbacEnabled
customFilters={{ filters, globalFilter }}
Expand Down Expand Up @@ -375,10 +362,6 @@ ConventionalSystemsTab.propTypes = {
PropTypes.arrayOf(PropTypes.string),
PropTypes.string,
]),
systemTypeFilter: PropTypes.oneOfType([
PropTypes.arrayOf(PropTypes.string),
PropTypes.string,
]),
};

ConventionalSystemsTab.defaultProps = {
Expand Down
1 change: 0 additions & 1 deletion src/components/filters/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export * from './useRhcdFilter';
export * from './useUpdateMethodFilter';
export * from './useLastSeenFilter';
export * from './useGroupFilter';
export * from './useSystemTypeFilter';
export const filtersReducer = (reducersList) => (state, action) =>
reducersList.reduce(
(acc, curr) => ({
Expand Down
51 changes: 0 additions & 51 deletions src/components/filters/useSystemTypeFilter.js

This file was deleted.

0 comments on commit 4c9d70f

Please sign in to comment.