diff options
3 files changed, 24 insertions, 7 deletions
diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.tsx index 466907065cc..137ceffefc1 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.tsx +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/DetailsHeader.tsx @@ -78,7 +78,10 @@ export default function DetailsHeader({ qualityGate }: Readonly<Props>) { }; const handleSetQualityGateAiCodeAssurance = () => { - if (qualityGateProjectsHavingAiCode?.length > 0 && qualityGate.isAiCodeSupported) { + if ( + (qualityGateProjectsHavingAiCode?.length > 0 && qualityGate.isAiCodeSupported) || + (qualityGate.isDefault && qualityGate.isAiCodeSupported) + ) { setIsQualifyAiFormOpen(true); return; } @@ -241,6 +244,7 @@ export default function DetailsHeader({ qualityGate }: Readonly<Props>) { {isQualifyAiFormOpen && ( <DisqualifyAiQualityGateForm onClose={() => setIsQualifyAiFormOpen(false)} + isDefault={qualityGate.isDefault} onConfirm={updateQualityGateAiCodeAssurance} count={qualityGateProjectsHavingAiCode.length} /> diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/DisqualifyAiQualityGateForm.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/DisqualifyAiQualityGateForm.tsx index 56ca78df6c0..9ef2bace768 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/DisqualifyAiQualityGateForm.tsx +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/DisqualifyAiQualityGateForm.tsx @@ -23,6 +23,7 @@ import { useIntl } from 'react-intl'; interface Props { count: number; + isDefault?: boolean; onClose: () => void; onConfirm: () => void; } @@ -30,6 +31,7 @@ interface Props { export default function DisqualifyAiQualityGateForm({ onConfirm, onClose, + isDefault = false, count = 0, }: Readonly<Props>) { const intl = useIntl(); @@ -38,15 +40,24 @@ export default function DisqualifyAiQualityGateForm({ <Modal isOpen size={ModalSize.Wide} - title={intl.formatMessage({ id: 'quality_gates.disqualify_ai_modal.title' }, { count })} + title={ + isDefault + ? intl.formatMessage({ id: 'quality_gates.disqualify_ai_modal_default.title' }) + : intl.formatMessage({ id: 'quality_gates.disqualify_ai_modal.title' }, { count }) + } onOpenChange={onClose} content={ <> <p> - {intl.formatMessage( - { id: 'quality_gates.disqualify_ai_modal.content.line1' }, - { count }, - )} + {isDefault + ? intl.formatMessage( + { id: 'quality_gates.disqualify_ai_modal_default.content.line1' }, + { count }, + ) + : intl.formatMessage( + { id: 'quality_gates.disqualify_ai_modal.content.line1' }, + { count }, + )} </p> <br /> <p>{intl.formatMessage({ id: 'quality_gates.disqualify_ai_modal.content.line2' })}</p> diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index b77a4af2c36..70047020204 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -2257,7 +2257,7 @@ project_quality_gate.not_ai_assured_quality_gate=This quality gate is not qualif project_quality_gate.ai_generated_code_protected.title=Your AI-generated code is protected project_quality_gate.ai_generated_code_protected.description=<p>This project contains AI-generated code and the selected quality gate is qualified for <link>AI Code Assurance</link>.</p> project_quality_gate.ai_generated_code_not_protected.title=Protect your AI-generated code with ‘AI Code Assurance’ -project_quality_gate.ai_generated_code_not_protected.description=<p>This project contains AI-generated code. We recommend using a qualified quality gate to enable <link>AI Code Assurance</link>.</p><p>You may use <linkSonarWay>Sonar way for AI code</linkSonarWay> or <linkQualifyDoc>qualify your own custom quality gates for AI Code Assurance.</linkQualifyDoc></p> +project_quality_gate.ai_generated_code_not_protected.description=<p>This project contains AI-generated code. We recommend using a qualified quality gate to enable <link>AI Code Assurance</link>.</p><p>You may use <linkSonarWay>Sonar way for AI code</linkSonarWay> or <linkQualifyDoc>qualify your own custom quality gates for AI Code Assurance</linkQualifyDoc>.</p> #------------------------------------------------------------------------------ # @@ -2614,7 +2614,9 @@ quality_gates.mode_banner.button=Review and update metrics quality_gates.actions.disqualify_for_ai_code_assurance=Disqualify for AI Code Assurance quality_gates.actions.qualify_for_ai_code_assurance=Qualify for AI Code Assurance quality_gates.disqualify_ai_modal.title=Disqualify this quality gate and disable AI Code Assurance on {count} {count, plural, one {project} other {projects}}? +quality_gates.disqualify_ai_modal_default.title=Some projects may lose their AI Code Assurance quality_gates.disqualify_ai_modal.content.line1={count} {count, plural, one {project uses} other {projects use}} this quality gate to benefit from AI Code Assurance. If you disqualify it, {count, plural, one {this project} other {these projects}} will lose {count, plural, one {its} other {their}} AI Code Assurance. +quality_gates.disqualify_ai_modal_default.content.line1=Some projects may rely on the default quality gate to benefit from AI Code Assurance. If you disqualify it, these projects will lose their AI Code Assurance. quality_gates.disqualify_ai_modal.content.line2=Do you want to continue? quality_gates.disqualify_ai_modal.confirm=Disqualify for AI Code Assurance |