From aa39b79abe152872df7630316cfa39bf093236e3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gr=C3=A9goire=20Aubert?= Date: Mon, 2 Oct 2017 17:19:52 +0200 Subject: [PATCH] SONAR-9545 Better wording when searching for a project in My Favorites scope --- .../apps/projects/components/AllProjects.tsx | 1 + .../components/EmptyFavoriteSearch.tsx | 42 +++++++++++++++++++ .../apps/projects/components/ProjectsList.tsx | 13 +++--- .../__snapshots__/AllProjects-test.tsx.snap | 1 + .../resources/org/sonar/l10n/core.properties | 2 + 5 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 server/sonar-web/src/main/js/apps/projects/components/EmptyFavoriteSearch.tsx diff --git a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx index d0c700dbc1b..deb67d0892e 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/AllProjects.tsx @@ -271,6 +271,7 @@ export default class AllProjects extends React.PureComponent { isFiltered={this.isFiltered()} organization={this.props.organization} projects={this.state.projects} + query={this.state.query} /> )} +

{translate('no_results_search.favorites')}

+

+ {translate('all')} + }} + /> +

+ + ); +} diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectsList.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectsList.tsx index 6636307001a..423da0dcd26 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectsList.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectsList.tsx @@ -21,8 +21,10 @@ import * as React from 'react'; import ProjectCard from './ProjectCard'; import NoFavoriteProjects from './NoFavoriteProjects'; import EmptyInstance from './EmptyInstance'; +import EmptyFavoriteSearch from './EmptyFavoriteSearch'; import EmptySearch from '../../../components/common/EmptySearch'; import { Project } from '../types'; +import { Query } from '../query'; interface Props { cardType?: string; @@ -30,17 +32,16 @@ interface Props { isFiltered: boolean; organization?: { key: string }; projects: Project[]; + query: Query; } export default class ProjectsList extends React.PureComponent { renderNoProjects() { - if (this.props.isFavorite && !this.props.isFiltered) { - return ; - } else if (!this.props.isFiltered) { - return ; - } else { - return ; + const { isFavorite, isFiltered, query } = this.props; + if (isFiltered) { + return isFavorite ? : ; } + return isFavorite ? : ; } render() { diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/AllProjects-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/AllProjects-test.tsx.snap index 2561502915e..fc7e90eddd2 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/AllProjects-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/AllProjects-test.tsx.snap @@ -91,6 +91,7 @@ exports[`renders 1`] = ` }, ] } + query={Object {}} />