~ubuntuone-pqm-team/yui/stable-min

« back to all changes in this revision

Viewing changes to build/console-filters/console-filters-debug.js

  • Committer: Ricardo Kirkner
  • Date: 2014-09-23 20:17:06 UTC
  • Revision ID: ricardo.kirkner@canonical.com-20140923201706-17kwxwckw6orp28k
re-added all .js files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
YUI.add('console-filters', function (Y, NAME) {
 
2
 
 
3
/**
 
4
 * <p>Provides Plugin.ConsoleFilters plugin class.</p>
 
5
 *
 
6
 * <p>This plugin adds the ability to control which Console entries display by filtering on category and source. Two groups of checkboxes are added to the Console footer, one for categories and the other for sources.  Only those messages that match a checked category or source are displayed.</p>
 
7
 *
 
8
 * @module console-filters
 
9
 * @namespace Plugin
 
10
 * @class ConsoleFilters
 
11
 */
 
12
 
 
13
// Some common strings and functions
 
14
var getCN = Y.ClassNameManager.getClassName,
 
15
    CONSOLE = 'console',
 
16
    FILTERS = 'filters',
 
17
    FILTER  = 'filter',
 
18
    CATEGORY = 'category',
 
19
    SOURCE   = 'source',
 
20
    CATEGORY_DOT = 'category.',
 
21
    SOURCE_DOT   = 'source.',
 
22
 
 
23
    HOST     = 'host',
 
24
    CHECKED  = 'checked',
 
25
    DEF_VISIBILITY = 'defaultVisibility',
 
26
 
 
27
    DOT = '.',
 
28
    EMPTY   = '',
 
29
 
 
30
    C_BODY       = DOT + Y.Console.CHROME_CLASSES.console_bd_class,
 
31
    C_FOOT       = DOT + Y.Console.CHROME_CLASSES.console_ft_class,
 
32
 
 
33
    SEL_CHECK    = 'input[type=checkbox].',
 
34
 
 
35
    isString = Y.Lang.isString;
 
36
 
 
37
function ConsoleFilters() {
 
38
    ConsoleFilters.superclass.constructor.apply(this,arguments);
 
39
}
 
40
 
 
41
Y.namespace('Plugin').ConsoleFilters = Y.extend(ConsoleFilters, Y.Plugin.Base,
 
42
 
 
43
// Y.Plugin.ConsoleFilters prototype
 
44
{
 
45
    /**
 
46
     * Collection of all log messages passed through since the plugin's
 
47
     * instantiation.  This holds all messages regardless of filter status.
 
48
     * Used as a single source of truth for repopulating the Console body when
 
49
     * filters are changed.
 
50
     *
 
51
     * @property _entries
 
52
     * @type Array
 
53
     * @protected
 
54
     */
 
55
    _entries : null,
 
56
 
 
57
    /**
 
58
     * Maximum number of entries to store in the message cache.
 
59
     *
 
60
     * @property _cacheLimit
 
61
     * @type {Number}
 
62
     * @default Infinity
 
63
     * @protected
 
64
     */
 
65
    _cacheLimit : Number.POSITIVE_INFINITY,
 
66
 
 
67
    /**
 
68
     * The container node created to house the category filters.
 
69
     *
 
70
     * @property _categories
 
71
     * @type Node
 
72
     * @protected
 
73
     */
 
74
    _categories : null,
 
75
 
 
76
    /**
 
77
     * The container node created to house the source filters.
 
78
     *
 
79
     * @property _sources
 
80
     * @type Node
 
81
     * @protected
 
82
     */
 
83
    _sources : null,
 
84
 
 
85
    /**
 
86
     * Initialize entries collection and attach listeners to host events and
 
87
     * methods.
 
88
     *
 
89
     * @method initializer
 
90
     * @protected
 
91
     */
 
92
    initializer : function () {
 
93
        this._entries = [];
 
94
 
 
95
        this.get(HOST).on("entry", this._onEntry, this);
 
96
 
 
97
        this.doAfter("renderUI", this.renderUI);
 
98
        this.doAfter("syncUI", this.syncUI);
 
99
        this.doAfter("bindUI", this.bindUI);
 
100
 
 
101
        this.doAfter("clearConsole", this._afterClearConsole);
 
102
 
 
103
        if (this.get(HOST).get('rendered')) {
 
104
            this.renderUI();
 
105
            this.syncUI();
 
106
            this.bindUI();
 
107
        }
 
108
 
 
109
        this.after("cacheLimitChange", this._afterCacheLimitChange);
 
110
    },
 
111
 
 
112
    /**
 
113
     * Removes the plugin UI and unwires events.
 
114
     *
 
115
     * @method destructor
 
116
     * @protected
 
117
     */
 
118
    destructor : function () {
 
119
        //TODO: grab last {consoleLimit} entries and update the console with
 
120
        //them (no filtering)
 
121
        this._entries = [];
 
122
 
 
123
        if (this._categories) {
 
124
            this._categories.remove();
 
125
        }
 
126
        if (this._sources) {
 
127
            this._sources.remove();
 
128
        }
 
129
    },
 
130
 
 
131
    /**
 
132
     * Adds the category and source filter sections to the Console footer.
 
133
     *
 
134
     * @method renderUI
 
135
     * @protected
 
136
     */
 
137
    renderUI : function () {
 
138
        var foot = this.get(HOST).get('contentBox').one(C_FOOT),
 
139
            html;
 
140
 
 
141
        if (foot) {
 
142
            html = Y.Lang.sub(
 
143
                        ConsoleFilters.CATEGORIES_TEMPLATE,
 
144
                        ConsoleFilters.CHROME_CLASSES);
 
145
 
 
146
            this._categories = foot.appendChild(Y.Node.create(html));
 
147
 
 
148
            html = Y.Lang.sub(
 
149
                        ConsoleFilters.SOURCES_TEMPLATE,
 
150
                        ConsoleFilters.CHROME_CLASSES);
 
151
 
 
152
            this._sources = foot.appendChild(Y.Node.create(html));
 
153
        }
 
154
    },
 
155
 
 
156
    /**
 
157
     * Binds to checkbox click events and internal attribute change events to
 
158
     * maintain the UI state.
 
159
     *
 
160
     * @method bindUI
 
161
     * @protected
 
162
     */
 
163
    bindUI : function () {
 
164
        this._categories.on('click', Y.bind(this._onCategoryCheckboxClick, this));
 
165
 
 
166
        this._sources.on('click', Y.bind(this._onSourceCheckboxClick, this));
 
167
 
 
168
        this.after('categoryChange',this._afterCategoryChange);
 
169
        this.after('sourceChange',  this._afterSourceChange);
 
170
    },
 
171
 
 
172
    /**
 
173
     * Updates the UI to be in accordance with the current state of the plugin.
 
174
     *
 
175
     * @method syncUI
 
176
     */
 
177
    syncUI : function () {
 
178
        Y.each(this.get(CATEGORY), function (v, k) {
 
179
            this._uiSetCheckbox(CATEGORY, k, v);
 
180
        }, this);
 
181
 
 
182
        Y.each(this.get(SOURCE), function (v, k) {
 
183
            this._uiSetCheckbox(SOURCE, k, v);
 
184
        }, this);
 
185
 
 
186
        this.refreshConsole();
 
187
    },
 
188
 
 
189
    /**
 
190
     * Ensures a filter is set up for any new categories or sources and
 
191
     * collects the messages in _entries.  If the message is stamped with a
 
192
     * category or source that is currently being filtered out, the message
 
193
     * will not pass to the Console's print buffer.
 
194
     *
 
195
     * @method _onEntry
 
196
     * @param e {Event} the custom event object
 
197
     * @protected
 
198
     */
 
199
    _onEntry : function (e) {
 
200
        this._entries.push(e.message);
 
201
 
 
202
        var cat = CATEGORY_DOT + e.message.category,
 
203
            src = SOURCE_DOT + e.message.source,
 
204
            cat_filter = this.get(cat),
 
205
            src_filter = this.get(src),
 
206
            overLimit  = this._entries.length - this._cacheLimit,
 
207
            visible;
 
208
 
 
209
        if (overLimit > 0) {
 
210
            this._entries.splice(0, overLimit);
 
211
        }
 
212
 
 
213
        if (cat_filter === undefined) {
 
214
            visible = this.get(DEF_VISIBILITY);
 
215
            this.set(cat, visible);
 
216
            cat_filter = visible;
 
217
        }
 
218
 
 
219
        if (src_filter === undefined) {
 
220
            visible = this.get(DEF_VISIBILITY);
 
221
            this.set(src, visible);
 
222
            src_filter = visible;
 
223
        }
 
224
 
 
225
        if (!cat_filter || !src_filter) {
 
226
            e.preventDefault();
 
227
        }
 
228
    },
 
229
 
 
230
    /**
 
231
     * Flushes the cached entries after a call to the Console's clearConsole().
 
232
     *
 
233
     * @method _afterClearConsole
 
234
     * @protected
 
235
     */
 
236
    _afterClearConsole : function () {
 
237
        this._entries = [];
 
238
    },
 
239
 
 
240
    /**
 
241
     * Triggers the Console to update if a known category filter
 
242
     * changes value (e.g. visible => hidden).  Updates the appropriate
 
243
     * checkbox's checked state if necessary.
 
244
     *
 
245
     * @method _afterCategoryChange
 
246
     * @param e {Event} the attribute change event object
 
247
     * @protected
 
248
     */
 
249
    _afterCategoryChange : function (e) {
 
250
        var cat    = e.subAttrName.replace(/category\./, EMPTY),
 
251
            before = e.prevVal,
 
252
            after  = e.newVal;
 
253
 
 
254
        // Don't update the console for new categories
 
255
        if (!cat || before[cat] !== undefined) {
 
256
            this.refreshConsole();
 
257
 
 
258
            this._filterBuffer();
 
259
        }
 
260
 
 
261
        if (cat && !e.fromUI) {
 
262
            this._uiSetCheckbox(CATEGORY, cat, after[cat]);
 
263
        }
 
264
    },
 
265
 
 
266
    /**
 
267
     * Triggers the Console to update if a known source filter
 
268
     * changes value (e.g. visible => hidden).  Updates the appropriate
 
269
     * checkbox's checked state if necessary.
 
270
     *
 
271
     * @method _afterSourceChange
 
272
     * @param e {Event} the attribute change event object
 
273
     * @protected
 
274
     */
 
275
    _afterSourceChange : function (e) {
 
276
        var src     = e.subAttrName.replace(/source\./, EMPTY),
 
277
            before = e.prevVal,
 
278
            after  = e.newVal;
 
279
 
 
280
        // Don't update the console for new sources
 
281
        if (!src || before[src] !== undefined) {
 
282
            this.refreshConsole();
 
283
 
 
284
            this._filterBuffer();
 
285
        }
 
286
 
 
287
        if (src && !e.fromUI) {
 
288
            this._uiSetCheckbox(SOURCE, src, after[src]);
 
289
        }
 
290
    },
 
291
 
 
292
    /**
 
293
     * Flushes the Console's print buffer of any entries that have a category
 
294
     * or source that is currently being excluded.
 
295
     *
 
296
     * @method _filterBuffer
 
297
     * @protected
 
298
     */
 
299
    _filterBuffer : function () {
 
300
        var cats = this.get(CATEGORY),
 
301
            srcs = this.get(SOURCE),
 
302
            buffer = this.get(HOST).buffer,
 
303
            start = null,
 
304
            i;
 
305
 
 
306
        for (i = buffer.length - 1; i >= 0; --i) {
 
307
            if (!cats[buffer[i].category] || !srcs[buffer[i].source]) {
 
308
                start = start || i;
 
309
            } else if (start) {
 
310
                buffer.splice(i,(start - i));
 
311
                start = null;
 
312
            }
 
313
        }
 
314
        if (start) {
 
315
            buffer.splice(0,start + 1);
 
316
        }
 
317
    },
 
318
 
 
319
    /**
 
320
     * Trims the cache of entries to the appropriate new length.
 
321
     *
 
322
     * @method _afterCacheLimitChange
 
323
     * @param e {Event} the attribute change event object
 
324
     * @protected
 
325
     */
 
326
    _afterCacheLimitChange : function (e) {
 
327
        if (isFinite(e.newVal)) {
 
328
            var delta = this._entries.length - e.newVal;
 
329
 
 
330
            if (delta > 0) {
 
331
                this._entries.splice(0,delta);
 
332
            }
 
333
        }
 
334
    },
 
335
 
 
336
    /**
 
337
     * Repopulates the Console with entries appropriate to the current filter
 
338
     * settings.
 
339
     *
 
340
     * @method refreshConsole
 
341
     */
 
342
    refreshConsole : function () {
 
343
        var entries   = this._entries,
 
344
            host      = this.get(HOST),
 
345
            body      = host.get('contentBox').one(C_BODY),
 
346
            remaining = host.get('consoleLimit'),
 
347
            cats      = this.get(CATEGORY),
 
348
            srcs      = this.get(SOURCE),
 
349
            buffer    = [],
 
350
            i,e;
 
351
 
 
352
        if (body) {
 
353
            host._cancelPrintLoop();
 
354
 
 
355
            // Evaluate all entries from latest to oldest
 
356
            for (i = entries.length - 1; i >= 0 && remaining >= 0; --i) {
 
357
                e = entries[i];
 
358
                if (cats[e.category] && srcs[e.source]) {
 
359
                    buffer.unshift(e);
 
360
                    --remaining;
 
361
                }
 
362
            }
 
363
 
 
364
            body.setHTML(EMPTY);
 
365
            host.buffer = buffer;
 
366
            host.printBuffer();
 
367
        }
 
368
    },
 
369
 
 
370
    /**
 
371
     * Updates the checked property of a filter checkbox of the specified type.
 
372
     * If no checkbox is found for the input params, one is created.
 
373
     *
 
374
     * @method _uiSetCheckbox
 
375
     * @param type {String} 'category' or 'source'
 
376
     * @param item {String} the name of the filter (e.g. 'info', 'event')
 
377
     * @param checked {Boolean} value to set the checkbox's checked property
 
378
     * @protected
 
379
     */
 
380
    _uiSetCheckbox : function (type, item, checked) {
 
381
        if (type && item) {
 
382
            var container = type === CATEGORY ?
 
383
                                this._categories :
 
384
                                this._sources,
 
385
                sel      = SEL_CHECK + getCN(CONSOLE,FILTER,item),
 
386
                checkbox = container.one(sel),
 
387
                host;
 
388
 
 
389
            if (!checkbox) {
 
390
                host = this.get(HOST);
 
391
 
 
392
                this._createCheckbox(container, item);
 
393
 
 
394
                checkbox = container.one(sel);
 
395
 
 
396
                host._uiSetHeight(host.get('height'));
 
397
            }
 
398
 
 
399
            checkbox.set(CHECKED, checked);
 
400
        }
 
401
    },
 
402
 
 
403
    /**
 
404
     * Passes checkbox clicks on to the category attribute.
 
405
     *
 
406
     * @method _onCategoryCheckboxClick
 
407
     * @param e {Event} the DOM event
 
408
     * @protected
 
409
     */
 
410
    _onCategoryCheckboxClick : function (e) {
 
411
        var t = e.target, cat;
 
412
 
 
413
        if (t.hasClass(ConsoleFilters.CHROME_CLASSES.filter)) {
 
414
            cat = t.get('value');
 
415
            if (cat && cat in this.get(CATEGORY)) {
 
416
                this.set(CATEGORY_DOT + cat, t.get(CHECKED), { fromUI: true });
 
417
            }
 
418
        }
 
419
    },
 
420
 
 
421
    /**
 
422
     * Passes checkbox clicks on to the source attribute.
 
423
     *
 
424
     * @method _onSourceCheckboxClick
 
425
     * @param e {Event} the DOM event
 
426
     * @protected
 
427
     */
 
428
    _onSourceCheckboxClick : function (e) {
 
429
        var t = e.target, src;
 
430
 
 
431
        if (t.hasClass(ConsoleFilters.CHROME_CLASSES.filter)) {
 
432
            src = t.get('value');
 
433
            if (src && src in this.get(SOURCE)) {
 
434
                this.set(SOURCE_DOT + src, t.get(CHECKED), { fromUI: true });
 
435
            }
 
436
        }
 
437
    },
 
438
 
 
439
    /**
 
440
     * Hides any number of categories from the UI.  Convenience method for
 
441
     * myConsole.filter.set('category.foo', false); set('category.bar', false);
 
442
     * and so on.
 
443
     *
 
444
     * @method hideCategory
 
445
     * @param cat* {String} 1..n categories to filter out of the UI
 
446
     */
 
447
    hideCategory : function (cat, multiple) {
 
448
        if (isString(multiple)) {
 
449
            Y.Array.each(arguments, this.hideCategory, this);
 
450
        } else {
 
451
            this.set(CATEGORY_DOT + cat, false);
 
452
        }
 
453
    },
 
454
 
 
455
    /**
 
456
     * Shows any number of categories in the UI.  Convenience method for
 
457
     * myConsole.filter.set('category.foo', true); set('category.bar', true);
 
458
     * and so on.
 
459
     *
 
460
     * @method showCategory
 
461
     * @param cat* {String} 1..n categories to allow to display in the UI
 
462
     */
 
463
    showCategory : function (cat, multiple) {
 
464
        if (isString(multiple)) {
 
465
            Y.Array.each(arguments, this.showCategory, this);
 
466
        } else {
 
467
            this.set(CATEGORY_DOT + cat, true);
 
468
        }
 
469
    },
 
470
 
 
471
    /**
 
472
     * Hides any number of sources from the UI.  Convenience method for
 
473
     * myConsole.filter.set('source.foo', false); set('source.bar', false);
 
474
     * and so on.
 
475
     *
 
476
     * @method hideSource
 
477
     * @param src* {String} 1..n sources to filter out of the UI
 
478
     */
 
479
    hideSource : function (src, multiple) {
 
480
        if (isString(multiple)) {
 
481
            Y.Array.each(arguments, this.hideSource, this);
 
482
        } else {
 
483
            this.set(SOURCE_DOT + src, false);
 
484
        }
 
485
    },
 
486
 
 
487
    /**
 
488
     * Shows any number of sources in the UI.  Convenience method for
 
489
     * myConsole.filter.set('source.foo', true); set('source.bar', true);
 
490
     * and so on.
 
491
     *
 
492
     * @method showSource
 
493
     * @param src* {String} 1..n sources to allow to display in the UI
 
494
     */
 
495
    showSource : function (src, multiple) {
 
496
        if (isString(multiple)) {
 
497
            Y.Array.each(arguments, this.showSource, this);
 
498
        } else {
 
499
            this.set(SOURCE_DOT + src, true);
 
500
        }
 
501
    },
 
502
 
 
503
    /**
 
504
     * Creates a checkbox and label from the ConsoleFilters.FILTER_TEMPLATE for
 
505
     * the provided type and name.  The checkbox and label are appended to the
 
506
     * container node passes as the first arg.
 
507
     *
 
508
     * @method _createCheckbox
 
509
     * @param container {Node} the parentNode of the new checkbox and label
 
510
     * @param name {String} the identifier of the filter
 
511
     * @protected
 
512
     */
 
513
    _createCheckbox : function (container, name) {
 
514
        var info = Y.merge(ConsoleFilters.CHROME_CLASSES, {
 
515
                        filter_name  : name,
 
516
                        filter_class : getCN(CONSOLE, FILTER, name)
 
517
                   }),
 
518
            node = Y.Node.create(
 
519
                        Y.Lang.sub(ConsoleFilters.FILTER_TEMPLATE, info));
 
520
 
 
521
        container.appendChild(node);
 
522
    },
 
523
 
 
524
    /**
 
525
     * Validates category updates are objects and the subattribute is not too
 
526
     * deep.
 
527
     *
 
528
     * @method _validateCategory
 
529
     * @param cat {String} the new category:visibility map
 
530
     * @param v {String} the subattribute path updated
 
531
     * @return Boolean
 
532
     * @protected
 
533
     */
 
534
    _validateCategory : function (cat, v) {
 
535
        return Y.Lang.isObject(v,true) && cat.split(/\./).length < 3;
 
536
    },
 
537
 
 
538
    /**
 
539
     * Validates source updates are objects and the subattribute is not too
 
540
     * deep.
 
541
     *
 
542
     * @method _validateSource
 
543
     * @param cat {String} the new source:visibility map
 
544
     * @param v {String} the subattribute path updated
 
545
     * @return Boolean
 
546
     * @protected
 
547
     */
 
548
    _validateSource : function (src, v) {
 
549
        return Y.Lang.isObject(v,true) && src.split(/\./).length < 3;
 
550
    },
 
551
 
 
552
    /**
 
553
     * Setter method for cacheLimit attribute.  Basically a validator to ensure
 
554
     * numeric input.
 
555
     *
 
556
     * @method _setCacheLimit
 
557
     * @param v {Number} Maximum number of entries
 
558
     * @return {Number}
 
559
     * @protected
 
560
     */
 
561
    _setCacheLimit: function (v) {
 
562
        if (Y.Lang.isNumber(v)) {
 
563
            this._cacheLimit = v;
 
564
            return v;
 
565
        } else {
 
566
            return Y.Attribute.INVALID_VALUE;
 
567
        }
 
568
    }
 
569
},
 
570
 
 
571
// Y.Plugin.ConsoleFilters static properties
 
572
{
 
573
    /**
 
574
     * Plugin name.
 
575
     *
 
576
     * @property NAME
 
577
     * @type String
 
578
     * @static
 
579
     * @default 'consoleFilters'
 
580
     */
 
581
    NAME : 'consoleFilters',
 
582
 
 
583
    /**
 
584
     * The namespace hung off the host object that this plugin will inhabit.
 
585
     *
 
586
     * @property NS
 
587
     * @type String
 
588
     * @static
 
589
     * @default 'filter'
 
590
     */
 
591
    NS : FILTER,
 
592
 
 
593
    /**
 
594
     * Markup template used to create the container for the category filters.
 
595
     *
 
596
     * @property CATEGORIES_TEMPLATE
 
597
     * @type String
 
598
     * @static
 
599
     */
 
600
    CATEGORIES_TEMPLATE :
 
601
        '<div class="{categories}"></div>',
 
602
 
 
603
    /**
 
604
     * Markup template used to create the container for the source filters.
 
605
     *
 
606
     * @property SOURCES_TEMPLATE
 
607
     * @type String
 
608
     * @static
 
609
     */
 
610
    SOURCES_TEMPLATE :
 
611
        '<div class="{sources}"></div>',
 
612
 
 
613
    /**
 
614
     * Markup template used to create the category and source filter checkboxes.
 
615
     *
 
616
     * @property FILTER_TEMPLATE
 
617
     * @type String
 
618
     * @static
 
619
     */
 
620
    FILTER_TEMPLATE :
 
621
        // IE8 and FF3 don't permit breaking _between_ nowrap elements.  IE8
 
622
        // doesn't understand (non spec) wbr tag, nor does it create text nodes
 
623
        // for spaces in innerHTML strings.  The thin-space entity suffices to
 
624
        // create a breakable point.
 
625
        '<label class="{filter_label}">'+
 
626
            '<input type="checkbox" value="{filter_name}" '+
 
627
                'class="{filter} {filter_class}"> {filter_name}'+
 
628
        '</label>&#8201;',
 
629
 
 
630
    /**
 
631
     * Classnames used by the templates when creating nodes.
 
632
     *
 
633
     * @property CHROME_CLASSES
 
634
     * @type Object
 
635
     * @static
 
636
     * @protected
 
637
     */
 
638
    CHROME_CLASSES : {
 
639
        categories   : getCN(CONSOLE,FILTERS,'categories'),
 
640
        sources      : getCN(CONSOLE,FILTERS,'sources'),
 
641
        category     : getCN(CONSOLE,FILTER,CATEGORY),
 
642
        source       : getCN(CONSOLE,FILTER,SOURCE),
 
643
        filter       : getCN(CONSOLE,FILTER),
 
644
        filter_label : getCN(CONSOLE,FILTER,'label')
 
645
    },
 
646
 
 
647
    ATTRS : {
 
648
        /**
 
649
         * Default visibility applied to new categories and sources.
 
650
         *
 
651
         * @attribute defaultVisibility
 
652
         * @type {Boolean}
 
653
         * @default true
 
654
         */
 
655
        defaultVisibility : {
 
656
            value : true,
 
657
            validator : Y.Lang.isBoolean
 
658
        },
 
659
 
 
660
        /**
 
661
         * <p>Map of entry categories to their visibility status.  Update a
 
662
         * particular category's visibility by setting the subattribute to true
 
663
         * (visible) or false (hidden).</p>
 
664
         *
 
665
         * <p>For example, yconsole.filter.set('category.info', false) to hide
 
666
         * log entries with the category/logLevel of 'info'.</p>
 
667
         *
 
668
         * <p>Similarly, yconsole.filter.get('category.warn') will return a
 
669
         * boolean indicating whether that category is currently being included
 
670
         * in the UI.</p>
 
671
         *
 
672
         * <p>Unlike the YUI instance configuration's logInclude and logExclude
 
673
         * properties, filtered entries are only hidden from the UI, but
 
674
         * can be made visible again.</p>
 
675
         *
 
676
         * @attribute category
 
677
         * @type Object
 
678
         */
 
679
        category : {
 
680
            value : {},
 
681
            validator : function (v,k) {
 
682
                return this._validateCategory(k,v);
 
683
            }
 
684
        },
 
685
 
 
686
        /**
 
687
         * <p>Map of entry sources to their visibility status.  Update a
 
688
         * particular sources's visibility by setting the subattribute to true
 
689
         * (visible) or false (hidden).</p>
 
690
         *
 
691
         * <p>For example, yconsole.filter.set('sources.slider', false) to hide
 
692
         * log entries originating from Y.Slider.</p>
 
693
         *
 
694
         * @attribute source
 
695
         * @type Object
 
696
         */
 
697
        source : {
 
698
            value : {},
 
699
            validator : function (v,k) {
 
700
                return this._validateSource(k,v);
 
701
            }
 
702
        },
 
703
 
 
704
        /**
 
705
         * Maximum number of entries to store in the message cache.  Use this to
 
706
         * limit the memory footprint in environments with heavy log usage.
 
707
         * By default, there is no limit (Number.POSITIVE_INFINITY).
 
708
         *
 
709
         * @attribute cacheLimit
 
710
         * @type {Number}
 
711
         * @default Number.POSITIVE_INFINITY
 
712
         */
 
713
        cacheLimit : {
 
714
            value : Number.POSITIVE_INFINITY,
 
715
            setter : function (v) {
 
716
                return this._setCacheLimit(v);
 
717
            }
 
718
        }
 
719
    }
 
720
});
 
721
 
 
722
 
 
723
}, '@VERSION@', {"requires": ["plugin", "console"], "skinnable": true});