patch: update nodata display on homepage
Signed-off-by: Raul-Cristian Kele <raulkeleblk@gmail.com>
This commit is contained in:
parent
b787273b84
commit
b41fb2f841
@ -200,11 +200,16 @@ function Home() {
|
|||||||
navigate({ pathname: `/explore`, search: createSearchParams({ [type]: value }).toString() });
|
navigate({ pathname: `/explore`, search: createSearchParams({ [type]: value }).toString() });
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderCards = (cardArray, isLoading) => {
|
const isNoData = () =>
|
||||||
if (cardArray && cardArray.length < 1 && !isLoading) {
|
!isLoading &&
|
||||||
return <NoDataComponent text="No images" />;
|
!isLoadingBookmarks &&
|
||||||
}
|
!isLoadingPopular &&
|
||||||
|
!isLoadingRecent &&
|
||||||
|
bookmarkData.length === 0 &&
|
||||||
|
popularData.length === 0 &&
|
||||||
|
recentData.length === 0;
|
||||||
|
|
||||||
|
const renderCards = (cardArray) => {
|
||||||
return (
|
return (
|
||||||
cardArray &&
|
cardArray &&
|
||||||
cardArray.map((item, index) => {
|
cardArray.map((item, index) => {
|
||||||
@ -232,10 +237,9 @@ function Home() {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
const renderContent = () => {
|
||||||
<>
|
return isNoData() === true ? (
|
||||||
{isLoading ? (
|
<NoDataComponent text="No images" />
|
||||||
<Loading />
|
|
||||||
) : (
|
) : (
|
||||||
<Stack alignItems="center" className={classes.gridWrapper}>
|
<Stack alignItems="center" className={classes.gridWrapper}>
|
||||||
<Stack className={classes.sectionHeaderContainer} sx={{ paddingTop: '3rem' }}>
|
<Stack className={classes.sectionHeaderContainer} sx={{ paddingTop: '3rem' }}>
|
||||||
@ -291,9 +295,10 @@ function Home() {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
)}
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return <>{isLoading ? <Loading /> : renderContent()}</>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Home;
|
export default Home;
|
||||||
|
@ -23,9 +23,9 @@ const endpoints = {
|
|||||||
globalSearch: (searchTerm, sortCriteria, pageNumber = 1, pageSize = 10) =>
|
globalSearch: (searchTerm, sortCriteria, pageNumber = 1, pageSize = 10) =>
|
||||||
`/v2/_zot/ext/search?query={GlobalSearch(query:%22${searchTerm}%22,%20requestedPage:%20{limit:${pageSize}%20offset:${
|
`/v2/_zot/ext/search?query={GlobalSearch(query:%22${searchTerm}%22,%20requestedPage:%20{limit:${pageSize}%20offset:${
|
||||||
10 * (pageNumber - 1)
|
10 * (pageNumber - 1)
|
||||||
}%20sortBy:%20${sortCriteria}}%20)%20{Page%20{TotalCount%20ItemCount}%20Repos%20{Name%20LastUpdated%20Size%20Platforms%20{%20Os%20Arch%20}%20IsStarred%20IsBookmarked%20NewestImage%20{%20Tag%20Vulnerabilities%20{MaxSeverity%20Count}%20Description%20IsSigned%20Licenses%20Vendor%20Labels%20}%20DownloadCount}}}`,
|
}%20sortBy:%20${sortCriteria}}%20)%20{Page%20{TotalCount%20ItemCount}%20Repos%20{Name%20LastUpdated%20Size%20Platforms%20{%20Os%20Arch%20}%20IsStarred%20IsBookmarked%20NewestImage%20{%20Tag%20Vulnerabilities%20{MaxSeverity%20Count}%20Description%20IsSigned%20SignatureInfo%20{%20Tool%20IsTrusted%20Author%20}%20Licenses%20Vendor%20Labels%20}%20DownloadCount}}}`,
|
||||||
image: (name) =>
|
image: (name) =>
|
||||||
`/v2/_zot/ext/search?query={Image(image:%20%22${name}%22){RepoName%20IsSigned%20Vulnerabilities%20{MaxSeverity%20Count}%20%20Referrers%20{MediaType%20ArtifactType%20Size%20Digest%20Annotations{Key%20Value}}%20Tag%20Manifests%20{History%20{Layer%20{Size%20Digest}%20HistoryDescription%20{CreatedBy%20EmptyLayer}}%20Digest%20ConfigDigest%20LastUpdated%20Size%20Platform%20{Os%20Arch}}%20Vendor%20Licenses%20}}`
|
`/v2/_zot/ext/search?query={Image(image:%20%22${name}%22){RepoName%20IsSigned%20SignatureInfo%20{%20Tool%20IsTrusted%20Author%20}%20Vulnerabilities%20{MaxSeverity%20Count}%20%20Referrers%20{MediaType%20ArtifactType%20Size%20Digest%20Annotations{Key%20Value}}%20Tag%20Manifests%20{History%20{Layer%20{Size%20Digest}%20HistoryDescription%20{CreatedBy%20EmptyLayer}}%20Digest%20ConfigDigest%20LastUpdated%20Size%20Platform%20{Os%20Arch}}%20Vendor%20Licenses%20}}`
|
||||||
};
|
};
|
||||||
|
|
||||||
export { hosts, endpoints, sortCriteria, pageSizes };
|
export { hosts, endpoints, sortCriteria, pageSizes };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user