]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-12661 Rename configuration setting "sonar.dbcleaner.daysBeforeDeletingInactiveS...
authorPhilippe Perrin <philippe.perrin@sonarsource.com>
Mon, 18 Nov 2019 15:01:07 +0000 (16:01 +0100)
committerSonarTech <sonartech@sonarsource.com>
Mon, 9 Dec 2019 19:46:17 +0000 (20:46 +0100)
server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformation.tsx
server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LifetimeInformation-test.tsx
server/sonar-web/src/main/js/types/settings.ts [new file with mode: 0644]

index c9b7890f323a258c44794f86053a1392d524cf98..8274ae399618a67b9b91a4d140d6c41be802af67 100644 (file)
@@ -22,6 +22,7 @@ import * as React from 'react';
 import { connect } from 'react-redux';
 import { getValues } from '../../../api/settings';
 import { getAppState, Store } from '../../../store/rootReducer';
+import { SettingsKey } from '../../../types/settings';
 import LifetimeInformationRenderer from './LifetimeInformationRenderer';
 
 interface Props {
@@ -33,9 +34,6 @@ interface State {
   loading: boolean;
 }
 
-export const BRANCH_PULL_REQUEST_LIFETIME_SETTING =
-  'sonar.dbcleaner.daysBeforeDeletingInactiveShortLivingBranches';
-
 export class LifetimeInformation extends React.PureComponent<Props, State> {
   mounted = false;
   state: State = { loading: true };
@@ -50,7 +48,7 @@ export class LifetimeInformation extends React.PureComponent<Props, State> {
   }
 
   fetchBranchAndPullRequestLifetimeSetting() {
-    getValues({ keys: BRANCH_PULL_REQUEST_LIFETIME_SETTING }).then(
+    getValues({ keys: SettingsKey.DaysBeforeDeletingInactiveBranchesAndPRs }).then(
       settings => {
         if (this.mounted) {
           this.setState({
index ffc75629492bec06dc9ab48f1cd6790fafdc3105..5072571c5b5900d31524d2d8f80e3f0b77961198 100644 (file)
@@ -22,7 +22,8 @@ import { shallow } from 'enzyme';
 import * as React from 'react';
 import { waitAndUpdate } from 'sonar-ui-common/helpers/testUtils';
 import { getValues } from '../../../../api/settings';
-import { BRANCH_PULL_REQUEST_LIFETIME_SETTING, LifetimeInformation } from '../LifetimeInformation';
+import { SettingsKey } from '../../../../types/settings';
+import { LifetimeInformation } from '../LifetimeInformation';
 
 jest.mock('../../../../api/settings', () => ({
   getValues: jest.fn().mockResolvedValue([{ value: '45' }])
@@ -34,7 +35,9 @@ it('should render correctly', async () => {
 
   await waitAndUpdate(wrapper);
 
-  expect(getValues).toHaveBeenCalledWith({ keys: BRANCH_PULL_REQUEST_LIFETIME_SETTING });
+  expect(getValues).toHaveBeenCalledWith({
+    keys: SettingsKey.DaysBeforeDeletingInactiveBranchesAndPRs
+  });
   expect(wrapper).toMatchSnapshot('after_fetching_data');
 });
 
diff --git a/server/sonar-web/src/main/js/types/settings.ts b/server/sonar-web/src/main/js/types/settings.ts
new file mode 100644 (file)
index 0000000..61344d4
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2019 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+
+export const enum SettingsKey {
+  DaysBeforeDeletingInactiveBranchesAndPRs = 'sonar.dbcleaner.daysBeforeDeletingInactiveBranchesAndPRs'
+}