diff --git a/frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/SoftwareTitleDetailsPage.tsx b/frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/SoftwareTitleDetailsPage.tsx index 3f217906f7..9e1faa39d0 100644 --- a/frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/SoftwareTitleDetailsPage.tsx +++ b/frontend/pages/SoftwarePage/SoftwareTitleDetailsPage/SoftwareTitleDetailsPage.tsx @@ -9,6 +9,7 @@ import softwareAPI, { import MainContent from "components/MainContent"; import TableDataError from "components/DataError"; +import Spinner from "components/Spinner"; import SoftwareDetailsSummary from "../components/SoftwareDetailsSummary"; import SoftwareTitleDetailsTable from "./SoftwareTitleDetailsTable"; @@ -43,37 +44,47 @@ const SoftwareTitleDetailsPage = ({ } ); - if (!softwareTitle) { - return null; - } + const renderContent = () => { + if (isSoftwareTitleLoading) { + return ; + } + + if (isSoftwareTitleError) { + return ; + } + + if (!softwareTitle) { + return null; + } + + return ( + <> + + {/* TODO: can we use Card here for card styles */} +
+

Versions

+ +
+ + ); + }; return ( - {isSoftwareTitleError ? ( - - ) : ( - <> - - {/* TODO: can we use Card here for card styles */} -
-

Versions

- -
- - )} + <>{renderContent()}
); }; diff --git a/frontend/pages/SoftwarePage/SoftwareVersionDetailsPage/SoftwareVersionDetailsPage.tsx b/frontend/pages/SoftwarePage/SoftwareVersionDetailsPage/SoftwareVersionDetailsPage.tsx index 7f7d2568bd..1b9dd052dc 100644 --- a/frontend/pages/SoftwarePage/SoftwareVersionDetailsPage/SoftwareVersionDetailsPage.tsx +++ b/frontend/pages/SoftwarePage/SoftwareVersionDetailsPage/SoftwareVersionDetailsPage.tsx @@ -18,6 +18,7 @@ import TableContainer from "components/TableContainer"; import CustomLink from "components/CustomLink"; import EmptyTable from "components/EmptyTable"; import TableDataError from "components/DataError"; +import Spinner from "components/Spinner"; import generateSoftwareVersionDetailsTableConfig from "./SoftwareVersionDetailsTableConfig"; import SoftwareDetailsSummary from "../components/SoftwareDetailsSummary"; @@ -55,9 +56,7 @@ const SoftwareVersionDetailsPage = ({ routeParams, }: ISoftwareTitleDetailsPageProps) => { const versionId = parseInt(routeParams.id, 10); - const { isPremiumTier, isSandboxMode, filteredSoftwarePath } = useContext( - AppContext - ); + const { isPremiumTier, isSandboxMode } = useContext(AppContext); const { data: softwareVersion, @@ -95,49 +94,59 @@ const SoftwareVersionDetailsPage = ({ [isPremiumTier, isSandboxMode] ); - if (!softwareVersion) { - return null; - } + const renderContent = () => { + if (isSoftwareVersionLoading) { + return ; + } + + if (isSoftwareVersionError) { + return ; + } + + if (!softwareVersion) { + return null; + } + + return ( + <> + +
+

Vulnerabilities

+ {softwareVersion?.vulnerabilities?.length ? ( +
+ +
+ ) : ( + + )} +
+ + ); + }; return ( - {isSoftwareVersionError ? ( - - ) : ( - <> - -
-

Vulnerabilities

- {softwareVersion?.vulnerabilities?.length ? ( -
- -
- ) : ( - - )} -
- - )} + <>{renderContent()}
); }; diff --git a/frontend/router/index.tsx b/frontend/router/index.tsx index b2a7452d81..cb67debd82 100644 --- a/frontend/router/index.tsx +++ b/frontend/router/index.tsx @@ -218,6 +218,8 @@ const routes = ( + {/* This redirect keeps the old software/:id working */} + diff --git a/frontend/router/paths.ts b/frontend/router/paths.ts index 0f429762b5..3917a86bdb 100644 --- a/frontend/router/paths.ts +++ b/frontend/router/paths.ts @@ -85,7 +85,12 @@ export default { FORGOT_PASSWORD: `${URL_PREFIX}/login/forgot`, NO_ACCESS: `${URL_PREFIX}/login/denied`, API_ONLY_USER: `${URL_PREFIX}/apionlyuser`, + + // error pages FLEET_403: `${URL_PREFIX}/403`, + FLEET_404: `${URL_PREFIX}/404`, + FLEET_500: `${URL_PREFIX}/500`, + LOGIN: `${URL_PREFIX}/login`, LOGOUT: `${URL_PREFIX}/logout`, MANAGE_HOSTS: `${URL_PREFIX}/hosts/manage`,