|
266 | 266 | } |
267 | 267 | break; |
268 | 268 | case 'pushMany': |
269 | | - event.data.reverse(); |
270 | 269 | const tmp = event.data.filter(record => this._passesCurrentFilters(record)); |
271 | 270 | this.viewBuffer.pushMany(tmp); |
272 | 271 | break; |
|
279 | 278 | * mutated on the viewbuffer is considered valid (passed the filter(s)). |
280 | 279 | */ |
281 | 280 | _onViewBufferEvent(event) { |
282 | | - // also investigate setData instead of addDate + remove |
283 | 281 | switch (event.type) { |
284 | 282 | case 'push': |
285 | | - this.table.addData([event.data], true); |
286 | | - break; |
287 | 283 | case 'pushMany': |
288 | | - this.table.addData(event.data.reverse(), true); |
289 | | - break; |
290 | 284 | case 'reset': |
291 | | - let tmp = this.viewBuffer.toArray(); |
292 | | - this.table.addData(tmp, true); |
| 285 | + this.table.clearData(); |
| 286 | + this.table.setData(this.viewBuffer.toArray()); |
293 | 287 | break; |
294 | 288 | case 'clear': |
295 | 289 | this.table.clearData(); |
296 | 290 | break; |
297 | 291 | } |
298 | | - |
299 | | - let rows = this.table.getRows(); |
300 | | - if (this.viewBuffer.length >= this.bufferSize && rows.length > this.bufferSize) { |
301 | | - for (let i = this.bufferSize; i < rows.length; i++) { |
302 | | - rows[i].delete(); |
303 | | - } |
304 | | - } |
305 | 292 | } |
306 | 293 |
|
307 | 294 | _hashFilter({field, operator, value}) { |
|
454 | 441 | } |
455 | 442 |
|
456 | 443 | /** |
457 | | - * |
| 444 | + * Update existing records in the table. Records supplied but not found in |
| 445 | + * the table (indexed by __digest__) are ignored. |
458 | 446 | */ |
459 | 447 | updateTable(records) { |
460 | | - try { |
461 | | - this.table.updateData(records, true); |
462 | | - } catch (e) { |
463 | | - // ignore |
464 | | - } |
| 448 | + this.table.updateData(records).catch((error) => {}); |
465 | 449 | } |
466 | 450 |
|
467 | 451 | setFilterMode(mode = 'AND') { |
|
540 | 524 | if (!hostnames.get(record.dst)) hostnames.set(record.dst, null); |
541 | 525 |
|
542 | 526 | // make sure the hostname key exists |
543 | | - record['srchostname'] = hostnames.get(record.src); |
544 | | - record['dsthostname'] = hostnames.get(record.dst); |
| 527 | + record['srchostname'] = hostnames.get(record.src) || '<span class="fa fa-spinner fa-pulse"></span>'; |
| 528 | + record['dsthostname'] = hostnames.get(record.dst) || '<span class="fa fa-spinner fa-pulse"></span>'; |
545 | 529 | } |
546 | 530 |
|
547 | 531 | resolve(data); |
|
962 | 946 | } |
963 | 947 |
|
964 | 948 | bufferDataUnsubscribe = buffer.subscribe((event) => { |
965 | | - // register to active data feed, apply hostnames as they come |
| 949 | + // register to active data feed (all data), apply hostnames as they come |
966 | 950 | if (event.type === "push" || event.type === "pushMany") { |
967 | 951 | let records = Array.isArray(event.data) ? event.data : [event.data]; |
968 | 952 | records.map((record) => { |
|
0 commit comments