aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/apps')
-rw-r--r--server/sonar-web/src/main/js/apps/issues/facets/project-facet.js8
-rw-r--r--server/sonar-web/src/main/js/apps/issues/templates/facets/issues-projects-facet.hbs16
2 files changed, 24 insertions, 0 deletions
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"}}
+
+<div class="search-navigator-facet-list">
+ {{#each values}}
+ <a class="facet search-navigator-facet js-facet" data-value="{{val}}" title="{{#if extra}}({{extra}}) {{/if}}{{default label val}}">
+ <span class="facet-name">{{#if organization}}{{organization.name}}<span class="slash-separator"></span>{{/if}}{{default label val}}</span>
+ <span class="facet-stat">
+ {{#eq ../state.facetMode 'count'}}{{numberShort count}}{{else}}{{formatMeasure count 'SHORT_WORK_DUR'}}{{/eq}}
+ </span>
+ </a>
+ {{/each}}
+
+ <div class="search-navigator-facet-custom-value">
+ <input type="hidden" class="js-custom-value">
+ </div>
+</div>