Fix : Typos and delete bypass scenario (#864)

pull/3441/head
Ritik Kapoor 2023-12-05 09:39:16 +00:00 committed by Harness
parent dad33e2696
commit 31ff66a3a0
4 changed files with 14 additions and 5 deletions

View File

@ -170,7 +170,7 @@ export function useCommitModal({
if (response?.rule_violations?.length) {
setAllStates({
violation: true,
bypassed: false,
bypassed: true,
bypassable: response?.rule_violations[0]?.bypassable
})
setDisableCTA(!response?.rule_violations[0]?.bypassable)
@ -256,8 +256,8 @@ export function useCommitModal({
<Icon intent={Intent.WARNING} name="danger-icon" size={16} />
<Text font={{ variation: FontVariation.BODY2 }} color={Color.RED_800}>
{bypassable
? getString('branchProtection.commitDirectlyBlockText')
: getString('branchProtection.commitNewBranchBlockText')}
? getString('branchProtection.commitDirectlyAlertText')
: getString('branchProtection.commitDirectlyBlockText')}
</Text>
</Layout.Horizontal>
</Render>
@ -319,7 +319,11 @@ export function useCommitModal({
disabled={loading}
type="submit"
variation={ButtonVariation.SECONDARY}
text={getString('branchProtection.commitNewBranchAlertBtn')}
text={
targetBranchOption === CommitToGitRefOption.NEW_BRANCH
? getString('branchProtection.commitNewBranchAlertBtn')
: getString('branchProtection.commitDirectlyAlertBtn')
}
/>
)}
<Button text={getString('cancel')} variation={ButtonVariation.LINK} onClick={hideModal} />

View File

@ -54,6 +54,8 @@ export interface StringsMap {
'branchProtection.blockBranchDeletion': string
'branchProtection.blockBranchDeletionText': string
'branchProtection.bypassList': string
'branchProtection.commitDirectlyAlertBtn': string
'branchProtection.commitDirectlyAlertText': string
'branchProtection.commitDirectlyBlockText': string
'branchProtection.commitNewBranchAlertBtn': string
'branchProtection.commitNewBranchAlertText': string

View File

@ -926,6 +926,8 @@ branchProtection:
commitNewBranchAlertText: Some rules will be bypassed to commit by creating branch
commitNewBranchBlockText: Some rules don't allow you to create new branch for commit
commitDirectlyBlockText: Some rules don't allow you to commit directly
commitDirectlyAlertText: Some rules will be bypassed to commit directly
commitDirectlyAlertBtn: Bypass rules and commit directly
codeOwner:
title: Code Owner
changesRequested: '{count} {count|1:change,changes} requested'

View File

@ -175,7 +175,8 @@ export function BranchesContent({ repoMetadata, searchTerm = '', branches, onDel
const [persistModal, setPersistModal] = useState(true)
const { mutate: deleteBranch } = useMutate({
verb: 'DELETE',
path: `/api/v1/repos/${repoMetadata.path}/+/branches/${row.original.name}?bypass_rules=${bypassed}`
path: `/api/v1/repos/${repoMetadata.path}/+/branches/${row.original.name}`,
queryParams: { bypass_rules: bypassed }
})
const { showSuccess, showError } = useToaster()
const confirmDeleteBranch = useConfirmAction({