Skip to content

Commit

Permalink
ui: decontrollify Flows
Browse files Browse the repository at this point in the history
- Move logic as-is to FlowManager.
- Remove FlowEventsPanel, nobody was using it after killing TabsV1
- clean up some plumbing from globals -> Trace

Change-Id: I8202079c59052f444833fa9392b1ad3d8f30c260
  • Loading branch information
primiano committed Sep 30, 2024
1 parent 06e8c33 commit 4e1ce2f
Show file tree
Hide file tree
Showing 17 changed files with 349 additions and 437 deletions.
8 changes: 0 additions & 8 deletions ui/src/common/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,6 @@ export const StateActions = {
state.highlightedSliceId = args.sliceId;
},

setHighlightedFlowLeftId(state: StateDraft, args: {flowId: number}) {
state.focusedFlowIdLeft = args.flowId;
},

setHighlightedFlowRightId(state: StateDraft, args: {flowId: number}) {
state.focusedFlowIdRight = args.flowId;
},

setHoverCursorTimestamp(state: StateDraft, args: {ts: time}) {
state.hoverCursorTimestamp = args.ts;
},
Expand Down
2 changes: 0 additions & 2 deletions ui/src/common/empty_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ export function createEmptyState(): State {
hoverCursorTimestamp: Time.INVALID,
hoveredNoteTimestamp: Time.INVALID,
highlightedSliceId: -1,
focusedFlowIdLeft: -1,
focusedFlowIdRight: -1,

recordingInProgress: false,
recordingCancelled: false,
Expand Down
2 changes: 0 additions & 2 deletions ui/src/common/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,6 @@ export interface State {
hoverCursorTimestamp: time;
hoveredNoteTimestamp: time;
highlightedSliceId: number;
focusedFlowIdLeft: number;
focusedFlowIdRight: number;

/**
* Trace recording
Expand Down
9 changes: 0 additions & 9 deletions ui/src/controller/trace_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ import {
} from '../trace_processor/wasm_engine_proxy';
import {showModal} from '../widgets/modal';
import {Child, Children, Controller} from './controller';
import {
FlowEventsController,
FlowEventsControllerArgs,
} from './flow_events_controller';
import {LoadingManager} from './loading_manager';
import {TraceErrorController} from './trace_error_controller';
import {
Expand Down Expand Up @@ -235,11 +231,6 @@ export class TraceController extends Controller<States> {
const engine = assertExists(this.engine);
const childControllers: Children = [];

const flowEventsArgs: FlowEventsControllerArgs = {engine};
childControllers.push(
Child('flowEvents', FlowEventsController, flowEventsArgs),
);

childControllers.push(
Child('traceError', TraceErrorController, {engine}),
);
Expand Down
15 changes: 15 additions & 0 deletions ui/src/core/app_trace_impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {Selection, SelectionOpts} from '../public/selection';
import {SearchResult} from '../public/search';
import {raf} from './raf_scheduler';
import {PivotTableManager} from './pivot_table_manager';
import {FlowManager} from './flow_manager';

// The pseudo plugin id used for the core instance of AppImpl.
export const CORE_PLUGIN_ID = '__core__';
Expand Down Expand Up @@ -178,6 +179,7 @@ class TraceContext implements Disposable {
readonly trackMgr = new TrackManagerImpl();
readonly workspaceMgr = new WorkspaceManagerImpl();
readonly noteMgr = new NoteManagerImpl();
readonly flowMgr: FlowManager;
readonly pluginSerializableState = createStore<{[key: string]: {}}>({});
readonly scrollHelper: ScrollHelper;
readonly pivotTableMgr;
Expand Down Expand Up @@ -218,6 +220,13 @@ class TraceContext implements Disposable {
engine.getProxy('PivotTableManager'),
);

this.flowMgr = new FlowManager(
engine.getProxy('FlowManager'),
this.trackMgr,
this.selectionMgr,
() => this.workspaceMgr.currentWorkspace,
);

this.searchMgr = new SearchManagerImpl({
timeline: this.timeline,
trackManager: this.trackMgr,
Expand All @@ -243,6 +252,8 @@ class TraceContext implements Disposable {
this.pivotTableMgr.setSelectionArea(selection);
}

this.flowMgr.updateFlows(selection);

// TODO(primiano): this is temporarily necessary until we kill
// controllers. The flow controller needs to be re-kicked when we change
// the selection.
Expand Down Expand Up @@ -391,6 +402,10 @@ export class TraceImpl implements Trace {
return this.traceCtx.pivotTableMgr;
}

get flows() {
return this.traceCtx.flowMgr;
}

// App interface implementation.

get pluginId(): string {
Expand Down
Loading

0 comments on commit 4e1ce2f

Please sign in to comment.