diff --git a/src/short-urls/SearchBar.js b/src/short-urls/SearchBar.js
index be30125c..5feaf65a 100644
--- a/src/short-urls/SearchBar.js
+++ b/src/short-urls/SearchBar.js
@@ -5,7 +5,7 @@ import { connect } from 'react-redux';
import Tag from '../utils/Tag';
import { listShortUrls } from './reducers/shortUrlsList';
import './SearchBar.scss';
-import { pick } from 'ramda';
+import { pick, isEmpty } from 'ramda';
export class SearchBar extends React.Component {
state = {
@@ -16,7 +16,7 @@ export class SearchBar extends React.Component {
render() {
const { listShortUrls, shortUrlsListParams } = this.props;
- const selectedTag = shortUrlsListParams.tags ? shortUrlsListParams.tags[0] : '';
+ const selectedTags = shortUrlsListParams.tags || [];
return (
@@ -39,15 +39,20 @@ export class SearchBar extends React.Component {
- {selectedTag && (
+ {!isEmpty(selectedTags) && (
- Filtering by tag:
+ Filtering by tags:
- listShortUrls({ ...shortUrlsListParams, tags: undefined })}
- />
+ onClose={() => listShortUrls(
+ {
+ ...shortUrlsListParams,
+ tags: selectedTags.filter(selectedTag => selectedTag !== tag)
+ }
+ )}
+ />)}
)}
diff --git a/src/short-urls/ShortUrlsList.js b/src/short-urls/ShortUrlsList.js
index 0683c72a..6be4ad2a 100644
--- a/src/short-urls/ShortUrlsList.js
+++ b/src/short-urls/ShortUrlsList.js
@@ -94,7 +94,7 @@ export class ShortUrlsList extends React.Component {
}
renderShortUrls() {
- const { shortUrlsList, selectedServer, loading, error } = this.props;
+ const { shortUrlsList, selectedServer, loading, error, shortUrlsListParams } = this.props;
if (error) {
return Something went wrong while loading short URLs :( |
;
}
@@ -113,6 +113,7 @@ export class ShortUrlsList extends React.Component {
selectedServer={selectedServer}
key={shortUrl.shortCode}
refreshList={this.refreshList}
+ shortUrlsListParams={shortUrlsListParams}
/>
));
}
diff --git a/src/short-urls/helpers/ShortUrlsRow.js b/src/short-urls/helpers/ShortUrlsRow.js
index d2bef438..f7953f56 100644
--- a/src/short-urls/helpers/ShortUrlsRow.js
+++ b/src/short-urls/helpers/ShortUrlsRow.js
@@ -13,8 +13,11 @@ export class ShortUrlsRow extends React.Component {
return No tags;
}
- const { refreshList } = this.props;
- return tags.map(tag => refreshList({ tags: [tag] })} />);
+ const { refreshList, shortUrlsListParams } = this.props;
+ const selectedTags = shortUrlsListParams.tags || [];
+ return tags.map(
+ tag => refreshList({tags: [ ...selectedTags, tag ] })} />
+ );
}
render() {