return Controller.extend({
allFacets: ['q', 'languages', 'repositories', 'tags', 'qprofile', 'debt_characteristics', 'severities', 'statuses',
'available_since', 'inheritance', 'active_severities', 'is_template'],
- facetsFromServer: ['languages', 'repositories', 'tags'],
+ facetsFromServer: ['languages', 'repositories', 'tags', 'severities', 'statuses', 'debt_characteristics'],
pageSize: 200,
ruleFields: ['name', 'lang', 'langName', 'sysTags', 'tags', 'status'],
return BaseFacet.extend({
getValues: function () {
- var values = _.map(this.options.app.characteristics, function (value, key) {
- return {
- label: value,
- val: key
- };
+ 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');
+ }
+ return _.extend(value, { label: label });
+ });
+ },
+
+ sortValues: function (values) {
+ return _.sortBy(values, function (v) {
+ return v.val === 'NONE' ? -999999 : -v.count;
});
- return _.sortBy(values, 'label');
},
toggleFacet: function (e) {
serializeData: function () {
return _.extend(BaseFacet.prototype.serializeData.apply(this, arguments), {
- values: this.getValues()
+ values: this.sortValues(this.getValues())
});
}
});
return _.sortBy(values, function (v) {
return order.indexOf(v.val);
});
- },
-
- getValues: function () {
- return this.severities.map(function (s) {
- return { val: s };
- });
- },
-
- serializeData: function () {
- return _.extend(BaseFacet.prototype.serializeData.apply(this, arguments), {
- values: this.sortValues(this.getValues())
- });
}
});
], function (BaseFacet) {
return BaseFacet.extend({
+ statuses: ['READY', 'DEPRECATED', 'BETA'],
getValues: function () {
- return ['BETA', 'DEPRECATED', 'READY'].map(function (s) {
- return {
- label: t('rules.status', s.toLowerCase()),
- val: s
- };
+ var values = this.model.getValues();
+ var x = values.map(function (value) {
+ return _.extend(value, { label: t('rules.status', value.val.toLowerCase()) });
+ });
+ return x;
+ },
+
+ sortValues: function (values) {
+ var order = this.statuses;
+ return _.sortBy(values, function (v) {
+ return order.indexOf(v.val);
});
},
coding_rules._rules=rules
coding_rules.select_tag=Select Tag
coding_rules.show_template=Show Template
+coding_rules.noncharacterized=Noncharacterized
coding_rules.update_custom_rule=Update Custom Rule
coding_rules.update_manual_rule=Update Manual Rule