aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/projects/query.ts
diff options
context:
space:
mode:
authorJeremy Davis <jeremy.davis@sonarsource.com>2020-04-01 16:40:30 +0200
committersonartech <sonartech@sonarsource.com>2020-04-15 20:03:38 +0000
commitafa5ca444414f8c4352afb53528b9514d1c22c77 (patch)
tree24e34f6255bb9dc131443c7749f230fb61eaa38d /server/sonar-web/src/main/js/apps/projects/query.ts
parentf535e9b3fc11d6020a0d6143ab3931d2d5566627 (diff)
downloadsonarqube-afa5ca444414f8c4352afb53528b9514d1c22c77.tar.gz
sonarqube-afa5ca444414f8c4352afb53528b9514d1c22c77.zip
SONAR-13189 Add qualifier facet to projects
Diffstat (limited to 'server/sonar-web/src/main/js/apps/projects/query.ts')
-rw-r--r--server/sonar-web/src/main/js/apps/projects/query.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/js/apps/projects/query.ts b/server/sonar-web/src/main/js/apps/projects/query.ts
index e40e9c9af0c..727ca3439d2 100644
--- a/server/sonar-web/src/main/js/apps/projects/query.ts
+++ b/server/sonar-web/src/main/js/apps/projects/query.ts
@@ -17,6 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+import { ComponentQualifier } from '../../types/component';
import { VISUALIZATIONS } from './utils';
type Level = 'ERROR' | 'WARN' | 'OK';
@@ -38,6 +39,7 @@ export interface Query {
size?: number;
new_lines?: number;
languages?: string[];
+ qualifier?: ComponentQualifier;
tags?: string[];
search?: string;
sort?: string;
@@ -65,6 +67,7 @@ export function parseUrlQuery(urlQuery: T.RawQuery): Query {
new_lines: getAsNumericRating(urlQuery['new_lines']),
languages: getAsStringArray(urlQuery['languages']),
tags: getAsStringArray(urlQuery['tags']),
+ qualifier: getAsQualifier(urlQuery['qualifier']),
search: getAsString(urlQuery['search']),
sort: getAsString(urlQuery['sort']),
view: getView(urlQuery['view']),
@@ -106,7 +109,7 @@ export function convertToFilter(query: Query, isFavorite: boolean): string {
'new_maintainability'
].forEach(property => pushMetricToArray(query, property, conditions, convertIssuesRating));
- ['languages', 'tags'].forEach(property =>
+ ['languages', 'tags', 'qualifier'].forEach(property =>
pushMetricToArray(query, property, conditions, convertArrayMetric)
);
@@ -160,6 +163,10 @@ function getAsStringArray(value: any): string[] | undefined {
return value.split(',');
}
+function getAsQualifier(value: string | undefined): ComponentQualifier | undefined {
+ return value ? (value as ComponentQualifier) : undefined;
+}
+
function getView(value: any): string | undefined {
return typeof value !== 'string' || value === 'overall' ? undefined : value;
}
@@ -251,7 +258,8 @@ function mapPropertyToMetric(property?: string): string | undefined {
gate: 'alert_status',
languages: 'languages',
tags: 'tags',
- search: 'query'
+ search: 'query',
+ qualifier: 'qualifier'
};
return property && map[property];
}