How to use the type.Warning.all function in type

To help you get started, we’ve selected a few type examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github basisjs / basisjs / src / devpanel / view / warnings / view / index.js View on Github external
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: {
github basisjs / basisjs / src / devpanel / view / warnings / view / index.js View on Github external
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: {
github basisjs / basisjs / src / devpanel / view / warnings / tab.js View on Github external
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)
  }
};
github basisjs / basisjs / src / devpanel / view / warnings / view / index.js View on Github external
dataSource: Value.query(stat, 'selection.pick()').as(function(selected){
    return selected ? selected.dataset || selected.delegate : Warning.all;
  }),
github basisjs / basisjs / src / devpanel / view / warnings / view / index.js View on Github external
},
    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,
github basisjs / basisjs / src / devpanel / view / warnings / view / index.js View on Github external
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){