diff --git a/frontend/app/components/Client/Sites/SiteSearch/SiteSearch.tsx b/frontend/app/components/Client/Sites/SiteSearch/SiteSearch.tsx
new file mode 100644
index 000000000..1a4c2b881
--- /dev/null
+++ b/frontend/app/components/Client/Sites/SiteSearch/SiteSearch.tsx
@@ -0,0 +1,34 @@
+import React, { useEffect } from 'react';
+import { Icon } from 'UI';
+import { debounce } from 'App/utils';
+
+let debounceUpdate: any = () => {}
+interface Props {
+ onChange: (value: string) => void;
+}
+function SiteSearch(props: Props) {
+ const { onChange } = props;
+
+ useEffect(() => {
+ debounceUpdate = debounce((value) => onChange(value), 500);
+ }, [])
+
+ const write = ({ target: { name, value } }) => {
+ debounceUpdate(value);
+ }
+
+ return (
+
+
+
+
+ );
+}
+
+export default SiteSearch;
\ No newline at end of file
diff --git a/frontend/app/components/Client/Sites/SiteSearch/index.ts b/frontend/app/components/Client/Sites/SiteSearch/index.ts
new file mode 100644
index 000000000..54376cf15
--- /dev/null
+++ b/frontend/app/components/Client/Sites/SiteSearch/index.ts
@@ -0,0 +1 @@
+export { default } from './SiteSearch';
\ No newline at end of file
diff --git a/frontend/app/components/Client/Sites/Sites.js b/frontend/app/components/Client/Sites/Sites.js
index 027b09cf3..ba3c72e6e 100644
--- a/frontend/app/components/Client/Sites/Sites.js
+++ b/frontend/app/components/Client/Sites/Sites.js
@@ -10,6 +10,7 @@ import GDPRForm from './GDPRForm';
import TrackingCodeModal from 'Shared/TrackingCodeModal';
import BlockedIps from './BlockedIps';
import { confirm } from 'UI/Confirmation';
+import SiteSearch from './SiteSearch';
const STATUS_MESSAGE_MAP = {
[ RED ]: ' There seems to be an issue (please verify your installation)',
@@ -43,6 +44,7 @@ class Sites extends React.PureComponent {
showTrackingCode: false,
modalContent: NONE,
detailContent: NONE,
+ searchQuery: '',
};
toggleBlockedIp = () => {
@@ -119,6 +121,7 @@ class Sites extends React.PureComponent {
const isAdmin = user.admin || user.superAdmin;
const canAddSites = isAdmin && account.limits.projects && account.limits.projects.remaining !== 0;
const canDeleteSites = sites.size > 1 && isAdmin;
+ const filteredSites = sites.filter(site => site.name.toLowerCase().includes(this.state.searchQuery.toLowerCase()));
return (
@@ -159,12 +162,15 @@ class Sites extends React.PureComponent {
position="top left"
/>
-
+
+
+ this.setState({ searchQuery: value })} />
+
@@ -175,7 +181,7 @@ class Sites extends React.PureComponent {
{
- sites.map(_site => (
+ filteredSites.map(_site => (
//