mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
make name default searchColumn for ProjectJobTemplatesList. also add helpful error message to tell you this is the issue
This commit is contained in:
parent
f24654fb26
commit
f8bd8abc82
@ -43,7 +43,17 @@ function Search({
|
||||
}) {
|
||||
const [isSearchDropdownOpen, setIsSearchDropdownOpen] = useState(false);
|
||||
const [searchKey, setSearchKey] = useState(
|
||||
columns.find(col => col.isDefault).key
|
||||
(() => {
|
||||
const defaultColumn = columns.filter(col => col.isDefault);
|
||||
|
||||
if (defaultColumn.length !== 1) {
|
||||
throw new Error(
|
||||
'One (and only one) searchColumn must be marked isDefault: true'
|
||||
);
|
||||
}
|
||||
|
||||
return defaultColumn[0]?.key;
|
||||
})()
|
||||
);
|
||||
const [searchValue, setSearchValue] = useState('');
|
||||
const [isFilterDropdownOpen, setIsFilterDropdownOpen] = useState(false);
|
||||
|
||||
@ -102,6 +102,11 @@ function ProjectJobTemplatesList({ i18n }) {
|
||||
qsConfig={QS_CONFIG}
|
||||
onRowClick={handleSelect}
|
||||
toolbarSearchColumns={[
|
||||
{
|
||||
name: i18n._(t`Name`),
|
||||
key: 'name__icontains',
|
||||
isDefault: true,
|
||||
},
|
||||
{
|
||||
name: i18n._(t`Created By (Username)`),
|
||||
key: 'created_by__username__icontains',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user