mirror of
https://github.com/harness/drone.git
synced 2025-05-21 11:29:52 +08:00
feat: [SCM-42]: added route for createwebhook (#93)
* feat: added route for createwebhook * feat: added createwebhook route
This commit is contained in:
parent
732e1914ae
commit
b8cc24c491
@ -38,7 +38,8 @@ module.exports = {
|
||||
'./RepositoryFileEdit': './src/pages/RepositoryFileEdit/RepositoryFileEdit.tsx',
|
||||
'./RepositoryCommits': './src/pages/RepositoryCommits/RepositoryCommits.tsx',
|
||||
'./RepositoryBranches': './src/pages/RepositoryBranches/RepositoryBranches.tsx',
|
||||
'./RepositorySettings': './src/pages/RepositorySettings/RepositorySettings.tsx'
|
||||
'./RepositorySettings': './src/pages/RepositorySettings/RepositorySettings.tsx',
|
||||
'./RepositoryCreateWebhook': './src/pages/RepositoryCreateWebhook/RepositoryCreateWebhook.tsx'
|
||||
},
|
||||
shared: {
|
||||
formik: packageJSON.dependencies['formik'],
|
||||
|
@ -44,6 +44,7 @@ export interface CODERoutes {
|
||||
toCODERepositoryCommits: ({ repoPath, commitRef }: { repoPath: string; commitRef: string }) => string
|
||||
toCODERepositoryBranches: ({ repoPath, branch }: { repoPath: string; branch?: string }) => string
|
||||
toCODERepositorySettings: ({ repoPath }: { repoPath: string }) => string
|
||||
toCODECreateWebhook: ({ repoPath }: { repoPath: string }) => string
|
||||
}
|
||||
|
||||
export const routes: CODERoutes = {
|
||||
@ -55,5 +56,6 @@ export const routes: CODERoutes = {
|
||||
toCODERepositoryFileEdit: ({ repoPath, gitRef, resourcePath }) => `/${repoPath}/edit/${gitRef}/~/${resourcePath}`,
|
||||
toCODERepositoryCommits: ({ repoPath, commitRef }) => `/${repoPath}/commits/${commitRef}`,
|
||||
toCODERepositoryBranches: ({ repoPath, branch }) => `/${repoPath}/branches/${branch ? '/' + branch : ''}`,
|
||||
toCODERepositorySettings: ({ repoPath }) => `/${repoPath}/settings`
|
||||
toCODERepositorySettings: ({ repoPath }) => `/${repoPath}/settings`,
|
||||
toCODECreateWebhook: ({ repoPath }) => `/${repoPath}/settings/webhook/new`
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
import React from 'react'
|
||||
import { Container, PageBody } from '@harness/uicore'
|
||||
|
||||
export default function RepositoryCreateWebhook() {
|
||||
return (
|
||||
<Container>
|
||||
<PageBody>This is wEbhook page</PageBody>
|
||||
</Container>
|
||||
)
|
||||
}
|
@ -1,16 +1,38 @@
|
||||
import React from 'react'
|
||||
import { useHistory } from 'react-router-dom'
|
||||
|
||||
import { PageBody, Button, Intent, Container, PageHeader } from '@harness/uicore'
|
||||
import { useGetRepositoryMetadata } from 'hooks/useGetRepositoryMetadata'
|
||||
import { useStrings } from 'framework/strings'
|
||||
import { useAppContext } from 'AppContext'
|
||||
import { CodeIcon } from 'utils/GitUtils'
|
||||
|
||||
import { RepositorySettingsHeader } from './RepositorySettingsHeader/RepositorySettingsHeader'
|
||||
|
||||
import emptyStateImage from './empty-state.svg'
|
||||
|
||||
import css from './RepositorySettings.module.scss'
|
||||
|
||||
export default function RepositorySettings() {
|
||||
const { repoMetadata, error, loading } = useGetRepositoryMetadata()
|
||||
const NewWebHookButton = <Button type="submit" text={'Create Webhook'} intent={Intent.PRIMARY} />
|
||||
const { routes } = useAppContext()
|
||||
const history = useHistory()
|
||||
|
||||
const NewWebHookButton = (
|
||||
<Button
|
||||
type="button"
|
||||
text={'Create Webhook'}
|
||||
intent={Intent.PRIMARY}
|
||||
icon={CodeIcon.Add}
|
||||
onClick={() => {
|
||||
history.push(
|
||||
routes.toCODECreateWebhook({
|
||||
repoPath: repoMetadata?.path as string
|
||||
})
|
||||
)
|
||||
}}
|
||||
/>
|
||||
)
|
||||
const { getString } = useStrings()
|
||||
return (
|
||||
<Container className={css.main}>
|
||||
|
@ -16,9 +16,9 @@ export function RepositorySettingsHeader({ repoMetadata }: Pick<GitInfoProps, 'r
|
||||
<Container className={css.header}>
|
||||
<Container>
|
||||
<Layout.Horizontal spacing="small" className={css.breadcrumb}>
|
||||
<Link to={routes.toSCMRepositoriesListing({ space })}>{getString('repositories')}</Link>
|
||||
<Link to={routes.toCODERepositoriesListing({ space })}>{getString('repositories')}</Link>
|
||||
<Icon name="main-chevron-right" size={10} color={Color.GREY_500} />
|
||||
<Link to={routes.toSCMRepository({ repoPath: repoMetadata.path as string })}>{repoMetadata.uid}</Link>
|
||||
<Link to={routes.toCODERepository({ repoPath: repoMetadata.path as string })}>{repoMetadata.uid}</Link>
|
||||
</Layout.Horizontal>
|
||||
<Container padding={{ top: 'medium', bottom: 'medium' }}>
|
||||
<Text font={{ variation: FontVariation.H4 }}>{getString('settings')}</Text>
|
||||
|
Loading…
Reference in New Issue
Block a user