import { redirect, type LoaderFunctionArgs } from 'react-router-dom'; import { GROUP_DETAILS_PATH, GROUP_RELEASE_DETAILS_PATH, GROUP_SNAPSHOT_DETAILS_PATH, GROUPS_PATH, GROUP_INTEGRATION_TEST_DETAILS_PATH, } from '@routes/paths'; import { RouteErrorBoundry } from '@routes/RouteErrorBoundary'; import { ComponentGroupComponentsTab, ComponentGroupDetailsViewLayout, componentGroupDetailsViewLoader, ComponentGroupReleasesTab, ComponentGroupPipelineRunsTab, ComponentGroupIntegrationTestsTab, } from '~/components/ComponentGroups/ComponentGroupDetails'; import { ComponentGroupSnapshotsTab } from '~/components/ComponentGroups/ComponentGroupDetails/tabs/ComponentGroupSnapshotsTab'; import { integrationDetailsPageLoader, IntegrationTestDetailsView, IntegrationTestOverviewTab, IntegrationTestPipelineRunTabV2, } from '~/components/IntegrationTests/IntegrationTestDetails'; import { groupReleaseDetailsLoader } from '~/components/Releases/groupReleaseDetailsLoader'; import GroupReleaseDetailsView from '~/components/Releases/GroupReleaseDetailsView'; import GroupReleaseOverviewTab from '~/components/Releases/GroupReleaseOverviewTab'; import GroupReleasePipelineRunsTab from '~/components/Releases/GroupReleasePipelineRunsTab'; import ReleaseArtifactsTab from '~/components/Releases/ReleaseArtifactsTab'; import { GroupSnapshotDetailsView, snapshotDetailsViewLoader, GroupSnapshotOverview, } from '~/components/SnapshotDetails'; import SnapshotPipelineRunsTabV2 from '~/components/SnapshotDetails/tabs/SnapshotPipelineRunsTabV2'; import { snapshotsTabLoader } from '~/components/Snapshots/SnapshotsListView/SnapshotsTab'; import { ensureFeatureFlagOnLoader } from '~/feature-flags/utils'; const componentGroupRoutes = [ { path: GROUP_RELEASE_DETAILS_PATH.path, loader: groupReleaseDetailsLoader, errorElement: , element: , children: [ { index: true, element: }, { path: 'pipelineruns', element: }, { path: 'artifacts', element: }, { path: 'yaml', async lazy() { const { ReleaseYamlTab } = await import('~/components/Releases/ReleaseYamlTab'); return { element: }; }, }, ], }, { path: GROUP_SNAPSHOT_DETAILS_PATH.path, loader: (args: LoaderFunctionArgs) => { ensureFeatureFlagOnLoader('component-model'); return snapshotDetailsViewLoader(args); }, errorElement: , element: , children: [ { index: true, element: }, { path: 'pipelineruns', element: }, ], }, { path: GROUPS_PATH.path, errorElement: , async lazy() { ensureFeatureFlagOnLoader('component-model'); const { ComponentGroupsListView: Component } = await import( '~/components/ComponentGroups/ComponentGroupsListView/ComponentGroupsListView' /* webpackChunkName: "component-groups" */ ); return { Component }; }, }, { path: GROUP_DETAILS_PATH.path, loader: componentGroupDetailsViewLoader, errorElement: , element: , children: [ { index: true, loader: () => redirect('components'), }, { path: 'components', element: , }, { path: 'integrationtests', element: , }, { path: 'pipelineruns', element: , }, { path: 'snapshots', loader: snapshotsTabLoader, element: , }, { path: 'releases', element: , }, ], }, { path: GROUP_INTEGRATION_TEST_DETAILS_PATH.path, loader: (args: LoaderFunctionArgs) => { ensureFeatureFlagOnLoader('component-model'); return integrationDetailsPageLoader(args); }, errorElement: , element: , children: [ { index: true, element: , }, { path: 'pipelineruns', element: , }, ], }, ]; export default componentGroupRoutes;