aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2017-02-02 11:56:15 +0100
committerStas Vilchik <stas-vilchik@users.noreply.github.com>2017-02-02 13:32:25 +0100
commitf68400bad2fa34525a5caf62b603d2e547dd4df6 (patch)
tree86a1f272a89fc628b971762d22a512accf403cd6 /server/sonar-web/src/main/js
parent3b5e6ef0f8e19a09c4949089bacd617e98fc861e (diff)
downloadsonarqube-f68400bad2fa34525a5caf62b603d2e547dd4df6.tar.gz
sonarqube-f68400bad2fa34525a5caf62b603d2e547dd4df6.zip
display organizations in projects facet on issues page
Diffstat (limited to 'server/sonar-web/src/main/js')
-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>