diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2015-01-21 11:07:57 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2015-01-21 12:03:30 +0100 |
commit | f22b8c87b9a9efde595691c6e5879c4c5b1dc3a6 (patch) | |
tree | e006aa42f56841fb7c9df6432e391cd68e8f115e /server/sonar-web/src/main/js/coding-rules | |
parent | e8f492a694c6868128d84d4a75f56f4e8cac0224 (diff) | |
download | sonarqube-f22b8c87b9a9efde595691c6e5879c4c5b1dc3a6.tar.gz sonarqube-f22b8c87b9a9efde595691c6e5879c4c5b1dc3a6.zip |
fix SONAR-5820/SONAR-6019 fix characteristic facet
Diffstat (limited to 'server/sonar-web/src/main/js/coding-rules')
4 files changed, 23 insertions, 23 deletions
diff --git a/server/sonar-web/src/main/js/coding-rules/app.js b/server/sonar-web/src/main/js/coding-rules/app.js index cbf845d6410..b467dbaadb7 100644 --- a/server/sonar-web/src/main/js/coding-rules/app.js +++ b/server/sonar-web/src/main/js/coding-rules/app.js @@ -93,8 +93,14 @@ requirejs([ }; }; - App.getSubCharacteristicName = function (name) { - return (App.characteristics[name] || '').replace(': ', ' > '); + App.getSubCharacteristicName = function (key) { + if (key != null) { + var ch = _.findWhere(App.characteristics, { key: key }), + parent = _.findWhere(App.characteristics, { key: ch.parent }); + return [parent.name, ch.name].join(' > '); + } else { + return null; + } }; var appXHR = $.get(baseUrl + '/api/rules/app').done(function(r) { diff --git a/server/sonar-web/src/main/js/coding-rules/facets/characteristic-facet.js b/server/sonar-web/src/main/js/coding-rules/facets/characteristic-facet.js index 256db1fa3d8..359131f5f04 100644 --- a/server/sonar-web/src/main/js/coding-rules/facets/characteristic-facet.js +++ b/server/sonar-web/src/main/js/coding-rules/facets/characteristic-facet.js @@ -1,20 +1,20 @@ define([ - 'coding-rules/facets/base-facet' + 'coding-rules/facets/base-facet' ], function (BaseFacet) { - var $ = jQuery; - return BaseFacet.extend({ getValues: function () { var values = this.model.getValues(), characteristics = this.options.app.characteristics; return values.map(function (value) { - var label = characteristics[value.val]; - if (value.val === 'NONE') { - label = t('coding_rules.noncharacterized'); + var ch = _.findWhere(characteristics, { key: value.val }); + if (ch != null) { + _.extend(value, ch, { label: ch.name }); + } else { + _.extend(value, { label: t('coding_rules.noncharacterized') }); } - return _.extend(value, { label: label }); + return value; }); }, @@ -24,17 +24,6 @@ define([ }); }, - toggleFacet: function (e) { - var obj = {}, - property = this.model.get('property'); - if ($(e.currentTarget).is('.active')) { - obj[property] = null; - } else { - obj[property] = $(e.currentTarget).data('value'); - } - this.options.app.state.updateFilter(obj); - }, - serializeData: function () { return _.extend(BaseFacet.prototype.serializeData.apply(this, arguments), { values: this.sortValues(this.getValues()) diff --git a/server/sonar-web/src/main/js/coding-rules/rule-details-view.js b/server/sonar-web/src/main/js/coding-rules/rule-details-view.js index 95475fe7b5a..c6c6d75cb64 100644 --- a/server/sonar-web/src/main/js/coding-rules/rule-details-view.js +++ b/server/sonar-web/src/main/js/coding-rules/rule-details-view.js @@ -171,7 +171,6 @@ define([ isEditable: isEditable, canWrite: this.options.app.canWrite, qualityProfilesVisible: qualityProfilesVisible, - subCharacteristic: this.options.app.getSubCharacteristicName(this.model.get('debtSubChar')), allTags: _.union(this.model.get('sysTags'), this.model.get('tags')) }); } diff --git a/server/sonar-web/src/main/js/coding-rules/show-app.js b/server/sonar-web/src/main/js/coding-rules/show-app.js index 3e815a93f26..1505c23ec51 100644 --- a/server/sonar-web/src/main/js/coding-rules/show-app.js +++ b/server/sonar-web/src/main/js/coding-rules/show-app.js @@ -42,8 +42,14 @@ requirejs([ }; }; - App.getSubCharacteristicName = function (name) { - return (App.characteristics[name] || '').replace(': ', ' > '); + App.getSubCharacteristicName = function (key) { + if (key != null) { + var ch = _.findWhere(App.characteristics, { key: key }), + parent = _.findWhere(App.characteristics, { key: ch.parent }); + return [parent.name, ch.name].join(' > '); + } else { + return null; + } }; var appXHR = $.get(baseUrl + '/api/rules/app').done(function(r) { |