fix: [CODE-1573]: fix for breaking search page for org and account repositories (#1114)

eb/code-1016-2
Karan Saraswat 2024-03-17 06:31:50 +00:00 committed by Harness
parent e7436eef80
commit b772dca155
5 changed files with 6 additions and 6 deletions

View File

@ -98,7 +98,7 @@ export interface CODERoutes {
toCODESettings: ( toCODESettings: (
args: RequiredField<Pick<CODEProps, 'repoPath' | 'settingSection' | 'ruleId' | 'settingSectionMode'>, 'repoPath'> args: RequiredField<Pick<CODEProps, 'repoPath' | 'settingSection' | 'ruleId' | 'settingSectionMode'>, 'repoPath'>
) => string ) => string
toCODEProjectSearch: (args: Required<Pick<CODEProps, 'space'>>) => string toCODESpaceSearch: (args: Required<Pick<CODEProps, 'space'>>) => string
toCODERepositorySearch: (args: Required<Pick<CODEProps, 'repoPath'>>) => string toCODERepositorySearch: (args: Required<Pick<CODEProps, 'repoPath'>>) => string
toCODESemanticSearch: (args: Required<Pick<CODEProps, 'repoPath'>>) => string toCODESemanticSearch: (args: Required<Pick<CODEProps, 'repoPath'>>) => string
toCODEExecutions: (args: Required<Pick<CODEProps, 'repoPath' | 'pipeline'>>) => string toCODEExecutions: (args: Required<Pick<CODEProps, 'repoPath' | 'pipeline'>>) => string
@ -157,7 +157,7 @@ export const routes: CODERoutes = {
`/${repoPath}/settings${settingSection ? '/' + settingSection : ''}${ruleId ? '/' + ruleId : ''}${ `/${repoPath}/settings${settingSection ? '/' + settingSection : ''}${ruleId ? '/' + ruleId : ''}${
settingSectionMode ? '/' + settingSectionMode : '' settingSectionMode ? '/' + settingSectionMode : ''
}`, }`,
toCODEProjectSearch: ({ space }) => `/${space}/search`, toCODESpaceSearch: ({ space }) => `/${space}/search`,
toCODERepositorySearch: ({ repoPath }) => `/${repoPath}/search`, toCODERepositorySearch: ({ repoPath }) => `/${repoPath}/search`,
toCODESemanticSearch: ({ repoPath }) => `/${repoPath}/search/semantic`, toCODESemanticSearch: ({ repoPath }) => `/${repoPath}/search/semantic`,
toCODEWebhooks: ({ repoPath }) => `/${repoPath}/webhooks`, toCODEWebhooks: ({ repoPath }) => `/${repoPath}/webhooks`,

View File

@ -294,7 +294,7 @@ export const RouteDestinations: React.FC = React.memo(function RouteDestinations
</Route> </Route>
<Route <Route
path={[routes.toCODEProjectSearch({ space: pathProps.space }), routes.toCODERepositorySearch({ repoPath })]} path={[routes.toCODESpaceSearch({ space: pathProps.space }), routes.toCODERepositorySearch({ repoPath })]}
exact> exact>
<LayoutWithSideNav title={getString('search')}> <LayoutWithSideNav title={getString('search')}>
<CodeSearchPage /> <CodeSearchPage />

View File

@ -63,7 +63,7 @@ const CodeSearch = ({ repoMetadata }: CodeSearchProps) => {
}) })
} else { } else {
history.push({ history.push({
pathname: routes.toCODEProjectSearch({ pathname: routes.toCODESpaceSearch({
space space
}), }),
search: `q=${q}` search: `q=${q}`

View File

@ -59,7 +59,7 @@ const KeywordSearch = ({ repoMetadata }: KeywordSearchProps) => {
}) })
} else { } else {
history.push({ history.push({
pathname: routes.toCODEProjectSearch({ pathname: routes.toCODESpaceSearch({
space space
}), }),
search: `q=${q}` search: `q=${q}`

View File

@ -177,7 +177,7 @@ export const DefaultMenu: React.FC = () => {
icon="thinner-search" icon="thinner-search"
data-code-repo-section="search" data-code-repo-section="search"
label={getString('search')} label={getString('search')}
to={routes.toCODEProjectSearch({ space: selectedSpace?.path as string })} to={routes.toCODESpaceSearch({ space: selectedSpace?.path as string })}
/> />
</Render> </Render>