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.

settings.ts 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2024 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 { Dict } from './types';
  21. export const enum SettingsKey {
  22. AuditHouseKeeping = 'sonar.dbcleaner.auditHousekeeping',
  23. DaysBeforeDeletingInactiveBranchesAndPRs = 'sonar.dbcleaner.daysBeforeDeletingInactiveBranchesAndPRs',
  24. DefaultProjectVisibility = 'projects.default.visibility',
  25. ServerBaseUrl = 'sonar.core.serverBaseURL',
  26. PluginRiskConsent = 'sonar.plugins.risk.consent',
  27. LicenceRemainingLocNotificationThreshold = 'sonar.license.notifications.remainingLocThreshold',
  28. TokenMaxAllowedLifetime = 'sonar.auth.token.max.allowed.lifetime',
  29. QPAdminCanDisableInheritedRules = 'sonar.qualityProfiles.allowDisableInheritedRules',
  30. }
  31. export enum GlobalSettingKeys {
  32. LogoUrl = 'sonar.lf.logoUrl',
  33. LogoWidth = 'sonar.lf.logoWidthPx',
  34. EnableGravatar = 'sonar.lf.enableGravatar',
  35. GravatarServerUrl = 'sonar.lf.gravatarServerUrl',
  36. RatingGrid = 'sonar.technicalDebt.ratingGrid',
  37. DeveloperAggregatedInfoDisabled = 'sonar.developerAggregatedInfo.disabled',
  38. UpdatecenterActivated = 'sonar.updatecenter.activate',
  39. DisplayAnnouncementMessage = 'sonar.announcement.displayMessage',
  40. AnnouncementMessage = 'sonar.announcement.message',
  41. MainBranchName = 'sonar.projectCreation.mainBranchName',
  42. }
  43. export type SettingDefinitionAndValue = {
  44. definition: ExtendedSettingDefinition;
  45. settingValue?: SettingValue;
  46. };
  47. export type Setting = SettingValue & { definition: SettingDefinition; hasValue: boolean };
  48. export type SettingWithCategory = Setting & { definition: ExtendedSettingDefinition };
  49. export enum SettingType {
  50. STRING = 'STRING',
  51. TEXT = 'TEXT',
  52. JSON = 'JSON',
  53. PASSWORD = 'PASSWORD',
  54. BOOLEAN = 'BOOLEAN',
  55. FLOAT = 'FLOAT',
  56. INTEGER = 'INTEGER',
  57. LICENSE = 'LICENSE',
  58. LONG = 'LONG',
  59. SINGLE_SELECT_LIST = 'SINGLE_SELECT_LIST',
  60. PROPERTY_SET = 'PROPERTY_SET',
  61. FORMATTED_TEXT = 'FORMATTED_TEXT',
  62. REGULAR_EXPRESSION = 'REGULAR_EXPRESSION',
  63. USER_LOGIN = 'USER_LOGIN',
  64. }
  65. export interface SettingDefinition {
  66. description?: string;
  67. key: string;
  68. multiValues?: boolean;
  69. name?: string;
  70. options: string[];
  71. type?: SettingType;
  72. }
  73. export interface SettingFieldDefinition extends SettingDefinition {
  74. name: string;
  75. }
  76. export interface ExtendedSettingDefinition extends SettingDefinition {
  77. category: string;
  78. defaultValue?: string;
  79. deprecatedKey?: string;
  80. fields: SettingFieldDefinition[];
  81. multiValues?: boolean;
  82. subCategory: string;
  83. }
  84. export interface DefinitionV2 {
  85. name: string;
  86. key: string;
  87. description?: string;
  88. secured: boolean;
  89. multiValues?: boolean;
  90. type?: SettingType;
  91. }
  92. export interface SettingValueResponse {
  93. settings: SettingValue[];
  94. setSecuredSettings: string[];
  95. }
  96. export interface SettingValue {
  97. fieldValues?: Array<Dict<string>>;
  98. inherited?: boolean;
  99. key: string;
  100. parentFieldValues?: Array<Dict<string>>;
  101. parentValue?: string;
  102. parentValues?: string[];
  103. value?: string;
  104. values?: string[];
  105. }