diff --git a/docker/config.yml.template b/docker/config.yml.template index f628a60c8..a2dd0a73c 100644 --- a/docker/config.yml.template +++ b/docker/config.yml.template @@ -39,4 +39,3 @@ ui: email: dev@.nip.io enforce_quota: false fqdn: .nip.io - ui4_path: /next/ diff --git a/src/components/routes/admin/error_viewer.tsx b/src/components/routes/admin/error_viewer.tsx index 5d873f48a..25a65870e 100644 --- a/src/components/routes/admin/error_viewer.tsx +++ b/src/components/routes/admin/error_viewer.tsx @@ -14,6 +14,7 @@ import { DEFAULT_SUGGESTION } from 'components/visual/SearchBar/search-textfield import SimpleSearchQuery from 'components/visual/SearchBar/simple-search-query'; import SearchPager from 'components/visual/SearchPager'; import ErrorsTable from 'components/visual/SearchResult/errors'; +import { searchResultsDisplay } from 'helpers/utils'; import 'moment/locale/fr'; import React, { useCallback, useEffect, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; @@ -288,7 +289,7 @@ export default function ErrorViewer() { {t('searching')} ) : ( - {errorResults.total}  + {searchResultsDisplay(errorResults.total)}  {query.get('query') ? t(`filtered${errorResults.total === 1 ? '' : 's'}`) : t(`total${errorResults.total === 1 ? '' : 's'}`)} diff --git a/src/components/routes/admin/users.tsx b/src/components/routes/admin/users.tsx index 1818c8170..d9b77baa1 100644 --- a/src/components/routes/admin/users.tsx +++ b/src/components/routes/admin/users.tsx @@ -28,6 +28,7 @@ import { DEFAULT_SUGGESTION } from 'components/visual/SearchBar/search-textfield import SimpleSearchQuery from 'components/visual/SearchBar/simple-search-query'; import SearchPager from 'components/visual/SearchPager'; import UsersTable from 'components/visual/SearchResult/users'; +import { searchResultsDisplay } from 'helpers/utils'; import ChipInput from 'material-ui-chip-input'; import 'moment/locale/fr'; import React, { useEffect, useRef, useState } from 'react'; @@ -420,7 +421,7 @@ export default function Users() { {t('searching')} ) : ( - {userResults.total}  + {searchResultsDisplay(userResults.total)}  {query.get('query') ? t(`filtered${userResults.total === 1 ? '' : 's'}`) : t(`total${userResults.total === 1 ? '' : 's'}`)} diff --git a/src/components/routes/alerts/alerts.tsx b/src/components/routes/alerts/alerts.tsx index 961f30220..c01dba95b 100644 --- a/src/components/routes/alerts/alerts.tsx +++ b/src/components/routes/alerts/alerts.tsx @@ -14,6 +14,7 @@ import InformativeAlert from 'components/visual/InformativeAlert'; import SearchBar from 'components/visual/SearchBar/search-bar'; import SearchQuery, { SearchQueryFilters } from 'components/visual/SearchBar/search-query'; import { DEFAULT_SUGGESTION } from 'components/visual/SearchBar/search-textfield'; +import { searchResultsDisplay } from 'helpers/utils'; import React, { useCallback, useEffect, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { BiNetworkChart } from 'react-icons/bi'; @@ -472,7 +473,7 @@ const SearchResultLarge = ({ searching, total, query, onApplyFilters }) => {
- {searching ? '' : {`${total} ${total > 1 ? t('results') : t('result')}`}} + {searching ? '' : {`${searchResultsDisplay(total)} ${total > 1 ? t('results') : t('result')}`}}
); @@ -490,7 +491,7 @@ const SearchResultSmall = ({ searching, total, query }) => { )} - {searching ? '' : `${total} ${total > 1 ? t('results') : t('result')}`} + {searching ? '' : `${searchResultsDisplay(total)} ${total > 1 ? t('results') : t('result')}`} ); diff --git a/src/components/routes/manage/heuristics.tsx b/src/components/routes/manage/heuristics.tsx index 08fb86453..2a5b50f72 100644 --- a/src/components/routes/manage/heuristics.tsx +++ b/src/components/routes/manage/heuristics.tsx @@ -10,6 +10,7 @@ import { DEFAULT_SUGGESTION } from 'components/visual/SearchBar/search-textfield import SimpleSearchQuery from 'components/visual/SearchBar/simple-search-query'; import SearchPager from 'components/visual/SearchPager'; import HeuristicsTable from 'components/visual/SearchResult/heuristics'; +import { searchResultsDisplay } from 'helpers/utils'; import 'moment/locale/fr'; import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; @@ -148,7 +149,7 @@ export default function Heuristics() { {t('searching')} ) : ( - {heuristicResults.total}  + {searchResultsDisplay(heuristicResults.total)}  {query.get('query') ? t(`filtered${heuristicResults.total === 1 ? '' : 's'}`) : t(`total${heuristicResults.total === 1 ? '' : 's'}`)} diff --git a/src/components/routes/manage/signatures.tsx b/src/components/routes/manage/signatures.tsx index b77b5bb15..dae72a6ee 100644 --- a/src/components/routes/manage/signatures.tsx +++ b/src/components/routes/manage/signatures.tsx @@ -13,6 +13,7 @@ import { DEFAULT_SUGGESTION } from 'components/visual/SearchBar/search-textfield import SimpleSearchQuery from 'components/visual/SearchBar/simple-search-query'; import SearchPager from 'components/visual/SearchPager'; import SignaturesTable from 'components/visual/SearchResult/signatures'; +import { searchResultsDisplay } from 'helpers/utils'; import 'moment/locale/fr'; import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; @@ -225,7 +226,7 @@ export default function Signatures() { {t('searching')} ) : ( - {signatureResults.total}  + {searchResultsDisplay(signatureResults.total)}  {query.get('query') ? t(`filtered${signatureResults.total === 1 ? '' : 's'}`) : t(`total${signatureResults.total === 1 ? '' : 's'}`)} diff --git a/src/components/routes/manage/workflows.tsx b/src/components/routes/manage/workflows.tsx index 01ce4ebd3..3a064f665 100644 --- a/src/components/routes/manage/workflows.tsx +++ b/src/components/routes/manage/workflows.tsx @@ -13,6 +13,7 @@ import { DEFAULT_SUGGESTION } from 'components/visual/SearchBar/search-textfield import SimpleSearchQuery from 'components/visual/SearchBar/simple-search-query'; import SearchPager from 'components/visual/SearchPager'; import WorkflowTable from 'components/visual/SearchResult/workflow'; +import { searchResultsDisplay } from 'helpers/utils'; import 'moment/locale/fr'; import React, { useCallback, useEffect, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; @@ -210,7 +211,7 @@ export default function Workflows() { {t('searching')} ) : ( - {workflowResults.total}  + {searchResultsDisplay(workflowResults.total)}  {query.get('query') ? t(`filtered${workflowResults.total === 1 ? '' : 's'}`) : t(`total${workflowResults.total === 1 ? '' : 's'}`)} diff --git a/src/components/routes/search.tsx b/src/components/routes/search.tsx index 6b015d91c..65d4df59a 100644 --- a/src/components/routes/search.tsx +++ b/src/components/routes/search.tsx @@ -28,6 +28,7 @@ import FilesTable from 'components/visual/SearchResult/files'; import ResultsTable from 'components/visual/SearchResult/results'; import SignaturesTable from 'components/visual/SearchResult/signatures'; import SubmissionsTable from 'components/visual/SearchResult/submissions'; +import { searchResultsDisplay } from 'helpers/utils'; import React, { useEffect, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Link, useHistory, useLocation, useParams } from 'react-router-dom'; @@ -265,16 +266,29 @@ function Search({ index }: SearchProps) { variant="scrollable" > - - + + - + @@ -293,7 +307,9 @@ function Search({ index }: SearchProps) {
{resMap[tab] && resMap[tab].total !== 0 && (index || id) && (
- {`${resMap[tab].total} ${t(resMap[tab].total === 1 ? 'matching_result' : 'matching_results')}`} + {`${searchResultsDisplay(resMap[tab].total)} ${t( + resMap[tab].total === 1 ? 'matching_result' : 'matching_results' + )}`}
)}
diff --git a/src/components/routes/submissions.tsx b/src/components/routes/submissions.tsx index 2a1e84c6c..34be8ce14 100644 --- a/src/components/routes/submissions.tsx +++ b/src/components/routes/submissions.tsx @@ -12,6 +12,7 @@ import { DEFAULT_SUGGESTION } from 'components/visual/SearchBar/search-textfield import SimpleSearchQuery from 'components/visual/SearchBar/simple-search-query'; import SearchPager from 'components/visual/SearchPager'; import SubmissionsTable, { SubmissionResult } from 'components/visual/SearchResult/submissions'; +import { searchResultsDisplay } from 'helpers/utils'; import 'moment/locale/fr'; import React, { useEffect, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; @@ -153,7 +154,7 @@ export default function Submissions() { {t('searching')} ) : ( - {submissionResults.total}  + {searchResultsDisplay(submissionResults.total)}  {query.get('query') ? t(`filtered${submissionResults.total === 1 ? '' : 's'}`) : t(`total${submissionResults.total === 1 ? '' : 's'}`)} diff --git a/src/helpers/utils.ts b/src/helpers/utils.ts index 5806f9ba5..66aa26a44 100644 --- a/src/helpers/utils.ts +++ b/src/helpers/utils.ts @@ -51,3 +51,11 @@ export function getProvider() { const params = new URLSearchParams(window.location.search); return params.get('provider'); } + +export function searchResultsDisplay(count, max = 10000) { + if (count >= max) { + return `${count}+`; + } + + return `${count}`; +}