From f68400bad2fa34525a5caf62b603d2e547dd4df6 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Thu, 2 Feb 2017 11:56:15 +0100 Subject: [PATCH] display organizations in projects facet on issues page --- .../main/js/apps/issues/facets/project-facet.js | 8 ++++++++ .../templates/facets/issues-projects-facet.hbs | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 server/sonar-web/src/main/js/apps/issues/templates/facets/issues-projects-facet.hbs diff --git a/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js b/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js index da323213530..c5eaa70356a 100644 --- a/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js +++ b/server/sonar-web/src/main/js/apps/issues/facets/project-facet.js @@ -18,9 +18,12 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import CustomValuesFacet from './custom-values-facet'; +import Template from '../templates/facets/issues-projects-facet.hbs'; import { translate, translateWithParameters } from '../../../helpers/l10n'; +import { areThereCustomOrganizations, getOrganization } from '../../../store/organizations/utils'; export default CustomValuesFacet.extend({ + template: Template, getUrl () { return window.baseUrl + '/api/components/search'; @@ -80,16 +83,21 @@ export default CustomValuesFacet.extend({ getValuesWithLabels () { const values = this.model.getValues(); const projects = this.options.app.facets.components; + const displayOrganizations = areThereCustomOrganizations(); values.forEach(v => { const uuid = v.val; let label = ''; + let organization = null; if (uuid) { const project = projects.find(p => p.uuid === uuid); if (project != null) { label = project.longName; + organization = displayOrganizations && project.organization ? + getOrganization(project.organization) : null; } } v.label = label; + v.organization = organization; }); return values; }, diff --git a/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-projects-facet.hbs b/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-projects-facet.hbs new file mode 100644 index 00000000000..7693af65549 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/issues/templates/facets/issues-projects-facet.hbs @@ -0,0 +1,16 @@ +{{> "_issues-facet-header"}} + +
+ {{#each values}} + + {{#if organization}}{{organization.name}}{{/if}}{{default label val}} + + {{#eq ../state.facetMode 'count'}}{{numberShort count}}{{else}}{{formatMeasure count 'SHORT_WORK_DUR'}}{{/eq}} + + + {{/each}} + +
+ +
+
-- 2.39.5