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

Antd4 migration minor fixes found on cvat.org #2561

Merged
merged 6 commits into from
Dec 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions cvat-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion cvat-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-ui",
"version": "1.13.0",
"version": "1.13.1",
"description": "CVAT single-page application",
"main": "src/index.tsx",
"scripts": {
Expand Down Expand Up @@ -68,6 +68,7 @@
"moment": "^2.29.1",
"platform": "^1.3.6",
"prop-types": "^15.7.2",
"rc-virtual-list": "^3.2.3",
"react": "^16.14.0",
"react-color": "^2.19.3",
"react-cookie": "^4.0.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,16 @@ function AttributeAnnotationSidebar(props: StateToProps & DispatchToProps): JSX.
const collapse = (): void => {
const [collapser] = window.document.getElementsByClassName('attribute-annotation-sidebar');

const listener = (event: TransitionEvent): void => {
if (event.target && event.propertyName === 'width' && event.target === collapser) {
canvasInstance.fitCanvas();
canvasInstance.fit();
(collapser as HTMLElement).removeEventListener('transitionend', listener as any);
}
};

if (collapser) {
collapser.addEventListener(
'transitionend',
() => {
canvasInstance.fitCanvas();
},
{ once: true },
);
(collapser as HTMLElement).addEventListener('transitionend', listener as any);
}

setSidebarCollapsed(!sidebarCollapsed);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-License-Identifier: MIT

import './styles.scss';
import React, { Dispatch, useEffect } from 'react';
import React, { Dispatch, useEffect, TransitionEvent } from 'react';
import { AnyAction } from 'redux';
import { connect } from 'react-redux';
import { MenuFoldOutlined, MenuUnfoldOutlined } from '@ant-design/icons';
Expand Down Expand Up @@ -81,24 +81,22 @@ function ObjectsSideBar(props: StateToProps & DispatchToProps & OwnProps): JSX.E
};
}, []);

useEffect(() => {
const listener = (event: Event): void => {
if (
(event as TransitionEvent).propertyName === 'width' &&
((event.target as any).classList as DOMTokenList).contains('ant-tabs-tab-prev')
) {
const collapse = (): void => {
const [collapser] = window.document.getElementsByClassName('cvat-objects-sidebar');
const listener = (event: TransitionEvent): void => {
if (event.target && event.propertyName === 'width' && event.target === collapser) {
canvasInstance.fitCanvas();
canvasInstance.fit();
(collapser as HTMLElement).removeEventListener('transitionend', listener as any);
}
};

const [sidebar] = window.document.getElementsByClassName('cvat-objects-sidebar');

sidebar.addEventListener('transitionstart', listener);
if (collapser) {
(collapser as HTMLElement).addEventListener('transitionend', listener as any);
}

return () => {
sidebar.removeEventListener('transitionstart', listener);
};
}, []);
collapseSidebar();
};

return (
<Layout.Sider
Expand All @@ -116,7 +114,7 @@ function ObjectsSideBar(props: StateToProps & DispatchToProps & OwnProps): JSX.E
className={`cvat-objects-sidebar-sider
ant-layout-sider-zero-width-trigger
ant-layout-sider-zero-width-trigger-left`}
onClick={collapseSidebar}
onClick={collapse}
>
{sidebarCollapsed ? <MenuFoldOutlined title='Show' /> : <MenuUnfoldOutlined title='Hide' />}
</span>
Expand Down
1 change: 1 addition & 0 deletions cvat-ui/src/components/projects-page/project-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default function ProjectListComponent(): JSX.Element {
<Pagination
className='cvat-projects-pagination'
onChange={changePage}
showSizeChanger={false}
total={projectsCount}
pageSize={12}
current={page}
Expand Down
7 changes: 6 additions & 1 deletion cvat-ui/src/components/task-page/job-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,13 @@ function JobListComponent(props: Props & RouteComponentProps): JSX.Element {
);

if (job.assignee) {
serialized += `\t assigned to: ${job.assignee.username}`;
serialized += `\t assigned to "${job.assignee.username}"`;
}

if (job.reviewer) {
serialized += `\t reviewed by "${job.reviewer.username}"`;
}

serialized += '\n';
}
copy(serialized);
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/src/components/tasks-page/task-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class TaskItemComponent extends React.PureComponent<TaskItemProps & RouteCompone
</Col>
</Row>
<Row>
<Col>
<Col span={24}>
<Progress
className={`${progressColor} cvat-task-progress`}
percent={jobsProgress * 100}
Expand Down
1 change: 1 addition & 0 deletions cvat-ui/src/components/tasks-page/task-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default function TaskListComponent(props: ContentListProps): JSX.Element
<Pagination
className='cvat-tasks-pagination'
onChange={onSwitchPage}
showSizeChanger={false}
total={numberOfTasks}
pageSize={10}
current={currentPage}
Expand Down