Skip to content

Instantly share code, notes, and snippets.

@jasonLaster
Created May 26, 2022 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonLaster/78fa5b41b7a9c5e9f7986182a60735ed to your computer and use it in GitHub Desktop.
Save jasonLaster/78fa5b41b7a9c5e9f7986182a60735ed to your computer and use it in GitHub Desktop.
// 1. passing in points to the LogpointsManager
// 2. dont run every analysis now
// Analysis Manager will be user to help our thunks conduct analysis for Logpoints and Other portions of the UI.
// NOTE
// * it will not have the store
// * it will be designed behave simililarly to several backend classes (i.e. async queue)
// * it will support the two phases of analysis (Find Points, Run Analysis)
// * it will use a cache to support not re-fetching the same data
//
// Decisions
// * should the API expose map/reduce?
// * should the API expose events, exceptions, and other non-source-location params
// Logpoints Reducer will be used to show logpoints in the UI
type Analysis = {
id: string,
points: TimeStampedPoint[],
results: {[point: ExecutionPoint]: any},
error: any,
pending: boolean,
}
type Logpoint = {
location: Location,
expression: string,
condition: string,
primitiveExpression: boolean,
enabled: boolean,
prefix: "unicorn" | void,
analyses: Analysis[]
}
const logpointState = {
logpoints: {[locationKey: string]: Logpoint}
}
// addLogpoint
// removeLogpoint
// updateLogpoint
export function addLogpoint(cx: Context, line: number): UIThunkAction {
return (dispatch, getState, {analysisManager}) => {
analysisManager.runAnalysis(location, focusWindow)
};
}
export function refocusLogpoint(focus): UIThunkAction {
return (dispatch, getState, {analysisManager}) => {
for (const logpoint of logpoints) {
analysisManager.updateAnalysis(logpoint.analysisId, focusWindow)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment