swap column types use of shape for exact and fix warnings it found

This commit is contained in:
John Mitchell 2019-12-19 11:17:27 -05:00
parent 2c1648f9c9
commit 30b6e318cc
6 changed files with 12 additions and 13 deletions

View File

@ -1,7 +1,6 @@
import React from 'react';
import { createMemoryHistory } from 'history';
import { mountWithContexts } from '@testUtils/enzymeHelpers';
import { sleep } from '@testUtils/testUtils';
import ListHeader from './ListHeader';
describe('ListHeader', () => {
@ -21,7 +20,7 @@ describe('ListHeader', () => {
{ name: 'foo', key: 'foo', isDefault: true},
]}
sortColumns={[
{ name: 'foo', key: 'foo', isDefault: true},
{ name: 'foo', key: 'foo'},
]}
renderToolbar={renderToolbarFn}
/>
@ -42,7 +41,7 @@ describe('ListHeader', () => {
{ name: 'foo', key: 'foo', isDefault: true},
]}
sortColumns={[
{ name: 'foo', key: 'foo', isDefault: true},
{ name: 'foo', key: 'foo'},
]}
/>,
{ context: { router: { history } } }

View File

@ -3,7 +3,7 @@ import { mountWithContexts } from '@testUtils/enzymeHelpers';
import { getQSConfig } from '@util/qs';
import OptionsList from './OptionsList';
const qsConfig = getQSConfig('test', {});
const qsConfig = getQSConfig('test', { order_by: 'foo' });
describe('<OptionsList />', () => {
it('should display list of options', () => {
@ -17,8 +17,8 @@ describe('<OptionsList />', () => {
value={[]}
options={options}
optionCount={3}
searchColumns={[]}
sortColumns={[]}
searchColumns={[{name: 'Foo', key: 'foo', isDefault: true}]}
sortColumns={[{ name: 'Foo', key: 'foo' }]}
qsConfig={qsConfig}
selectItem={() => {}}
deselectItem={() => {}}
@ -40,8 +40,8 @@ describe('<OptionsList />', () => {
value={[options[1]]}
options={options}
optionCount={3}
searchColumns={[]}
sortColumns={[]}
searchColumns={[{name: 'Foo', key: 'foo', isDefault: true}]}
sortColumns={[{ name: 'Foo', key: 'foo' }]}
qsConfig={qsConfig}
selectItem={() => {}}
deselectItem={() => {}}

View File

@ -181,7 +181,6 @@ class ResourceAccessList extends React.Component {
{
name: i18n._(t`Username`),
key: 'username',
isDefault: true
},
{
name: i18n._(t`First Name`),

View File

@ -186,7 +186,6 @@ function InventoryGroupsList({ i18n, location, match }) {
{
name: i18n._(t`Is root group`),
key: 'parents__isnull',
isDefault: true,
isBoolean: true
},
{

View File

@ -173,7 +173,6 @@ class UsersList extends Component {
{
name: i18n._(t`Username`),
key: 'username',
isDefault: true
},
{
name: i18n._(t`First name`),

View File

@ -1,5 +1,6 @@
import {
shape,
exact,
arrayOf,
number,
string,
@ -251,15 +252,17 @@ export const Group = shape({
});
export const SearchColumns = arrayOf(
shape({
exact({
name: string.isRequired,
key: string.isRequired,
isDefault: bool,
isBoolean: bool,
options: arrayOf(arrayOf(string, string))
})
);
export const SortColumns = arrayOf(
shape({
exact({
name: string.isRequired,
key: string.isRequired,
})