1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 06:51:10 +03:00

update search based on pr feedback:

- fix InventoryHost list inadverdent breakage due to merge conflict
- update label__name search key to labels__name
- always snap to page 1 when a search happens
- udpate capitalization of keys to be consistent
- remove isDefault from sort col items in tests
This commit is contained in:
John Mitchell 2020-01-07 13:27:19 -05:00
parent 068de221c1
commit 3cdf274bdb
21 changed files with 56 additions and 54 deletions

View File

@ -149,11 +149,11 @@ class AddResourceRole extends React.Component {
isDefault: true
},
{
name: i18n._(t`First name`),
name: i18n._(t`First Name`),
key: 'first_name',
},
{
name: i18n._(t`Last name`),
name: i18n._(t`Last Name`),
key: 'last_name',
}
];
@ -164,11 +164,11 @@ class AddResourceRole extends React.Component {
key: 'username',
},
{
name: i18n._(t`First name`),
name: i18n._(t`First Name`),
key: 'first_name',
},
{
name: i18n._(t`Last name`),
name: i18n._(t`Last Name`),
key: 'last_name',
}
];
@ -180,11 +180,11 @@ class AddResourceRole extends React.Component {
isDefault: true
},
{
name: i18n._(t`Created by (username)`),
name: i18n._(t`Created By (Username)`),
key: 'created_by__username',
},
{
name: i18n._(t`Modified by (username)`),
name: i18n._(t`Modified By (Username)`),
key: 'modified_by__username',
},
];

View File

@ -190,11 +190,11 @@ describe('<DataListToolbar />', () => {
const upAlphaIconSelector = 'SortAlphaUpIcon';
const numericColumns = [
{ name: 'ID', key: 'id', isDefault: true },
{ name: 'ID', key: 'id' },
];
const alphaColumns = [
{ name: 'Name', key: 'name', isDefault: true },
{ name: 'Name', key: 'name' },
];
const searchColumns = [
@ -252,7 +252,7 @@ describe('<DataListToolbar />', () => {
{ name: 'Name', key: 'name', isDefault: true }
];
const sortColumns = [
{ name: 'Name', key: 'name', isDefault: true }
{ name: 'Name', key: 'name' }
];
toolbar = mountWithContexts(

View File

@ -38,8 +38,10 @@ class ListHeader extends React.Component {
handleSearch(key, value) {
const { location, qsConfig } = this.props;
const oldParams = parseQueryString(qsConfig, location.search);
this.pushHistoryState(mergeParams(oldParams, { [key]: value }));
let params = parseQueryString(qsConfig, location.search);
params = mergeParams(params, { [key]: value });
params = replaceParams(params, { 'page' : 1 })
this.pushHistoryState(params);
}
handleReplaceSearch(key, value) {

View File

@ -82,11 +82,11 @@ function CredentialLookup({
isDefault: true
},
{
name: i18n._(t`Created by (username)`),
name: i18n._(t`Created By (Username)`),
key: 'created_by__username',
},
{
name: i18n._(t`Modified by (username)`),
name: i18n._(t`Modified By (Username)`),
key: 'modified_by__username',
}
]}

View File

@ -71,15 +71,15 @@ function InstanceGroupsLookup(props) {
isDefault: true
},
{
name: i18n._(t`Credential name`),
name: i18n._(t`Credential Name`),
key: 'credential__name'
},
{
name: i18n._(t`Created by (username)`),
name: i18n._(t`Created By (Username)`),
key: 'created_by__username',
},
{
name: i18n._(t`Modified by (username)`),
name: i18n._(t`Modified By (Username)`),
key: 'modified_by__username',
},
]}

View File

@ -75,11 +75,11 @@ function InventoryLookup({
isDefault: true
},
{
name: i18n._(t`Created by (username)`),
name: i18n._(t`Created By (Username)`),
key: 'created_by__username',
},
{
name: i18n._(t`Modified by (username)`),
name: i18n._(t`Modified By (Username)`),
key: 'modified_by__username',
},
]}

View File

@ -129,11 +129,11 @@ function MultiCredentialsLookup(props) {
isDefault: true
},
{
name: i18n._(t`Created by (username)`),
name: i18n._(t`Created By (Username)`),
key: 'created_by__username',
},
{
name: i18n._(t`Modified by (username)`),
name: i18n._(t`Modified By (Username)`),
key: 'modified_by__username',
},
]}

View File

@ -77,11 +77,11 @@ function OrganizationLookup({
isDefault: true
},
{
name: i18n._(t`Created by (username)`),
name: i18n._(t`Created By (Username)`),
key: 'created_by__username',
},
{
name: i18n._(t`Modified by (username)`),
name: i18n._(t`Modified By (Username)`),
key: 'modified_by__username',
},
]}

View File

@ -106,11 +106,11 @@ function ProjectLookup({
key: 'scm_url',
},
{
name: i18n._(t`Modified by (username)`),
name: i18n._(t`Modified By (Username)`),
key: 'modified_by__username',
},
{
name: i18n._(t`Created by (username)`),
name: i18n._(t`Created By (Username)`),
key: 'created_by__username',
},
]}

View File

@ -11,7 +11,6 @@ import PaginatedDataList from '@components/PaginatedDataList';
import { getQSConfig, parseQueryString } from '@util/qs';
import { NotificationTemplatesAPI } from '@api';
import { type } from 'os';
const QS_CONFIG = getQSConfig('notification', {
page: 1,
@ -222,11 +221,11 @@ class NotificationList extends Component {
]
},
{
name: i18n._(t`Created by (username)`),
name: i18n._(t`Created By (Username)`),
key: 'created_by__username',
},
{
name: i18n._(t`Modified by (username)`),
name: i18n._(t`Modified By (Username)`),
key: 'modified_by__username',
},
]}

