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