📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
organisation settings - project search & pagination
Blue Mouse6e29a02e8d75
diff --git a/web/app/pages/Dashboard/Tabs.tsx b/web/app/pages/Dashboard/Tabs.tsxindex c82a31522..17078bf35 100644--- a/web/app/pages/Dashboard/Tabs.tsx+++ b/web/app/pages/Dashboard/Tabs.tsx@@ -46,6 +46,7 @@ export const Tabs = ({ activeTab, setActiveTab, className, isLoading }: TabsPropreturn (<buttonkey={tab.id}+ type='button'onClick={() => {if (isLoading) {returndiff --git a/web/app/pages/Organisations/Settings/People.tsx b/web/app/pages/Organisations/Settings/People.tsxindex 4e740f483..ae95ddf88 100644--- a/web/app/pages/Organisations/Settings/People.tsx+++ b/web/app/pages/Organisations/Settings/People.tsx@@ -291,9 +291,9 @@ const People = ({ organisation, reloadOrganisation }: PeopleProps) => {<NoPeople />) : (<div className='mt-3 flex flex-col'>- <div className='-mx-4 -my-2 overflow-x-auto sm:-mx-6 md:overflow-x-visible lg:-mx-8'>- <div className='inline-block min-w-full py-2 md:px-6 lg:px-8'>- <div className='shadow ring-1 ring-black ring-opacity-5 md:rounded-lg'>+ <div className='-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8'>+ <div className='inline-block min-w-full py-2 align-middle md:px-6 lg:px-8'>+ <div className='overflow-hidden shadow ring-1 ring-black ring-opacity-5 md:rounded-lg'><table className='min-w-full divide-y divide-gray-300 dark:divide-gray-600'><thead><tr className='dark:bg-slate-800'>diff --git a/web/app/pages/Organisations/Settings/Projects.tsx b/web/app/pages/Organisations/Settings/Projects.tsxindex 9417d31de..b4f874c8d 100644--- a/web/app/pages/Organisations/Settings/Projects.tsx+++ b/web/app/pages/Organisations/Settings/Projects.tsx@@ -1,6 +1,6 @@-import React, { useState, useEffect } from 'react'+import React, { useState, useEffect, useMemo } from 'react'import { toast } from 'sonner'-import { InformationCircleIcon, MagnifyingGlassIcon, FolderPlusIcon } from '@heroicons/react/24/outline'+import { InformationCircleIcon, MagnifyingGlassIcon, FolderPlusIcon, XMarkIcon } from '@heroicons/react/24/outline'import { useTranslation } from 'react-i18next'import _isEmpty from 'lodash/isEmpty'import _replace from 'lodash/replace'@@ -25,7 +25,8 @@ interface SelectAProjectProps {onSelect: (project: Project) => void}-const PAGINATION_ENTRIES = 5+const PROJECT_SELECT_PAGE_SIZE = 5+const PROJECT_LIST_PAGE_SIZE = 2const SelectAProject = ({ onSelect }: SelectAProjectProps) => {const { t } = useTranslation('common')@@ -37,15 +38,15 @@ const SelectAProject = ({ onSelect }: SelectAProjectProps) => {const [total, setTotal] = useState(0)const debouncedSearch = useDebounce(search, 500)- const pageAmount = Math.ceil(total / PAGINATION_ENTRIES)+ const pageAmount = Math.ceil(total / PROJECT_SELECT_PAGE_SIZE)useEffect(() => {const loadProjects = async () => {setIsLoading(true)try {const { results, total: totalCount } = await getProjectsAvailableForOrganisation(- PAGINATION_ENTRIES,- (currentPage - 1) * PAGINATION_ENTRIES,+ PROJECT_SELECT_PAGE_SIZE,+ (currentPage - 1) * PROJECT_SELECT_PAGE_SIZE,debouncedSearch,)setProjects(results)@@ -113,7 +114,7 @@ const SelectAProject = ({ onSelect }: SelectAProjectProps) => {pageAmount={pageAmount}setPage={setCurrentPage}total={total}- pageSize={PAGINATION_ENTRIES}+ pageSize={PROJECT_SELECT_PAGE_SIZE}/>) : null}</div>@@ -126,7 +127,7 @@ const NoProjects = () => {return (<div className='flex flex-col py-6 sm:px-6 lg:px-8'><div className='mx-auto w-full max-w-7xl text-gray-900 dark:text-gray-50'>- <h2 className='mb-8 px-4 text-center text-xl leading-snug'>{t('project.settings.noPeople')}</h2>+ <h2 className='mb-8 px-4 text-center text-xl leading-snug'>{t('organisations.noProjectsFound')}</h2></div></div>)@@ -182,8 +183,21 @@ export const Projects = ({ organisation, reloadOrganisation }: ProjectsProps) =>const [isActionLoading, setIsActionLoading] = useState(false)const [selectedProject, setSelectedProject] = useState<any>(null)+ const [currentPage, setCurrentPage] = useState(1)+ const [search, setSearch] = useState('')+ const [isSearchActive, setIsSearchActive] = useState(false)const { projects } = organisation+ const pageAmount = Math.ceil(projects.length / PROJECT_LIST_PAGE_SIZE)++ const filteredProjects = useMemo(() => {+ if (!search) {+ return projects+ }++ return projects.filter((project) => project.name.toLowerCase().includes(search.toLowerCase()))+ }, [projects, search])+const removeProject = async (projectId: string) => {if (isActionLoading) {return@@ -231,6 +245,22 @@ export const Projects = ({ organisation, reloadOrganisation }: ProjectsProps) =><div className='mb-3 flex items-center justify-between'><h3 className='mt-2 flex items-center text-lg font-bold text-gray-900 dark:text-gray-50'>{t('organisations.projects')}+ {isSearchActive ? (+ <XMarkIcon+ className='ml-2 h-5 w-5 cursor-pointer text-gray-900 hover:opacity-80 dark:text-gray-50'+ onClick={() => {+ setSearch('')+ setIsSearchActive(false)+ }}+ />+ ) : (+ <MagnifyingGlassIcon+ className='ml-2 h-5 w-5 cursor-pointer text-gray-900 hover:opacity-80 dark:text-gray-50'+ onClick={() => {+ setIsSearchActive(true)+ }}+ />+ )}</h3><ButtonclassName='h-8 pl-2'@@ -247,14 +277,28 @@ export const Projects = ({ organisation, reloadOrganisation }: ProjectsProps) =></></Button></div>+ {isSearchActive && (+ <div className='relative w-full'>+ <div className='pointer-events-none absolute inset-y-0 left-0 hidden items-center sm:flex'>+ <MagnifyingGlassIcon className='ml-2 h-5 w-5 cursor-pointer text-gray-900 hover:opacity-80 dark:text-gray-50' />+ </div>+ <input+ type='text'+ onChange={(e) => setSearch(e.target.value)}+ value={search}+ className='block h-8 w-full rounded-lg border-none bg-gray-50 p-2.5 text-sm text-gray-900 ring-1 ring-gray-300 focus:ring-gray-500 dark:bg-slate-900 dark:text-white dark:placeholder-gray-400 dark:ring-slate-600 dark:focus:ring-slate-200 sm:pl-10'+ placeholder={t('project.search')}+ />+ </div>+ )}<div>- {_isEmpty(projects) ? (+ {_isEmpty(filteredProjects) ? (<NoProjects />) : (<div className='mt-3 flex flex-col'>- <div className='-mx-4 -my-2 overflow-x-auto sm:-mx-6 md:overflow-x-visible lg:-mx-8'>- <div className='inline-block min-w-full py-2 md:px-6 lg:px-8'>- <div className='shadow ring-1 ring-black ring-opacity-5 md:rounded-lg'>+ <div className='-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8'>+ <div className='inline-block min-w-full py-2 align-middle md:px-6 lg:px-8'>+ <div className='overflow-hidden shadow ring-1 ring-black ring-opacity-5 md:rounded-lg'><table className='min-w-full divide-y divide-gray-300 dark:divide-gray-600'><thead><tr className='dark:bg-slate-800'>@@ -269,7 +313,10 @@ export const Projects = ({ organisation, reloadOrganisation }: ProjectsProps) =></thead><tbody className='divide-y divide-gray-300 dark:divide-gray-600'><ProjectList- projects={projects}+ projects={filteredProjects.slice(+ (currentPage - 1) * PROJECT_LIST_PAGE_SIZE,+ currentPage * PROJECT_LIST_PAGE_SIZE,+ )}onRemove={(project) => {setProjectToRemove(project)setShowDeleteModal(true)@@ -278,6 +325,16 @@ export const Projects = ({ organisation, reloadOrganisation }: ProjectsProps) =></tbody></table></div>+ {pageAmount > 1 ? (+ <Pagination+ className='mt-4 px-2'+ page={currentPage}+ pageAmount={pageAmount}+ setPage={setCurrentPage}+ total={projects.length}+ pageSize={PROJECT_LIST_PAGE_SIZE}+ />+ ) : null}</div></div></div>diff --git a/web/app/pages/Project/View/ViewProject.tsx b/web/app/pages/Project/View/ViewProject.tsxindex 9ea84b8c9..a6c60e535 100644--- a/web/app/pages/Project/View/ViewProject.tsx+++ b/web/app/pages/Project/View/ViewProject.tsx@@ -3567,6 +3567,7 @@ const ViewProject = () => {</div>{activeTab === PROJECT_TABS.funnels && (<button+ type='button'onClick={() => setActiveFunnel(null)}className='mx-auto mb-4 mt-2 flex items-center text-base font-normal text-gray-900 underline decoration-dashed hover:decoration-solid dark:text-gray-100 lg:mx-0 lg:mt-0'>@@ -3683,6 +3684,7 @@ const ViewProject = () => {{activeTab === PROJECT_TABS.sessions && activePSID && (<><button+ type='button'onClick={() => {setActiveSession(null)setActivePSID(null)@@ -3759,6 +3761,7 @@ const ViewProject = () => {{activeTab === PROJECT_TABS.errors && activeEID && (<><button+ type='button'onClick={() => {setActiveError(null)setActiveEID(null)diff --git a/web/app/pages/Project/uptime/View.tsx b/web/app/pages/Project/uptime/View.tsxindex 0e5216ac5..584f872fe 100644--- a/web/app/pages/Project/uptime/View.tsx+++ b/web/app/pages/Project/uptime/View.tsx@@ -401,6 +401,7 @@ const Uptime = () => {</div></div><button+ type='button'onClick={() => setActiveMonitor(null)}className='mx-auto mb-4 mt-2 flex items-center text-base font-normal text-gray-900 underline decoration-dashed hover:decoration-solid dark:text-gray-100 lg:mx-0 lg:mt-0'>diff --git a/web/app/ui/Pagination.tsx b/web/app/ui/Pagination.tsxindex 738fed979..3275c6a31 100644--- a/web/app/ui/Pagination.tsx+++ b/web/app/ui/Pagination.tsx@@ -41,6 +41,7 @@ const Pagination = ({><div className='flex flex-1 justify-between sm:hidden'><button+ type='button'onClick={() => {if (page === 1) {return@@ -60,6 +61,7 @@ const Pagination = ({{t('project.prev')}</button><button+ type='button'onClick={() => {if (page === pageAmount) {return@@ -97,6 +99,7 @@ const Pagination = ({)}<nav className='isolate inline-flex -space-x-px rounded-md shadow-sm' aria-label='Pagination'><button+ type='button'onClick={() => {if (page === 1) {return@@ -120,6 +123,7 @@ const Pagination = ({if (item === DOTS) {return (<button+ type='button'key={item + index}onClick={() => {const lastShownPage = paginationRange[index - 1] as number@@ -137,6 +141,7 @@ const Pagination = ({return (<button+ type='button'key={item}onClick={() => setPage(item)}className={cx(@@ -152,6 +157,7 @@ const Pagination = ({)})}<button+ type='button'onClick={() => {if (page === pageAmount) {returndiff --git a/web/public/locales/de.json b/web/public/locales/de.jsonindex f38d8ff0f..94c6902c3 100644--- a/web/public/locales/de.json+++ b/web/public/locales/de.json@@ -669,6 +669,7 @@},"projects": "Projects","addProject": "Add project",+ "noProjectsFound": "No projects found within this organisation","modals": {"remove": {"title": "Remove {{project}}?",diff --git a/web/public/locales/el.json b/web/public/locales/el.jsonindex f5f36c652..d90e2f39a 100644--- a/web/public/locales/el.json+++ b/web/public/locales/el.json@@ -669,6 +669,7 @@},"projects": "Projects","addProject": "Add project",+ "noProjectsFound": "No projects found within this organisation","modals": {"remove": {"title": "Remove {{project}}?",diff --git a/web/public/locales/en.json b/web/public/locales/en.jsonindex b81541675..19c13962f 100644--- a/web/public/locales/en.json+++ b/web/public/locales/en.json@@ -669,6 +669,7 @@},"projects": "Projects","addProject": "Add project",+ "noProjectsFound": "No projects found within this organisation","modals": {"remove": {"title": "Remove {{project}}?",diff --git a/web/public/locales/es.json b/web/public/locales/es.jsonindex e447c60f9..72d67b9a9 100644--- a/web/public/locales/es.json+++ b/web/public/locales/es.json@@ -669,6 +669,7 @@},"projects": "Projects","addProject": "Add project",+ "noProjectsFound": "No projects found within this organisation","modals": {"remove": {"title": "Remove {{project}}?",diff --git a/web/public/locales/fr.json b/web/public/locales/fr.jsonindex 4008d64a0..53f4884aa 100644--- a/web/public/locales/fr.json+++ b/web/public/locales/fr.json@@ -669,6 +669,7 @@},"projects": "Projects","addProject": "Add project",+ "noProjectsFound": "No projects found within this organisation","modals": {"remove": {"title": "Remove {{project}}?",diff --git a/web/public/locales/pl.json b/web/public/locales/pl.jsonindex 6112fc089..a698443fa 100644--- a/web/public/locales/pl.json+++ b/web/public/locales/pl.json@@ -669,6 +669,7 @@},"projects": "Projects","addProject": "Add project",+ "noProjectsFound": "No projects found within this organisation","modals": {"remove": {"title": "Remove {{project}}?",diff --git a/web/public/locales/sv.json b/web/public/locales/sv.jsonindex 127855add..7c155d4b8 100644--- a/web/public/locales/sv.json+++ b/web/public/locales/sv.json@@ -669,6 +669,7 @@},"projects": "Projects","addProject": "Add project",+ "noProjectsFound": "No projects found within this organisation","modals": {"remove": {"title": "Remove {{project}}?",diff --git a/web/public/locales/uk.json b/web/public/locales/uk.jsonindex 00cd9ef25..2bd41b054 100644--- a/web/public/locales/uk.json+++ b/web/public/locales/uk.json@@ -669,6 +669,7 @@},"projects": "Projects","addProject": "Add project",+ "noProjectsFound": "No projects found within this organisation","modals": {"remove": {"title": "Remove {{project}}?",