Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2020 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. export enum Visibility {
  21. Public = 'public',
  22. Private = 'private'
  23. }
  24. export enum ComponentQualifier {
  25. Application = 'APP',
  26. Directory = 'DIR',
  27. Developper = 'DEV',
  28. File = 'FIL',
  29. Portfolio = 'VW',
  30. Project = 'TRK',
  31. SubPortfolio = 'SVW',
  32. SubProject = 'BRC',
  33. TestFile = 'UTS'
  34. }
  35. export enum ProjectKeyValidationResult {
  36. Valid = 'valid',
  37. Empty = 'empty',
  38. TooLong = 'too_long',
  39. InvalidChar = 'invalid_char',
  40. OnlyDigits = 'only_digits'
  41. }
  42. export interface TreeComponent extends T.LightComponent {
  43. id?: string;
  44. name: string;
  45. path?: string;
  46. refId?: string;
  47. refKey?: string;
  48. tags?: string[];
  49. visibility: T.Visibility;
  50. }
  51. export interface TreeComponentWithPath extends TreeComponent {
  52. path: string;
  53. }
  54. export function isPortfolioLike(
  55. componentQualifier?: string | ComponentQualifier
  56. ): componentQualifier is ComponentQualifier.Portfolio | ComponentQualifier.SubPortfolio {
  57. return Boolean(
  58. componentQualifier &&
  59. [
  60. ComponentQualifier.Portfolio.toString(),
  61. ComponentQualifier.SubPortfolio.toString()
  62. ].includes(componentQualifier)
  63. );
  64. }
  65. export function isApplication(
  66. componentQualifier?: string | ComponentQualifier
  67. ): componentQualifier is ComponentQualifier.Application {
  68. return componentQualifier === ComponentQualifier.Application;
  69. }