aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/tutorials/utils.ts
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2018-07-26 11:44:57 +0200
committerSonarTech <sonartech@sonarsource.com>2018-08-10 20:21:30 +0200
commit4f5f81d6c146d6cc873239258343141e9631c9b6 (patch)
treecbfc4686ececf2c9308ad3f5ece645c5fc0945cd /server/sonar-web/src/main/js/apps/tutorials/utils.ts
parent75f56b1e0ce0d59f9bdb039b41563c1994488775 (diff)
downloadsonarqube-4f5f81d6c146d6cc873239258343141e9631c9b6.tar.gz
sonarqube-4f5f81d6c146d6cc873239258343141e9631c9b6.zip
SONAR-11029 Move the tutorial inside provisioned projects dashboard
* Move/Rename files of tutorials folder * SONAR-11049 Update tutorial UI and move it inside the project dashboard * SONAR-11050 Update tutorial to skip now useless steps * Remove unused style * SONAR-11030 Make dashboard tutorial work with already known project key * Better manage error messages when no analysis and analyzed branches * SONAR-11052 Refresh project status as long as there is no analysis * SONAR-11051 Add infos suggestions depending on the ALM of the project * Do no display tutorial when there is analyses in the pipe
Diffstat (limited to 'server/sonar-web/src/main/js/apps/tutorials/utils.ts')
-rw-r--r--server/sonar-web/src/main/js/apps/tutorials/utils.ts40
1 files changed, 40 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/apps/tutorials/utils.ts b/server/sonar-web/src/main/js/apps/tutorials/utils.ts
new file mode 100644
index 00000000000..f84785ef61d
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/tutorials/utils.ts
@@ -0,0 +1,40 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2018 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 interface LanguageConfig {
+ language?: string;
+ javaBuild?: string;
+ cFamilyCompiler?: string;
+ os?: string;
+ projectKey?: string;
+}
+
+export function isLanguageConfigured(config?: LanguageConfig) {
+ if (!config) {
+ return false;
+ }
+ const { language, javaBuild, cFamilyCompiler, os, projectKey } = config;
+ const isJavaConfigured = language === 'java' && javaBuild != null;
+ const isDotNetConfigured = language === 'dotnet' && projectKey != null;
+ const isCFamilyConfigured =
+ language === 'c-family' && (cFamilyCompiler === 'msvc' || os != null) && projectKey != null;
+ const isOtherConfigured = language === 'other' && projectKey != null;
+
+ return isJavaConfigured || isDotNetConfigured || isCFamilyConfigured || isOtherConfigured;
+}