-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: rebase * chore: rebase * fix: lint/tsc * chore: rebase * fix: lint/tsc * tsc again * chore: minor fix * feat: review comments
- Loading branch information
1 parent
f3efd1a
commit 3ed69f2
Showing
14 changed files
with
315 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { useEffect } from 'react' | ||
import { useParams } from 'react-router-dom' | ||
|
||
import { useListRepoWebhookExecutionsQuery } from '@harnessio/code-service-client' | ||
import { RepoWebhookExecutionsPage, WebhookExecutionType } from '@harnessio/ui/views' | ||
|
||
import { useRoutes } from '../../framework/context/NavigationContext' | ||
import { useGetRepoRef } from '../../framework/hooks/useGetRepoPath' | ||
import usePaginationQueryStateWithStore from '../../hooks/use-pagination-query-state-with-store' | ||
import { useTranslationStore } from '../../i18n/stores/i18n-store' | ||
import { PathParams } from '../../RouteDefinitions' | ||
import { useWebhookStore } from './stores/webhook-store' | ||
|
||
export const WebhookExecutionsContainer = () => { | ||
const repo_ref = useGetRepoRef() | ||
const routes = useRoutes() | ||
const { webhookId } = useParams<PathParams>() | ||
const { webhookExecutionPage, setWebhookExecutionPage, setExecutions, setTotalWebhookExecutionPages } = | ||
useWebhookStore() | ||
|
||
const { queryPage } = usePaginationQueryStateWithStore({ | ||
page: webhookExecutionPage, | ||
setPage: setWebhookExecutionPage | ||
}) | ||
|
||
const { data: { body: executions, headers } = {}, isLoading } = useListRepoWebhookExecutionsQuery( | ||
{ | ||
repo_ref, | ||
webhook_identifier: parseInt(webhookId ?? ''), | ||
queryParams: { | ||
page: queryPage | ||
} | ||
}, | ||
{ enabled: !!webhookId } | ||
) | ||
|
||
useEffect(() => { | ||
if (executions && headers) { | ||
setExecutions(executions as WebhookExecutionType[]) | ||
setTotalWebhookExecutionPages(headers) | ||
} | ||
}, [executions, setExecutions]) | ||
|
||
return ( | ||
<RepoWebhookExecutionsPage | ||
useTranslationStore={useTranslationStore} | ||
useWebhookStore={useWebhookStore} | ||
toRepoWebhooks={() => routes.toRepoWebhooks({ repoId: repo_ref })} | ||
repo_ref={repo_ref} | ||
isLoading={isLoading} | ||
/> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/ui/src/views/layouts/webhooks-settings-layout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Outlet } from 'react-router-dom' | ||
|
||
import { ContentLayoutWithSidebar, TranslationStore } from '@/views' | ||
import { TFunction } from 'i18next' | ||
|
||
const getNavItems = (t: TFunction) => [ | ||
{ | ||
groupId: 0, | ||
title: t('views:repos.general', 'Webhook Settings'), | ||
items: [ | ||
{ id: 0, title: t('views:repos.details', 'Details'), to: 'details' }, | ||
{ id: 1, title: t('views:repos.executions', 'Executions'), to: 'executions' } | ||
] | ||
} | ||
] | ||
|
||
export function WebhookSettingsLayout({ useTranslationStore }: { useTranslationStore: () => TranslationStore }) { | ||
const { t } = useTranslationStore() | ||
|
||
return ( | ||
<ContentLayoutWithSidebar sidebarMenu={getNavItems(t)} sidebarOffsetTop={100} sidebarViewportClassName="pt-7"> | ||
<Outlet /> | ||
</ContentLayoutWithSidebar> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.