Loading lib/jsduck/stats.rb +21 −2 Original line number Diff line number Diff line Loading @@ -8,17 +8,36 @@ module JsDuck @classes = classes classes.map do |cls| local_members = cls.all_local_members total_members = cls.all_members { :name => cls[:name], :members => cls.all_members.length, :localMembers => cls.all_local_members.length, :local_cfgs => member_count(local_members, :cfg), :local_properties => member_count(local_members, :property), :local_methods => member_count(local_members, :method), :local_events => member_count(local_members, :event), :local_members => local_members.length, :total_cfgs => member_count(total_members, :cfg), :total_properties => member_count(total_members, :property), :total_methods => member_count(total_members, :method), :total_events => member_count(total_members, :event), :total_members => total_members.length, :fanIn => fan_in(cls), :fanOut => fan_out(cls), :wordCount => class_wc(cls), } end end def member_count(members, type) members.find_all {|m| m[:tagname] == type }.length end # How many classes depend on this class def fan_in(cls) fan_in_table[cls[:name]] || 0 Loading template/app/model/Stats.js +13 −2 Original line number Diff line number Diff line Loading @@ -5,8 +5,19 @@ Ext.define('Docs.model.Stats', { extend: 'Ext.data.Model', fields: [ 'name', 'members', 'localMembers', 'local_cfgs', 'local_properties', 'local_methods', 'local_events', 'local_members', 'total_cfgs', 'total_properties', 'total_methods', 'total_events', 'total_members', 'fanIn', 'fanOut', 'wordCount' Loading template/app/view/stats/Index.js +72 −10 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ Ext.define('Docs.view.stats.Index', { data: Docs.data.stats, sorters: "name" }); Ext.QuickTips.init(); this.items = [{ xtype: 'grid', store: store, Loading @@ -27,29 +27,91 @@ Ext.define('Docs.view.stats.Index', { width: 200, dataIndex: 'name' }, { text: 'Configs', width: 50, align: 'right', dataIndex: 'local_cfgs' }, { text: 'Props', width: 50, align: 'right', dataIndex: 'local_properties' }, { text: 'Methods', width: 50, align: 'right', dataIndex: 'local_methods' }, { text: 'Events', width: 50, align: 'right', dataIndex: 'local_events' }, { text: 'Members', width: 70, dataIndex: 'members' width: 50, align: 'right', dataIndex: 'local_members', renderer: function(v) { return "<b>"+v+"</b>"; } }, { text: 'All Configs', width: 50, align: 'right', dataIndex: 'total_cfgs' }, { text: 'All Props', width: 50, align: 'right', dataIndex: 'total_properties' }, { text: 'Local members', width: 100, dataIndex: 'localMembers' text: 'All Methods', width: 50, align: 'right', dataIndex: 'total_methods' }, { text: 'All Events', width: 50, align: 'right', dataIndex: 'total_events' }, { text: 'All Members', width: 50, align: 'right', dataIndex: 'total_members', renderer: function(v) { return "<b>"+v+"</b>"; } }, { text: 'Fan-in', width: 70, width: 50, align: 'right', dataIndex: 'fanIn' }, { text: 'Fan-out', width: 70, width: 50, align: 'right', dataIndex: 'fanOut' }, { text: 'Words in docs', flex: 1, text: 'Word count', width: 70, align: 'right', dataIndex: 'wordCount' } ] Loading Loading
lib/jsduck/stats.rb +21 −2 Original line number Diff line number Diff line Loading @@ -8,17 +8,36 @@ module JsDuck @classes = classes classes.map do |cls| local_members = cls.all_local_members total_members = cls.all_members { :name => cls[:name], :members => cls.all_members.length, :localMembers => cls.all_local_members.length, :local_cfgs => member_count(local_members, :cfg), :local_properties => member_count(local_members, :property), :local_methods => member_count(local_members, :method), :local_events => member_count(local_members, :event), :local_members => local_members.length, :total_cfgs => member_count(total_members, :cfg), :total_properties => member_count(total_members, :property), :total_methods => member_count(total_members, :method), :total_events => member_count(total_members, :event), :total_members => total_members.length, :fanIn => fan_in(cls), :fanOut => fan_out(cls), :wordCount => class_wc(cls), } end end def member_count(members, type) members.find_all {|m| m[:tagname] == type }.length end # How many classes depend on this class def fan_in(cls) fan_in_table[cls[:name]] || 0 Loading
template/app/model/Stats.js +13 −2 Original line number Diff line number Diff line Loading @@ -5,8 +5,19 @@ Ext.define('Docs.model.Stats', { extend: 'Ext.data.Model', fields: [ 'name', 'members', 'localMembers', 'local_cfgs', 'local_properties', 'local_methods', 'local_events', 'local_members', 'total_cfgs', 'total_properties', 'total_methods', 'total_events', 'total_members', 'fanIn', 'fanOut', 'wordCount' Loading
template/app/view/stats/Index.js +72 −10 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ Ext.define('Docs.view.stats.Index', { data: Docs.data.stats, sorters: "name" }); Ext.QuickTips.init(); this.items = [{ xtype: 'grid', store: store, Loading @@ -27,29 +27,91 @@ Ext.define('Docs.view.stats.Index', { width: 200, dataIndex: 'name' }, { text: 'Configs', width: 50, align: 'right', dataIndex: 'local_cfgs' }, { text: 'Props', width: 50, align: 'right', dataIndex: 'local_properties' }, { text: 'Methods', width: 50, align: 'right', dataIndex: 'local_methods' }, { text: 'Events', width: 50, align: 'right', dataIndex: 'local_events' }, { text: 'Members', width: 70, dataIndex: 'members' width: 50, align: 'right', dataIndex: 'local_members', renderer: function(v) { return "<b>"+v+"</b>"; } }, { text: 'All Configs', width: 50, align: 'right', dataIndex: 'total_cfgs' }, { text: 'All Props', width: 50, align: 'right', dataIndex: 'total_properties' }, { text: 'Local members', width: 100, dataIndex: 'localMembers' text: 'All Methods', width: 50, align: 'right', dataIndex: 'total_methods' }, { text: 'All Events', width: 50, align: 'right', dataIndex: 'total_events' }, { text: 'All Members', width: 50, align: 'right', dataIndex: 'total_members', renderer: function(v) { return "<b>"+v+"</b>"; } }, { text: 'Fan-in', width: 70, width: 50, align: 'right', dataIndex: 'fanIn' }, { text: 'Fan-out', width: 70, width: 50, align: 'right', dataIndex: 'fanOut' }, { text: 'Words in docs', flex: 1, text: 'Word count', width: 70, align: 'right', dataIndex: 'wordCount' } ] Loading