You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ApplicationNonCaycProjectWarning.tsx 3.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2023 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. import * as React from 'react';
  21. import DocLink from '../../../components/common/DocLink';
  22. import Link from '../../../components/common/Link';
  23. import QualifierIcon from '../../../components/icons/QualifierIcon';
  24. import { Alert } from '../../../components/ui/Alert';
  25. import { getBranchLikeQuery } from '../../../helpers/branch-like';
  26. import { translate, translateWithParameters } from '../../../helpers/l10n';
  27. import { getProjectQueryUrl } from '../../../helpers/urls';
  28. import { ComponentQualifier } from '../../../types/component';
  29. import { QualityGateStatus } from '../../../types/quality-gates';
  30. import { CaycStatus } from '../../../types/types';
  31. interface Props {
  32. projects: QualityGateStatus[];
  33. caycStatus: CaycStatus;
  34. }
  35. export default function ApplicationNonCaycProjectWarning({ projects, caycStatus }: Props) {
  36. return (
  37. <div className="overview-quality-gate-conditions-list padded big-spacer-top">
  38. {caycStatus === CaycStatus.NonCompliant ? (
  39. <Alert variant="warning">
  40. {translateWithParameters(
  41. 'overview.quality_gate.application.non_cayc.projects_x',
  42. projects.length
  43. )}
  44. </Alert>
  45. ) : (
  46. <p className="padded">
  47. {translateWithParameters(
  48. 'overview.quality_gate.application.cayc_over_compliant.projects_x',
  49. projects.length
  50. )}
  51. </p>
  52. )}
  53. <ul className="spacer-left spacer-bottom big-spacer-top">
  54. {projects.map(({ key, name, branchLike }) => (
  55. <li key={key} className="text-ellipsis spacer-bottom" title={name}>
  56. <Link
  57. className="link-no-underline"
  58. to={getProjectQueryUrl(key, getBranchLikeQuery(branchLike))}
  59. >
  60. <QualifierIcon
  61. className="little-spacer-right"
  62. qualifier={ComponentQualifier.Project}
  63. />
  64. {name}
  65. </Link>
  66. </li>
  67. ))}
  68. </ul>
  69. <hr className="big-spacer-top big-spacer-bottom" />
  70. <div className="spacer spacer-bottom big-spacer-top">
  71. {caycStatus === CaycStatus.NonCompliant ? (
  72. <DocLink to="/user-guide/clean-as-you-code/">
  73. {translate('overview.quality_gate.conditions.cayc.link')}
  74. </DocLink>
  75. ) : (
  76. <DocLink to="/user-guide/clean-as-you-code/#potential-drawbacks">
  77. {translate('overview.quality_gate.conditions.cayc_over_compliant.link')}
  78. </DocLink>
  79. )}
  80. </div>
  81. </div>
  82. );
  83. }