From 43fba2524dae68a583a9354cfba4991c493a3b83 Mon Sep 17 00:00:00 2001 From: Shaurya Kalia <113332561+shaurya-harness@users.noreply.github.com> Date: Thu, 23 Jan 2025 22:50:45 +0530 Subject: [PATCH 01/14] feat: add repo code commits history (#813) --- .../src/components-v2/file-content-viewer.tsx | 132 +++++++++++++++--- .../file-viewer-control-bar.tsx | 1 + .../src/components/file-control-bars/types.ts | 2 +- 3 files changed, 114 insertions(+), 21 deletions(-) diff --git a/apps/gitness/src/components-v2/file-content-viewer.tsx b/apps/gitness/src/components-v2/file-content-viewer.tsx index 6a0a9d9bef..863466e82a 100644 --- a/apps/gitness/src/components-v2/file-content-viewer.tsx +++ b/apps/gitness/src/components-v2/file-content-viewer.tsx @@ -1,8 +1,17 @@ import { useEffect, useMemo, useState } from 'react' import { useNavigate, useParams } from 'react-router-dom' -import { OpenapiGetContentOutput } from '@harnessio/code-service-client' -import { FileViewerControlBar, MarkdownViewer, ViewTypeValue } from '@harnessio/ui/components' +import { parseAsInteger, useQueryState } from 'nuqs' + +import { OpenapiGetContentOutput, TypesCommit, useListCommitsQuery } from '@harnessio/code-service-client' +import { + FileViewerControlBar, + MarkdownViewer, + PaginationComponent, + SkeletonList, + ViewTypeValue +} from '@harnessio/ui/components' +import { BranchSelectorTab, CommitsList } from '@harnessio/ui/views' import { CodeEditor } from '@harnessio/yaml-editor' import GitCommitDialog from '../components-v2/git-commit-dialog' @@ -13,10 +22,20 @@ import { useDownloadRawFile } from '../framework/hooks/useDownloadRawFile' import { useGetRepoRef } from '../framework/hooks/useGetRepoPath' import { useIsMFE } from '../framework/hooks/useIsMFE' import useCodePathDetails from '../hooks/useCodePathDetails' +import { useTranslationStore } from '../i18n/stores/i18n-store' import { themes } from '../pages-v2/pipeline/pipeline-edit/theme/monaco-theme' import { useRepoBranchesStore } from '../pages-v2/repo/stores/repo-branches-store' import { PathParams } from '../RouteDefinitions' -import { decodeGitContent, FILE_SEPERATOR, filenameToLanguage, formatBytes, GitCommitAction } from '../utils/git-utils' +import { PageResponseHeader } from '../types' +import { + decodeGitContent, + FILE_SEPERATOR, + filenameToLanguage, + formatBytes, + GitCommitAction, + normalizeGitRef, + REFS_TAGS_PREFIX +} from '../utils/git-utils' const getIsMarkdown = (language?: string) => language === 'markdown' @@ -46,8 +65,25 @@ export default function FileContentViewer({ repoContent }: FileContentViewerProp const rawURL = `${isMFE ? '/code' : ''}/api/v1/repos/${repoRef}/raw/${fullResourcePath}?git_ref=${fullGitRef}` const [view, setView] = useState(getDefaultView(language)) const [isDeleteFileDialogOpen, setIsDeleteFileDialogOpen] = useState(false) - const { selectedBranchTag } = useRepoBranchesStore() + const { selectedBranchTag, selectedRefType } = useRepoBranchesStore() + const [page, setPage] = useQueryState('page', parseAsInteger.withDefault(1).withOptions({ history: 'push' })) const { theme } = useThemeStore() + const { t } = useTranslationStore() + const { data: { body: commitData, headers } = {}, isFetching: isFetchingCommits } = useListCommitsQuery({ + repo_ref: repoRef, + queryParams: { + page, + git_ref: normalizeGitRef( + selectedRefType === BranchSelectorTab.TAGS + ? REFS_TAGS_PREFIX + selectedBranchTag?.name + : selectedBranchTag?.name + ), + path: fullResourcePath + } + }) + + const xNextPage = parseInt(headers?.get(PageResponseHeader.xNextPage) || '') + const xPrevPage = parseInt(headers?.get(PageResponseHeader.xPrevPage) || '') // TODO: temporary solution for matching themes const monacoTheme = (theme ?? '').startsWith('dark') ? 'dark' : 'light' @@ -98,6 +134,77 @@ export default function FileContentViewer({ repoContent }: FileContentViewerProp navigate(`${routes.toRepoFiles({ spaceId, repoId })}/edit/${fullGitRef}/~/${fullResourcePath}`) } + const renderFileView = () => { + switch (view) { + case 'preview': + // For Markdown 'preview' + if (getIsMarkdown(language)) { + return + } + // If a non-markdown file somehow has 'preview', we could fallback to 'code' + return ( + undefined} + themeConfig={themeConfig} + options={{ + readOnly: true + }} + /> + ) + + case 'code': + return ( + undefined} + themeConfig={themeConfig} + options={{ + readOnly: true + }} + /> + ) + + case 'blame': + return + + case 'history': + if (isFetchingCommits) { + return + } + return ( +
+ + routes.toRepoCommitDetails({ spaceId, repoId, commitSHA: sha }) + } + toCode={({ sha }: { sha: string }) => routes.toRepoFiles({ spaceId, repoId, commitSHA: sha })} + data={commitData?.commits?.map((item: TypesCommit) => ({ + sha: item.sha, + parent_shas: item.parent_shas, + title: item.title, + message: item.message, + author: item.author, + committer: item.committer + }))} + /> + +
+ ) + default: + return null + } + } + return ( <> handleToggleDeleteDialog(true)} /> - - {language === 'markdown' && view === 'preview' ? ( - - ) : view === 'code' ? ( - undefined} - themeConfig={themeConfig} - options={{ - readOnly: true - }} - /> - ) : ( - - )} + {renderFileView()} ) } diff --git a/packages/ui/src/components/file-control-bars/file-viewer-control-bar.tsx b/packages/ui/src/components/file-control-bars/file-viewer-control-bar.tsx index 3c9f1bee63..b800e2fb58 100644 --- a/packages/ui/src/components/file-control-bars/file-viewer-control-bar.tsx +++ b/packages/ui/src/components/file-control-bars/file-viewer-control-bar.tsx @@ -88,6 +88,7 @@ export const FileViewerControlBar: FC = ({ {isMarkdown && Preview} Code Blame + History } /> diff --git a/packages/ui/src/components/file-control-bars/types.ts b/packages/ui/src/components/file-control-bars/types.ts index fcd03b2b26..42a6b0b394 100644 --- a/packages/ui/src/components/file-control-bars/types.ts +++ b/packages/ui/src/components/file-control-bars/types.ts @@ -1,3 +1,3 @@ -export type ViewTypeValue = 'preview' | 'code' | 'blame' +export type ViewTypeValue = 'preview' | 'code' | 'blame' | 'history' export type EditViewTypeValue = 'edit' | 'preview' From 6e69ea52be16931148cbbef469064ea30fa0a135 Mon Sep 17 00:00:00 2001 From: Vardan Bansal Date: Thu, 23 Jan 2025 10:56:39 -0800 Subject: [PATCH 02/14] fix: Fix route definition for PR compare (#806) * fix route definition for PR compare * prettier fix --- apps/gitness/src/components-v2/file-content-viewer.tsx | 4 +++- apps/gitness/src/components-v2/file-editor.tsx | 2 +- apps/gitness/src/routes.tsx | 9 +++++++-- .../views/repo/repo-branch/components/branch-list.tsx | 6 +++--- .../views/repo/repo-branch/repo-branch-list-view.tsx | 10 +++------- packages/ui/src/views/repo/repo-branch/types.ts | 8 +------- 6 files changed, 18 insertions(+), 21 deletions(-) diff --git a/apps/gitness/src/components-v2/file-content-viewer.tsx b/apps/gitness/src/components-v2/file-content-viewer.tsx index 863466e82a..ae20e47b6a 100644 --- a/apps/gitness/src/components-v2/file-content-viewer.tsx +++ b/apps/gitness/src/components-v2/file-content-viewer.tsx @@ -217,7 +217,9 @@ export default function FileContentViewer({ repoContent }: FileContentViewerProp if (!isNewBranch) { navigate(`${routes.toRepoFiles({ spaceId, repoId })}${parentPath ? `/~/${parentPath}` : ''}`) } else { - navigate(`${routes.toPullRequestCompare({ spaceId, repoId })}/${selectedBranchTag.name}...${newBranchName}`) + navigate( + routes.toPullRequestCompare({ spaceId, repoId, diffRefs: `${selectedBranchTag.name}...${newBranchName}` }) + ) } }} currentBranch={fullGitRef || selectedBranchTag?.name || ''} diff --git a/apps/gitness/src/components-v2/file-editor.tsx b/apps/gitness/src/components-v2/file-editor.tsx index 399fa2cbcb..cc6d64636b 100644 --- a/apps/gitness/src/components-v2/file-editor.tsx +++ b/apps/gitness/src/components-v2/file-editor.tsx @@ -171,7 +171,7 @@ export const FileEditor: FC = ({ repoDetails, defaultBranch }) if (!isNewBranch) { navigate(`${routes.toRepoFiles({ spaceId, repoId })}/${fullGitRef}/~/${fileResourcePath}`) } else { - navigate(`${routes.toPullRequestCompare({ spaceId, repoId })}/${defaultBranch}...${newBranchName}`) + navigate(routes.toPullRequestCompare({ spaceId, repoId, diffRefs: `${defaultBranch}...${newBranchName}` })) } }} currentBranch={fullGitRef || selectedBranchTag?.name} diff --git a/apps/gitness/src/routes.tsx b/apps/gitness/src/routes.tsx index 7e36dac21d..6084c545cc 100644 --- a/apps/gitness/src/routes.tsx +++ b/apps/gitness/src/routes.tsx @@ -169,10 +169,15 @@ const repoRoutes: CustomRouteObject[] = [ { index: true, element: }, { path: 'compare/:diffRefs', - element: , handle: { + breadcrumb: () => Compare, + asLink: false, routeName: RouteConstants.toPullRequestCompare - } + }, + children: [ + { index: true, element: }, + { path: '*', element: } + ] }, { path: ':pullRequestId', diff --git a/packages/ui/src/views/repo/repo-branch/components/branch-list.tsx b/packages/ui/src/views/repo/repo-branch/components/branch-list.tsx index 91a442cd6c..d17e8ce0e0 100644 --- a/packages/ui/src/views/repo/repo-branch/components/branch-list.tsx +++ b/packages/ui/src/views/repo/repo-branch/components/branch-list.tsx @@ -197,7 +197,7 @@ export const BranchesList: FC = ({ size="xs" asChild > - + = ({ actions={[ { title: t('views:repos.newPullReq', 'New pull request'), - to: toPullRequestCompare({ diffRefs: `${defaultBranch}...${branch.name}` }) + to: toPullRequestCompare?.({ diffRefs: `${defaultBranch}...${branch.name}` }) || '' }, { title: t('views:repos.viewRules', 'View Rules'), - to: toBranchRules() + to: toBranchRules?.() }, { isDanger: true, diff --git a/packages/ui/src/views/repo/repo-branch/repo-branch-list-view.tsx b/packages/ui/src/views/repo/repo-branch/repo-branch-list-view.tsx index 30144c9ccf..e585ab150d 100644 --- a/packages/ui/src/views/repo/repo-branch/repo-branch-list-view.tsx +++ b/packages/ui/src/views/repo/repo-branch/repo-branch-list-view.tsx @@ -23,12 +23,10 @@ export const RepoBranchListView: FC = ({ isCreatingBranch, searchQuery, setSearchQuery, - toPullRequest, - toBranchRules, - toPullRequestCompare, onDeleteBranch, searchBranches, - setCreateBranchSearchQuery + setCreateBranchSearchQuery, + ...routingProps }) => { const { t } = useTranslationStore() const { branchList, defaultBranch, xNextPage, xPrevPage, page, setPage } = useRepoBranchesStore() @@ -107,11 +105,9 @@ export const RepoBranchListView: FC = ({ useTranslationStore={useTranslationStore} setCreateBranchDialogOpen={setCreateBranchDialogOpen} handleResetFiltersAndPages={handleResetFiltersAndPages} - toPullRequest={toPullRequest} - toBranchRules={toBranchRules} - toPullRequestCompare={toPullRequestCompare} onDeleteBranch={onDeleteBranch} isDirtyList={isDirtyList} + {...routingProps} /> {!isLoading && ( string toPullRequestCompare: ({ diffRefs }: { diffRefs: string }) => string - toCommitDetails?: ({ sha }: { sha: string }) => string + toPullRequest: ({ pullRequestId }: { pullRequestId: number }) => string } export interface BranchListPageProps extends Partial { @@ -49,9 +49,6 @@ export interface BranchListPageProps extends Partial { useTranslationStore: () => TranslationStore setCreateBranchDialogOpen: (isOpen: boolean) => void handleResetFiltersAndPages: () => void - toPullRequest: ({ pullRequestId }: { pullRequestId: number }) => string - toBranchRules: () => string - toPullRequestCompare: ({ diffRefs }: { diffRefs: string }) => string onDeleteBranch: (branchName: string) => void isDirtyList: boolean } @@ -67,9 +64,6 @@ export interface RepoBranchListViewProps extends Partial { createBranchError?: string searchQuery: string | null setSearchQuery: (query: string | null) => void - toPullRequest: ({ pullRequestId }: { pullRequestId: number }) => string - toBranchRules: () => string - toPullRequestCompare: ({ diffRefs }: { diffRefs: string }) => string onDeleteBranch: (branchName: string) => void searchBranches: Branch[] setCreateBranchSearchQuery: Dispatch> From 724822959135314e6fec9b6d4f209fbb017bf3f0 Mon Sep 17 00:00:00 2001 From: Sanskar Date: Thu, 23 Jan 2025 11:27:54 -0800 Subject: [PATCH 03/14] Bug fixes #3 (#810) * feat: password/signin fixes * chore: rebase * feat: fix webhook flicker * feat: add rule + disbale btn fix * fix: edit button * fix: tsc/lint * fix: tsc --- .../repo-webhooks-list/repo-webhooks-list.tsx | 5 ++- .../repo/repo-settings-general-container.tsx | 2 +- .../src/pages-v2/webhooks/webhook-list.tsx | 19 ++++----- apps/gitness/src/routes.tsx | 4 +- .../src/utils/repo-branch-rules-utils.ts | 17 ++++++-- packages/ui/locales/en/views.json | 2 + packages/ui/locales/es/views.json | 2 + packages/ui/locales/fr/views.json | 2 + .../git-commit-dialog/git-commit-dialog.tsx | 2 +- packages/ui/src/views/auth/signin-page.tsx | 5 +-- .../profile-settings-general-page.tsx | 6 +-- .../components/repo-branch-rules-data.tsx | 8 ++++ .../repo-branch-settings-rules-page.tsx | 4 +- .../src/views/repo/repo-branch-rules/types.ts | 5 ++- .../ui/src/views/repo/repo-list/repo-list.tsx | 14 +++++-- .../repo-summary/components/summary-panel.tsx | 19 ++++++++- .../views/repo/repo-summary/repo-summary.tsx | 3 ++ .../webhook-list/repo-webhook-list-page.tsx | 40 +++++++++---------- .../views/repo/webhooks/webhook-list/types.ts | 3 ++ 19 files changed, 105 insertions(+), 57 deletions(-) diff --git a/apps/design-system/src/subjects/views/repo-webhooks-list/repo-webhooks-list.tsx b/apps/design-system/src/subjects/views/repo-webhooks-list/repo-webhooks-list.tsx index cc67339f69..11961aa739 100644 --- a/apps/design-system/src/subjects/views/repo-webhooks-list/repo-webhooks-list.tsx +++ b/apps/design-system/src/subjects/views/repo-webhooks-list/repo-webhooks-list.tsx @@ -1,6 +1,6 @@ import { useCallback, useState } from 'react' -import { useTranslationsStore } from '@utils/viewUtils.ts' +import { noop, useTranslationsStore } from '@utils/viewUtils.ts' import { DeleteAlertDialog } from '@harnessio/ui/components' import { RepoWebhookListPage } from '@harnessio/ui/views' @@ -27,6 +27,9 @@ export const RepoWebhooksList = () => { useWebhookStore={repoWebhooksListStore.useWebhookStore} useTranslationStore={useTranslationsStore} openDeleteWebhookDialog={openDeleteWebhookDialog} + setSearchQuery={noop} + searchQuery={null} + webhookLoading={false} /> { } const handleRuleClick = (identifier: string) => { - navigate(routes.toRepoBranchRule({ spaceId, repoId: repoName, identifier })) + navigate(routes.toRepoBranchRules({ spaceId, repoId: repoName, identifier })) } const handleDeleteRule = (ruleIdentifier: string) => { diff --git a/apps/gitness/src/pages-v2/webhooks/webhook-list.tsx b/apps/gitness/src/pages-v2/webhooks/webhook-list.tsx index 7ce2306761..6770be0740 100644 --- a/apps/gitness/src/pages-v2/webhooks/webhook-list.tsx +++ b/apps/gitness/src/pages-v2/webhooks/webhook-list.tsx @@ -1,6 +1,7 @@ import { useCallback, useEffect, useState } from 'react' import { useQueryClient } from '@tanstack/react-query' +import { useQueryState } from 'nuqs' import { DeleteRepoWebhookErrorResponse, @@ -12,15 +13,15 @@ import { RepoWebhookListPage } from '@harnessio/ui/views' import { useGetRepoRef } from '../../framework/hooks/useGetRepoPath' import usePaginationQueryStateWithStore from '../../hooks/use-pagination-query-state-with-store' -import { useDebouncedQueryState } from '../../hooks/useDebouncedQueryState' import { useTranslationStore } from '../../i18n/stores/i18n-store' import { getErrorMessage } from '../../utils/error-utils' import { useWebhookStore } from './stores/webhook-store' export default function WebhookListPage() { const repoRef = useGetRepoRef() ?? '' - const { setWebhooks, page, setPage, setWebhookLoading, setError } = useWebhookStore() - const [query] = useDebouncedQueryState('query') + const { setWebhooks, page, setPage, setError } = useWebhookStore() + const [query, setQuery] = useQueryState('query') + const queryClient = useQueryClient() const [apiError, setApiError] = useState<{ type: string; message: string } | null>(null) @@ -41,7 +42,7 @@ export default function WebhookListPage() { { queryParams: { page: queryPage, - query + query: query ?? '' }, repo_ref: repoRef }, @@ -90,18 +91,11 @@ export default function WebhookListPage() { useEffect(() => { if (webhookData) { setWebhooks(webhookData, headers) - setWebhookLoading(false) } // eslint-disable-next-line react-hooks/exhaustive-deps }, [webhookData, headers, setWebhooks]) - useEffect(() => { - if (isFetching) { - setWebhookLoading(isFetching) - } - }, [isFetching, setWebhookLoading]) - useEffect(() => { if (isError && error !== undefined) { setError(getErrorMessage(error)) @@ -114,6 +108,9 @@ export default function WebhookListPage() { useWebhookStore={useWebhookStore} useTranslationStore={useTranslationStore} openDeleteWebhookDialog={openDeleteWebhookDialog} + searchQuery={query} + setSearchQuery={setQuery} + webhookLoading={isFetching} /> , + element: , handle: { breadcrumb: ({ commitSHA }: { commitSHA: string }) => ( <> @@ -121,7 +121,7 @@ const repoRoutes: CustomRouteObject[] = [ index: true, element: ( - + ) } diff --git a/apps/gitness/src/utils/repo-branch-rules-utils.ts b/apps/gitness/src/utils/repo-branch-rules-utils.ts index 5501a86102..3cddfb903a 100644 --- a/apps/gitness/src/utils/repo-branch-rules-utils.ts +++ b/apps/gitness/src/utils/repo-branch-rules-utils.ts @@ -5,8 +5,13 @@ import { RepoRuleAddRequestBody, RepoRuleGetOkResponse } from '@harnessio/code-service-client' -import { RepoBranchSettingsFormFields } from '@harnessio/ui/views' -import { BranchRuleId, MergeStrategy, PatternsButtonType, Rule } from '@harnessio/views' +import { + BranchRuleId, + MergeStrategy, + PatternsButtonType, + RepoBranchSettingsFormFields, + Rule +} from '@harnessio/ui/views' const ruleIds = [ BranchRuleId.REQUIRE_LATEST_COMMIT, @@ -18,7 +23,8 @@ const ruleIds = [ BranchRuleId.BLOCK_BRANCH_CREATION, BranchRuleId.BLOCK_BRANCH_DELETION, BranchRuleId.REQUIRE_PULL_REQUEST, - BranchRuleId.REQUIRE_CODE_REVIEW + BranchRuleId.REQUIRE_CODE_REVIEW, + BranchRuleId.REQUIRE_CODE_OWNERS ] // Util to transform API response into expected-form format for branch-rules-edit @@ -67,6 +73,9 @@ const extractBranchRules = (data: RepoRuleGetOkResponse): Rule[] => { checked = (definition?.pullreq?.approvals?.require_minimum_count ?? 0) > 0 input = definition?.pullreq?.approvals?.require_minimum_count?.toString() || '' break + case BranchRuleId.REQUIRE_CODE_OWNERS: + checked = definition?.pullreq?.approvals?.require_code_owners || false + break default: continue } @@ -163,7 +172,7 @@ export const transformFormOutput = (formOutput: RepoBranchSettingsFormFields): R }, pullreq: { approvals: { - require_code_owners: true, + require_code_owners: rulesMap[BranchRuleId.REQUIRE_CODE_OWNERS]?.checked || false, require_latest_commit: rulesMap[BranchRuleId.REQUIRE_LATEST_COMMIT]?.checked || false, require_no_change_request: rulesMap[BranchRuleId.REQUIRE_NO_CHANGE_REQUEST]?.checked || false, require_minimum_count: rulesMap[BranchRuleId.REQUIRE_CODE_REVIEW].checked diff --git a/packages/ui/locales/en/views.json b/packages/ui/locales/en/views.json index 8b67acdaa4..431688b768 100644 --- a/packages/ui/locales/en/views.json +++ b/packages/ui/locales/en/views.json @@ -54,6 +54,8 @@ "RequirePullRequestDescription": "Do not allow any changes to matching branches without a pull request", "RequireCodeReview": "Require a minimum number of reviewers", "RequireCodeReviewDescription": "Require approval on pull requests from a minimum number of reviewers", + "RequireCodeOwners": "Require review from code owners", + "RequireCodeOwnersDescription": "Require approval on pull requests from one reviewer for each Code Owner rule", "enableRule": "Enable the rule", "enableRuleDescription": "By enabling the toggle, the branch rule will be enforced.", "enterRuleName": "Enter the rule name here", diff --git a/packages/ui/locales/es/views.json b/packages/ui/locales/es/views.json index ea9e9d5d3c..1cdfa4bf87 100644 --- a/packages/ui/locales/es/views.json +++ b/packages/ui/locales/es/views.json @@ -54,6 +54,8 @@ "RequirePullRequestDescription": "Do not allow any changes to matching branches without a pull request", "RequireCodeReview": "Require a minimum number of reviewers", "RequireCodeReviewDescription": "Require approval on pull requests from a minimum number of reviewers", + "RequireCodeOwners": "Require review from code owners", + "RequireCodeOwnersDescription": "Require approval on pull requests from one reviewer for each Code Owner rule", "enableRule": "Enable the rule", "enableRuleDescription": "By enabling the toggle, the branch rule will be enforced.", "enterRuleName": "Enter the rule name here", diff --git a/packages/ui/locales/fr/views.json b/packages/ui/locales/fr/views.json index 7acb8ce60f..5dcae9c31b 100644 --- a/packages/ui/locales/fr/views.json +++ b/packages/ui/locales/fr/views.json @@ -54,6 +54,8 @@ "RequirePullRequestDescription": "Interdire les modifications directes sur les branches sans requête de tirage", "RequireCodeReview": "Exiger un minimum de réviseurs", "RequireCodeReviewDescription": "Les requêtes de tirage doivent être approuvées par un nombre minimal de réviseurs", + "RequireCodeOwners": "Require review from code owners", + "RequireCodeOwnersDescription": "Require approval on pull requests from one reviewer for each Code Owner rule", "enableRule": "Activer la règle", "enableRuleDescription": "En activant cette option, la règle sera appliquée.", "enterRuleName": "Enter the rule name here", diff --git a/packages/ui/src/components/git-commit-dialog/git-commit-dialog.tsx b/packages/ui/src/components/git-commit-dialog/git-commit-dialog.tsx index 89fb13db41..8316439fd1 100644 --- a/packages/ui/src/components/git-commit-dialog/git-commit-dialog.tsx +++ b/packages/ui/src/components/git-commit-dialog/git-commit-dialog.tsx @@ -208,7 +208,7 @@ export const GitCommitDialog: FC = ({ /> {violation && ( - + {bypassable ? commitToGitRefValue === CommitToGitRefOption.DIRECTLY ? 'Some rules will be bypassed to commit directly' diff --git a/packages/ui/src/views/auth/signin-page.tsx b/packages/ui/src/views/auth/signin-page.tsx index 2b9e465978..71e6d15aa8 100644 --- a/packages/ui/src/views/auth/signin-page.tsx +++ b/packages/ui/src/views/auth/signin-page.tsx @@ -22,7 +22,7 @@ export interface SignInData { } const signInSchema = z.object({ - email: z.string().email({ message: 'Invalid email address' }), + email: z.string(), password: z.string().min(1, { message: 'The field can’t be blank' }) }) @@ -90,8 +90,7 @@ export function SignInPage({ handleSignIn, isLoading, error }: SignInPageProps)
data.newPassword === data.confirmPassword, { diff --git a/packages/ui/src/views/repo/repo-branch-rules/components/repo-branch-rules-data.tsx b/packages/ui/src/views/repo/repo-branch-rules/components/repo-branch-rules-data.tsx index d86c958476..8f19a8f9c6 100644 --- a/packages/ui/src/views/repo/repo-branch-rules/components/repo-branch-rules-data.tsx +++ b/packages/ui/src/views/repo/repo-branch-rules/components/repo-branch-rules-data.tsx @@ -101,5 +101,13 @@ export const getBranchRules = (t: TFunction): BranchRuleType[] => [ 'Require approval on pull requests from a minimum number of reviewers' ), hasInput: true + }, + { + id: BranchRuleId.REQUIRE_CODE_OWNERS, + label: t('views:repos.RequireCodeOwners', 'Require review from code owners'), + description: t( + 'views:repos.RequireCodeOwnersDescription', + 'Require approval on pull requests from one reviewer for each Code Owner rule' + ) } ] diff --git a/packages/ui/src/views/repo/repo-branch-rules/repo-branch-settings-rules-page.tsx b/packages/ui/src/views/repo/repo-branch-rules/repo-branch-settings-rules-page.tsx index 92b0484b40..0c03a56fd9 100644 --- a/packages/ui/src/views/repo/repo-branch-rules/repo-branch-settings-rules-page.tsx +++ b/packages/ui/src/views/repo/repo-branch-rules/repo-branch-settings-rules-page.tsx @@ -62,7 +62,7 @@ export const RepoBranchSettingsRulesPage: FC = setValue, watch, reset, - formState: { errors, isValid } + formState: { errors } } = useForm({ resolver: zodResolver(repoBranchSettingsFormSchema), mode: 'onChange', @@ -156,7 +156,7 @@ export const RepoBranchSettingsRulesPage: FC =
-