fix: [code-1046]: fix inverted target patterns and text (#752)

This commit is contained in:
Calvin Lee 2023-11-01 17:42:30 +00:00 committed by Harness
parent 49ca8a8bc3
commit cd2447a82c
6 changed files with 12 additions and 13 deletions

View File

@ -65,7 +65,6 @@ const BranchProtectionForm = (props: {
const { showError, showSuccess } = useToaster() const { showError, showSuccess } = useToaster()
const { editMode = false, repoMetadata, ruleUid, refetchRules } = props const { editMode = false, repoMetadata, ruleUid, refetchRules } = props
const { getString } = useStrings() const { getString } = useStrings()
const { data: rule } = useGet<OpenapiRule>({ const { data: rule } = useGet<OpenapiRule>({
path: `/api/v1/repos/${repoMetadata?.path}/+/rules/${ruleId}`, path: `/api/v1/repos/${repoMetadata?.path}/+/rules/${ruleId}`,
lazy: !repoMetadata && !ruleId lazy: !repoMetadata && !ruleId
@ -212,8 +211,8 @@ const BranchProtectionForm = (props: {
state: formData.enable === true ? 'active' : 'disabled', state: formData.enable === true ? 'active' : 'disabled',
pattern: { pattern: {
default: formData.targetDefault, default: formData.targetDefault,
exclude: includeArray, exclude: excludeArray,
include: excludeArray include: includeArray
}, },
definition: { definition: {
bypass: { bypass: {

View File

@ -36,7 +36,7 @@ const BranchProtectionHeader = ({
<Layout.Horizontal spacing="medium"> <Layout.Horizontal spacing="medium">
<Button <Button
variation={ButtonVariation.PRIMARY} variation={ButtonVariation.PRIMARY}
text={getString('branchProtection.newBranchProtectionRule')} text={getString('branchProtection.newRule')}
icon={CodeIcon.Add} icon={CodeIcon.Add}
onClick={() => onClick={() =>
history.push( history.push(

View File

@ -326,7 +326,7 @@ const BranchProtectionListing = (props: { activeTab: string }) => {
) )
} }
id="protectionApplied" id="protectionApplied"
summary={`${nonEmptyRules.length} Protections applied`} summary={`${nonEmptyRules.length} Rules applied`}
/> />
</Accordion> </Accordion>
</Container> </Container>
@ -388,7 +388,7 @@ const BranchProtectionListing = (props: { activeTab: string }) => {
showWhen={() => rules?.length === 0} showWhen={() => rules?.length === 0}
forSearch={!!searchTerm} forSearch={!!searchTerm}
message={getString('branchProtection.ruleEmpty')} message={getString('branchProtection.ruleEmpty')}
buttonText={getString('branchProtection.newBranchProtectionRule')} buttonText={getString('branchProtection.newRule')}
onButtonClick={() => { onButtonClick={() => {
history.push( history.push(
routes.toCODESettings({ routes.toCODESettings({

View File

@ -70,7 +70,7 @@ export interface StringsMap {
'branchProtection.minNumber': string 'branchProtection.minNumber': string
'branchProtection.minNumberPlaceholder': string 'branchProtection.minNumberPlaceholder': string
'branchProtection.namePlaceholder': string 'branchProtection.namePlaceholder': string
'branchProtection.newBranchProtectionRule': string 'branchProtection.newRule': string
'branchProtection.protectionSelectAll': string 'branchProtection.protectionSelectAll': string
'branchProtection.reqCommentResolutionText': string 'branchProtection.reqCommentResolutionText': string
'branchProtection.reqCommentResolutionTitle': string 'branchProtection.reqCommentResolutionTitle': string

View File

@ -851,16 +851,16 @@ Enable: Enable
branchProtection: branchProtection:
namePlaceholder: Enter the rule name here namePlaceholder: Enter the rule name here
descPlaceholder: Enter the description here descPlaceholder: Enter the description here
title: Protection Rules title: Rules
edit: Edit Branch Protection edit: Edit Rule
create: Create Branch Protection create: Create Rule
targetBranches: Target Patterns targetBranches: Target Patterns
targetPlaceholder: Enter the target patterns targetPlaceholder: Enter the target patterns
defaultBranch: Default branch defaultBranch: Default branch
bypassList: Bypass List bypassList: Bypass List
newBranchProtectionRule: New Branch Protection Rule newRule: New branch rule
allRepoOwners: Allow users with edit permission on the repository to bypass allRepoOwners: Allow users with edit permission on the repository to bypass
protectionSelectAll: 'Protections: Select all that apply' protectionSelectAll: 'Rules: Select all that apply'
requireMinReviewersTitle: Require a minimum number of reviewers requireMinReviewersTitle: Require a minimum number of reviewers
requireMinReviewersContent: Require approval on pull requests from a minimum number of reviewers requireMinReviewersContent: Require approval on pull requests from a minimum number of reviewers
minNumber: Minimum number minNumber: Minimum number

View File

@ -206,7 +206,7 @@ export const rulesFormInitialPayload = {
desc: '', desc: '',
enable: true, enable: true,
target: '', target: '',
targetDefault: true, targetDefault: false,
targetList: [] as string[][], targetList: [] as string[][],
allRepoOwners: false, allRepoOwners: false,
bypassList: [] as string[], bypassList: [] as string[],