mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 10:00:01 -03:30
working commit
This commit is contained in:
parent
a58468ffee
commit
357887417c
@ -25,7 +25,7 @@ const FilterLabel = styled.span`
|
||||
`;
|
||||
|
||||
// remove non-default query params so they don't show up as filter tags
|
||||
const filterOutDefaultParams = (paramsArr, config) => {
|
||||
const filterDefaultParams = (paramsArr, config) => {
|
||||
const defaultParamsKeys = Object.keys(config.defaultParams);
|
||||
return paramsArr.filter(key => defaultParamsKeys.indexOf(key) === -1);
|
||||
};
|
||||
@ -34,7 +34,7 @@ const FilterTags = ({ i18n, itemCount, qsConfig, location, onRemove, onRemoveAll
|
||||
const queryParams = parseQueryString(qsConfig, location.search);
|
||||
const queryParamsArr = [];
|
||||
const displayAll = true;
|
||||
const nonDefaultParams = filterOutDefaultParams(Object.keys(queryParams), qsConfig);
|
||||
const nonDefaultParams = filterDefaultParams(Object.keys(queryParams), qsConfig);
|
||||
nonDefaultParams
|
||||
.forEach(key => {
|
||||
if (Array.isArray(queryParams[key])) {
|
||||
@ -50,16 +50,16 @@ const FilterTags = ({ i18n, itemCount, qsConfig, location, onRemove, onRemoveAll
|
||||
{`${itemCount} results`}
|
||||
</ResultCount>
|
||||
<VerticalSeparator />
|
||||
<FilterLabel>Active Filters:</FilterLabel>
|
||||
<FilterLabel>{i18n._(t`Active Filters:`)}</FilterLabel>
|
||||
<ChipGroup displayAll={displayAll}>
|
||||
{queryParamsArr.map(param => (
|
||||
{queryParamsArr.map(({ key, value }) => (
|
||||
<Chip
|
||||
className="searchTagChip"
|
||||
key={`${param.key}__${param.value}`}
|
||||
key={`${key}__${value}`}
|
||||
isReadOnly={false}
|
||||
onClick={() => onRemove(param)}
|
||||
onClick={() => onRemove(key, value)}
|
||||
>
|
||||
{param.value}
|
||||
{value}
|
||||
</Chip>
|
||||
))}
|
||||
<div className="pf-c-chip pf-m-overflow">
|
||||
|
||||
@ -50,7 +50,7 @@ class ListHeader extends React.Component {
|
||||
this.pushHistoryState(addParams(qsConfig, search, { [key]: value }));
|
||||
}
|
||||
|
||||
handleRemove ({ key, value }) {
|
||||
handleRemove (key, value) {
|
||||
const { history, qsConfig } = this.props;
|
||||
const { search } = history.location;
|
||||
this.pushHistoryState(removeParams(qsConfig, search, { [key]: value }));
|
||||
|
||||
@ -51,7 +51,7 @@ class PaginatedDataList extends React.Component {
|
||||
|
||||
render () {
|
||||
const {
|
||||
hasContentError,
|
||||
contentError,
|
||||
hasContentLoading,
|
||||
emptyStateControls,
|
||||
items,
|
||||
@ -79,8 +79,8 @@ class PaginatedDataList extends React.Component {
|
||||
let Content;
|
||||
if (hasContentLoading && items.length <= 0) {
|
||||
Content = (<ContentLoading />);
|
||||
} else if (hasContentError) {
|
||||
Content = (<ContentError />);
|
||||
} else if (contentError) {
|
||||
Content = (<ContentError error={contentError} />);
|
||||
} else if (items.length <= 0) {
|
||||
Content = (<ContentEmpty title={emptyContentTitle} message={emptyContentMessage} />);
|
||||
} else {
|
||||
@ -150,12 +150,12 @@ PaginatedDataList.propTypes = {
|
||||
showPageSizeOptions: PropTypes.bool,
|
||||
renderToolbar: PropTypes.func,
|
||||
hasContentLoading: PropTypes.bool,
|
||||
hasContentError: PropTypes.bool,
|
||||
contentError: PropTypes.shape(),
|
||||
};
|
||||
|
||||
PaginatedDataList.defaultProps = {
|
||||
hasContentLoading: false,
|
||||
hasContentError: false,
|
||||
contentError: null,
|
||||
toolbarColumns: [],
|
||||
itemName: 'item',
|
||||
itemNamePlural: '',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user