Skip to content

Commit 79e214d

Browse files
authored
Fix inventory type filter (#2684)
1 parent 9fe46ad commit 79e214d

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

frontend/awx/common/awx-toolbar-filters.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,16 +160,17 @@ export function useInventoryTypeToolbarFilter() {
160160
const { t } = useTranslation();
161161
return useMemo<IToolbarFilter>(
162162
() => ({
163-
key: 'kind',
163+
key: 'inventory-type',
164164
label: t('Inventory type'),
165165
type: ToolbarFilterType.MultiSelect,
166-
query: 'or__kind',
166+
query: 'kind',
167167
options: [
168168
{ label: t('Inventory'), value: '' },
169169
{ label: t('Smart inventory'), value: 'smart' },
170170
{ label: t('Constructed inventory'), value: 'constructed' },
171171
],
172172
placeholder: t('Select types'),
173+
disableSortOptions: true,
173174
}),
174175
[t]
175176
);
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
import {
22
useCreatedByToolbarFilter,
3+
useInventoryTypeToolbarFilter,
34
useModifiedByToolbarFilter,
45
} from '../../../common/awx-toolbar-filters';
56
import { useDynamicToolbarFilters } from '../../../common/useDynamicFilters';
67

78
export function useInventoriesFilters() {
9+
const inventoryTypeToolbarFilter = useInventoryTypeToolbarFilter();
810
const createdByToolbarFilter = useCreatedByToolbarFilter();
911
const modifiedByToolbarFilter = useModifiedByToolbarFilter();
1012

1113
const toolbarFilters = useDynamicToolbarFilters({
1214
optionsPath: 'inventories',
13-
preSortedKeys: ['name', 'id', 'created-by', 'modified-by'],
15+
preSortedKeys: ['name', 'id', 'created-by', 'modified-by', 'inventory-type'],
1416
preFilledValueKeys: { name: { apiPath: 'inventories' }, id: { apiPath: 'inventories' } },
15-
additionalFilters: [createdByToolbarFilter, modifiedByToolbarFilter],
17+
additionalFilters: [
18+
createdByToolbarFilter,
19+
modifiedByToolbarFilter,
20+
inventoryTypeToolbarFilter,
21+
],
22+
removeFilters: ['kind'],
1623
});
1724
return toolbarFilters;
1825
}

0 commit comments

Comments
 (0)