From 4ac88f47bbc707c5bfcffefaa2cde5dded30b9ca Mon Sep 17 00:00:00 2001 From: Grégoire Aubert Date: Wed, 18 Jul 2018 11:46:04 +0200 Subject: SONARCLOUD-77 Display correct empty project page --- server/sonar-web/src/main/js/apps/projects/query.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'server/sonar-web/src/main/js/apps/projects/query.ts') 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 54cb473e714..ebe03ae2677 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. */ +/* eslint-disable camelcase */ import { VISUALIZATIONS } from './utils'; import { RawQuery } from '../../helpers/query'; @@ -112,6 +113,20 @@ export function convertToFilter(query: Query, isFavorite: boolean): string { return conditions.join(' and '); } +const visualizationParams = ['sort', 'view', 'visualization']; + +export function hasFilterParams(query: Query) { + return Object.keys(query) + .filter(key => !visualizationParams.includes(key)) + .some(key => query[key] !== undefined); +} + +export function hasVisualizationParams(query: Query) { + return Object.keys(query) + .filter(key => visualizationParams.includes(key)) + .some(key => query[key] !== undefined); +} + function getAsNumericRating(value: any): number | undefined { if (value === '' || value == null || isNaN(value)) { return undefined; -- cgit v1.2.3