mirror of
https://github.com/harness/drone.git
synced 2025-05-31 11:43:15 +00:00
Merge branch 'ui/sub-space-nav-fix' of _OKE5H2PQKOUfzFFDuD4FA/default/CODE/gitness (#228)
This commit is contained in:
commit
030f2a4ccf
@ -18,7 +18,7 @@ export interface CODEQueryProps {
|
||||
}
|
||||
|
||||
export const pathProps: Readonly<Omit<Required<CODEProps>, 'repoPath' | 'branch' | 'tags'>> = {
|
||||
space: ':space',
|
||||
space: ':space*',
|
||||
repoName: ':repoName',
|
||||
gitRef: ':gitRef*',
|
||||
resourcePath: ':resourcePath*',
|
||||
|
@ -66,6 +66,30 @@ export const RouteDestinations: React.FC = React.memo(function RouteDestinations
|
||||
</LayoutWithSideNav>
|
||||
</Route>
|
||||
|
||||
<Route path={[routes.toCODEHome()]} exact>
|
||||
<LayoutWithSideNav title={getString('pageTitle.home')}>
|
||||
<Home />
|
||||
</LayoutWithSideNav>
|
||||
</Route>
|
||||
|
||||
<Route path={routes.toCODEUsers()}>
|
||||
<LayoutWithSideNav title={getString('pageTitle.users')}>
|
||||
<UsersListing />
|
||||
</LayoutWithSideNav>
|
||||
</Route>
|
||||
|
||||
<Route path={routes.toCODEUserProfile()} exact>
|
||||
<LayoutWithSideNav title={getString('pageTitle.userProfile')}>
|
||||
<UserProfile />
|
||||
</LayoutWithSideNav>
|
||||
</Route>
|
||||
|
||||
<Route path={routes.toCODEUserChangePassword()} exact>
|
||||
<LayoutWithSideNav title={getString('pageTitle.changePassword')}>
|
||||
<ChangePassword />
|
||||
</LayoutWithSideNav>
|
||||
</Route>
|
||||
|
||||
<Route
|
||||
path={[
|
||||
routes.toCODEPullRequest({
|
||||
@ -192,30 +216,6 @@ export const RouteDestinations: React.FC = React.memo(function RouteDestinations
|
||||
<Repository />
|
||||
</LayoutWithSideNav>
|
||||
</Route>
|
||||
|
||||
<Route path={[routes.toCODEHome()]} exact>
|
||||
<LayoutWithSideNav title={getString('pageTitle.home')}>
|
||||
<Home />
|
||||
</LayoutWithSideNav>
|
||||
</Route>
|
||||
|
||||
<Route path={routes.toCODEUsers()}>
|
||||
<LayoutWithSideNav title={getString('pageTitle.users')}>
|
||||
<UsersListing />
|
||||
</LayoutWithSideNav>
|
||||
</Route>
|
||||
|
||||
<Route path={routes.toCODEUserProfile()} exact>
|
||||
<LayoutWithSideNav title={getString('pageTitle.userProfile')}>
|
||||
<UserProfile />
|
||||
</LayoutWithSideNav>
|
||||
</Route>
|
||||
|
||||
<Route path={routes.toCODEUserChangePassword()} exact>
|
||||
<LayoutWithSideNav title={getString('pageTitle.changePassword')}>
|
||||
<ChangePassword />
|
||||
</LayoutWithSideNav>
|
||||
</Route>
|
||||
</Switch>
|
||||
</BrowserRouter>
|
||||
)
|
||||
|
@ -18,7 +18,7 @@ export const SpaceSelector: React.FC<SpaceSelectorProps> = ({ onSelect }) => {
|
||||
const [selectedSpace, setSelectedSpace] = useState<TypesSpace | undefined>()
|
||||
const { space } = useGetRepositoryMetadata()
|
||||
const [opened, setOpened] = React.useState(false)
|
||||
const { data, error } = useGetSpace({ space_ref: space, lazy: !space })
|
||||
const { data, error } = useGetSpace({ space_ref: encodeURIComponent(space), lazy: !space })
|
||||
const selectSpace = useCallback(
|
||||
(_space: TypesSpace, isUserAction: boolean) => {
|
||||
setSelectedSpace(_space)
|
||||
@ -82,6 +82,12 @@ export const SpaceSelector: React.FC<SpaceSelectorProps> = ({ onSelect }) => {
|
||||
onClick={() => selectSpace({ uid: 'root', path: 'root' }, true)}>
|
||||
Root Space
|
||||
</Text>
|
||||
<Text
|
||||
className={Classes.POPOVER_DISMISS}
|
||||
{...ButtonRoleProps}
|
||||
onClick={() => selectSpace({ uid: 'rootChild1', path: 'root/rootChild1' }, true)}>
|
||||
Root Child 1 Space
|
||||
</Text>
|
||||
<Text
|
||||
className={Classes.POPOVER_DISMISS}
|
||||
{...ButtonRoleProps}
|
||||
|
@ -20,7 +20,7 @@ export const DefaultMenu: React.FC = () => {
|
||||
const repoPath = useMemo(() => repoMetadata?.path || '', [repoMetadata])
|
||||
const routeMatch = useRouteMatch()
|
||||
const isFilesSelected = useMemo(
|
||||
() => routeMatch.path === '/:space/:repoName' || routeMatch.path.startsWith('/:space/:repoName/edit'),
|
||||
() => routeMatch.path === '/:space*/:repoName' || routeMatch.path.startsWith('/:space*/:repoName/edit'),
|
||||
[routeMatch]
|
||||
)
|
||||
|
||||
@ -52,7 +52,7 @@ export const DefaultMenu: React.FC = () => {
|
||||
}
|
||||
}}
|
||||
label={getString('repositories')}
|
||||
to={routes.toCODERepositories({ space: selectedSpace?.uid as string })}
|
||||
to={routes.toCODERepositories({ space: selectedSpace?.path as string })}
|
||||
isDeselected={!!repoMetadata}
|
||||
isHighlighted={!!repoMetadata}
|
||||
/>
|
||||
@ -139,13 +139,13 @@ export const DefaultMenu: React.FC = () => {
|
||||
<NavMenuItem
|
||||
icon="nav-project"
|
||||
label={getString('accessControl')}
|
||||
to={routes.toCODESpaceAccessControl({ space: selectedSpace?.uid as string })}
|
||||
to={routes.toCODESpaceAccessControl({ space: selectedSpace?.path as string })}
|
||||
/>
|
||||
|
||||
<NavMenuItem
|
||||
icon="code-settings"
|
||||
label={getString('settings')}
|
||||
to={routes.toCODESpaceSettings({ space: selectedSpace?.uid as string })}
|
||||
to={routes.toCODESpaceSettings({ space: selectedSpace?.path as string })}
|
||||
/>
|
||||
</Render>
|
||||
</Layout.Vertical>
|
||||
|
Loading…
x
Reference in New Issue
Block a user