aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilippe Perrin <philippe.perrin@sonarsource.com>2019-11-18 16:01:07 +0100
committerSonarTech <sonartech@sonarsource.com>2019-12-09 20:46:17 +0100
commitf13b0df538063f349e4fd50009cc826cda276252 (patch)
treec75683219af61d65252c205692839bbc3464a127
parent956001c58e66df580b0a3a8b91cb886b84980971 (diff)
downloadsonarqube-f13b0df538063f349e4fd50009cc826cda276252.tar.gz
sonarqube-f13b0df538063f349e4fd50009cc826cda276252.zip
SONAR-12661 Rename configuration setting "sonar.dbcleaner.daysBeforeDeletingInactiveShortLivingBranches"
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformation.tsx6
-rw-r--r--server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LifetimeInformation-test.tsx7
-rw-r--r--server/sonar-web/src/main/js/types/settings.ts23
3 files changed, 30 insertions, 6 deletions
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformation.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformation.tsx
index c9b7890f323..8274ae39961 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformation.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/LifetimeInformation.tsx
@@ -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({
diff --git a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LifetimeInformation-test.tsx b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LifetimeInformation-test.tsx
index ffc75629492..5072571c5b5 100644
--- a/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LifetimeInformation-test.tsx
+++ b/server/sonar-web/src/main/js/apps/projectBranches/components/__tests__/LifetimeInformation-test.tsx
@@ -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
index 00000000000..61344d4bfa5
--- /dev/null
+++ b/server/sonar-web/src/main/js/types/settings.ts
@@ -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'
+}