Skip to content

Commit dc644e6

Browse files
committed
misc
1 parent 689d763 commit dc644e6

File tree

10 files changed

+30
-42
lines changed

10 files changed

+30
-42
lines changed

frontend/javascripts/test/helpers/saveHelpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export function createSaveQueueFromUpdateActions(
2121
}));
2222
}
2323

24-
export function withoutUpdateTracing(
24+
export function withoutUpdateActiveItemTracing(
2525
items: UpdateActionWithoutIsolationRequirement[],
2626
): UpdateActionWithoutIsolationRequirement[] {
2727
return items.filter(

frontend/javascripts/test/reducers/update_action_application/skeleton.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ describe("Update Action Application for SkeletonTracing", () => {
222222
mag,
223223
);
224224
const newState = applyActions(initialState, [
225-
createNode, // 1
226-
createNode, // 2
225+
createNode, // nodeId=1
226+
createNode, // nodeId=2
227227
SkeletonTracingActions.setActiveNodeAction(2),
228228
]);
229229
expect(getActiveNode(enforceSkeletonTracing(newState.annotation))?.id).toBe(2);
@@ -250,8 +250,8 @@ describe("Update Action Application for SkeletonTracing", () => {
250250
mag,
251251
);
252252
const newState = applyActions(initialState, [
253-
createNode, // 1
254-
createNode, // 2
253+
createNode, // nodeId=1
254+
createNode, // nodeId=2
255255
SkeletonTracingActions.setActiveTreeAction(2),
256256
]);
257257
expect(getActiveTree(enforceSkeletonTracing(newState.annotation))?.treeId).toBe(2);

frontend/javascripts/test/sagas/compact_toggle_actions.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from "viewer/model/sagas/update_actions";
1111
import {
1212
withoutUpdateSegment,
13-
withoutUpdateTracing,
13+
withoutUpdateActiveItemTracing,
1414
withoutUpdateTree,
1515
} from "test/helpers/saveHelpers";
1616
import DiffableMap from "libs/diffable_map";
@@ -162,7 +162,7 @@ function testSkeletonDiffing(prevState: WebknossosState, nextState: WebknossosSt
162162
// are creating completely new trees, so that we don't have to go through the
163163
// action->reducer pipeline)
164164
return withoutUpdateTree(
165-
withoutUpdateTracing(
165+
withoutUpdateActiveItemTracing(
166166
Array.from(
167167
diffSkeletonTracing(
168168
enforceSkeletonTracing(prevState.annotation),
@@ -179,7 +179,7 @@ function testVolumeDiffing(prevState: WebknossosState, nextState: WebknossosStat
179179
// are creating completely new trees, so that we don't have to go through the
180180
// action->reducer pipeline)
181181
return withoutUpdateSegment(
182-
withoutUpdateTracing(
182+
withoutUpdateActiveItemTracing(
183183
Array.from(
184184
diffVolumeTracing(prevState.annotation.volumes[0], nextState.annotation.volumes[0]),
185185
),

frontend/javascripts/test/sagas/skeletontracing_saga.spec.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { setupWebknossosForTesting, type WebknossosTestContext } from "test/help
22
import type { SkeletonTracing, StoreAnnotation } from "viewer/store";
33
import { describe, it, expect, beforeEach, afterEach } from "vitest";
44
import Store from "viewer/store";
5-
import { hasRootSagaCrashed } from "viewer/model/sagas/root_saga";
65

76
import { chainReduce } from "test/helpers/chainReducer";
87
import DiffableMap from "libs/diffable_map";
@@ -11,7 +10,10 @@ import compactSaveQueue from "viewer/model/helpers/compaction/compact_save_queue
1110
import compactUpdateActions from "viewer/model/helpers/compaction/compact_update_actions";
1211
import defaultState from "viewer/default_state";
1312
import update from "immutability-helper";
14-
import { createSaveQueueFromUpdateActions, withoutUpdateTracing } from "../helpers/saveHelpers";
13+
import {
14+
createSaveQueueFromUpdateActions,
15+
withoutUpdateActiveItemTracing,
16+
} from "../helpers/saveHelpers";
1517
import { MISSING_GROUP_ID } from "viewer/view/right-border-tabs/trees_tab/tree_hierarchy_view_helpers";
1618
import { TreeTypeEnum } from "viewer/constants";
1719
import { enforceSkeletonTracing } from "viewer/model/accessors/skeletontracing_accessor";
@@ -27,7 +29,7 @@ import { Model } from "viewer/singletons";
2729
const actionTracingId = "tracingId";
2830

2931
function testDiffing(prevAnnotation: StoreAnnotation, nextAnnotation: StoreAnnotation) {
30-
return withoutUpdateTracing(
32+
return withoutUpdateActiveItemTracing(
3133
Array.from(
3234
diffSkeletonTracing(
3335
enforceSkeletonTracing(prevAnnotation),
@@ -135,11 +137,6 @@ describe("SkeletonTracingSaga", () => {
135137
context.tearDownPullQueues();
136138
// Saving after each test and checking that the root saga didn't crash,
137139
// ensures that each test is cleanly exited. Without it weird output can
138-
// occur (e.g., a promise gets resolved which interferes with the next test).
139-
expect(hasRootSagaCrashed()).toBe(false);
140-
});
141-
142-
it("shouldn't do anything if unchanged (saga test)", async (context: WebknossosTestContext) => {
143140
await Model.ensureSavedState();
144141
expect(context.receivedDataPerSaveRequest.length).toBe(0);
145142
});

frontend/javascripts/test/sagas/volumetracing/volumetracing_saga.spec.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
import VolumeLayer from "viewer/model/volumetracing/volumelayer";
2222
import { serverVolumeToClientVolumeTracing } from "viewer/model/reducers/volumetracing_reducer";
2323
import { Model, Store } from "viewer/singletons";
24-
import { hasRootSagaCrashed } from "viewer/model/sagas/root_saga";
2524

2625
const serverVolumeTracing: ServerVolumeTracing = {
2726
typ: "Volume",
@@ -87,12 +86,6 @@ describe("VolumeTracingSaga", () => {
8786
context.tearDownPullQueues();
8887

8988
// Saving after each test and checking that the root saga didn't crash,
90-
// ensures that each test is cleanly exited. Without it weird output can
91-
// occur (e.g., a promise gets resolved which interferes with the next test).
92-
expect(hasRootSagaCrashed()).toBe(false);
93-
});
94-
95-
it("shouldn't do anything if unchanged (saga test)", async (context: WebknossosTestContext) => {
9689
await Model.ensureSavedState();
9790
expect(context.receivedDataPerSaveRequest.length).toBe(0);
9891
});
Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
import type { Point3, Vector3 } from "viewer/constants";
22

3-
// 51 matches
43
export type BoundingBoxMinMaxType = {
54
min: Vector3;
65
max: Vector3;
76
};
87

9-
// 10 matches
10-
export type BoundingBoxProto = {
11-
topLeft: Point3;
12-
width: number;
13-
height: number;
14-
depth: number;
15-
};
16-
17-
// 39 matches
188
export type BoundingBoxObject = {
199
readonly topLeft: Vector3;
2010
readonly width: number;
2111
readonly height: number;
2212
readonly depth: number;
2313
};
14+
15+
export type BoundingBoxProto = {
16+
topLeft: Point3;
17+
width: number;
18+
height: number;
19+
depth: number;
20+
};

frontend/javascripts/viewer/model/reducers/skeletontracing_reducer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,6 @@ function SkeletonTracingReducer(state: WebknossosState, action: Action): Webknos
673673
return state;
674674
}
675675

676-
// use this code as template
677676
const { position, rotation, viewport, mag, treeId, timestamp, additionalCoordinates } =
678677
action;
679678
const tree = getOrCreateTree(state, skeletonTracing, treeId, timestamp, TreeTypeEnum.DEFAULT);

frontend/javascripts/viewer/model/sagas/save_saga.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -847,11 +847,9 @@ function* tryToIncorporateActions(newerActions: APIUpdateActionBatch[]): Saga<bo
847847
case "removeFallbackLayer":
848848
case "updateMappingName": // Refactor mapping activation first before implementing this.
849849

850-
// Skeleton
851-
case "mergeTree": // todop: this action is never used? legacy?
852-
853850
// Legacy! The following actions are legacy actions and don't
854851
// need to be supported.
852+
case "mergeTree":
855853
case "updateSkeletonTracing":
856854
case "updateVolumeTracing":
857855
case "updateUserBoundingBoxesInSkeletonTracing":

frontend/javascripts/viewer/model/sagas/update_actions.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type PartialBoundingBoxWithoutVisibility = Partial<Omit<UserBoundingBox, "isVisi
2323
export type UpdateTreeUpdateAction = ReturnType<typeof updateTree> | ReturnType<typeof createTree>;
2424
export type DeleteTreeUpdateAction = ReturnType<typeof deleteTree>;
2525
export type MoveTreeComponentUpdateAction = ReturnType<typeof moveTreeComponent>;
26-
export type MergeTreeUpdateAction = ReturnType<typeof mergeTree>;
26+
export type LEGACY_MergeTreeUpdateAction = ReturnType<typeof LEGACY_mergeTree>;
2727
export type CreateNodeUpdateAction = ReturnType<typeof createNode>;
2828
export type UpdateNodeUpdateAction = ReturnType<typeof updateNode>;
2929
export type UpdateTreeVisibilityUpdateAction = ReturnType<typeof updateTreeVisibility>;
@@ -141,7 +141,7 @@ export type UpdateActionWithIsolationRequirement =
141141
export type UpdateActionWithoutIsolationRequirement =
142142
| UpdateTreeUpdateAction
143143
| DeleteTreeUpdateAction
144-
| MergeTreeUpdateAction
144+
| LEGACY_MergeTreeUpdateAction
145145
| MoveTreeComponentUpdateAction
146146
| CreateNodeUpdateAction
147147
| UpdateNodeUpdateAction
@@ -313,7 +313,11 @@ export function updateTreeGroupVisibility(
313313
},
314314
} as const;
315315
}
316-
export function mergeTree(sourceTreeId: number, targetTreeId: number, actionTracingId: string) {
316+
export function LEGACY_mergeTree(
317+
sourceTreeId: number,
318+
targetTreeId: number,
319+
actionTracingId: string,
320+
) {
317321
return {
318322
name: "mergeTree",
319323
value: {

frontend/javascripts/viewer/view/version_entry.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import type {
4343
LEGACY_UpdateUserBoundingBoxesInSkeletonTracingUpdateAction,
4444
LEGACY_UpdateUserBoundingBoxesInVolumeTracingUpdateAction,
4545
MergeAgglomerateUpdateAction,
46-
MergeTreeUpdateAction,
46+
LEGACY_MergeTreeUpdateAction,
4747
MoveTreeComponentUpdateAction,
4848
RevertToVersionUpdateAction,
4949
ServerUpdateAction,
@@ -387,7 +387,7 @@ const descriptionFns: Record<
387387
icon: <EditOutlined />,
388388
}),
389389
// This should never be shown since currently this update action is never dispatched.
390-
mergeTree: (action: AsServerAction<MergeTreeUpdateAction>): Description => ({
390+
mergeTree: (action: AsServerAction<LEGACY_MergeTreeUpdateAction>): Description => ({
391391
description: `Merged the trees with id ${action.value.sourceId} and ${action.value.targetId}.`,
392392
icon: <EditOutlined />,
393393
}),

0 commit comments

Comments
 (0)