Implement deeplink, creating pastes, log deduplication

Summary:
This diff implements the remaining features in the logs plugin:

- deeplinking
- merging duplicate rows

The logs plugin source code has now been reduced from originally `935` to `285` LoC. All optimisation code has been removed from the plugin:

* debouncing data processing
* pre-rendering (and storing!) all rows

Finally applied some further styling tweaks and applied some renames to DataTable / DataSource + types finetuning. Some more will follow.
Fixed a emotion warning in unit tests which was pretty annoying.

Reviewed By: passy

Differential Revision: D26666190

fbshipit-source-id: e45e289b4422ebeb46cad927cfc0cfcc9566834f
This commit is contained in:
Michel Weststrate
2021-03-16 14:54:53 -07:00
committed by Facebook GitHub Bot
parent dec8e88aeb
commit 525e079284
17 changed files with 132 additions and 70 deletions

View File

@@ -108,11 +108,8 @@ export class DataSource<
output: Entry<T>[] = [];
/**
* Returns a direct reference to the stored records.
* The collection should be treated as readonly and mutable;
* the collection might be directly written to by the datasource,
* so for an immutable state create a defensive copy:
* `datasource.records.slice()`
* Returns a defensive copy of the stored records.
* This is a O(n) operation! Prefer using .size and .get instead!
*/
get records(): readonly T[] {
return this._records.map(unwrap);
@@ -134,6 +131,18 @@ export class DataSource<
this.setSortBy(undefined);
}
public get size() {
return this._records.length;
}
public getRecord(index: number): T {
return this._records[index]?.value;
}
public get outputSize() {
return this.output.length;
}
/**
* Returns a defensive copy of the current output.
* Sort, filter, reverse and window are applied, but windowing isn't.