App.addInitializer ->
- $.get RESOURCES_URL, resource: window.resourceKey, metrics: 'dsm', (rawData) ->
+ packageTangles = {}
+
+ packageTanglesXHR = $.get RESOURCES_URL, resource: window.resourceKey, depth: 1, metrics: 'package_tangles', (data) ->
+ data.forEach (component) ->
+ packageTangles[component.id] = component.msr[0].frmt_val
+
+ dsmXHR = $.get RESOURCES_URL, resource: window.resourceKey, metrics: 'dsm'
+
+ $.when(packageTanglesXHR, dsmXHR).done ->
+ rawData = dsmXHR.responseJSON
data = JSON.parse rawData[0].msr[0].data
data.forEach (row, rowIndex) ->
row.v.forEach (cell, columnIndex) ->
cell.status = 'cycle'
else
cell.status = 'dependency'
- @view = new DesignView app: @, collection: new Backbone.Collection data
+ collection = new Backbone.Collection data
+ collection.forEach (model) ->
+ model.set 'pt', packageTangles[model.get 'i']
+ @view = new DesignView app: @, collection: collection
$('#project-design').empty().append @view.render().el
<tr>
<td class="dsm-body-title" title="{{t 'design.rowTooltip'}}">
{{qualifierIcon q}} {{n}}
+ {{#gt pt 0}}
+ <span class="dsm-body-title-package-tangles" title="{{t 'metric.package_cycles.name'}}">{{pt}}</span>
+ {{/gt}}
<span class="dsm-body-title-indicator"></span>
</td>
{{#eachIndex v}}
return v1 != v2 ? options.fn(this) : options.inverse(this);
});
+ Handlebars.registerHelper('gt', function(v1, v2, options) {
+ return v1 > v2 ? options.fn(this) : options.inverse(this);
+ });
+
Handlebars.registerHelper('notNull', function(value, options) {
return value != null ? options.fn(this) : options.inverse(this);
});