diff --git a/src/assets/locales/de/main.json b/src/assets/locales/de/main.json index 5b6fa733b1..63c4a319d5 100644 --- a/src/assets/locales/de/main.json +++ b/src/assets/locales/de/main.json @@ -2456,7 +2456,9 @@ }, "table": { "search": "Enter email to search", - "searchName": "Enter name to search" + "searchName": "Enter name to search", + "emptyDataMsg": "Keine Einträge vorhanden.\nEinträge werden hier angezeigt, sobald sie hinzugefügt werden.", + "noSearchResults": "Keine Ergebnisse gefunden.\nBitte versuchen Sie es mit anderen Suchbegriffen." }, "noData": { "heading": "No data available", diff --git a/src/assets/locales/en/main.json b/src/assets/locales/en/main.json index 30f46d0a91..54de25ab4d 100644 --- a/src/assets/locales/en/main.json +++ b/src/assets/locales/en/main.json @@ -2456,7 +2456,9 @@ }, "table": { "search": "Enter email to search", - "searchName": "Enter name to search" + "searchName": "Enter name to search", + "emptyDataMsg": "No items to display.\nItems will appear here once they are added.", + "noSearchResults": "No results found.\nPlease try again with different keywords." }, "noData": { "heading": "No data available", diff --git a/src/components/overlays/AddAppUserRoles/UserListContent.tsx b/src/components/overlays/AddAppUserRoles/UserListContent.tsx index 0d9b0297f0..456f148e59 100644 --- a/src/components/overlays/AddAppUserRoles/UserListContent.tsx +++ b/src/components/overlays/AddAppUserRoles/UserListContent.tsx @@ -66,7 +66,6 @@ export default function UserListContent() { onSelection={(id: GridRowId[]) => { dispatch(setSelectedUserToAdd(id)) }} - noRowsMsg={t('content.usermanagement.table.noRowsMsg')} title={t('content.usermanagement.table.title')} loadLabel={t('global.actions.loadmore')} fetchHook={useFetchAppUsersSearchQuery} @@ -94,6 +93,8 @@ export default function UserListContent() { }, ]} checkboxSelection + emptyDataMsg={t('global.table.emptyDataMsg')} + noSearchResultsMsg={t('global.table.noSearchResults')} /> ) } diff --git a/src/components/pages/Admin/RegistrationRequests/RequestList/index.tsx b/src/components/pages/Admin/RegistrationRequests/RequestList/index.tsx index ff01c0288f..f272282f67 100644 --- a/src/components/pages/Admin/RegistrationRequests/RequestList/index.tsx +++ b/src/components/pages/Admin/RegistrationRequests/RequestList/index.tsx @@ -154,6 +154,8 @@ export const RequestList = ({ )}${t('content.admin.registration-requests.introText2')}`} defaultFilter={group} filterViews={filterView} + emptyDataMsg={t('global.table.emptyDataMsg')} + noSearchResultsMsg={t('global.table.noSearchResults')} /> ) diff --git a/src/components/pages/AdminCredential/AdminCredentialElements.tsx b/src/components/pages/AdminCredential/AdminCredentialElements.tsx index d7a9c1b5f8..152cccf22d 100644 --- a/src/components/pages/AdminCredential/AdminCredentialElements.tsx +++ b/src/components/pages/AdminCredential/AdminCredentialElements.tsx @@ -436,6 +436,8 @@ export default function AdminCredentialElements() { setSortOption(value) }} disableColumnSelector={true} + emptyDataMsg={t('global.table.emptyDataMsg')} + noSearchResultsMsg={t('global.table.noSearchResults')} /> diff --git a/src/components/pages/AppOverview/AddRoles.tsx b/src/components/pages/AppOverview/AddRoles.tsx index 2cb62b6cf1..db5097697f 100644 --- a/src/components/pages/AppOverview/AddRoles.tsx +++ b/src/components/pages/AppOverview/AddRoles.tsx @@ -61,6 +61,7 @@ export default function AddRoles() { const navigate = useNavigate() const appId = useParams().appId const [isLoading, setIsLoading] = useState(false) + const [noRowsMsg, setNoRowsMsg] = useState('') const { state } = useLocation() const items = state const app = items?.filter((item: ItemType) => item.id === appId) @@ -74,6 +75,14 @@ export default function AddRoles() { [`${()}`], ]) + const appRolesData = + data && data.length > 0 + ? appRoles.map((item, i) => ({ + establishedRoles: item[0], + id: i, + })) + : [] + useEffect(() => { refetch() }, [state]) @@ -91,13 +100,11 @@ export default function AddRoles() { ) }, [data]) - const appRolesData = - data && data.length > 0 - ? appRoles.map((item, i) => ({ - establishedRoles: item[0], - id: i, - })) - : [] + useEffect(() => { + if (appRolesData && appRolesData.length === 0) { + setNoRowsMsg(t('global.table.emptyDataMsg')) + } + }, [appRolesData]) const columns = [ { @@ -194,6 +201,7 @@ export default function AddRoles() { rows={appRolesData} getRowId={(row) => uniqueId(row.urn)} hasBorder={false} + noRowsMsg={noRowsMsg} /> diff --git a/src/components/pages/CompanyData/CompanyAddressList.tsx b/src/components/pages/CompanyData/CompanyAddressList.tsx index 5b9e0754f9..697016d4a6 100644 --- a/src/components/pages/CompanyData/CompanyAddressList.tsx +++ b/src/components/pages/CompanyData/CompanyAddressList.tsx @@ -18,7 +18,7 @@ ********************************************************************************/ import { Chip, IconButton, Table } from '@catena-x/portal-shared-components' -import { useEffect, useState } from 'react' +import { useEffect, useMemo, useState } from 'react' import { useDispatch, useSelector } from 'react-redux' import { Box } from '@mui/material' import { useTranslation } from 'react-i18next' @@ -60,6 +60,7 @@ export const CompanyAddressList = ({ handleConfirm: () => void }) => { const { t } = useTranslation() + const [noRowsMsg, setNoRowsMsg] = useState('') const [page, setPage] = useState(0) const { data, @@ -80,6 +81,8 @@ export const CompanyAddressList = ({ const dispatch = useDispatch() const refetch = useSelector(companyRefetch) + const rows = useMemo(() => inputs.concat(outputs), [inputs, outputs]) + const getInputItems = async () => { const params = sharingStates ?.filter( @@ -139,6 +142,12 @@ export const CompanyAddressList = ({ } }, [data]) + useEffect(() => { + if (rows && rows.length === 0) { + setNoRowsMsg(t('global.table.emptyDataMsg')) + } + }, [rows]) + const getStatus = (id: string) => sharingStates?.filter((state) => id === state.externalId)[0] ?.sharingStateType @@ -212,9 +221,7 @@ export const CompanyAddressList = ({ columnHeadersBackgroundColor={'#FFFFFF'} searchDebounce={1000} noRowsMsg={ - !isFetching && !isOutputLoading && !isInputLoading - ? t('content.companyData.table.noRowsMsg') - : '' + !isFetching && !isOutputLoading && !isInputLoading ? noRowsMsg : '' } title={t('content.companyData.table.title')} getRowId={(row: { [key: string]: string }) => row.createdAt} diff --git a/src/components/pages/CompanySubscriptions/index.tsx b/src/components/pages/CompanySubscriptions/index.tsx index d914877fd9..4fe5536a69 100644 --- a/src/components/pages/CompanySubscriptions/index.tsx +++ b/src/components/pages/CompanySubscriptions/index.tsx @@ -229,6 +229,8 @@ export default function CompanySubscriptions() { onClearSearch={() => { setSearchExpr('') }} + emptyDataMsg={t('global.table.emptyDataMsg')} + noSearchResultsMsg={t('global.table.noSearchResults')} /> ) diff --git a/src/components/pages/EdcConnector/index.tsx b/src/components/pages/EdcConnector/index.tsx index 32e9521df2..532009a0df 100644 --- a/src/components/pages/EdcConnector/index.tsx +++ b/src/components/pages/EdcConnector/index.tsx @@ -504,6 +504,8 @@ const EdcConnector = () => { onCellClick={(params: GridCellParams) => { onTableCellClick(params) }} + emptyDataMsg={t('global.table.emptyDataMsg')} + noSearchResultsMsg={t('global.table.noSearchResults')} /> @@ -517,10 +519,11 @@ const EdcConnector = () => { fetchHookRefresh={refresh} getRowId={(row: { [key: string]: string }) => row.id} columns={managedConnectorCols} - noRowsMsg={t('content.edcconnector.noConnectorsMessage')} onCellClick={(params: GridCellParams) => { onTableCellClick(params) }} + emptyDataMsg={t('global.table.emptyDataMsg')} + noSearchResultsMsg={t('global.table.noSearchResults')} /> diff --git a/src/components/pages/IDPManagement/IDPList.tsx b/src/components/pages/IDPManagement/IDPList.tsx index 0a0d19fa67..579da9d440 100644 --- a/src/components/pages/IDPManagement/IDPList.tsx +++ b/src/components/pages/IDPManagement/IDPList.tsx @@ -88,6 +88,7 @@ export const IDPList = ({ isManagementOSP }: { isManagementOSP?: boolean }) => { const [disableLoading, setDisableLoading] = useState(false) const [deleteLoading, setDeleteLoading] = useState(false) + const [noRowsMsg, setNoRowsMsg] = useState('') const { data, isFetching } = useFetchIDPListQuery() const idpsData = data @@ -107,6 +108,13 @@ export const IDPList = ({ isManagementOSP }: { isManagementOSP?: boolean }) => { setIdpsManagedData(managedIdpsData) }, [data]) + useEffect(() => { + const dataRows = isManagementOSP ? idpsManagedData : idpsData + if (dataRows && dataRows.length === 0) { + setNoRowsMsg(t('global.table.emptyDataMsg')) + } + }, [isManagementOSP, idpsData, idpsManagedData]) + const doDelete = async ( e: React.MouseEvent, idp: IdentityProvider @@ -474,6 +482,7 @@ export const IDPList = ({ isManagementOSP }: { isManagementOSP?: boolean }) => { rows={(isManagementOSP ? idpsManagedData : idpsData) ?? []} getRowId={(row: { [key: string]: string }) => row.identityProviderId} hasBorder={false} + noRowsMsg={noRowsMsg} searchPlaceholder={ isManagementOSP ? t('content.onboardingServiceProvider.search') diff --git a/src/components/pages/InviteBusinessPartner/InviteList/index.tsx b/src/components/pages/InviteBusinessPartner/InviteList/index.tsx index 70e3762580..f2eb3ecbf2 100644 --- a/src/components/pages/InviteBusinessPartner/InviteList/index.tsx +++ b/src/components/pages/InviteBusinessPartner/InviteList/index.tsx @@ -135,6 +135,8 @@ export const InviteList = ({ ), }, ]} + emptyDataMsg={t('global.table.emptyDataMsg')} + noSearchResultsMsg={t('global.table.noSearchResults')} /> ) diff --git a/src/components/pages/OnboardingServiceProvider/OnboardingServiceProvider.tsx b/src/components/pages/OnboardingServiceProvider/OnboardingServiceProvider.tsx index 6b979229ce..3ad2d279e4 100644 --- a/src/components/pages/OnboardingServiceProvider/OnboardingServiceProvider.tsx +++ b/src/components/pages/OnboardingServiceProvider/OnboardingServiceProvider.tsx @@ -404,6 +404,8 @@ const OnboardingServiceProvider = () => { sortable: false, }, ]} + emptyDataMsg={t('global.table.emptyDataMsg')} + noSearchResultsMsg={t('global.table.noSearchResults')} /> diff --git a/src/components/pages/PartnerNetwork/index.tsx b/src/components/pages/PartnerNetwork/index.tsx index 7b13af8562..e8c20b0d6c 100644 --- a/src/components/pages/PartnerNetwork/index.tsx +++ b/src/components/pages/PartnerNetwork/index.tsx @@ -47,6 +47,7 @@ const PartnerNetwork = () => { const { t } = useTranslation() const [expr, setExpr] = useState('') const [bpn, setBpn] = useState('') + const [noRowsMsg, setNoRowsMsg] = useState('') const searchInputData = useSelector(updatePartnerSelector) const columns = PartnerNetworksTableColumns(t) const [mutationRequest] = useFetchBusinessPartnerAddressMutation() @@ -89,6 +90,16 @@ const PartnerNetwork = () => { if (data && data.length > 0) fetchAllMembers() }, [data, fetchArgs]) + useEffect(() => { + if (allItems) { + if (!(expr || bpn) && allItems.length === 0) { + setNoRowsMsg(t('global.table.emptyDataMsg')) + } else if ((expr || bpn) && allItems.length === 0) { + setNoRowsMsg(t('global.table.noSearchResults')) + } + } + }, [allItems, expr, bpn]) + const setCountryAttributes = (payload: PaginResult) => { let finalObj = JSON.parse(JSON.stringify(payload?.content)) finalObj = addCountryAttribute( @@ -171,7 +182,7 @@ const PartnerNetwork = () => { loading={loading} rows={allItems} rowsCount={allItems?.length} - noRowsMsg={t('content.companyData.table.noRowsMsg')} + noRowsMsg={noRowsMsg} nextPage={() => { setPage(page + 1) }} diff --git a/src/components/pages/SemanticHub/ModelTable.tsx b/src/components/pages/SemanticHub/ModelTable.tsx index e52ec5d6fe..6f3f12ef9d 100644 --- a/src/components/pages/SemanticHub/ModelTable.tsx +++ b/src/components/pages/SemanticHub/ModelTable.tsx @@ -51,6 +51,7 @@ const ModelTable = ({ onModelSelect }: ModelTableProps) => { const [selectedFilter, setSelectedFilter] = useState({ status: [DefaultStatus], }) + const [noRowsMsg, setNoRowsMsg] = useState('') const rowCount = 10 const filter = [ { @@ -94,6 +95,16 @@ const ModelTable = ({ onModelSelect }: ModelTableProps) => { const { uploadedModel } = useSelector(semanticModelsSelector) + useEffect(() => { + if (models) { + if (!searchValue && models.length === 0) { + setNoRowsMsg(t('global.table.emptyDataMsg')) + } else if (searchValue && models.length === 0) { + setNoRowsMsg(t('global.table.noSearchResults')) + } + } + }, [models, searchValue]) + useEffect(() => { if (modelList) { if (pageNumber === 0) { @@ -156,6 +167,7 @@ const ModelTable = ({ onModelSelect }: ModelTableProps) => {
{ reload={() => { setPageNumber(0) }} - noRowsMsg={t('global.noData.heading')} + noRowsMsg={noRowsMsg} />
{modelList?.totalPages !== pageNumber && ( diff --git a/src/components/pages/TechnicalUserManagement/TechnicalUserTable.tsx b/src/components/pages/TechnicalUserManagement/TechnicalUserTable.tsx index 823664fe90..737cd706c3 100644 --- a/src/components/pages/TechnicalUserManagement/TechnicalUserTable.tsx +++ b/src/components/pages/TechnicalUserManagement/TechnicalUserTable.tsx @@ -208,6 +208,8 @@ export const TechnicalUserTable = () => { ), }, ]} + emptyDataMsg={t('global.table.emptyDataMsg')} + noSearchResultsMsg={t('global.table.noSearchResults')} />
) diff --git a/src/components/shared/frame/UserList/index.tsx b/src/components/shared/frame/UserList/index.tsx index 5428bb57c9..ea2d837d8e 100644 --- a/src/components/shared/frame/UserList/index.tsx +++ b/src/components/shared/frame/UserList/index.tsx @@ -120,7 +120,6 @@ export const UserList = ({ onSearch(expr) }} searchDebounce={1000} - noRowsMsg={t('content.usermanagement.appUserDetails.table.noRowsMsg')} title={t(tableLabel)} loadLabel={t('global.actions.more')} fetchHook={fetchHook} @@ -209,6 +208,8 @@ export const UserList = ({ }, ]} disableColumnMenu + emptyDataMsg={t('global.table.emptyDataMsg')} + noSearchResultsMsg={t('global.table.noSearchResults')} /> ) diff --git a/src/components/shared/templates/StaticTemplateResponsive/index.tsx b/src/components/shared/templates/StaticTemplateResponsive/index.tsx index cd8d722f9d..27d5609d50 100644 --- a/src/components/shared/templates/StaticTemplateResponsive/index.tsx +++ b/src/components/shared/templates/StaticTemplateResponsive/index.tsx @@ -39,6 +39,7 @@ import { uniqueId } from 'lodash' import TitleDescriptionAndSectionlink from './Cards/TitleDescriptionAndSectionlink' import { StandardLibrariesTableColumns } from './Cards/StandardLibrariesTableColumns' import { type StandardLibraryType } from 'features/staticContent/staticContentApiSlice' +import { useTranslation } from 'react-i18next' const TemplateConfig = ({ provider, @@ -239,6 +240,7 @@ export const StaticTemplateResponsive = ({ baseUrl: string stdLibraries?: StandardLibraryType }) => { + const { t } = useTranslation() const [showScroll, setShowScroll] = useState(false) const theme = useTheme() const isMobile = useMediaQuery(theme.breakpoints.down('md'), { @@ -313,6 +315,11 @@ export const StaticTemplateResponsive = ({ rows={stdLibraries.rows} getRowId={(row) => uniqueId(row.uid)} hasBorder={false} + noRowsMsg={ + stdLibraries.rows.length === 0 + ? t('global.table.emptyDataMsg') + : '' + } /> )}