Merge pull request #7987 from nixocio/ui_add_adv_search

Add advanced search keys for InstanceGroup and CredentialType Lists

Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
softwarefactory-project-zuul[bot]
2020-08-27 02:55:19 +00:00
committed by GitHub
2 changed files with 34 additions and 2 deletions

View File

@@ -32,7 +32,13 @@ function CredentialTypeList({ i18n }) {
error: contentError,
isLoading,
request: fetchCredentialTypes,
result: { credentialTypes, credentialTypesCount, actions },
result: {
credentialTypes,
credentialTypesCount,
actions,
relatedSearchableKeys,
searchableKeys,
},
} = useRequest(
useCallback(async () => {
const params = parseQueryString(QS_CONFIG, location.search);
@@ -46,12 +52,20 @@ function CredentialTypeList({ i18n }) {
credentialTypes: response.data.results,
credentialTypesCount: response.data.count,
actions: responseActions.data.actions,
relatedSearchableKeys: (
responseActions?.data?.related_search_fields || []
).map(val => val.slice(0, -8)),
searchableKeys: Object.keys(
responseActions.data.actions?.GET || {}
).filter(key => responseActions.data.actions?.GET[key].filterable),
};
}, [location]),
{
credentialTypes: [],
credentialTypesCount: 0,
actions: {},
relatedSearchableKeys: [],
searchableKeys: [],
}
);
@@ -100,6 +114,8 @@ function CredentialTypeList({ i18n }) {
pluralizedItemName={i18n._(t`Credential Types`)}
qsConfig={QS_CONFIG}
onRowClick={handleSelect}
toolbarSearchableKeys={searchableKeys}
toolbarRelatedSearchableKeys={relatedSearchableKeys}
renderToolbar={props => (
<DatalistToolbar
{...props}

View File

@@ -49,7 +49,13 @@ function InstanceGroupList({ i18n }) {
error: contentError,
isLoading,
request: fetchInstanceGroups,
result: { instanceGroups, instanceGroupsCount, actions },
result: {
instanceGroups,
instanceGroupsCount,
actions,
relatedSearchableKeys,
searchableKeys,
},
} = useRequest(
useCallback(async () => {
const params = parseQueryString(QS_CONFIG, location.search);
@@ -63,12 +69,20 @@ function InstanceGroupList({ i18n }) {
instanceGroups: response.data.results,
instanceGroupsCount: response.data.count,
actions: responseActions.data.actions,
relatedSearchableKeys: (
responseActions?.data?.related_search_fields || []
).map(val => val.slice(0, -8)),
searchableKeys: Object.keys(
responseActions.data.actions?.GET || {}
).filter(key => responseActions.data.actions?.GET[key].filterable),
};
}, [location]),
{
instanceGroups: [],
instanceGroupsCount: 0,
actions: {},
relatedSearchableKeys: [],
searchableKeys: [],
}
);
@@ -171,6 +185,8 @@ function InstanceGroupList({ i18n }) {
pluralizedItemName={pluralizedItemName}
qsConfig={QS_CONFIG}
onRowClick={handleSelect}
toolbarSearchableKeys={searchableKeys}
toolbarRelatedSearchableKeys={relatedSearchableKeys}
renderToolbar={props => (
<DatalistToolbar
{...props}