fix prettier issues

This commit is contained in:
John Mitchell
2020-01-14 13:28:53 -05:00
parent 1b726a1b2f
commit 9ecb704e10
3 changed files with 82 additions and 80 deletions

View File

@@ -210,83 +210,85 @@ class Search extends React.Component {
<NoOptionDropdown>{searchColumnName}</NoOptionDropdown> <NoOptionDropdown>{searchColumnName}</NoOptionDropdown>
)} )}
</DataToolbarItem> </DataToolbarItem>
{columns.map(({ key, name, options, isBoolean, booleanLabels = {} }) => ( {columns.map(
<DataToolbarFilter ({ key, name, options, isBoolean, booleanLabels = {} }) => (
chips={chipsByKey[key] ? chipsByKey[key].chips : []} <DataToolbarFilter
deleteChip={(unusedKey, val) => { chips={chipsByKey[key] ? chipsByKey[key].chips : []}
onRemove(chipsByKey[key].key, val); deleteChip={(unusedKey, val) => {
}} onRemove(chipsByKey[key].key, val);
categoryName={chipsByKey[key] ? chipsByKey[key].label : key} }}
key={key} categoryName={chipsByKey[key] ? chipsByKey[key].label : key}
showToolbarItem={searchKey === key} key={key}
> showToolbarItem={searchKey === key}
{(options && ( >
<Fragment> {(options && (
<Select <Fragment>
variant={SelectVariant.checkbox} <Select
aria-label={name} variant={SelectVariant.checkbox}
onToggle={this.handleFilterDropdownToggle} aria-label={name}
onSelect={(event, selection) => onToggle={this.handleFilterDropdownToggle}
this.handleFilterDropdownSelect(key, event, selection) onSelect={(event, selection) =>
} this.handleFilterDropdownSelect(key, event, selection)
selections={chipsByKey[key].chips}
isExpanded={isFilterDropdownOpen}
placeholderText={`Filter By ${name}`}
>
{options.map(([optionKey, optionLabel]) => (
<SelectOption key={optionKey} value={optionKey}>
{optionLabel}
</SelectOption>
))}
</Select>
</Fragment>
)) ||
(isBoolean && (
<Select
aria-label={name}
onToggle={this.handleFilterDropdownToggle}
onSelect={(event, selection) =>
this.handleFilterBooleanSelect(key, selection)
}
selections={chipsByKey[key].chips[0]}
isExpanded={isFilterDropdownOpen}
placeholderText={`Filter By ${name}`}
>
<SelectOption key="true" value="true">
{booleanLabels.true || i18n._(t`Yes`)}
</SelectOption>
<SelectOption key="false" value="false">
{booleanLabels.false || i18n._(t`No`)}
</SelectOption>
</Select>
)) || (
<InputGroup>
{/* TODO: add support for dates:
qsConfig.dateFields.filter(field => field === key).length && "date" */}
<TextInput
type={
(qsConfig.integerFields.find(
field => field === searchKey
) &&
'number') ||
'search'
} }
aria-label={i18n._(t`Search text input`)} selections={chipsByKey[key].chips}
value={searchValue} isExpanded={isFilterDropdownOpen}
onChange={this.handleSearchInputChange} placeholderText={`Filter By ${name}`}
onKeyDown={this.handleTextKeyDown}
/>
<Button
variant={ButtonVariant.control}
aria-label={i18n._(t`Search submit button`)}
onClick={this.handleSearch}
> >
<SearchIcon /> {options.map(([optionKey, optionLabel]) => (
</Button> <SelectOption key={optionKey} value={optionKey}>
</InputGroup> {optionLabel}
)} </SelectOption>
</DataToolbarFilter> ))}
))} </Select>
</Fragment>
)) ||
(isBoolean && (
<Select
aria-label={name}
onToggle={this.handleFilterDropdownToggle}
onSelect={(event, selection) =>
this.handleFilterBooleanSelect(key, selection)
}
selections={chipsByKey[key].chips[0]}
isExpanded={isFilterDropdownOpen}
placeholderText={`Filter By ${name}`}
>
<SelectOption key="true" value="true">
{booleanLabels.true || i18n._(t`Yes`)}
</SelectOption>
<SelectOption key="false" value="false">
{booleanLabels.false || i18n._(t`No`)}
</SelectOption>
</Select>
)) || (
<InputGroup>
{/* TODO: add support for dates:
qsConfig.dateFields.filter(field => field === key).length && "date" */}
<TextInput
type={
(qsConfig.integerFields.find(
field => field === searchKey
) &&
'number') ||
'search'
}
aria-label={i18n._(t`Search text input`)}
value={searchValue}
onChange={this.handleSearchInputChange}
onKeyDown={this.handleTextKeyDown}
/>
<Button
variant={ButtonVariant.control}
aria-label={i18n._(t`Search submit button`)}
onClick={this.handleSearch}
>
<SearchIcon />
</Button>
</InputGroup>
)}
</DataToolbarFilter>
)
)}
</DataToolbarGroup> </DataToolbarGroup>
); );
} }

View File

@@ -188,9 +188,9 @@ function InventoryGroupsList({ i18n, location, match }) {
key: 'parents__isnull', key: 'parents__isnull',
isBoolean: true, isBoolean: true,
booleanLabels: { booleanLabels: {
"true": i18n._(t`Show Only Root Groups`), true: i18n._(t`Show Only Root Groups`),
"false": i18n._(t`Show All Groups`) false: i18n._(t`Show All Groups`),
} },
}, },
{ {
name: i18n._(t`Created By (Username)`), name: i18n._(t`Created By (Username)`),

View File

@@ -258,8 +258,8 @@ export const SearchColumns = arrayOf(
isDefault: bool, isDefault: bool,
isBoolean: bool, isBoolean: bool,
booleanLabels: shape({ booleanLabels: shape({
"true": string.isRequired, true: string.isRequired,
"false": string.isRequired false: string.isRequired,
}), }),
options: arrayOf(arrayOf(string, string)), options: arrayOf(arrayOf(string, string)),
}) })