Skip to content

Commit

Permalink
Added Pipelines route and fixed breaking pages
Browse files Browse the repository at this point in the history
  • Loading branch information
vivek-harness committed Jan 6, 2025
1 parent 6ca37cd commit 870dab5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
25 changes: 25 additions & 0 deletions apps/gitness/src/AppMFE.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { NuqsAdapter } from 'nuqs/adapters/react-router'

import { TooltipProvider } from '@harnessio/canary'
import { CodeServiceAPIClient } from '@harnessio/code-service-client'
import { BreadcrumbSeparator } from '@harnessio/ui/components'
import { RepoSettingsPage } from '@harnessio/ui/views'

import { AppProvider } from './framework/context/AppContext'
Expand All @@ -31,8 +32,10 @@ import { RepoBranchesListPage } from './pages-v2/repo/repo-branch-list'
import { RepoCode } from './pages-v2/repo/repo-code'
import RepoCommitsPage from './pages-v2/repo/repo-commits'
import { CreateRepo } from './pages-v2/repo/repo-create-page'
import RepoExecutionListPage from './pages-v2/repo/repo-execution-list'
import RepoLayout from './pages-v2/repo/repo-layout'
import ReposListPage from './pages-v2/repo/repo-list'
import RepoPipelineListPage from './pages-v2/repo/repo-pipeline-list'
import { RepoSettingsGeneralPageContainer } from './pages-v2/repo/repo-settings-general-container'
import { RepoSidebar } from './pages-v2/repo/repo-sidebar'
import RepoSummaryPage from './pages-v2/repo/repo-summary'
Expand Down Expand Up @@ -157,6 +160,28 @@ export default function AppMFE({
element: <RepoSummaryPage />,
handle: { breadcrumb: () => <span>Summary</span> }
},
{
path: 'pipelines',
handle: {
breadcrumb: () => <span>Pipelines</span>
},
children: [
{ index: true, element: <RepoPipelineListPage /> },
{
path: ':pipelineId',
element: <RepoExecutionListPage />,
handle: {
breadcrumb: ({ pipelineId }: { pipelineId: string }) => (
<div className="flex items-center gap-1">
<span>{pipelineId}</span>
<BreadcrumbSeparator>/</BreadcrumbSeparator>
<span>Executions</span>
</div>
)
}
}
]
},
{
path: 'commits',
element: <RepoCommitsPage />,
Expand Down
8 changes: 6 additions & 2 deletions apps/gitness/src/components-v2/file-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { CodeDiffEditor, CodeEditor } from '@harnessio/yaml-editor'
import GitCommitDialog from '../components-v2/git-commit-dialog'
import { useThemeStore } from '../framework/context/ThemeContext'
import { useExitConfirm } from '../framework/hooks/useExitConfirm'
import { useGetSpaceURLParam } from '../framework/hooks/useGetSpaceParam'
import { useIsMFE } from '../framework/hooks/useIsMFE'
import useCodePathDetails from '../hooks/useCodePathDetails'
import { useTranslationStore } from '../i18n/stores/i18n-store'
import { useRepoBranchesStore } from '../pages-v2/repo/stores/repo-branches-store'
Expand All @@ -25,7 +27,9 @@ export interface FileEditorProps {
export const FileEditor: FC<FileEditorProps> = ({ repoDetails, defaultBranch }) => {
const navigate = useNavigate()
const { codeMode, fullGitRef, gitRefName, fullResourcePath } = useCodePathDetails()
const { spaceId, repoId } = useParams<PathParams>()
const { repoId } = useParams<PathParams>()
const spaceId = useGetSpaceURLParam() ?? ''
const isMFE = useIsMFE()
const { show } = useExitConfirm()
const repoPath = `/${spaceId}/repos/${repoId}/code/${fullGitRef}`

Expand Down Expand Up @@ -127,7 +131,7 @@ export const FileEditor: FC<FileEditorProps> = ({ repoDetails, defaultBranch })
* Navigate to file view route
*/
const onExitConfirm = useCallback(() => {
const navigateTo = `/${spaceId}/repos/${repoId}/code/${fullGitRef}/${fullResourcePath ? `~/${fullResourcePath}` : ''}`
const navigateTo = `${isMFE ? '' : `/${spaceId}`}/repos/${repoId}/code/${fullGitRef}/${fullResourcePath ? `~/${fullResourcePath}` : ''}`
navigate(navigateTo)
}, [fullGitRef, fullResourcePath, navigate, repoId, spaceId])

Expand Down
2 changes: 1 addition & 1 deletion apps/gitness/src/pages-v2/repo/repo-summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default function RepoSummaryPage() {
})

useEffect(() => {
setSpaceIdAndRepoId(spaceId || '', repoId || '')
setSpaceIdAndRepoId(isMFE ? '' : spaceId || '', repoId || '')
}, [spaceId, repoId])

useEffect(() => {
Expand Down

0 comments on commit 870dab5

Please sign in to comment.