View File

@ -197,11 +197,11 @@ class HostsList extends Component {
isDefault: true
},
{
name: i18n._(t`Created by (username)`),
name: i18n._(t`Created By (Username)`),
key: 'created_by__username',
},
{
name: i18n._(t`Modified by (username)`),
name: i18n._(t`Modified By (Username)`),
key: 'modified_by__username',
},
]}

View File

@ -184,16 +184,16 @@ function InventoryGroupsList({ i18n, location, match }) {
isDefault: true
},
{
name: i18n._(t`Is root group`),
name: i18n._(t`Is Root Group`),
key: 'parents__isnull',
isBoolean: true
},
{
name: i18n._(t`Created by (username)`),
name: i18n._(t`Created By (Username)`),
key: 'created_by__username',
},
{
name: i18n._(t`Modified by (username)`),
name: i18n._(t`Modified By (Username)`),
key: 'modified_by__username',
},
]}

View File

@ -131,7 +131,7 @@ function InventoryHosts({ i18n, location, match }) {
itemCount={hostCount}
pluralizedItemName={i18n._(t`Hosts`)}
qsConfig={QS_CONFIG}
onRowClick={this.handleSelect}
onRowClick={handleSelect}
toolbarSearchColumns={[
{
name: i18n._(t`Name`),
@ -139,11 +139,11 @@ function InventoryHosts({ i18n, location, match }) {
isDefault: true
},
{
name: i18n._(t`Created by (username)`),
name: i18n._(t`Created By (Username)`),
key: 'created_by__username',
},
{
name: i18n._(t`Modified by (username)`),
name: i18n._(t`Modified By (Username)`),
key: 'modified_by__username',
},
]}

View File

@ -181,11 +181,11 @@ class InventoriesList extends Component {
isDefault: true
},
{
name: i18n._(t`Created by (username)`),
name: i18n._(t`Created By (Username)`),
key: 'created_by__username',
},
{
name: i18n._(t`Modified by (username)`),
name: i18n._(t`Modified By (Username)`),
key: 'modified_by__username',
},
]}

View File

@ -174,11 +174,11 @@ class JobList extends Component {
key: 'id'
},
{
name: i18n._(t`Label name`),
key: 'label__name'
name: i18n._(t`Label Name`),
key: 'labels__name'
},
{
name: i18n._(t`Job type`),
name: i18n._(t`Job Type`),
key: `type`,
options: [
[
@ -208,7 +208,7 @@ class JobList extends Component {
]
},
{
name: i18n._(t`Created by (username)`),
name: i18n._(t`Created By (Username)`),
key: 'created_by__username'
},
{

View File

@ -126,11 +126,11 @@ function OrganizationsList({ i18n }) {
isDefault: true
},
{
name: i18n._(t`Created by (username)`),
name: i18n._(t`Created By (Username)`),
key: 'created_by__username',
},
{
name: i18n._(t`Modified by (username)`),
name: i18n._(t`Modified By (Username)`),
key: 'modified_by__username',
},
]}

View File

@ -192,11 +192,11 @@ class ProjectsList extends Component {
key: 'scm_url',
},
{
name: i18n._(t`Modified by (username)`),
name: i18n._(t`Modified By (Username)`),
key: 'modified_by__username',
},
{
name: i18n._(t`Created by (username)`),
name: i18n._(t`Created By (Username)`),
key: 'created_by__username',
},
]}

View File

@ -161,15 +161,15 @@ class TeamsList extends Component {
isDefault: true
},
{
name: i18n._(t`Organization name`),
name: i18n._(t`Organization Name`),
key: 'organization__name',
},
{
name: i18n._(t`Created by (username)`),
name: i18n._(t`Created By (Username)`),
key: 'created_by__username',
},
{
name: i18n._(t`Modified by (username)`),
name: i18n._(t`Modified By (Username)`),
key: 'modified_by__username',
},
]}

View File

@ -239,11 +239,11 @@ class TemplatesList extends Component {
key: 'job_template__playbook',
},
{
name: i18n._(t`Created by (username)`),
name: i18n._(t`Created By (Username)`),
key: 'created_by__username',
},
{
name: i18n._(t`Modified by (username)`),
name: i18n._(t`Modified By (Username)`),
key: 'modified_by__username',
},
]}

View File

@ -161,11 +161,11 @@ class UsersList extends Component {
isDefault: true
},
{
name: i18n._(t`First name`),
name: i18n._(t`First Name`),
key: 'first_name',
},
{
name: i18n._(t`Last name`),
name: i18n._(t`Last Name`),
key: 'last_name',
}
]}
@ -175,11 +175,11 @@ class UsersList extends Component {
key: 'username',
},
{
name: i18n._(t`First name`),
name: i18n._(t`First Name`),
key: 'first_name',
},
{
name: i18n._(t`Last name`),
name: i18n._(t`Last Name`),
key: 'last_name',
},
]}

View File

@ -193,6 +193,7 @@ function removeParam(oldVal, deleteVal) {
* @return {object} merged namespaced params object
*/
export function mergeParams(oldParams, newParams) {
debugger;
const merged = {};
Object.keys(oldParams).forEach(key => {
merged[key] = mergeParam(oldParams[key], newParams[key]);