Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var KeyObjectMap = require('basis.data').KeyObjectMap;
var Split = require('basis.data.dataset').Split;
var Filter = require('basis.data.dataset').Filter;
var count = require('basis.data.index').count;
var Warning = require('type').Warning;
var fileApi = require('api').ns('file');
var warningsByType = new Split({
source: Warning.all,
rule: function(item){
return basis.path.extname(item.data.file);
}
});
var fatalWarnings = new Filter({
source: Warning.all,
rule: 'data.fatal'
});
var StatItem = Node.subclass({
fatal: false,
template: resource('./template/stat-item.tmpl'),
binding: {
fatal: 'fatal',
caption: {
events: 'update',
getter: function(node){
var title = node.caption || node.data.title;
return title ? title.replace('.', '') : 'other';
}
},
count: {
var STATE = require('basis.data').STATE;
var Value = require('basis.data').Value;
var DataObject = require('basis.data').Object;
var Node = require('basis.ui').Node;
var KeyObjectMap = require('basis.data').KeyObjectMap;
var Split = require('basis.data.dataset').Split;
var Filter = require('basis.data.dataset').Filter;
var count = require('basis.data.index').count;
var Warning = require('type').Warning;
var fileApi = require('api').ns('file');
var warningsByType = new Split({
source: Warning.all,
rule: function(item){
return basis.path.extname(item.data.file);
}
});
var fatalWarnings = new Filter({
source: Warning.all,
rule: 'data.fatal'
});
var StatItem = Node.subclass({
fatal: false,
template: resource('./template/stat-item.tmpl'),
binding: {
fatal: 'fatal',
caption: {
var count = require('basis.data.index').count;
var Warning = require('type').Warning;
module.exports = {
caption: 'Warnings',
view: resource('./view/index.js'),
template: resource('./tab.tmpl'),
binding: {
count: count(Warning.all)
}
};
dataSource: Value.query(stat, 'selection.pick()').as(function(selected){
return selected ? selected.dataset || selected.delegate : Warning.all;
}),
},
count: {
events: 'delegateChanged',
getter: function(node){
return count(node.dataset || node.delegate);
}
}
}
});
var stat = new Node({
template: resource('./template/stat.tmpl'),
binding: {
total: 'satellite:',
fatal: 'satellite:',
hasWarnings: count(Warning.all)
},
dataSource: warningsByType,
childClass: StatItem,
sorting: 'data.title',
selection: true,
satellite: {
total: {
delegate: basis.fn.$self,
instance: new StatItem({
dataset: Warning.all,
caption: 'Total'
})
},
fatal: {
existsIf: count(fatalWarnings),
delegate: basis.fn.$self,
var stat = new Node({
template: resource('./template/stat.tmpl'),
binding: {
total: 'satellite:',
fatal: 'satellite:',
hasWarnings: count(Warning.all)
},
dataSource: warningsByType,
childClass: StatItem,
sorting: 'data.title',
selection: true,
satellite: {
total: {
delegate: basis.fn.$self,
instance: new StatItem({
dataset: Warning.all,
caption: 'Total'
})
},
fatal: {
existsIf: count(fatalWarnings),
delegate: basis.fn.$self,
instance: new StatItem({
dataset: fatalWarnings,
caption: 'Fatal',
fatal: true
})
}
}
});
StatItem.prototype.contextSelection = stat.selection;
Value.query(stat, 'selection.pick()').link(stat.selection, function(selected){