aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/projectBaseline/utils.ts
diff options
context:
space:
mode:
authorJacek <jacek.poreda@sonarsource.com>2019-09-06 10:19:26 +0200
committerSonarTech <sonartech@sonarsource.com>2019-09-24 20:21:17 +0200
commite8f1a84869bcb72af1ca30fa78b9c936a3e028a3 (patch)
treec525ec29534c2266bd7cc76cfab344cfa6e1c3ae /server/sonar-web/src/main/js/apps/projectBaseline/utils.ts
parent3079907d1f13a509709c72a5dade87d129a4eb5c (diff)
downloadsonarqube-e8f1a84869bcb72af1ca30fa78b9c936a3e028a3.tar.gz
sonarqube-e8f1a84869bcb72af1ca30fa78b9c936a3e028a3.zip
Fix conflicts after rebase
Diffstat (limited to 'server/sonar-web/src/main/js/apps/projectBaseline/utils.ts')
-rw-r--r--server/sonar-web/src/main/js/apps/projectBaseline/utils.ts25
1 files changed, 20 insertions, 5 deletions
diff --git a/server/sonar-web/src/main/js/apps/projectBaseline/utils.ts b/server/sonar-web/src/main/js/apps/projectBaseline/utils.ts
index 69b7cfabda0..99ee11e50dd 100644
--- a/server/sonar-web/src/main/js/apps/projectBaseline/utils.ts
+++ b/server/sonar-web/src/main/js/apps/projectBaseline/utils.ts
@@ -48,15 +48,30 @@ export function validateSetting(state: {
currentSettingValue?: string;
days: string;
selected?: T.NewCodePeriodSettingType;
+ overrideGeneralSetting?: boolean;
}) {
- const { analysis = '', currentSetting, currentSettingValue, days, selected } = state;
+ const {
+ analysis = '',
+ currentSetting,
+ currentSettingValue,
+ days,
+ selected,
+ overrideGeneralSetting
+ } = state;
- const isChanged =
- selected !== currentSetting ||
- (selected === 'NUMBER_OF_DAYS' && days !== currentSettingValue) ||
- (selected === 'SPECIFIC_ANALYSIS' && analysis !== currentSettingValue);
+ let isChanged;
+ if (!currentSetting && overrideGeneralSetting !== undefined) {
+ isChanged = overrideGeneralSetting;
+ } else {
+ isChanged =
+ overrideGeneralSetting === false ||
+ selected !== currentSetting ||
+ (selected === 'NUMBER_OF_DAYS' && days !== currentSettingValue) ||
+ (selected === 'SPECIFIC_ANALYSIS' && analysis !== currentSettingValue);
+ }
const isValid =
+ overrideGeneralSetting === false ||
selected === 'PREVIOUS_VERSION' ||
(selected === 'SPECIFIC_ANALYSIS' && analysis.length > 0) ||
(selected === 'NUMBER_OF_DAYS' && validateDays(days));