new hcp and scroller implementation

This commit is contained in:
Mason Houtz
2021-04-13 20:11:53 -07:00
parent b7078f51fa
commit 8ffb41e8d6
75 changed files with 3899 additions and 2580 deletions
@@ -1,9 +1,7 @@
import { of, race, pipe, concat, iif } from "rxjs";
import { filter, mergeMap, switchMap, delay, share, repeat, take, takeWhile } from "rxjs/operators";
import { cacheContent, monitorContentQuery } from "components/History/caching";
import { singleUpdateResult } from "components/History/caching/db/monitorQuery";
import { filter, map, mergeMap, switchMap, delay, share, repeat, take, takeWhile } from "rxjs/operators";
import { cacheContent, monitorContentQuery, loadHistoryContents } from "components/History/caching";
import { fetchDatasetById, fetchDatasetCollectionById, fetchInvocationStepById } from "./fetch";
import { loadHistoryContents } from "components/History/caching";
// prettier-ignore
export const datasetMonitor = (cfg = {}) => {
@@ -49,18 +47,21 @@ const buildPouchRequest = (id, contentType) => {
const createMonitor = (id, contentType, fetcher, spinUpDelay = 250) => {
// build the pouchdb/mongo request, which is a selector
// and limits, offsets, etc
const request = buildPouchRequest(id, contentType);
// retrieve changes from cache
const changes$ = of(buildPouchRequest(id, contentType)).pipe(
const changes$ = of(request).pipe(
monitorContentQuery(),
singleUpdateResult(),
// singleUpdateResult(),
filter(change => change.match && change.doc),
map(change => change.doc),
share()
);
// cache results that reflect non-deleted existing data in the cache
const existing$ = changes$.pipe(
filter(Boolean),
);
);
// load and cache dataset from server then switch over to the monitor
const fetchItem$ = of(id).pipe(
@@ -1,6 +1,6 @@
import { of } from "rxjs";
import { ObserverSpy } from "@hirez_io/observer-spy";
import * as caching from "components/History/caching/loadHistoryContents";
import { loadHistoryContents } from "../../History/caching";
import { monitorHistoryUntilTrue, invocationStepMonitor } from "./monitors";
import * as fetch from "./fetch";
@@ -58,7 +58,7 @@ describe("monitorHistoryUntilTrue", () => {
stopMonitor = false;
completed = false;
mockLoadHistoryContent = of(1, 2, 3);
jest.spyOn(caching, 'loadHistoryContents').mockImplementation(() => () => mockLoadHistoryContent);
loadHistoryContents.mockImplementation(() => () => mockLoadHistoryContent);
monitor$ = monitorHistoryUntilTrue(stopFn, historyId, 20);
});