mirror of
https://github.com/ansible/awx.git
synced 2026-01-16 20:30:46 -03:30
Removes the need to pass default search params to the select resource step
This commit is contained in:
parent
a1002b03fa
commit
9880f1e124
@ -147,7 +147,8 @@ describe('<SelectResourceStep />', () => {
|
||||
foo: 'bar'
|
||||
});
|
||||
expect(readUsers).toHaveBeenCalledWith({
|
||||
foo: 'bar'
|
||||
foo: 'bar',
|
||||
is_superuser: false
|
||||
});
|
||||
wrapper.instance().readTeams({
|
||||
foo: 'bar'
|
||||
|
||||
@ -15,9 +15,6 @@ describe('<SelectResourceStep />', () => {
|
||||
<I18nProvider>
|
||||
<SelectResourceStep
|
||||
columns={columns}
|
||||
defaultSearchParams={{
|
||||
is_superuser: false
|
||||
}}
|
||||
displayKey="username"
|
||||
onRowClick={jest.fn()}
|
||||
onSearch={jest.fn()}
|
||||
@ -40,9 +37,6 @@ describe('<SelectResourceStep />', () => {
|
||||
<I18nProvider>
|
||||
<SelectResourceStep
|
||||
columns={columns}
|
||||
defaultSearchParams={{
|
||||
is_superuser: false
|
||||
}}
|
||||
displayKey="username"
|
||||
onRowClick={jest.fn()}
|
||||
onSearch={handleSearch}
|
||||
@ -51,7 +45,6 @@ describe('<SelectResourceStep />', () => {
|
||||
</I18nProvider>
|
||||
);
|
||||
expect(handleSearch).toHaveBeenCalledWith({
|
||||
is_superuser: false,
|
||||
order_by: 'username',
|
||||
page: 1,
|
||||
page_size: 5
|
||||
@ -77,9 +70,6 @@ describe('<SelectResourceStep />', () => {
|
||||
<I18nProvider>
|
||||
<SelectResourceStep
|
||||
columns={columns}
|
||||
defaultSearchParams={{
|
||||
is_superuser: false
|
||||
}}
|
||||
displayKey="username"
|
||||
onRowClick={jest.fn()}
|
||||
onSearch={handleSearch}
|
||||
@ -93,7 +83,6 @@ describe('<SelectResourceStep />', () => {
|
||||
order_by: '-username'
|
||||
});
|
||||
expect(handleSearch).toHaveBeenCalledWith({
|
||||
is_superuser: false,
|
||||
order_by: '-username',
|
||||
page: 1
|
||||
});
|
||||
|
||||
@ -106,7 +106,7 @@ class AddResourceRole extends React.Component {
|
||||
|
||||
async readUsers (queryParams) {
|
||||
const { api } = this.props;
|
||||
return api.readUsers(queryParams);
|
||||
return api.readUsers(Object.assign(queryParams, { is_superuser: false }));
|
||||
}
|
||||
|
||||
async readTeams (queryParams) {
|
||||
@ -174,9 +174,6 @@ class AddResourceRole extends React.Component {
|
||||
{selectedResource === 'users' && (
|
||||
<SelectResourceStep
|
||||
columns={userColumns}
|
||||
defaultSearchParams={{
|
||||
is_superuser: false
|
||||
}}
|
||||
displayKey="username"
|
||||
emptyListBody={i18n._(t`Please add users to populate this list`)}
|
||||
emptyListTitle={i18n._(t`No Users Found`)}
|
||||
|
||||
@ -70,7 +70,7 @@ class SelectResourceStep extends React.Component {
|
||||
}
|
||||
|
||||
async readResourceList (queryParams) {
|
||||
const { onSearch, defaultSearchParams } = this.props;
|
||||
const { onSearch } = this.props;
|
||||
const { page, order_by } = queryParams;
|
||||
|
||||
let sortOrder = 'ascending';
|
||||
@ -84,7 +84,7 @@ class SelectResourceStep extends React.Component {
|
||||
this.setState({ error: false });
|
||||
|
||||
try {
|
||||
const { data } = await onSearch(Object.assign(queryParams, defaultSearchParams));
|
||||
const { data } = await onSearch(queryParams);
|
||||
const { count, results } = data;
|
||||
|
||||
const stateToUpdate = {
|
||||
@ -189,7 +189,6 @@ class SelectResourceStep extends React.Component {
|
||||
|
||||
SelectResourceStep.propTypes = {
|
||||
columns: PropTypes.arrayOf(PropTypes.object).isRequired,
|
||||
defaultSearchParams: PropTypes.shape(),
|
||||
displayKey: PropTypes.string,
|
||||
emptyListBody: PropTypes.string,
|
||||
emptyListTitle: PropTypes.string,
|
||||
@ -202,7 +201,6 @@ SelectResourceStep.propTypes = {
|
||||
};
|
||||
|
||||
SelectResourceStep.defaultProps = {
|
||||
defaultSearchParams: {},
|
||||
displayKey: 'name',
|
||||
emptyListBody: i18nMark('Please add items to populate this list'),
|
||||
emptyListTitle: i18nMark('No Items Found'),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user