Skip to content

Commit 229c628

Browse files
committed
misc
1 parent af5f23c commit 229c628

File tree

10 files changed

+35
-34
lines changed

10 files changed

+35
-34
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: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import compactUpdateActions from "viewer/model/helpers/compaction/compact_update
66
import { describe, it, expect, vi } from "vitest";
77
import defaultState from "viewer/default_state";
88
import update from "immutability-helper";
9-
import { createSaveQueueFromUpdateActions, withoutUpdateTracing } from "../helpers/saveHelpers";
9+
import {
10+
createSaveQueueFromUpdateActions,
11+
withoutUpdateActiveItemTracing,
12+
} from "../helpers/saveHelpers";
1013
import { expectValueDeepEqual, execCall } from "../helpers/sagaHelpers";
1114
import { MISSING_GROUP_ID } from "viewer/view/right-border-tabs/trees_tab/tree_hierarchy_view_helpers";
1215
import { TreeTypeEnum } from "viewer/constants";
@@ -33,7 +36,7 @@ vi.mock("viewer/model/sagas/root_saga", () => ({
3336
}));
3437

3538
function testDiffing(prevAnnotation: StoreAnnotation, nextAnnotation: StoreAnnotation) {
36-
return withoutUpdateTracing(
39+
return withoutUpdateActiveItemTracing(
3740
Array.from(
3841
diffSkeletonTracing(
3942
enforceSkeletonTracing(prevAnnotation),
@@ -169,7 +172,7 @@ describe("SkeletonTracingSaga", () => {
169172

170173
// only updateTracing
171174
const items = execCall(expect, saga.next(initialState.annotation.skeleton));
172-
expect(withoutUpdateTracing(items).length).toBe(0);
175+
expect(withoutUpdateActiveItemTracing(items).length).toBe(0);
173176
});
174177

175178
it("should do something if changed (saga test)", () => {
@@ -186,7 +189,7 @@ describe("SkeletonTracingSaga", () => {
186189

187190
const items = execCall(expect, saga.next(newState.annotation.skeleton));
188191

189-
expect(withoutUpdateTracing(items).length).toBeGreaterThan(0);
192+
expect(withoutUpdateActiveItemTracing(items).length).toBeGreaterThan(0);
190193
expectValueDeepEqual(expect, saga.next(items), put(pushSaveQueueTransaction(items)));
191194
});
192195

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import * as VolumeTracingActions from "viewer/model/actions/volumetracing_action
1616
import VolumeTracingReducer from "viewer/model/reducers/volumetracing_reducer";
1717
import defaultState from "viewer/default_state";
1818
import { expectValueDeepEqual, execCall } from "test/helpers/sagaHelpers";
19-
import { withoutUpdateTracing } from "test/helpers/saveHelpers";
19+
import { withoutUpdateActiveItemTracing } from "test/helpers/saveHelpers";
2020
import type { ActiveMappingInfo } from "viewer/store";
2121
import { askUserForLockingActiveMapping } from "viewer/model/sagas/saga_helpers";
2222
import { setupSavingForTracingType } from "viewer/model/sagas/save_saga";
@@ -137,7 +137,7 @@ describe("VolumeTracingSaga", () => {
137137
saga.next(true);
138138
// only updateTracing
139139
const items = execCall(expect, saga.next(initialState.annotation.volumes[0]));
140-
expect(withoutUpdateTracing(items).length).toBe(0);
140+
expect(withoutUpdateActiveItemTracing(items).length).toBe(0);
141141
});
142142

143143
it("should do something if changed (saga test)", () => {
@@ -154,7 +154,7 @@ describe("VolumeTracingSaga", () => {
154154

155155
const items = execCall(expect, saga.next(newState.annotation.volumes[0]));
156156

157-
expect(withoutUpdateTracing(items).length).toBe(0);
157+
expect(withoutUpdateActiveItemTracing(items).length).toBe(0);
158158
expect(items[0].value.activeSegmentId).toBe(ACTIVE_CELL_ID);
159159
expectValueDeepEqual(expect, saga.next(items), put(pushSaveQueueTransaction(items)));
160160
});
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
@@ -819,11 +819,9 @@ function* tryToIncorporateActions(newerActions: APIUpdateActionBatch[]): Saga<bo
819819
case "removeFallbackLayer":
820820
case "updateMappingName": // Refactor mapping activation first before implementing this.
821821

822-
// Skeleton
823-
case "mergeTree": // todop: this action is never used? legacy?
824-
825822
// Legacy! The following actions are legacy actions and don't
826823
// need to be supported.
824+
case "mergeTree":
827825
case "updateSkeletonTracing":
828826
case "updateVolumeTracing":
829827
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)