mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 18:40:01 -03:30
add keys to search on lookups
This commit is contained in:
parent
2d00623c16
commit
2c953ed7d0
@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
|
||||
import { bool, func, number, string, oneOfType } from 'prop-types';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { withI18n } from '@lingui/react';
|
||||
import { t } from '@lingui/macro';
|
||||
import { CredentialsAPI } from '@api';
|
||||
import { Credential } from '@types';
|
||||
import { getQSConfig, parseQueryString, mergeParams } from '@util/qs';
|
||||
@ -26,6 +27,7 @@ function CredentialLookup({
|
||||
credentialTypeId,
|
||||
value,
|
||||
history,
|
||||
i18n
|
||||
}) {
|
||||
const [credentials, setCredentials] = useState([]);
|
||||
const [count, setCount] = useState(0);
|
||||
@ -48,6 +50,8 @@ function CredentialLookup({
|
||||
})();
|
||||
}, [credentialTypeId, history.location.search]);
|
||||
|
||||
// TODO: replace credential type search with REST-based grabbing of cred types
|
||||
|
||||
return (
|
||||
<FormGroup
|
||||
fieldId="credential"
|
||||
@ -71,6 +75,25 @@ function CredentialLookup({
|
||||
optionCount={count}
|
||||
header={label}
|
||||
qsConfig={QS_CONFIG}
|
||||
searchColumns={[
|
||||
{
|
||||
name: i18n._(t`Name`),
|
||||
key: 'name',
|
||||
isDefault: true
|
||||
},
|
||||
{
|
||||
name: i18n._(t`Created by (username)`),
|
||||
key: 'created_by__username',
|
||||
},
|
||||
{
|
||||
name: i18n._(t`Modified by (username)`),
|
||||
key: 'modified_by__username',
|
||||
}
|
||||
]}
|
||||
sortColumns={[{
|
||||
name: i18n._(t`Name`),
|
||||
key: 'name'
|
||||
}]}
|
||||
readOnly={!canDelete}
|
||||
selectItem={item => dispatch({ type: 'SELECT_ITEM', item })}
|
||||
deselectItem={item => dispatch({ type: 'DESELECT_ITEM', item })}
|
||||
|
||||
@ -68,14 +68,15 @@ function InstanceGroupsLookup(props) {
|
||||
{
|
||||
name: i18n._(t`Name`),
|
||||
key: 'name',
|
||||
isDefault: true
|
||||
},
|
||||
{
|
||||
name: i18n._(t`Modified`),
|
||||
key: 'modified',
|
||||
name: i18n._(t`Created by (username)`),
|
||||
key: 'created_by__username',
|
||||
},
|
||||
{
|
||||
name: i18n._(t`Created`),
|
||||
key: 'created',
|
||||
name: i18n._(t`Modified by (username)`),
|
||||
key: 'modified_by__username',
|
||||
},
|
||||
]}
|
||||
sortColumns={[{
|
||||
|
||||
@ -72,14 +72,15 @@ function InventoryLookup({
|
||||
{
|
||||
name: i18n._(t`Name`),
|
||||
key: 'name',
|
||||
isDefault: true
|
||||
},
|
||||
{
|
||||
name: i18n._(t`Modified`),
|
||||
key: 'modified',
|
||||
name: i18n._(t`Created by (username)`),
|
||||
key: 'created_by__username',
|
||||
},
|
||||
{
|
||||
name: i18n._(t`Created`),
|
||||
key: 'created',
|
||||
name: i18n._(t`Modified by (username)`),
|
||||
key: 'modified_by__username',
|
||||
},
|
||||
]}
|
||||
sortColumns={[{
|
||||
|
||||
@ -122,14 +122,25 @@ function MultiCredentialsLookup(props) {
|
||||
value={state.selectedItems}
|
||||
options={credentials}
|
||||
optionCount={credentialsCount}
|
||||
columns={[
|
||||
searchColumns={[
|
||||
{
|
||||
name: i18n._(t`Name`),
|
||||
key: 'name',
|
||||
isSortable: true,
|
||||
isSearchable: true,
|
||||
isDefault: true
|
||||
},
|
||||
{
|
||||
name: i18n._(t`Created by (username)`),
|
||||
key: 'created_by__username',
|
||||
},
|
||||
{
|
||||
name: i18n._(t`Modified by (username)`),
|
||||
key: 'modified_by__username',
|
||||
},
|
||||
]}
|
||||
sortColumns={[{
|
||||
name: i18n._(t`Name`),
|
||||
key: 'name'
|
||||
}]}
|
||||
multiple={isMultiple}
|
||||
header={i18n._(t`Credentials`)}
|
||||
name="credentials"
|
||||
|
||||
@ -77,16 +77,18 @@ function OrganizationLookup({
|
||||
isDefault: true
|
||||
},
|
||||
{
|
||||
name: i18n._(t`Team name`),
|
||||
key: 'teams__name',
|
||||
}
|
||||
]}
|
||||
sortColumns={[
|
||||
name: i18n._(t`Created by (username)`),
|
||||
key: 'created_by__username',
|
||||
},
|
||||
{
|
||||
name: i18n._(t`Name`),
|
||||
key: 'name',
|
||||
name: i18n._(t`Modified by (username)`),
|
||||
key: 'modified_by__username',
|
||||
},
|
||||
]}
|
||||
sortColumns={[{
|
||||
name: i18n._(t`Name`),
|
||||
key: 'name'
|
||||
}]}
|
||||
readOnly={!canDelete}
|
||||
selectItem={item => dispatch({ type: 'SELECT_ITEM', item })}
|
||||
deselectItem={item => dispatch({ type: 'DESELECT_ITEM', item })}
|
||||
|
||||
@ -70,6 +70,56 @@ function ProjectLookup({
|
||||
renderOptionsList={({ state, dispatch, canDelete }) => (
|
||||
<OptionsList
|
||||
value={state.selectedItems}
|
||||
searchColumns={[
|
||||
{
|
||||
name: i18n._(t`Name`),
|
||||
key: 'name',
|
||||
isDefault: true
|
||||
},
|
||||
{
|
||||
name: i18n._(t`Type`),
|
||||
options: [
|
||||
[
|
||||
``,
|
||||
i18n._(t`Manual`)
|
||||
],
|
||||
[
|
||||
`git`,
|
||||
i18n._(t`Git`)
|
||||
],
|
||||
[
|
||||
`hg`,
|
||||
i18n._(t`Mercurial`)
|
||||
],
|
||||
[
|
||||
`svn`,
|
||||
i18n._(t`Subversion`)
|
||||
],
|
||||
[
|
||||
`insights`,
|
||||
i18n._(t`Red Hat Insights`)
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
name: i18n._(t`SCM URL`),
|
||||
key: 'scm_url',
|
||||
},
|
||||
{
|
||||
name: i18n._(t`Modified by (username)`),
|
||||
key: 'modified_by__username',
|
||||
},
|
||||
{
|
||||
name: i18n._(t`Created by (username)`),
|
||||
key: 'created_by__username',
|
||||
},
|
||||
]}
|
||||
sortColumns={[
|
||||
{
|
||||
name: i18n._(t`Name`),
|
||||
key: 'name',
|
||||
}
|
||||
]}
|
||||
options={projects}
|
||||
optionCount={count}
|
||||
multiple={state.multiple}
|
||||
|
||||
@ -17,7 +17,8 @@ describe('<OptionsList />', () => {
|
||||
value={[]}
|
||||
options={options}
|
||||
optionCount={3}
|
||||
columns={[]}
|
||||
searchColumns={[]}
|
||||
sortColumns={[]}
|
||||
qsConfig={qsConfig}
|
||||
selectItem={() => {}}
|
||||
deselectItem={() => {}}
|
||||
@ -39,7 +40,8 @@ describe('<OptionsList />', () => {
|
||||
value={[options[1]]}
|
||||
options={options}
|
||||
optionCount={3}
|
||||
columns={[]}
|
||||
searchColumns={[]}
|
||||
sortColumns={[]}
|
||||
qsConfig={qsConfig}
|
||||
selectItem={() => {}}
|
||||
deselectItem={() => {}}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user