Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update React to v17 #7765

Merged
merged 24 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
de7388c
update deps to ract v17
hotzenklotz Apr 22, 2024
1a7416d
Merge branch 'master' of github.com:scalableminds/webknossos into rea…
hotzenklotz Apr 25, 2024
336f024
refactor antd table columns as arrays instead of react elements
hotzenklotz Apr 25, 2024
1cf2f45
fix dayjs types
hotzenklotz Apr 25, 2024
8249960
update more packages
hotzenklotz Apr 25, 2024
87fa94c
fix linting
hotzenklotz Apr 26, 2024
1db5e65
Merge branch 'master' of github.com:scalableminds/webknossos into rea…
hotzenklotz May 14, 2024
bc83f64
Merge branch 'master' of github.com:scalableminds/webknossos into rea…
hotzenklotz May 21, 2024
faade21
Merge branch 'master' of github.com:scalableminds/webknossos into rea…
hotzenklotz May 27, 2024
c13c7f1
undo any changes related to SortableTree lib
hotzenklotz May 27, 2024
420a946
Merge branch 'master' of github.com:scalableminds/webknossos into rea…
hotzenklotz Jul 15, 2024
7394b3b
remove enyzme adapter for react 16
hotzenklotz Jul 15, 2024
2c01652
Merge branch 'master' of github.com:scalableminds/webknossos into rea…
hotzenklotz Aug 6, 2024
3ab7c94
Merge branch 'master' of github.com:scalableminds/webknossos into rea…
philippotto Aug 14, 2024
7dd9a5e
format with 4 spaces
hotzenklotz Aug 27, 2024
301b421
Merge branch 'master' of github.com:scalableminds/webknossos into rea…
hotzenklotz Aug 27, 2024
a92c9da
fix type imports
hotzenklotz Aug 27, 2024
3862442
Merge branch 'react-17' of github.com:scalableminds/webknossos into r…
hotzenklotz Aug 27, 2024
8f02dca
updated cahngelog
hotzenklotz Aug 27, 2024
3ce8716
removed duplicate keys
hotzenklotz Aug 27, 2024
1df4753
remove enzyme component testing framework
hotzenklotz Aug 27, 2024
5505b02
move e2e-setup.ts out of enzyme folder
hotzenklotz Aug 27, 2024
9665ac7
pr feedback
hotzenklotz Aug 27, 2024
d057b02
Merge branch 'master' of github.com:scalableminds/webknossos into rea…
hotzenklotz Aug 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Upgraded ant icons to version 5.4. [#8007](https://github.com/scalableminds/webknossos/pull/8007)
- Increased maximum depth for ai-based quick select from 5 to 16. [#8021](https://github.com/scalableminds/webknossos/pull/8021)
- Zarr-streaming now uses the new unit-aware voxel size. This means that [wk-libs client v0.14.25 or newer](https://github.com/scalableminds/webknossos-libs/releases) is needed for dataset zarr streaming. [#8012](https://github.com/scalableminds/webknossos/pull/8012)
- Updated React to version 17. [#7765](https://github.com/scalableminds/webknossos/pull/7765)

### Fixed
- Fixed a bug that allowed the default newly created bounding box to appear outside the dataset. In case the whole bounding box would be outside it is created regardless. [#7892](https://github.com/scalableminds/webknossos/pull/7892)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import ProjectAndAnnotationTypeDropdown, {
import { isUserAdminOrTeamManager, transformToCSVRow } from "libs/utils";
import messages from "messages";
import Toast from "libs/toast";
import dayjs, { Dayjs } from "antd/node_modules/dayjs";
import TimeTrackingDetailView from "./time_tracking_detail_view";
import LinkButton from "components/link_button";
import FixedExpandableTable from "components/fixed_expandable_table";
import * as Utils from "libs/utils";
import { APITimeTrackingPerUser } from "types/api_flow_types";
import { useSelector } from "react-redux";
import { OxalisState } from "oxalis/store";
import dayjs, { type Dayjs } from "dayjs";
const { RangePicker } = DatePicker;

const TIMETRACKING_CSV_HEADER_PER_USER = ["userId,userFirstName,userLastName,timeTrackedInSeconds"];
Expand Down Expand Up @@ -236,7 +236,7 @@ function TimeTrackingOverview() {
style={filterStyle}
value={[startDate, endDate]}
presets={rangePresets}
onChange={(dates: null | (Dayjs | null)[]) => {
onChange={(dates: [Dayjs | null, Dayjs | null] | null) => {
if (dates == null || dates[0] == null || dates[1] == null) return;
if (Math.abs(dates[0].diff(dates[1], "days")) > 3 * 31) {
Toast.error(messages["timetracking.date_range_too_long"]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,8 @@ const DraggableDatasetRow = ({

const datasetName = restProps["data-row-key"];
const [, drag, preview] = useDrag({
item: { type: DraggableDatasetType, index, datasetName },
item: { index, datasetName },
type: DraggableDatasetType,
canDrag: () => isADataset,
});
const [collectedProps, drop] = useDatasetDrop(rowKey, !isADataset);
Expand Down
2 changes: 1 addition & 1 deletion frontend/javascripts/dashboard/dataset_view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import {
import { PricingEnforcedButton } from "components/pricing_enforcers";
import { PricingPlanEnum } from "admin/organization/pricing_plan_utils";
import { MenuProps } from "rc-menu";
import { ItemType } from "antd/lib/menu/hooks/useItems";
import { ItemType } from "antd/es/menu/interface";

type Props = {
user: APIUser;
Expand Down
7 changes: 3 additions & 4 deletions frontend/javascripts/dashboard/folders/folder_tree.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
import { DeleteOutlined, EditOutlined, PlusOutlined } from "@ant-design/icons";
import { Dropdown, Modal, MenuProps, Tree } from "antd";
import Toast from "libs/toast";
import { DragObjectWithType } from "react-dnd";
import { DataNode, DirectoryTreeProps } from "antd/lib/tree";
import memoizeOne from "memoize-one";
import classNames from "classnames";
Expand Down Expand Up @@ -296,17 +295,17 @@ export function useDatasetDrop(
const context = useDatasetCollectionContext();
const { selectedDatasets, setSelectedDatasets } = context;
const [collectedProps, drop] = useDrop<
DragObjectWithType & {
Partial<{
datasetName: string;
},
}>,
void,
{
canDrop: boolean;
isOver: boolean;
}
>({
accept: DraggableDatasetType,
drop: (item: DragObjectWithType & { datasetName: string }) => {
drop: (item: Partial<{ datasetName: string }>) => {
if (selectedDatasets.length > 1) {
if (selectedDatasets.every((ds) => ds.folderId === folderId)) {
Toast.warning(
Expand Down
2 changes: 1 addition & 1 deletion frontend/javascripts/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import { HelpModal } from "oxalis/view/help_modal";
import { PricingPlanEnum } from "admin/organization/pricing_plan_utils";
import messages from "messages";
import { PricingEnforcedSpan } from "components/pricing_enforcers";
import { ItemType, MenuItemType, SubMenuType } from "antd/lib/menu/hooks/useItems";
import { ItemType, MenuItemType, SubMenuType } from "antd/es/menu/interface";
import { MenuClickEventHandler } from "rc-menu/lib/interface";
import constants from "oxalis/constants";
import { MaintenanceBanner, UpgradeVersionBanner } from "banners";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ import Toast from "libs/toast";
import UrlManager from "oxalis/controller/url_manager";
import { withAuthentication } from "admin/auth/authentication_modal";
import { PrivateLinksModal } from "./private_links_view";
import { ItemType, SubMenuType } from "antd/lib/menu/hooks/useItems";
import { ItemType, SubMenuType } from "antd/es/menu/interface";
import CreateAnimationModal from "./create_animation_modal";

const AsyncButtonWithAuthentication = withAuthentication<AsyncButtonProps, typeof AsyncButton>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
setRenderAnimationModalVisibilityAction,
} from "oxalis/model/actions/ui_actions";
import Store, { OxalisState } from "oxalis/store";
import { MenuItemType, SubMenuType } from "antd/lib/menu/hooks/useItems";
import { MenuItemType, SubMenuType } from "antd/es/menu/interface";
import DownloadModalView from "./download_modal_view";
import CreateAnimationModal from "./create_animation_modal";

Expand Down
9 changes: 2 additions & 7 deletions frontend/javascripts/oxalis/view/context_menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,7 @@ import {
proofreadMerge,
} from "oxalis/model/actions/proofread_actions";
import { setPositionAction } from "oxalis/model/actions/flycam_actions";
import {
ItemType,
MenuItemGroupType,
MenuItemType,
SubMenuType,
} from "antd/lib/menu/hooks/useItems";
import { ItemType, MenuItemGroupType, MenuItemType, SubMenuType } from "antd/es/menu/interface";
import { getSegmentBoundingBoxes, getSegmentVolumes } from "admin/admin_rest_api";
import { useFetch } from "libs/react_helpers";
import { AsyncIconButton } from "components/async_clickables";
Expand Down Expand Up @@ -1558,7 +1553,7 @@ function ContextMenuInner(propsWithInputRef: Props) {
nodeContextMenuNode != null && clickedNodesPosition != null
? positionToString(clickedNodesPosition, nodeContextMenuNode.additionalCoordinates)
: "";
const infoRows = [];
const infoRows: ItemType[] = [];

if (maybeClickedNodeId != null && nodeContextMenuTree != null) {
infoRows.push(
Expand Down
4 changes: 1 addition & 3 deletions frontend/javascripts/oxalis/view/help_modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ function HelpButton() {
closable
onClose={discardButton}
onClick={() => setModalOpen(true)}
>
Help
</Alert>
/>
<HelpModal
isModalOpen={isModalOpen}
onCancel={() => setModalOpen(false)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import Toast from "libs/toast";
import { rgbaToCSS } from "oxalis/shaders/utils.glsl";
import { V4 } from "libs/mjs";
import { ChangeColorMenuItemContent } from "components/color_picker";
import { MenuItemType } from "antd/lib/menu/hooks/useItems";
import { MenuItemType } from "antd/es/menu/interface";
import { withMappingActivationConfirmation } from "./segments_view_helper";
import { type AdditionalCoordinate } from "types/api_flow_types";
import { getAdditionalCoordinatesAsString } from "oxalis/model/accessors/flycam_accessor";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ import {
MISSING_GROUP_ID,
} from "../tree_hierarchy_view_helpers";
import { ChangeColorMenuItemContent } from "components/color_picker";
import { ItemType } from "antd/lib/menu/hooks/useItems";
import { pluralize } from "libs/utils";
import AdvancedSearchPopover from "../advanced_search_popover";
import ButtonComponent from "oxalis/view/components/button_component";
Expand All @@ -127,6 +126,7 @@ import { ValueOf } from "types/globals";
import { getContextMenuPositionFromEvent } from "oxalis/view/context_menu";
import FastTooltip from "components/fast_tooltip";
import { ContextMenuContainer } from "../sidebar_context_menu";
import { ItemType } from "antd/es/menu/interface";

const { confirm } = Modal;
const { Option } = Select;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
setCurrToken,
tokenUserA,
writeTypeCheckingFile,
} from "test/enzyme/e2e-setup";
} from "test/e2e-setup";
import type { APIAnnotation } from "types/api_flow_types";
import { APIAnnotationTypeEnum } from "types/api_flow_types";
import { createTreeMapFromTreeArray } from "oxalis/model/reducers/skeletontracing_reducer_helpers";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import _ from "lodash";
import {
tokenUserA,
setCurrToken,
resetDatabase,
writeTypeCheckingFile,
} from "test/enzyme/e2e-setup";
import { tokenUserA, setCurrToken, resetDatabase, writeTypeCheckingFile } from "test/e2e-setup";
import type { APIDataset } from "types/api_flow_types";
import * as api from "admin/admin_rest_api";
import test from "ava";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
resetDatabase,
replaceVolatileValues,
writeTypeCheckingFile,
} from "test/enzyme/e2e-setup";
} from "test/e2e-setup";
import Request from "libs/request";
import * as foldersApi from "admin/api/folders";
import test from "ava";
Expand Down
7 changes: 1 addition & 6 deletions frontend/javascripts/test/backend-snapshot-tests/misc.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
tokenUserA,
setCurrToken,
resetDatabase,
writeTypeCheckingFile,
} from "test/enzyme/e2e-setup";
import { tokenUserA, setCurrToken, resetDatabase, writeTypeCheckingFile } from "test/e2e-setup";
import * as api from "admin/admin_rest_api";
import test from "ava";
test.before("Reset database and change token", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
replaceVolatileValues,
resetDatabase,
writeTypeCheckingFile,
} from "test/enzyme/e2e-setup";
} from "test/e2e-setup";
import type { APIProject, APIProjectUpdater } from "types/api_flow_types";
import * as api from "admin/admin_rest_api";
import test from "ava";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
tokenUserA,
setCurrToken,
resetDatabase,
writeTypeCheckingFile,
} from "test/enzyme/e2e-setup";
import { tokenUserA, setCurrToken, resetDatabase, writeTypeCheckingFile } from "test/e2e-setup";
import * as api from "admin/admin_rest_api";
import test from "ava";
test.before("Reset database", async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from "lodash";
import { resetDatabase, replaceVolatileValues, writeTypeCheckingFile } from "test/enzyme/e2e-setup";
import { resetDatabase, replaceVolatileValues, writeTypeCheckingFile } from "test/e2e-setup";
import * as api from "admin/admin_rest_api";
import test from "ava";
test.before("Reset database", async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import {
tokenUserA,
setCurrToken,
resetDatabase,
writeTypeCheckingFile,
} from "test/enzyme/e2e-setup";
import { tokenUserA, setCurrToken, resetDatabase, writeTypeCheckingFile } from "test/e2e-setup";
import * as api from "admin/admin_rest_api";
import test from "ava";
import { APIAllowedMode } from "types/api_flow_types";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import _ from "lodash";
import {
tokenUserA,
setCurrToken,
resetDatabase,
writeTypeCheckingFile,
} from "test/enzyme/e2e-setup";
import { tokenUserA, setCurrToken, resetDatabase, writeTypeCheckingFile } from "test/e2e-setup";
import * as api from "admin/admin_rest_api";
import test from "ava";
test.before("Reset database and change token", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
tokenUserE,
setCurrToken,
resetDatabase,
} from "test/enzyme/e2e-setup";
} from "test/e2e-setup";
import * as api from "admin/admin_rest_api";
import test from "ava";
test.before("Reset database", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
resetDatabase,
writeTypeCheckingFile,
replaceVolatileValues,
} from "test/enzyme/e2e-setup";
} from "test/e2e-setup";
import * as api from "admin/admin_rest_api";
import test from "ava";
import { APITeam, APIUser } from "types/api_flow_types";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
resetDatabase,
replaceVolatileValues,
writeTypeCheckingFile,
} from "test/enzyme/e2e-setup";
} from "test/e2e-setup";
import * as api from "admin/admin_rest_api";
import test from "ava";
test.before("Reset database and change token", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import "test/mocks/lz4";
import _ from "lodash";
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module 'deep... Remove this comment to see the full error message
import deepForEach from "deep-for-each";
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module 'enzy... Remove this comment to see the full error message
import { configure } from "enzyme";
// @ts-expect-error ts-migrate(7016) FIXME: Could not find a declaration file for module 'node... Remove this comment to see the full error message
import fetch, { Headers, Request, Response, FetchError } from "node-fetch";
import fs from "fs";
Expand Down Expand Up @@ -138,12 +136,6 @@ const a: ${fullTypeAnnotation} = ${JSON.stringify(object)}`,
);
}

// The adapter tries to access document when importing it, so we need to import it down here
const Adapter = require("enzyme-adapter-react-16");

configure({
adapter: new Adapter(),
});
export function resetDatabase() {
console.log("Resetting test database...");
// The parameter needs to be set globally here.
Expand Down
Loading