From 25527dbe6b015cd0bb89030afb7154c565ebe353 Mon Sep 17 00:00:00 2001 From: gudipudiramanakumar <47365328+gudipudiramanakumar@users.noreply.github.com> Date: Fri, 27 Aug 2021 15:51:13 +0530 Subject: [PATCH 01/17] Test Commit for Remove Range Test Commit for Remove Range --- cvat-ui/src/actions/annotation-actions.ts | 59 +++++++ .../top-bar/annotation-menu.tsx | 86 +++++++++-- .../top-bar/remove-range-confirm.tsx | 83 ++++++++++ .../top-bar/annotation-menu.tsx | 19 ++- .../top-bar/remove-range-confirm.tsx | 145 ++++++++++++++++++ cvat-ui/src/reducers/annotation-reducer.ts | 44 +++++- cvat-ui/src/reducers/interfaces.ts | 5 + 7 files changed, 425 insertions(+), 16 deletions(-) create mode 100644 cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx create mode 100644 cvat-ui/src/containers/annotation-page/top-bar/remove-range-confirm.tsx diff --git a/cvat-ui/src/actions/annotation-actions.ts b/cvat-ui/src/actions/annotation-actions.ts index 96bfb8d20dc6..5d954ee14ed3 100644 --- a/cvat-ui/src/actions/annotation-actions.ts +++ b/cvat-ui/src/actions/annotation-actions.ts @@ -167,6 +167,8 @@ export enum AnnotationActionTypes { UPLOAD_JOB_ANNOTATIONS_FAILED = 'UPLOAD_JOB_ANNOTATIONS_FAILED', REMOVE_JOB_ANNOTATIONS_SUCCESS = 'REMOVE_JOB_ANNOTATIONS_SUCCESS', REMOVE_JOB_ANNOTATIONS_FAILED = 'REMOVE_JOB_ANNOTATIONS_FAILED', + REMOVE_ANNOTATIONS_INRANGE = 'REMOVE_ANNOTATIONS_INRANGE', + CHANGE_REMOVE_ANNOTATIONS_RANGE = 'CHANGE_REMOVE_ANNOTATIONS_RANGE', UPDATE_CANVAS_CONTEXT_MENU = 'UPDATE_CANVAS_CONTEXT_MENU', UNDO_ACTION_SUCCESS = 'UNDO_ACTION_SUCCESS', UNDO_ACTION_FAILED = 'UNDO_ACTION_FAILED', @@ -504,9 +506,66 @@ export function changePropagateFrames(frames: number): AnyAction { }; } + +//Trying to add a function to remove all objects within a range !!! +export function removeObjectsinRangeAsync(sessionInstance: any, startFrame: number, endFrame: number, force: boolean): ThunkAction{ + console.log("IT CAME HERE ATLEAST"); + return async (dispatch: ActionCreator): Promise => { + const { filters, showAllInterpolationTracks } = receiveAnnotationsParameters(); + try { + for(let frame = startFrame; frame<=endFrame; frame++){ + console.log("Frame:"+frame); + dispatch(changeFrameAsync(frame)); + + const states = await sessionInstance.annotations.get(frame, showAllInterpolationTracks, filters ); + + + states.forEach((state: any) => { + console.log("State here:"); + var result = dispatch(removeObjectAsync(sessionInstance,state,force)); + console.log(result); + }); + } + }catch(error){ + dispatch({ + type: AnnotationActionTypes.REMOVE_JOB_ANNOTATIONS_FAILED, + payload: { + error, + }, + }); + + } + } +} + + +export function removeAnnotationsinRange(sessionInstance: any | null): AnyAction { + console.log("Action Ivoked:" +sessionInstance); + return { + type: AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE, + payload: { + sessionInstance, + }, + }; +} + +export function changeRemoveAnnotationRange(startFrame: number, endFrame: number): AnyAction { + console.log("Action Ivoked: changeRange: " +startFrame+" "+endFrame); + return { + type: AnnotationActionTypes.CHANGE_REMOVE_ANNOTATIONS_RANGE, + payload: { + startFrame, + endFrame, + }, + }; +} + export function removeObjectAsync(sessionInstance: any, objectState: any, force: boolean): ThunkAction { + console.log("removeObjectAsync:"+objectState.clientID); return async (dispatch: ActionCreator): Promise => { try { + console.log(objectState); + console.log(objectState.clientID); await sessionInstance.logger.log(LogType.deleteObject, { count: 1 }); const { frame } = receiveAnnotationsParameters(); diff --git a/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx b/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx index 1a9a10164eb0..40639e41e9a5 100644 --- a/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx +++ b/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx @@ -5,6 +5,7 @@ import React from 'react'; import Menu from 'antd/lib/menu'; import Modal from 'antd/lib/modal'; +import Button from 'antd/lib/button'; // eslint-disable-next-line import/no-extraneous-dependencies import { MenuInfo } from 'rc-menu/lib/interface'; @@ -12,6 +13,8 @@ import ExportDatasetModal from 'components/export-dataset/export-dataset-modal'; import LoadSubmenu from 'components/actions-menu/load-submenu'; import { DimensionType } from '../../../reducers/interfaces'; +import RemoveAnnotationsRangeContainer from 'containers/annotation-page/top-bar/remove-range-confirm'; + interface Props { taskMode: string; loaders: any[]; @@ -20,6 +23,7 @@ interface Props { isReviewer: boolean; jobInstance: any; onClickMenu(params: MenuInfo, file?: File): void; + removeRange(): void; setForceExitAnnotationFlag(forceExit: boolean): void; saveAnnotations(jobInstance: any, afterSave?: () => void): void; } @@ -27,6 +31,7 @@ interface Props { export enum Actions { LOAD_JOB_ANNO = 'load_job_anno', EXPORT_TASK_DATASET = 'export_task_dataset', + REMOVE_ANNO_INRANGE = 'remove_anno_inrange', REMOVE_ANNO = 'remove_anno', OPEN_TASK = 'open_task', REQUEST_REVIEW = 'request_review', @@ -42,6 +47,7 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { isReviewer, jobInstance, onClickMenu, + removeRange, setForceExitAnnotationFlag, saveAnnotations, } = props; @@ -108,20 +114,69 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { } } else if (copyParams.key === Actions.REMOVE_ANNO) { Modal.confirm({ - title: 'All the annotations will be removed', - content: - 'You are going to remove all the annotations from the client. ' + - 'It will stay on the server till you save the job. Continue?', - className: 'cvat-modal-confirm-remove-annotation', - onOk: () => { - onClickMenu(copyParams); - }, - okButtonProps: { - type: 'primary', - danger: true, - }, - okText: 'Delete', - }); + title: 'All the annotations will be removed', + content: + 'You are going to remove all the annotations from the client. ' + + 'It will stay on the server till you save the job. Continue?', + className: 'cvat-modal-confirm-remove-annotation', + onOk: () => { + onClickMenu(copyParams); + }, + okButtonProps: { + type: 'primary', + danger: true, + }, + okText: 'Delete', + }); + } else if (copyParams.key === Actions.REMOVE_ANNO_INRANGE) { + Modal.confirm({ + title: 'Selected range of the annotations will be removed', + content: + 'You are going to remove a arnge of the annotations from the client. ' + + 'It will stay on the server till you save the job. Continue?', + className: 'cvat-modal-confirm-remove-annotation', + onOk: () => { + onClickMenu(copyParams); + }, + okButtonProps: { + type: 'primary', + }, + okText: 'Select Range', + }); + // Modal.confirm({ + // title: 'Remove Annotations', + // content: + // 'Select whether to remove all annotations from the job or remove within a range', + // className: 'cvat-modal-confirm-remove-annotation', + // onOk: () => { + // Modal.confirm({ + // title: 'All the annotations will be removed', + // content: + // 'You are going to remove all the annotations from the client. ' + + // 'It will stay on the server till you save the job. Continue?', + // className: 'cvat-modal-confirm-remove-annotation', + // onOk: () => { + // onClickMenu(copyParams); + // }, + // okButtonProps: { + // type: 'primary', + // danger: true, + // }, + // okText: 'Delete', + // }); + // }, + // okButtonProps: { + // type: 'primary', + // danger: true + // }, + // okText: 'Remove All', + // onCancel: () => { + // copyParams.key = Actions.REMOVE_ANNO_INRANGE; + // console.log("Cancel: This is happening !!"+Actions.REMOVE_ANNO_INRANGE); + // onClickMenu(copyParams); + // }, + // cancelText: "Select Range", + // }); } else if ([Actions.REQUEST_REVIEW].includes(copyParams.key as Actions)) { checkUnsavedChanges(copyParams); } else if (copyParams.key === Actions.FINISH_JOB) { @@ -166,6 +221,8 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { })} Export task dataset Remove annotations + Remove annotations in range + {/* */} e.preventDefault()}> Open the task @@ -178,6 +235,7 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { )} {jobStatus === 'completed' && Renew the job} + ); } diff --git a/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx b/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx new file mode 100644 index 000000000000..c36e9539ea62 --- /dev/null +++ b/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx @@ -0,0 +1,83 @@ +// Copyright (C) 2020-2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +import React from 'react'; + +import Modal from 'antd/lib/modal'; +import InputNumber from 'antd/lib/input-number'; +import Text from 'antd/lib/typography/Text'; +import { clamp } from 'utils/math'; + +interface Props { + visible: boolean; + startFrame: number; + endFrame: number; + frameNumber: number; + stopFrame: number; + removeObject(): void; + cancel(): void; + changeRemoveAnnotationsRange(startFrame: number, endFrame: number): void; +} + +export default function RemoveRangeConfirmComponent(props: Props): JSX.Element { + const { + visible, + startFrame, + endFrame, + frameNumber, + stopFrame, + removeObject, + changeRemoveAnnotationsRange, + cancel, + } = props; + + const minStartFrames = 1; + + const minEndFrames = Math.max(startFrame+1,2); + + return ( + +
+ Do you want to remove the annotations on + { + if (typeof value !== 'undefined') { + value=Math.floor(clamp(+value, 0, stopFrame-1)); + changeRemoveAnnotationsRange(value,endFrame); + } + }} + /> + {startFrame > 1 ? frames : frame } + up to the + { + if (typeof value !== 'undefined') { + value=Math.floor(clamp(+value, 1, stopFrame)); + changeRemoveAnnotationsRange(startFrame,value); + } + }} + /> + frame +
+
+ ); +} diff --git a/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx b/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx index 60d5fef6fa6f..04cb121f779d 100644 --- a/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx +++ b/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx @@ -18,6 +18,7 @@ import { switchRequestReviewDialog as switchRequestReviewDialogAction, switchSubmitReviewDialog as switchSubmitReviewDialogAction, setForceExitAnnotationFlag as setForceExitAnnotationFlagAction, + removeAnnotationsinRange as removeAnnotationsinRangeAction, } from 'actions/annotation-actions'; import { exportActions } from 'actions/export-actions'; @@ -32,6 +33,7 @@ interface DispatchToProps { loadAnnotations(job: any, loader: any, file: File): void; showExportModal(task: any): void; removeAnnotations(sessionInstance: any): void; + removeAnnotationsinRange(sessionInstance: any): void; switchRequestReviewDialog(visible: boolean): void; switchSubmitReviewDialog(visible: boolean): void; setForceExitAnnotationFlag(forceExit: boolean): void; @@ -74,6 +76,10 @@ function mapDispatchToProps(dispatch: any): DispatchToProps { removeAnnotations(sessionInstance: any): void { dispatch(removeAnnotationsAsync(sessionInstance)); }, + removeAnnotationsinRange(sessionInstance: any){ + console.log("Came here: removeAnnotationsinRange(sessionInstance: any) :"+sessionInstance); + dispatch(removeAnnotationsinRangeAction(sessionInstance)); + }, switchRequestReviewDialog(visible: boolean): void { dispatch(switchRequestReviewDialogAction(visible)); }, @@ -103,6 +109,7 @@ function AnnotationMenuContainer(props: Props): JSX.Element { loadActivity, loadAnnotations, showExportModal, + removeAnnotationsinRange, removeAnnotations, switchRequestReviewDialog, switchSubmitReviewDialog, @@ -111,6 +118,10 @@ function AnnotationMenuContainer(props: Props): JSX.Element { updateJob, } = props; + const removeRange= (): void => { + removeAnnotationsinRange(jobInstance); + } + const onClickMenu = (params: MenuInfo, file?: File): void => { if (params.keyPath.length > 1) { const [additionalKey, action] = params.keyPath; @@ -123,9 +134,14 @@ function AnnotationMenuContainer(props: Props): JSX.Element { } } else { const [action] = params.keyPath; + console.log("Action:"+action); if (action === Actions.EXPORT_TASK_DATASET) { + console.log("Came here:" + Actions.EXPORT_TASK_DATASET); showExportModal(jobInstance.task); - } else if (action === Actions.REMOVE_ANNO) { + } else if (action === Actions.REMOVE_ANNO_INRANGE) { + console.log("Came here:" + Actions.REMOVE_ANNO_INRANGE); + removeAnnotationsinRange(jobInstance); + } else if (action === Actions.REMOVE_ANNO) { removeAnnotations(jobInstance); } else if (action === Actions.REQUEST_REVIEW) { switchRequestReviewDialog(true); @@ -154,6 +170,7 @@ function AnnotationMenuContainer(props: Props): JSX.Element { dumpers={dumpers} loadActivity={loadActivity} onClickMenu={onClickMenu} + removeRange={removeRange} setForceExitAnnotationFlag={setForceExitAnnotationFlag} saveAnnotations={saveAnnotations} jobInstance={jobInstance} diff --git a/cvat-ui/src/containers/annotation-page/top-bar/remove-range-confirm.tsx b/cvat-ui/src/containers/annotation-page/top-bar/remove-range-confirm.tsx new file mode 100644 index 000000000000..0438b8dc012f --- /dev/null +++ b/cvat-ui/src/containers/annotation-page/top-bar/remove-range-confirm.tsx @@ -0,0 +1,145 @@ +// Copyright (C) 2020-2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +import React from 'react'; +import { connect } from 'react-redux'; +import Modal from 'antd/lib/modal'; + +import { + removeAnnotationsinRange as removeAnnotationsinRangeAction , + changeRemoveAnnotationRange as changeRemoveAnnotationRangeAction, + removeObjectAsync, + removeObjectsinRangeAsync, + changeFrameAsync, +} from 'actions/annotation-actions'; + +import { CombinedState } from 'reducers/interfaces'; +import RemoveRangeConfirmComponent from 'components/annotation-page/top-bar/remove-range-confirm'; + +interface StateToProps { + objectStates: any[]; + frameNumber: number; + stopFrame: number; + jobInstance: any; + startFrame: number; + endFrame: number; +} + +interface DispatchToProps { + cancel(): void; + removeObject(sessionInstance: any, objectState: any): void; + removeObjectsinRange(sessionInstance: any, startFrame: number, endFrame: number): void; + changeRemoveAnnotationsRange(startFrame: number, endFrame: number): void; + changeFrame(toFrame: number): void; +} + +function mapStateToProps(state: CombinedState): StateToProps { + const { + annotation: { + annotations: { states: objectStates }, + removeinrange: { + sessionInstance: jobInstance, + startFrame: startFrame, + endFrame: endFrame, + }, + job: { + instance: { stopFrame }, + }, + player: { + frame: { number: frameNumber }, + }, + }, + } = state; + + return { + objectStates, + frameNumber, + stopFrame, + jobInstance, + startFrame, + endFrame + }; +} + +function mapDispatchToProps(dispatch: any): DispatchToProps { + return { + removeObjectsinRange(sessionInstance: any, startFrame: number, endFrame: number): void { + dispatch((removeObjectsinRangeAsync(sessionInstance, startFrame, endFrame, true))); + }, + removeObject(sessionInstance: any, objectState: any): void { + dispatch((removeObjectAsync(sessionInstance, objectState, true))); + }, + changeRemoveAnnotationsRange(startFrame: number, endFrame: number): void { + console.log("Cont Function Ivoked: changeRange: " +startFrame+" "+endFrame); + dispatch(changeRemoveAnnotationRangeAction(startFrame,endFrame)); + }, + async changeFrame(toFrame: number){ + return dispatch(await changeFrameAsync(toFrame)); + }, + cancel(): void { + dispatch(removeAnnotationsinRangeAction(null)); + }, + }; +} + +type Props = StateToProps & DispatchToProps; +class RemoveAnnotationsRangeContainer extends React.PureComponent { + private removeObject = (): void => { + console.log("Reached removeRange()"); + const { + removeObject, removeObjectsinRange,objectStates,jobInstance, cancel, startFrame, endFrame + } = this.props; + console.log("startFrame:" + startFrame + " endFrame:" + endFrame); + removeObjectsinRange(jobInstance, startFrame, endFrame); + cancel(); + // for(let frame=startFrame; frame{ + // objectStates.forEach((objectState: any) => { + // if(objectState.lock){ + // Modal.confirm({ + // className: 'cvat-modal-confirm', + // title: 'Object '+ objectState.label.id + objectState.clientID + ' is locked', + // content: 'Are you sure you want to remove it?', + // onOk() { + // removeObject(jobInstance,objectState); + // }, + // }); + // }else{ + // removeObject(jobInstance,objectState); + // } + // }); + // }); + // } + }; + + + private changeRemoveAnnotationsRange = (startFrame: number, endFrame: number): void => { + console.log("Cont Function Ivoked: changeRange: " +startFrame+" "+endFrame); + const { changeRemoveAnnotationsRange } = this.props; + changeRemoveAnnotationsRange(startFrame,endFrame); + }; + + + public render(): JSX.Element { + const { + startFrame,frameNumber, endFrame, stopFrame, cancel, jobInstance, + } = this.props; + + + return ( + + ); + } +} + +export default connect(mapStateToProps, mapDispatchToProps)(RemoveAnnotationsRangeContainer); diff --git a/cvat-ui/src/reducers/annotation-reducer.ts b/cvat-ui/src/reducers/annotation-reducer.ts index eb71b8fa16f0..7c2bcf3268b1 100644 --- a/cvat-ui/src/reducers/annotation-reducer.ts +++ b/cvat-ui/src/reducers/annotation-reducer.ts @@ -108,6 +108,11 @@ const defaultState: AnnotationState = { collecting: false, data: null, }, + removeinrange: { + sessionInstance: null, + startFrame: 0, + endFrame: 0, + }, aiToolsRef: React.createRef(), colors: [], sidebarCollapsed: false, @@ -818,7 +823,8 @@ export default (state = defaultState, action: AnyAction): AnnotationState => { } case AnnotationActionTypes.CHANGE_PROPAGATE_FRAMES: { const { frames } = action.payload; - + console.log("Reducer invoked: CHANGE_PROPAGATE_FRAMES"); + console.log("Frames: "+frames); return { ...state, propagate: { @@ -945,6 +951,42 @@ export default (state = defaultState, action: AnyAction): AnnotationState => { }, }; } + //Added Remove Annotations in Range + case AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE_SUCCESS: { + console.log("Reducer Invoked : REMOVE_ANNOTATIONS_INRANGE_SUCCESS"); + const { sessionInstance } = action.payload; + return { + ...state, + removeinrange: { + ...state.removeinrange, + sessionInstance, + }, + }; + } + case AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE: { + console.log("Reducer Invoked : REMOVE_ANNOTATIONS_INRANGE"); + const { sessionInstance } = action.payload; + return { + ...state, + removeinrange: { + ...state.removeinrange, + sessionInstance, + }, + }; + } + case AnnotationActionTypes.CHANGE_REMOVE_ANNOTATIONS_RANGE: { + console.log("Reducer Invoked : CHANGE_REMOVE_ANNOTATIONS_RANGE"); + const { startFrame, endFrame } = action.payload; + console.log("startFrame:" + startFrame + " endFrame:" + endFrame); + return { + ...state, + removeinrange: { + ...state.removeinrange, + startFrame, + endFrame, + }, + }; + } case AnnotationActionTypes.UPDATE_CANVAS_CONTEXT_MENU: { const { visible, left, top, type, pointID, diff --git a/cvat-ui/src/reducers/interfaces.ts b/cvat-ui/src/reducers/interfaces.ts index ef11a8207463..15786fa56b97 100644 --- a/cvat-ui/src/reducers/interfaces.ts +++ b/cvat-ui/src/reducers/interfaces.ts @@ -505,6 +505,11 @@ export interface AnnotationState { visible: boolean; data: any; }; + removeinrange: { + sessionInstance: any | null; + startFrame: number; + endFrame: number; + }; colors: any[]; filtersPanelVisible: boolean; requestReviewDialogVisible: boolean; From aab67f4403d957b17b9fb9eb4d4d56610fd2b942 Mon Sep 17 00:00:00 2001 From: gudipudiramanakumar <47365328+gudipudiramanakumar@users.noreply.github.com> Date: Sat, 28 Aug 2021 10:58:50 +0530 Subject: [PATCH 02/17] Remove annotations in range merged with remove annotations button merged Remove annotations in range merged with remove annotations button merged --- cvat-ui/src/actions/annotation-actions.ts | 32 +++++--- .../top-bar/annotation-menu.tsx | 75 ++++++------------- .../top-bar/remove-range-confirm.tsx | 14 ++-- .../top-bar/annotation-menu.tsx | 8 +- .../top-bar/remove-range-confirm.tsx | 37 ++------- cvat-ui/src/reducers/annotation-reducer.ts | 9 +-- 6 files changed, 58 insertions(+), 117 deletions(-) diff --git a/cvat-ui/src/actions/annotation-actions.ts b/cvat-ui/src/actions/annotation-actions.ts index 5d954ee14ed3..0d1c2b1009d2 100644 --- a/cvat-ui/src/actions/annotation-actions.ts +++ b/cvat-ui/src/actions/annotation-actions.ts @@ -167,6 +167,8 @@ export enum AnnotationActionTypes { UPLOAD_JOB_ANNOTATIONS_FAILED = 'UPLOAD_JOB_ANNOTATIONS_FAILED', REMOVE_JOB_ANNOTATIONS_SUCCESS = 'REMOVE_JOB_ANNOTATIONS_SUCCESS', REMOVE_JOB_ANNOTATIONS_FAILED = 'REMOVE_JOB_ANNOTATIONS_FAILED', + REMOVE_ANNOTATIONS_INRANGE_SUCCESS = 'REMOVE_ANNOTATIONS_INRANGE_SUCCESS', + REMOVE_ANNOTATIONS_INRANGE_FAILED = 'REMOVE_ANNOTATIONS_INRANGE_FAILED', REMOVE_ANNOTATIONS_INRANGE = 'REMOVE_ANNOTATIONS_INRANGE', CHANGE_REMOVE_ANNOTATIONS_RANGE = 'CHANGE_REMOVE_ANNOTATIONS_RANGE', UPDATE_CANVAS_CONTEXT_MENU = 'UPDATE_CANVAS_CONTEXT_MENU', @@ -508,39 +510,49 @@ export function changePropagateFrames(frames: number): AnyAction { //Trying to add a function to remove all objects within a range !!! -export function removeObjectsinRangeAsync(sessionInstance: any, startFrame: number, endFrame: number, force: boolean): ThunkAction{ - console.log("IT CAME HERE ATLEAST"); +export function removeAnnotationsinRangeAsync(sessionInstance: any, startFrame: number, endFrame: number, force: boolean): ThunkAction{ return async (dispatch: ActionCreator): Promise => { const { filters, showAllInterpolationTracks } = receiveAnnotationsParameters(); try { + var removedAll = true; for(let frame = startFrame; frame<=endFrame; frame++){ - console.log("Frame:"+frame); dispatch(changeFrameAsync(frame)); const states = await sessionInstance.annotations.get(frame, showAllInterpolationTracks, filters ); states.forEach((state: any) => { - console.log("State here:"); var result = dispatch(removeObjectAsync(sessionInstance,state,force)); - console.log(result); + if(result.type === AnnotationActionTypes.REMOVE_OBJECT_FAILED) + removedAll = false; }); } + + if(removedAll) { + dispatch({ + type: AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE_SUCCESS, + payload: { + startFrame, + endFrame, + }, + }); + }else { + throw new Error('Could not remove the locked objects'); + } + }catch(error){ dispatch({ - type: AnnotationActionTypes.REMOVE_JOB_ANNOTATIONS_FAILED, + type: AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE_FAILED, payload: { error, }, }); - } } } export function removeAnnotationsinRange(sessionInstance: any | null): AnyAction { - console.log("Action Ivoked:" +sessionInstance); return { type: AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE, payload: { @@ -550,7 +562,6 @@ export function removeAnnotationsinRange(sessionInstance: any | null): AnyAction } export function changeRemoveAnnotationRange(startFrame: number, endFrame: number): AnyAction { - console.log("Action Ivoked: changeRange: " +startFrame+" "+endFrame); return { type: AnnotationActionTypes.CHANGE_REMOVE_ANNOTATIONS_RANGE, payload: { @@ -561,11 +572,8 @@ export function changeRemoveAnnotationRange(startFrame: number, endFrame: number } export function removeObjectAsync(sessionInstance: any, objectState: any, force: boolean): ThunkAction { - console.log("removeObjectAsync:"+objectState.clientID); return async (dispatch: ActionCreator): Promise => { try { - console.log(objectState); - console.log(objectState.clientID); await sessionInstance.logger.log(LogType.deleteObject, { count: 1 }); const { frame } = receiveAnnotationsParameters(); diff --git a/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx b/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx index 40639e41e9a5..c53cf5607f5c 100644 --- a/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx +++ b/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx @@ -31,7 +31,6 @@ interface Props { export enum Actions { LOAD_JOB_ANNO = 'load_job_anno', EXPORT_TASK_DATASET = 'export_task_dataset', - REMOVE_ANNO_INRANGE = 'remove_anno_inrange', REMOVE_ANNO = 'remove_anno', OPEN_TASK = 'open_task', REQUEST_REVIEW = 'request_review', @@ -112,8 +111,15 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { } else { onClickMenu(copyParams); } - } else if (copyParams.key === Actions.REMOVE_ANNO) { + } else if (copyParams.key === Actions.REMOVE_ANNO) { Modal.confirm({ + title: 'Remove Annotations', + content: + 'Select whether to remove all annotations from the job or remove within a range' + '\n' + + 'It will stay on the server till you save the job. Continue?', + className: 'cvat-modal-confirm-remove-annotation', + onOk: () => { + Modal.confirm({ title: 'All the annotations will be removed', content: 'You are going to remove all the annotations from the client. ' + @@ -128,55 +134,20 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { }, okText: 'Delete', }); - } else if (copyParams.key === Actions.REMOVE_ANNO_INRANGE) { - Modal.confirm({ - title: 'Selected range of the annotations will be removed', - content: - 'You are going to remove a arnge of the annotations from the client. ' + - 'It will stay on the server till you save the job. Continue?', - className: 'cvat-modal-confirm-remove-annotation', - onOk: () => { - onClickMenu(copyParams); - }, - okButtonProps: { - type: 'primary', - }, - okText: 'Select Range', - }); - // Modal.confirm({ - // title: 'Remove Annotations', - // content: - // 'Select whether to remove all annotations from the job or remove within a range', - // className: 'cvat-modal-confirm-remove-annotation', - // onOk: () => { - // Modal.confirm({ - // title: 'All the annotations will be removed', - // content: - // 'You are going to remove all the annotations from the client. ' + - // 'It will stay on the server till you save the job. Continue?', - // className: 'cvat-modal-confirm-remove-annotation', - // onOk: () => { - // onClickMenu(copyParams); - // }, - // okButtonProps: { - // type: 'primary', - // danger: true, - // }, - // okText: 'Delete', - // }); - // }, - // okButtonProps: { - // type: 'primary', - // danger: true - // }, - // okText: 'Remove All', - // onCancel: () => { - // copyParams.key = Actions.REMOVE_ANNO_INRANGE; - // console.log("Cancel: This is happening !!"+Actions.REMOVE_ANNO_INRANGE); - // onClickMenu(copyParams); - // }, - // cancelText: "Select Range", - // }); + }, + okButtonProps: { + type: 'primary', + danger: true + }, + okText: 'Remove All', + onCancel: () => { + removeRange(); + }, + cancelText: "Select Range", + cancelButtonProps: { + type: 'primary', + }, + }); } else if ([Actions.REQUEST_REVIEW].includes(copyParams.key as Actions)) { checkUnsavedChanges(copyParams); } else if (copyParams.key === Actions.FINISH_JOB) { @@ -221,8 +192,6 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { })} Export task dataset Remove annotations - Remove annotations in range - {/* */}
e.preventDefault()}> Open the task diff --git a/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx b/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx index c36e9539ea62..c7c1efecd031 100644 --- a/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx +++ b/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx @@ -15,7 +15,7 @@ interface Props { endFrame: number; frameNumber: number; stopFrame: number; - removeObject(): void; + removeinRange(): void; cancel(): void; changeRemoveAnnotationsRange(startFrame: number, endFrame: number): void; } @@ -27,23 +27,23 @@ export default function RemoveRangeConfirmComponent(props: Props): JSX.Element { endFrame, frameNumber, stopFrame, - removeObject, + removeinRange, changeRemoveAnnotationsRange, cancel, } = props; - const minStartFrames = 1; + const minStartFrames = 0; - const minEndFrames = Math.max(startFrame+1,2); + const minEndFrames = Math.max(startFrame,0); return (
@@ -52,7 +52,7 @@ export default function RemoveRangeConfirmComponent(props: Props): JSX.Element { className='cvat-propagate-confirm-object-on-frames' size='small' min={minStartFrames} - max={stopFrame-1} + max={stopFrame} value={startFrame} onChange={(value: number | undefined | string) => { if (typeof value !== 'undefined') { diff --git a/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx b/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx index 04cb121f779d..4cb43fdaff5c 100644 --- a/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx +++ b/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx @@ -77,7 +77,6 @@ function mapDispatchToProps(dispatch: any): DispatchToProps { dispatch(removeAnnotationsAsync(sessionInstance)); }, removeAnnotationsinRange(sessionInstance: any){ - console.log("Came here: removeAnnotationsinRange(sessionInstance: any) :"+sessionInstance); dispatch(removeAnnotationsinRangeAction(sessionInstance)); }, switchRequestReviewDialog(visible: boolean): void { @@ -134,14 +133,9 @@ function AnnotationMenuContainer(props: Props): JSX.Element { } } else { const [action] = params.keyPath; - console.log("Action:"+action); if (action === Actions.EXPORT_TASK_DATASET) { - console.log("Came here:" + Actions.EXPORT_TASK_DATASET); showExportModal(jobInstance.task); - } else if (action === Actions.REMOVE_ANNO_INRANGE) { - console.log("Came here:" + Actions.REMOVE_ANNO_INRANGE); - removeAnnotationsinRange(jobInstance); - } else if (action === Actions.REMOVE_ANNO) { + } else if (action === Actions.REMOVE_ANNO) { removeAnnotations(jobInstance); } else if (action === Actions.REQUEST_REVIEW) { switchRequestReviewDialog(true); diff --git a/cvat-ui/src/containers/annotation-page/top-bar/remove-range-confirm.tsx b/cvat-ui/src/containers/annotation-page/top-bar/remove-range-confirm.tsx index 0438b8dc012f..1597d3c83e6f 100644 --- a/cvat-ui/src/containers/annotation-page/top-bar/remove-range-confirm.tsx +++ b/cvat-ui/src/containers/annotation-page/top-bar/remove-range-confirm.tsx @@ -9,8 +9,7 @@ import Modal from 'antd/lib/modal'; import { removeAnnotationsinRange as removeAnnotationsinRangeAction , changeRemoveAnnotationRange as changeRemoveAnnotationRangeAction, - removeObjectAsync, - removeObjectsinRangeAsync, + removeAnnotationsinRangeAsync, changeFrameAsync, } from 'actions/annotation-actions'; @@ -28,7 +27,6 @@ interface StateToProps { interface DispatchToProps { cancel(): void; - removeObject(sessionInstance: any, objectState: any): void; removeObjectsinRange(sessionInstance: any, startFrame: number, endFrame: number): void; changeRemoveAnnotationsRange(startFrame: number, endFrame: number): void; changeFrame(toFrame: number): void; @@ -65,13 +63,9 @@ function mapStateToProps(state: CombinedState): StateToProps { function mapDispatchToProps(dispatch: any): DispatchToProps { return { removeObjectsinRange(sessionInstance: any, startFrame: number, endFrame: number): void { - dispatch((removeObjectsinRangeAsync(sessionInstance, startFrame, endFrame, true))); - }, - removeObject(sessionInstance: any, objectState: any): void { - dispatch((removeObjectAsync(sessionInstance, objectState, true))); + dispatch((removeAnnotationsinRangeAsync(sessionInstance, startFrame, endFrame, false))); }, changeRemoveAnnotationsRange(startFrame: number, endFrame: number): void { - console.log("Cont Function Ivoked: changeRange: " +startFrame+" "+endFrame); dispatch(changeRemoveAnnotationRangeAction(startFrame,endFrame)); }, async changeFrame(toFrame: number){ @@ -85,37 +79,16 @@ function mapDispatchToProps(dispatch: any): DispatchToProps { type Props = StateToProps & DispatchToProps; class RemoveAnnotationsRangeContainer extends React.PureComponent { - private removeObject = (): void => { - console.log("Reached removeRange()"); + private removeinRange = (): void => { const { - removeObject, removeObjectsinRange,objectStates,jobInstance, cancel, startFrame, endFrame + removeObjectsinRange,jobInstance, cancel, startFrame, endFrame } = this.props; - console.log("startFrame:" + startFrame + " endFrame:" + endFrame); removeObjectsinRange(jobInstance, startFrame, endFrame); cancel(); - // for(let frame=startFrame; frame{ - // objectStates.forEach((objectState: any) => { - // if(objectState.lock){ - // Modal.confirm({ - // className: 'cvat-modal-confirm', - // title: 'Object '+ objectState.label.id + objectState.clientID + ' is locked', - // content: 'Are you sure you want to remove it?', - // onOk() { - // removeObject(jobInstance,objectState); - // }, - // }); - // }else{ - // removeObject(jobInstance,objectState); - // } - // }); - // }); - // } }; private changeRemoveAnnotationsRange = (startFrame: number, endFrame: number): void => { - console.log("Cont Function Ivoked: changeRange: " +startFrame+" "+endFrame); const { changeRemoveAnnotationsRange } = this.props; changeRemoveAnnotationsRange(startFrame,endFrame); }; @@ -134,7 +107,7 @@ class RemoveAnnotationsRangeContainer extends React.PureComponent { endFrame={endFrame} frameNumber={frameNumber} stopFrame={stopFrame} - removeObject={this.removeObject} + removeinRange={this.removeinRange} changeRemoveAnnotationsRange={this.changeRemoveAnnotationsRange} cancel={cancel} /> diff --git a/cvat-ui/src/reducers/annotation-reducer.ts b/cvat-ui/src/reducers/annotation-reducer.ts index 7c2bcf3268b1..bc47d844d426 100644 --- a/cvat-ui/src/reducers/annotation-reducer.ts +++ b/cvat-ui/src/reducers/annotation-reducer.ts @@ -953,18 +953,17 @@ export default (state = defaultState, action: AnyAction): AnnotationState => { } //Added Remove Annotations in Range case AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE_SUCCESS: { - console.log("Reducer Invoked : REMOVE_ANNOTATIONS_INRANGE_SUCCESS"); - const { sessionInstance } = action.payload; + const { sessionInstance, startFrame, endFrame } = action.payload; return { ...state, removeinrange: { ...state.removeinrange, - sessionInstance, + startFrame, + endFrame, }, }; } case AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE: { - console.log("Reducer Invoked : REMOVE_ANNOTATIONS_INRANGE"); const { sessionInstance } = action.payload; return { ...state, @@ -975,9 +974,7 @@ export default (state = defaultState, action: AnyAction): AnnotationState => { }; } case AnnotationActionTypes.CHANGE_REMOVE_ANNOTATIONS_RANGE: { - console.log("Reducer Invoked : CHANGE_REMOVE_ANNOTATIONS_RANGE"); const { startFrame, endFrame } = action.payload; - console.log("startFrame:" + startFrame + " endFrame:" + endFrame); return { ...state, removeinrange: { From a0855540d0058182eaf3f905bb45430a4f81975d Mon Sep 17 00:00:00 2001 From: gudipudiramanakumar <47365328+gudipudiramanakumar@users.noreply.github.com> Date: Sat, 28 Aug 2021 11:02:21 +0530 Subject: [PATCH 03/17] Update annotation-reducer.ts --- cvat-ui/src/reducers/annotation-reducer.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/cvat-ui/src/reducers/annotation-reducer.ts b/cvat-ui/src/reducers/annotation-reducer.ts index bc47d844d426..59d7de000545 100644 --- a/cvat-ui/src/reducers/annotation-reducer.ts +++ b/cvat-ui/src/reducers/annotation-reducer.ts @@ -823,8 +823,6 @@ export default (state = defaultState, action: AnyAction): AnnotationState => { } case AnnotationActionTypes.CHANGE_PROPAGATE_FRAMES: { const { frames } = action.payload; - console.log("Reducer invoked: CHANGE_PROPAGATE_FRAMES"); - console.log("Frames: "+frames); return { ...state, propagate: { From 7839fe8ee5a83361753b3b73cc52c2db6dd3b4ed Mon Sep 17 00:00:00 2001 From: gudipudiramanakumar <47365328+gudipudiramanakumar@users.noreply.github.com> Date: Sat, 28 Aug 2021 18:38:03 +0530 Subject: [PATCH 04/17] Update annotation-actions.ts --- cvat-ui/src/actions/annotation-actions.ts | 31 +++++++++-------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/cvat-ui/src/actions/annotation-actions.ts b/cvat-ui/src/actions/annotation-actions.ts index 0d1c2b1009d2..846f0ca4bacd 100644 --- a/cvat-ui/src/actions/annotation-actions.ts +++ b/cvat-ui/src/actions/annotation-actions.ts @@ -509,36 +509,29 @@ export function changePropagateFrames(frames: number): AnyAction { } -//Trying to add a function to remove all objects within a range !!! +//To remove annotation objects present in given range of frames export function removeAnnotationsinRangeAsync(sessionInstance: any, startFrame: number, endFrame: number, force: boolean): ThunkAction{ return async (dispatch: ActionCreator): Promise => { const { filters, showAllInterpolationTracks } = receiveAnnotationsParameters(); try { - var removedAll = true; + for(let frame = startFrame; frame<=endFrame; frame++){ - dispatch(changeFrameAsync(frame)); + await dispatch(changeFrameAsync(frame)); const states = await sessionInstance.annotations.get(frame, showAllInterpolationTracks, filters ); - - states.forEach((state: any) => { - var result = dispatch(removeObjectAsync(sessionInstance,state,force)); - if(result.type === AnnotationActionTypes.REMOVE_OBJECT_FAILED) - removedAll = false; + states.forEach(async (state: any) => { + await dispatch(removeObjectAsync(sessionInstance,state,force)); }); } - if(removedAll) { - dispatch({ - type: AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE_SUCCESS, - payload: { - startFrame, - endFrame, - }, - }); - }else { - throw new Error('Could not remove the locked objects'); - } + dispatch({ + type: AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE_SUCCESS, + payload: { + startFrame, + endFrame, + }, + }); }catch(error){ dispatch({ From c092a56c10a28afe6951024c311e68619a7b0d23 Mon Sep 17 00:00:00 2001 From: gudipudiramanakumar <47365328+gudipudiramanakumar@users.noreply.github.com> Date: Sat, 28 Aug 2021 18:38:15 +0530 Subject: [PATCH 05/17] Update annotation-reducer.ts --- cvat-ui/src/reducers/annotation-reducer.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/cvat-ui/src/reducers/annotation-reducer.ts b/cvat-ui/src/reducers/annotation-reducer.ts index 59d7de000545..9f39b791094f 100644 --- a/cvat-ui/src/reducers/annotation-reducer.ts +++ b/cvat-ui/src/reducers/annotation-reducer.ts @@ -823,6 +823,7 @@ export default (state = defaultState, action: AnyAction): AnnotationState => { } case AnnotationActionTypes.CHANGE_PROPAGATE_FRAMES: { const { frames } = action.payload; + return { ...state, propagate: { From cde900f8d0be7f902606323e7fad762ec4a0b2ff Mon Sep 17 00:00:00 2001 From: gudipudiramanakumar <47365328+gudipudiramanakumar@users.noreply.github.com> Date: Wed, 13 Oct 2021 00:35:52 +0530 Subject: [PATCH 06/17] Converting remove range component to hook based component Removed all the global states previously used and converted all the parameters to local state in annotation menu and remove range component. --- cvat-ui/src/actions/annotation-actions.ts | 27 +-- .../top-bar/annotation-menu.tsx | 21 +- .../top-bar/remove-range-confirm.tsx | 24 +- .../top-bar/annotation-menu.tsx | 23 +- .../top-bar/remove-range-confirm.tsx | 118 --------- cvat-ui/src/reducers/annotation-reducer.ts | 31 +-- cvat-ui/src/reducers/interfaces.ts | 5 - tests/.nyc_output/out.json | 1 + tests/coverage/clover.xml | 6 + tests/coverage/coverage-final.json | 1 + tests/coverage/coverage-summary.json | 2 + tests/coverage/lcov-report/base.css | 224 ++++++++++++++++++ .../coverage/lcov-report/block-navigation.js | 79 ++++++ tests/coverage/lcov-report/favicon.png | Bin 0 -> 540 bytes tests/coverage/lcov-report/index.html | 96 ++++++++ tests/coverage/lcov-report/prettify.css | 1 + tests/coverage/lcov-report/prettify.js | 2 + .../lcov-report/sort-arrow-sprite.png | Bin 0 -> 209 bytes tests/coverage/lcov-report/sorter.js | 170 +++++++++++++ tests/coverage/lcov.info | 0 tests/package-lock.json | 132 ++++++----- tests/package.json | 2 +- 22 files changed, 708 insertions(+), 257 deletions(-) delete mode 100644 cvat-ui/src/containers/annotation-page/top-bar/remove-range-confirm.tsx create mode 100644 tests/.nyc_output/out.json create mode 100644 tests/coverage/clover.xml create mode 100644 tests/coverage/coverage-final.json create mode 100644 tests/coverage/coverage-summary.json create mode 100644 tests/coverage/lcov-report/base.css create mode 100644 tests/coverage/lcov-report/block-navigation.js create mode 100644 tests/coverage/lcov-report/favicon.png create mode 100644 tests/coverage/lcov-report/index.html create mode 100644 tests/coverage/lcov-report/prettify.css create mode 100644 tests/coverage/lcov-report/prettify.js create mode 100644 tests/coverage/lcov-report/sort-arrow-sprite.png create mode 100644 tests/coverage/lcov-report/sorter.js create mode 100644 tests/coverage/lcov.info diff --git a/cvat-ui/src/actions/annotation-actions.ts b/cvat-ui/src/actions/annotation-actions.ts index 846f0ca4bacd..a3104a57b1a0 100644 --- a/cvat-ui/src/actions/annotation-actions.ts +++ b/cvat-ui/src/actions/annotation-actions.ts @@ -169,8 +169,6 @@ export enum AnnotationActionTypes { REMOVE_JOB_ANNOTATIONS_FAILED = 'REMOVE_JOB_ANNOTATIONS_FAILED', REMOVE_ANNOTATIONS_INRANGE_SUCCESS = 'REMOVE_ANNOTATIONS_INRANGE_SUCCESS', REMOVE_ANNOTATIONS_INRANGE_FAILED = 'REMOVE_ANNOTATIONS_INRANGE_FAILED', - REMOVE_ANNOTATIONS_INRANGE = 'REMOVE_ANNOTATIONS_INRANGE', - CHANGE_REMOVE_ANNOTATIONS_RANGE = 'CHANGE_REMOVE_ANNOTATIONS_RANGE', UPDATE_CANVAS_CONTEXT_MENU = 'UPDATE_CANVAS_CONTEXT_MENU', UNDO_ACTION_SUCCESS = 'UNDO_ACTION_SUCCESS', UNDO_ACTION_FAILED = 'UNDO_ACTION_FAILED', @@ -527,10 +525,7 @@ export function removeAnnotationsinRangeAsync(sessionInstance: any, startFrame: dispatch({ type: AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE_SUCCESS, - payload: { - startFrame, - endFrame, - }, + payload: { }, }); }catch(error){ @@ -544,26 +539,6 @@ export function removeAnnotationsinRangeAsync(sessionInstance: any, startFrame: } } - -export function removeAnnotationsinRange(sessionInstance: any | null): AnyAction { - return { - type: AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE, - payload: { - sessionInstance, - }, - }; -} - -export function changeRemoveAnnotationRange(startFrame: number, endFrame: number): AnyAction { - return { - type: AnnotationActionTypes.CHANGE_REMOVE_ANNOTATIONS_RANGE, - payload: { - startFrame, - endFrame, - }, - }; -} - export function removeObjectAsync(sessionInstance: any, objectState: any, force: boolean): ThunkAction { return async (dispatch: ActionCreator): Promise => { try { diff --git a/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx b/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx index c53cf5607f5c..7bcd8031f8a2 100644 --- a/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx +++ b/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx @@ -3,6 +3,7 @@ // SPDX-License-Identifier: MIT import React from 'react'; +import { useState } from 'react'; import Menu from 'antd/lib/menu'; import Modal from 'antd/lib/modal'; import Button from 'antd/lib/button'; @@ -13,7 +14,7 @@ import ExportDatasetModal from 'components/export-dataset/export-dataset-modal'; import LoadSubmenu from 'components/actions-menu/load-submenu'; import { DimensionType } from '../../../reducers/interfaces'; -import RemoveAnnotationsRangeContainer from 'containers/annotation-page/top-bar/remove-range-confirm'; +import RemoveAnnotationsRangeComponent from './remove-range-confirm'; interface Props { taskMode: string; @@ -22,8 +23,9 @@ interface Props { loadActivity: string | null; isReviewer: boolean; jobInstance: any; + stopFrame: number; onClickMenu(params: MenuInfo, file?: File): void; - removeRange(): void; + removeRange(startnumber: number, endnumber: number): void; setForceExitAnnotationFlag(forceExit: boolean): void; saveAnnotations(jobInstance: any, afterSave?: () => void): void; } @@ -45,12 +47,15 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { loadActivity, isReviewer, jobInstance, + stopFrame, onClickMenu, removeRange, setForceExitAnnotationFlag, saveAnnotations, } = props; + const [openRemoveRangeComponent, toggleOpenRemoveRangeComponent] = useState(false); + const jobStatus = jobInstance.status; const taskID = jobInstance.task.id; @@ -141,7 +146,7 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { }, okText: 'Remove All', onCancel: () => { - removeRange(); + toggleOpenRemoveRangeComponent(!openRemoveRangeComponent); }, cancelText: "Select Range", cancelButtonProps: { @@ -179,6 +184,7 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { const is2d = jobInstance.task.dimension === DimensionType.DIM_2D; + return ( {LoadSubmenu({ @@ -204,7 +210,14 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { )} {jobStatus === 'completed' && Renew the job} - + {toggleOpenRemoveRangeComponent(!openRemoveRangeComponent)}} + > + {/* */} + ); } diff --git a/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx b/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx index c7c1efecd031..33903e07d0e4 100644 --- a/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx +++ b/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx @@ -3,6 +3,7 @@ // SPDX-License-Identifier: MIT import React from 'react'; +import { useState } from 'react'; import Modal from 'antd/lib/modal'; import InputNumber from 'antd/lib/input-number'; @@ -11,37 +12,32 @@ import { clamp } from 'utils/math'; interface Props { visible: boolean; - startFrame: number; - endFrame: number; - frameNumber: number; stopFrame: number; - removeinRange(): void; + removeinRange(startnumber:number, endnumber:number): void; cancel(): void; - changeRemoveAnnotationsRange(startFrame: number, endFrame: number): void; } export default function RemoveRangeConfirmComponent(props: Props): JSX.Element { const { visible, - startFrame, - endFrame, - frameNumber, stopFrame, removeinRange, - changeRemoveAnnotationsRange, cancel, } = props; const minStartFrames = 0; - const minEndFrames = Math.max(startFrame,0); + const [startFrame, managestart] = useState(0); + const [endFrame, manageend] = useState(1); + + const minEndFrames = Math.max(startFrame,1); return ( {removeinRange(startFrame,endFrame);}} onCancel={cancel} title='Confirm to remove annotations in range' visible={visible} @@ -57,7 +53,7 @@ export default function RemoveRangeConfirmComponent(props: Props): JSX.Element { onChange={(value: number | undefined | string) => { if (typeof value !== 'undefined') { value=Math.floor(clamp(+value, 0, stopFrame-1)); - changeRemoveAnnotationsRange(value,endFrame); + managestart(value); } }} /> @@ -71,8 +67,8 @@ export default function RemoveRangeConfirmComponent(props: Props): JSX.Element { value={endFrame} onChange={(value: number | undefined | string) => { if (typeof value !== 'undefined') { - value=Math.floor(clamp(+value, 1, stopFrame)); - changeRemoveAnnotationsRange(startFrame,value); + value= Math.floor(clamp(+value, 1, stopFrame)); + manageend(value); } }} /> diff --git a/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx b/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx index 4cb43fdaff5c..e6fcd9381e23 100644 --- a/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx +++ b/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx @@ -19,12 +19,14 @@ import { switchSubmitReviewDialog as switchSubmitReviewDialogAction, setForceExitAnnotationFlag as setForceExitAnnotationFlagAction, removeAnnotationsinRange as removeAnnotationsinRangeAction, + removeAnnotationsinRangeAsync as removeAnnotationsinRangeAsyncAction, } from 'actions/annotation-actions'; import { exportActions } from 'actions/export-actions'; interface StateToProps { annotationFormats: any; jobInstance: any; + stopFrame: any; loadActivity: string | null; user: any; } @@ -34,6 +36,7 @@ interface DispatchToProps { showExportModal(task: any): void; removeAnnotations(sessionInstance: any): void; removeAnnotationsinRange(sessionInstance: any): void; + removeAnnotationinRangeAsync(sessionInstance: any, startnumber:number, endnumber:number): void; switchRequestReviewDialog(visible: boolean): void; switchSubmitReviewDialog(visible: boolean): void; setForceExitAnnotationFlag(forceExit: boolean): void; @@ -45,7 +48,10 @@ function mapStateToProps(state: CombinedState): StateToProps { const { annotation: { activities: { loads: jobLoads }, - job: { instance: jobInstance }, + job: { + instance: jobInstance, + instance: { stopFrame }, + }, }, formats: { annotationFormats }, tasks: { @@ -60,6 +66,7 @@ function mapStateToProps(state: CombinedState): StateToProps { return { loadActivity: taskID in loads || jobID in jobLoads ? loads[taskID] || jobLoads[jobID] : null, jobInstance, + stopFrame, annotationFormats, user, }; @@ -79,6 +86,9 @@ function mapDispatchToProps(dispatch: any): DispatchToProps { removeAnnotationsinRange(sessionInstance: any){ dispatch(removeAnnotationsinRangeAction(sessionInstance)); }, + removeAnnotationinRangeAsync(sessionInstance:any, startnumber: number, endnumber: number){ + dispatch(removeAnnotationsinRangeAsyncAction(sessionInstance, startnumber, endnumber, false)); + }, switchRequestReviewDialog(visible: boolean): void { dispatch(switchRequestReviewDialogAction(visible)); }, @@ -102,6 +112,7 @@ type Props = StateToProps & DispatchToProps & RouteComponentProps; function AnnotationMenuContainer(props: Props): JSX.Element { const { jobInstance, + stopFrame, user, annotationFormats: { loaders, dumpers }, history, @@ -109,6 +120,7 @@ function AnnotationMenuContainer(props: Props): JSX.Element { loadAnnotations, showExportModal, removeAnnotationsinRange, + removeAnnotationinRangeAsync, removeAnnotations, switchRequestReviewDialog, switchSubmitReviewDialog, @@ -117,10 +129,6 @@ function AnnotationMenuContainer(props: Props): JSX.Element { updateJob, } = props; - const removeRange= (): void => { - removeAnnotationsinRange(jobInstance); - } - const onClickMenu = (params: MenuInfo, file?: File): void => { if (params.keyPath.length > 1) { const [additionalKey, action] = params.keyPath; @@ -155,6 +163,10 @@ function AnnotationMenuContainer(props: Props): JSX.Element { } }; + const removeRange = (startFrame: number, endFrame: number) : void=>{ + removeAnnotationinRangeAsync(jobInstance, startFrame ,endFrame); + } + const isReviewer = jobInstance.reviewer?.id === user.id || user.isSuperuser; return ( @@ -169,6 +181,7 @@ function AnnotationMenuContainer(props: Props): JSX.Element { saveAnnotations={saveAnnotations} jobInstance={jobInstance} isReviewer={isReviewer} + stopFrame= {stopFrame} /> ); } diff --git a/cvat-ui/src/containers/annotation-page/top-bar/remove-range-confirm.tsx b/cvat-ui/src/containers/annotation-page/top-bar/remove-range-confirm.tsx deleted file mode 100644 index 1597d3c83e6f..000000000000 --- a/cvat-ui/src/containers/annotation-page/top-bar/remove-range-confirm.tsx +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (C) 2020-2021 Intel Corporation -// -// SPDX-License-Identifier: MIT - -import React from 'react'; -import { connect } from 'react-redux'; -import Modal from 'antd/lib/modal'; - -import { - removeAnnotationsinRange as removeAnnotationsinRangeAction , - changeRemoveAnnotationRange as changeRemoveAnnotationRangeAction, - removeAnnotationsinRangeAsync, - changeFrameAsync, -} from 'actions/annotation-actions'; - -import { CombinedState } from 'reducers/interfaces'; -import RemoveRangeConfirmComponent from 'components/annotation-page/top-bar/remove-range-confirm'; - -interface StateToProps { - objectStates: any[]; - frameNumber: number; - stopFrame: number; - jobInstance: any; - startFrame: number; - endFrame: number; -} - -interface DispatchToProps { - cancel(): void; - removeObjectsinRange(sessionInstance: any, startFrame: number, endFrame: number): void; - changeRemoveAnnotationsRange(startFrame: number, endFrame: number): void; - changeFrame(toFrame: number): void; -} - -function mapStateToProps(state: CombinedState): StateToProps { - const { - annotation: { - annotations: { states: objectStates }, - removeinrange: { - sessionInstance: jobInstance, - startFrame: startFrame, - endFrame: endFrame, - }, - job: { - instance: { stopFrame }, - }, - player: { - frame: { number: frameNumber }, - }, - }, - } = state; - - return { - objectStates, - frameNumber, - stopFrame, - jobInstance, - startFrame, - endFrame - }; -} - -function mapDispatchToProps(dispatch: any): DispatchToProps { - return { - removeObjectsinRange(sessionInstance: any, startFrame: number, endFrame: number): void { - dispatch((removeAnnotationsinRangeAsync(sessionInstance, startFrame, endFrame, false))); - }, - changeRemoveAnnotationsRange(startFrame: number, endFrame: number): void { - dispatch(changeRemoveAnnotationRangeAction(startFrame,endFrame)); - }, - async changeFrame(toFrame: number){ - return dispatch(await changeFrameAsync(toFrame)); - }, - cancel(): void { - dispatch(removeAnnotationsinRangeAction(null)); - }, - }; -} - -type Props = StateToProps & DispatchToProps; -class RemoveAnnotationsRangeContainer extends React.PureComponent { - private removeinRange = (): void => { - const { - removeObjectsinRange,jobInstance, cancel, startFrame, endFrame - } = this.props; - removeObjectsinRange(jobInstance, startFrame, endFrame); - cancel(); - }; - - - private changeRemoveAnnotationsRange = (startFrame: number, endFrame: number): void => { - const { changeRemoveAnnotationsRange } = this.props; - changeRemoveAnnotationsRange(startFrame,endFrame); - }; - - - public render(): JSX.Element { - const { - startFrame,frameNumber, endFrame, stopFrame, cancel, jobInstance, - } = this.props; - - - return ( - - ); - } -} - -export default connect(mapStateToProps, mapDispatchToProps)(RemoveAnnotationsRangeContainer); diff --git a/cvat-ui/src/reducers/annotation-reducer.ts b/cvat-ui/src/reducers/annotation-reducer.ts index 9f39b791094f..853616a8f1a4 100644 --- a/cvat-ui/src/reducers/annotation-reducer.ts +++ b/cvat-ui/src/reducers/annotation-reducer.ts @@ -952,36 +952,7 @@ export default (state = defaultState, action: AnyAction): AnnotationState => { } //Added Remove Annotations in Range case AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE_SUCCESS: { - const { sessionInstance, startFrame, endFrame } = action.payload; - return { - ...state, - removeinrange: { - ...state.removeinrange, - startFrame, - endFrame, - }, - }; - } - case AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE: { - const { sessionInstance } = action.payload; - return { - ...state, - removeinrange: { - ...state.removeinrange, - sessionInstance, - }, - }; - } - case AnnotationActionTypes.CHANGE_REMOVE_ANNOTATIONS_RANGE: { - const { startFrame, endFrame } = action.payload; - return { - ...state, - removeinrange: { - ...state.removeinrange, - startFrame, - endFrame, - }, - }; + console.log("REMOVE_ANNOTATIONS_INRANGE_SUCCESS"); } case AnnotationActionTypes.UPDATE_CANVAS_CONTEXT_MENU: { const { diff --git a/cvat-ui/src/reducers/interfaces.ts b/cvat-ui/src/reducers/interfaces.ts index 15786fa56b97..ef11a8207463 100644 --- a/cvat-ui/src/reducers/interfaces.ts +++ b/cvat-ui/src/reducers/interfaces.ts @@ -505,11 +505,6 @@ export interface AnnotationState { visible: boolean; data: any; }; - removeinrange: { - sessionInstance: any | null; - startFrame: number; - endFrame: number; - }; colors: any[]; filtersPanelVisible: boolean; requestReviewDialogVisible: boolean; diff --git a/tests/.nyc_output/out.json b/tests/.nyc_output/out.json new file mode 100644 index 000000000000..9e26dfeeb6e6 --- /dev/null +++ b/tests/.nyc_output/out.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/tests/coverage/clover.xml b/tests/coverage/clover.xml new file mode 100644 index 000000000000..c07df5c4594b --- /dev/null +++ b/tests/coverage/clover.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/coverage/coverage-final.json b/tests/coverage/coverage-final.json new file mode 100644 index 000000000000..0967ef424bce --- /dev/null +++ b/tests/coverage/coverage-final.json @@ -0,0 +1 @@ +{} diff --git a/tests/coverage/coverage-summary.json b/tests/coverage/coverage-summary.json new file mode 100644 index 000000000000..80354549d23f --- /dev/null +++ b/tests/coverage/coverage-summary.json @@ -0,0 +1,2 @@ +{"total": {"lines":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"},"statements":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"},"functions":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"},"branches":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"}} +} diff --git a/tests/coverage/lcov-report/base.css b/tests/coverage/lcov-report/base.css new file mode 100644 index 000000000000..f418035b469a --- /dev/null +++ b/tests/coverage/lcov-report/base.css @@ -0,0 +1,224 @@ +body, html { + margin:0; padding: 0; + height: 100%; +} +body { + font-family: Helvetica Neue, Helvetica, Arial; + font-size: 14px; + color:#333; +} +.small { font-size: 12px; } +*, *:after, *:before { + -webkit-box-sizing:border-box; + -moz-box-sizing:border-box; + box-sizing:border-box; + } +h1 { font-size: 20px; margin: 0;} +h2 { font-size: 14px; } +pre { + font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace; + margin: 0; + padding: 0; + -moz-tab-size: 2; + -o-tab-size: 2; + tab-size: 2; +} +a { color:#0074D9; text-decoration:none; } +a:hover { text-decoration:underline; } +.strong { font-weight: bold; } +.space-top1 { padding: 10px 0 0 0; } +.pad2y { padding: 20px 0; } +.pad1y { padding: 10px 0; } +.pad2x { padding: 0 20px; } +.pad2 { padding: 20px; } +.pad1 { padding: 10px; } +.space-left2 { padding-left:55px; } +.space-right2 { padding-right:20px; } +.center { text-align:center; } +.clearfix { display:block; } +.clearfix:after { + content:''; + display:block; + height:0; + clear:both; + visibility:hidden; + } +.fl { float: left; } +@media only screen and (max-width:640px) { + .col3 { width:100%; max-width:100%; } + .hide-mobile { display:none!important; } +} + +.quiet { + color: #7f7f7f; + color: rgba(0,0,0,0.5); +} +.quiet a { opacity: 0.7; } + +.fraction { + font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; + font-size: 10px; + color: #555; + background: #E8E8E8; + padding: 4px 5px; + border-radius: 3px; + vertical-align: middle; +} + +div.path a:link, div.path a:visited { color: #333; } +table.coverage { + border-collapse: collapse; + margin: 10px 0 0 0; + padding: 0; +} + +table.coverage td { + margin: 0; + padding: 0; + vertical-align: top; +} +table.coverage td.line-count { + text-align: right; + padding: 0 5px 0 20px; +} +table.coverage td.line-coverage { + text-align: right; + padding-right: 10px; + min-width:20px; +} + +table.coverage td span.cline-any { + display: inline-block; + padding: 0 5px; + width: 100%; +} +.missing-if-branch { + display: inline-block; + margin-right: 5px; + border-radius: 3px; + position: relative; + padding: 0 4px; + background: #333; + color: yellow; +} + +.skip-if-branch { + display: none; + margin-right: 10px; + position: relative; + padding: 0 4px; + background: #ccc; + color: white; +} +.missing-if-branch .typ, .skip-if-branch .typ { + color: inherit !important; +} +.coverage-summary { + border-collapse: collapse; + width: 100%; +} +.coverage-summary tr { border-bottom: 1px solid #bbb; } +.keyline-all { border: 1px solid #ddd; } +.coverage-summary td, .coverage-summary th { padding: 10px; } +.coverage-summary tbody { border: 1px solid #bbb; } +.coverage-summary td { border-right: 1px solid #bbb; } +.coverage-summary td:last-child { border-right: none; } +.coverage-summary th { + text-align: left; + font-weight: normal; + white-space: nowrap; +} +.coverage-summary th.file { border-right: none !important; } +.coverage-summary th.pct { } +.coverage-summary th.pic, +.coverage-summary th.abs, +.coverage-summary td.pct, +.coverage-summary td.abs { text-align: right; } +.coverage-summary td.file { white-space: nowrap; } +.coverage-summary td.pic { min-width: 120px !important; } +.coverage-summary tfoot td { } + +.coverage-summary .sorter { + height: 10px; + width: 7px; + display: inline-block; + margin-left: 0.5em; + background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; +} +.coverage-summary .sorted .sorter { + background-position: 0 -20px; +} +.coverage-summary .sorted-desc .sorter { + background-position: 0 -10px; +} +.status-line { height: 10px; } +/* yellow */ +.cbranch-no { background: yellow !important; color: #111; } +/* dark red */ +.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 } +.low .chart { border:1px solid #C21F39 } +.highlighted, +.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{ + background: #C21F39 !important; +} +/* medium red */ +.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE } +/* light red */ +.low, .cline-no { background:#FCE1E5 } +/* light green */ +.high, .cline-yes { background:rgb(230,245,208) } +/* medium green */ +.cstat-yes { background:rgb(161,215,106) } +/* dark green */ +.status-line.high, .high .cover-fill { background:rgb(77,146,33) } +.high .chart { border:1px solid rgb(77,146,33) } +/* dark yellow (gold) */ +.status-line.medium, .medium .cover-fill { background: #f9cd0b; } +.medium .chart { border:1px solid #f9cd0b; } +/* light yellow */ +.medium { background: #fff4c2; } + +.cstat-skip { background: #ddd; color: #111; } +.fstat-skip { background: #ddd; color: #111 !important; } +.cbranch-skip { background: #ddd !important; color: #111; } + +span.cline-neutral { background: #eaeaea; } + +.coverage-summary td.empty { + opacity: .5; + padding-top: 4px; + padding-bottom: 4px; + line-height: 1; + color: #888; +} + +.cover-fill, .cover-empty { + display:inline-block; + height: 12px; +} +.chart { + line-height: 0; +} +.cover-empty { + background: white; +} +.cover-full { + border-right: none !important; +} +pre.prettyprint { + border: none !important; + padding: 0 !important; + margin: 0 !important; +} +.com { color: #999 !important; } +.ignore-none { color: #999; font-weight: normal; } + +.wrapper { + min-height: 100%; + height: auto !important; + height: 100%; + margin: 0 auto -48px; +} +.footer, .push { + height: 48px; +} diff --git a/tests/coverage/lcov-report/block-navigation.js b/tests/coverage/lcov-report/block-navigation.js new file mode 100644 index 000000000000..c7ff5a5cac80 --- /dev/null +++ b/tests/coverage/lcov-report/block-navigation.js @@ -0,0 +1,79 @@ +/* eslint-disable */ +var jumpToCode = (function init() { + // Classes of code we would like to highlight in the file view + var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no']; + + // Elements to highlight in the file listing view + var fileListingElements = ['td.pct.low']; + + // We don't want to select elements that are direct descendants of another match + var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > ` + + // Selecter that finds elements on the page to which we can jump + var selector = + fileListingElements.join(', ') + + ', ' + + notSelector + + missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b` + + // The NodeList of matching elements + var missingCoverageElements = document.querySelectorAll(selector); + + var currentIndex; + + function toggleClass(index) { + missingCoverageElements + .item(currentIndex) + .classList.remove('highlighted'); + missingCoverageElements.item(index).classList.add('highlighted'); + } + + function makeCurrent(index) { + toggleClass(index); + currentIndex = index; + missingCoverageElements.item(index).scrollIntoView({ + behavior: 'smooth', + block: 'center', + inline: 'center' + }); + } + + function goToPrevious() { + var nextIndex = 0; + if (typeof currentIndex !== 'number' || currentIndex === 0) { + nextIndex = missingCoverageElements.length - 1; + } else if (missingCoverageElements.length > 1) { + nextIndex = currentIndex - 1; + } + + makeCurrent(nextIndex); + } + + function goToNext() { + var nextIndex = 0; + + if ( + typeof currentIndex === 'number' && + currentIndex < missingCoverageElements.length - 1 + ) { + nextIndex = currentIndex + 1; + } + + makeCurrent(nextIndex); + } + + return function jump(event) { + switch (event.which) { + case 78: // n + case 74: // j + goToNext(); + break; + case 66: // b + case 75: // k + case 80: // p + goToPrevious(); + break; + } + }; +})(); +window.addEventListener('keydown', jumpToCode); diff --git a/tests/coverage/lcov-report/favicon.png b/tests/coverage/lcov-report/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..6691817834a957c938e7f09640a37a645fb31457 GIT binary patch literal 540 zcmV+%0^|LOP)wSzy{h>9elhJ=8GnBQmf?)AI(^#wDA_`!QTxaXXE&bjxo zTGCc%V|W`}Lwz0rDO*qBbGY-M@aNENIZ1rK?nOAibaC*vb%CF;I_~lkJawax%_+1J zLn(#pv_v{f0`v`Cfp6()7MB(>IoTAiQdKxgxX?VyV&KVZ7b$vn<8|Z<9$35C+G_8SH0x6Y(xB&~bmn%r}ceRwbc0000 + + + + Code coverage report for All files + + + + + + + + + +
+
+

All files

+
+ +
+ Unknown% + Statements + 0/0 +
+ + +
+ Unknown% + Branches + 0/0 +
+ + +
+ Unknown% + Functions + 0/0 +
+ + +
+ Unknown% + Lines + 0/0 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+
+
+
+ + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
+
+
+
+
+
+ + + + + + + \ No newline at end of file diff --git a/tests/coverage/lcov-report/prettify.css b/tests/coverage/lcov-report/prettify.css new file mode 100644 index 000000000000..b317a7cda31a --- /dev/null +++ b/tests/coverage/lcov-report/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/tests/coverage/lcov-report/prettify.js b/tests/coverage/lcov-report/prettify.js new file mode 100644 index 000000000000..b3225238f26e --- /dev/null +++ b/tests/coverage/lcov-report/prettify.js @@ -0,0 +1,2 @@ +/* eslint-disable */ +window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/tests/coverage/lcov-report/sort-arrow-sprite.png b/tests/coverage/lcov-report/sort-arrow-sprite.png new file mode 100644 index 0000000000000000000000000000000000000000..03f704a609c6fd0dbfdac63466a7d7c958b5cbf3 GIT binary patch literal 209 zcmeAS@N?(olHy`uVBq!ia0vp^>_9Bd!3HEZxJ@+%Qj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS>Jii$m5978H@?Fn+^JD|Y9yzj{W`447Gxa{7*dM7nnnD-Lb z6^}Hx2)'; + } + } + return cols; + } + // attaches a data attribute to every tr element with an object + // of data values keyed by column name + function loadRowData(tableRow) { + var tableCols = tableRow.querySelectorAll('td'), + colNode, + col, + data = {}, + i, + val; + for (i = 0; i < tableCols.length; i += 1) { + colNode = tableCols[i]; + col = cols[i]; + val = colNode.getAttribute('data-value'); + if (col.type === 'number') { + val = Number(val); + } + data[col.key] = val; + } + return data; + } + // loads all row data + function loadData() { + var rows = getTableBody().querySelectorAll('tr'), + i; + + for (i = 0; i < rows.length; i += 1) { + rows[i].data = loadRowData(rows[i]); + } + } + // sorts the table using the data for the ith column + function sortByIndex(index, desc) { + var key = cols[index].key, + sorter = function(a, b) { + a = a.data[key]; + b = b.data[key]; + return a < b ? -1 : a > b ? 1 : 0; + }, + finalSorter = sorter, + tableBody = document.querySelector('.coverage-summary tbody'), + rowNodes = tableBody.querySelectorAll('tr'), + rows = [], + i; + + if (desc) { + finalSorter = function(a, b) { + return -1 * sorter(a, b); + }; + } + + for (i = 0; i < rowNodes.length; i += 1) { + rows.push(rowNodes[i]); + tableBody.removeChild(rowNodes[i]); + } + + rows.sort(finalSorter); + + for (i = 0; i < rows.length; i += 1) { + tableBody.appendChild(rows[i]); + } + } + // removes sort indicators for current column being sorted + function removeSortIndicators() { + var col = getNthColumn(currentSort.index), + cls = col.className; + + cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); + col.className = cls; + } + // adds sort indicators for current column being sorted + function addSortIndicators() { + getNthColumn(currentSort.index).className += currentSort.desc + ? ' sorted-desc' + : ' sorted'; + } + // adds event listeners for all sorter widgets + function enableUI() { + var i, + el, + ithSorter = function ithSorter(i) { + var col = cols[i]; + + return function() { + var desc = col.defaultDescSort; + + if (currentSort.index === i) { + desc = !currentSort.desc; + } + sortByIndex(i, desc); + removeSortIndicators(); + currentSort.index = i; + currentSort.desc = desc; + addSortIndicators(); + }; + }; + for (i = 0; i < cols.length; i += 1) { + if (cols[i].sortable) { + // add the click event handler on the th so users + // dont have to click on those tiny arrows + el = getNthColumn(i).querySelector('.sorter').parentElement; + if (el.addEventListener) { + el.addEventListener('click', ithSorter(i)); + } else { + el.attachEvent('onclick', ithSorter(i)); + } + } + } + } + // adds sorting functionality to the UI + return function() { + if (!getTable()) { + return; + } + cols = loadColumns(); + loadData(); + addSortIndicators(); + enableUI(); + }; +})(); + +window.addEventListener('load', addSorting); diff --git a/tests/coverage/lcov.info b/tests/coverage/lcov.info new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tests/package-lock.json b/tests/package-lock.json index d822611d4416..10e8a06fc8de 100644 --- a/tests/package-lock.json +++ b/tests/package-lock.json @@ -1016,9 +1016,9 @@ } }, "@cypress/request": { - "version": "2.88.5", - "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.5.tgz", - "integrity": "sha512-TzEC1XMi1hJkywWpRfD2clreTa/Z+lOrXDCxxBTBPEcY5azdPi56A6Xw+O4tWJnaJH3iIE7G5aDXZC6JgRZLcA==", + "version": "2.88.6", + "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.6.tgz", + "integrity": "sha512-z0UxBE/+qaESAHY9p9sM2h8Y4XqtsbDCt0/DPOrqA/RZgKi4PkxdpXyK4wCCnSk1xHqWHZZAE+gV6aDAR6+caQ==", "dev": true, "requires": { "aws-sign2": "~0.7.0", @@ -1034,13 +1034,20 @@ "isstream": "~0.1.2", "json-stringify-safe": "~5.0.1", "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", "performance-now": "^2.1.0", "qs": "~6.5.2", "safe-buffer": "^5.1.2", "tough-cookie": "~2.5.0", "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" + "uuid": "^8.3.2" + }, + "dependencies": { + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true + } } }, "@cypress/xvfb": { @@ -1439,16 +1446,22 @@ "any-observable": "^0.3.0" } }, + "@types/node": { + "version": "12.12.50", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.50.tgz", + "integrity": "sha512-5ImO01Fb8YsEOYpV+aeyGYztcYcjGsBvN4D7G5r1ef2cuQOpymjWNQi5V0rKHE6PC2ru3HkoUr/Br2/8GUA84w==", + "dev": true + }, "@types/sinonjs__fake-timers": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-6.0.2.tgz", - "integrity": "sha512-dIPoZ3g5gcx9zZEszaxLSVTvMReD3xxyyDnQUjA6IYDG9Ba2AV0otMPs+77sG9ojB4Qr2N2Vk5RnKeuA0X/0bg==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-6.0.3.tgz", + "integrity": "sha512-E1dU4fzC9wN2QK2Cr1MLCfyHM8BoNnRFvuf45LYMPNDA+WqbNzC45S4UzPxvp1fFJ1rvSGU0bPvdd35VLmXG8g==", "dev": true }, "@types/sizzle": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.2.tgz", - "integrity": "sha512-7EJYyKTL7tFR8+gDbB6Wwz/arpGa0Mywk1TJbNzKzHtzbwVmY4HR9WqS5VV7dsBUKQmPNr192jHr/VpBluj/hg==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/@types/sizzle/-/sizzle-2.3.3.tgz", + "integrity": "sha512-JYM8x9EGF163bEyhdJBpR2QX1R5naCJHC8ucJylJ3w9/CVBaskdQ8WqBf8MmQrd1kRvp/a4TS8HJ+bxzR7ZJYQ==", "dev": true }, "JSONStream": { @@ -2748,14 +2761,15 @@ "dev": true }, "cypress": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-6.4.0.tgz", - "integrity": "sha512-SrsPsZ4IBterudkoFYBvkQmXOVxclh1/+ytbzpV8AH/D2FA+s2Qy5ISsaRzOFsbQa4KZWoi3AKwREmF1HucYkg==", + "version": "6.9.1", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-6.9.1.tgz", + "integrity": "sha512-/RVx6sOhsyTR9sd9v0BHI4tnDZAhsH9rNat7CIKCUEr5VPWxyfGH0EzK4IHhAqAH8vjFcD4U14tPiJXshoUrmQ==", "dev": true, "requires": { "@cypress/listr-verbose-renderer": "^0.4.1", "@cypress/request": "^2.88.5", "@cypress/xvfb": "^1.2.4", + "@types/node": "12.12.50", "@types/sinonjs__fake-timers": "^6.0.1", "@types/sizzle": "^2.3.2", "arch": "^2.1.2", @@ -2768,7 +2782,7 @@ "commander": "^5.1.0", "common-tags": "^1.8.0", "dayjs": "^1.9.3", - "debug": "^4.1.1", + "debug": "4.3.2", "eventemitter2": "^6.4.2", "execa": "^4.0.2", "executable": "^4.1.1", @@ -2785,7 +2799,7 @@ "moment": "^2.29.1", "ospath": "^1.2.2", "pretty-bytes": "^5.4.1", - "ramda": "~0.26.1", + "ramda": "~0.27.1", "request-progress": "^3.0.0", "supports-color": "^7.2.0", "tmp": "~0.2.1", @@ -2810,9 +2824,9 @@ "dev": true }, "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, "requires": { "ansi-styles": "^4.1.0", @@ -2834,6 +2848,15 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, "fs-extra": { "version": "9.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", @@ -3202,9 +3225,9 @@ "dev": true }, "eventemitter2": { - "version": "6.4.3", - "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.3.tgz", - "integrity": "sha512-t0A2msp6BzOf+QAcI6z9XMktLj52OjGQg+8SJH6v5+3uxNpWYRR3wQmfA+6xtMU9kOC59qk9licus5dYcrYkMQ==", + "version": "6.4.4", + "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.4.tgz", + "integrity": "sha512-HLU3NDY6wARrLCEwyGKRBvuWYyvW6mHYv72SJJAH3iJN3a6eVUvkjFkcxah1bcTgGVBBrFdIopBJPhCQFMLyXw==", "dev": true }, "events": { @@ -4272,9 +4295,9 @@ } }, "is-path-inside": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.2.tgz", - "integrity": "sha512-/2UGPSgmtqwo1ktx8NDHjuPwZWmHhO+gj0f93EkhLB5RgW9RZevWYYlIkS6zePc6U2WpOdQYIwHe9YC4DWEBVg==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", "dev": true }, "is-plain-object": { @@ -4304,6 +4327,12 @@ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true }, + "is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true + }, "is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -4885,12 +4914,13 @@ "integrity": "sha1-SLtQiECfFvGCFmZkHETdGqrjzYg=" }, "log-symbols": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", - "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", "dev": true, "requires": { - "chalk": "^4.0.0" + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" }, "dependencies": { "ansi-styles": { @@ -4903,9 +4933,9 @@ } }, "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, "requires": { "ansi-styles": "^4.1.0", @@ -5141,18 +5171,18 @@ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" }, "mime-db": { - "version": "1.45.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.45.0.tgz", - "integrity": "sha512-CkqLUxUk15hofLoLyljJSrukZi8mAtgd+yE5uO4tqRZsdsAJKv0O+rFMhVDRJgozy+yG6md5KwuXhD4ocIoP+w==", + "version": "1.49.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.49.0.tgz", + "integrity": "sha512-CIc8j9URtOVApSFCQIF+VBkX1RwXp/oMMOrqdyXSBXq5RWNEsRfyj1kiRnQgmNXmHxPoFIxOroKA3zcU9P+nAA==", "dev": true }, "mime-types": { - "version": "2.1.28", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.28.tgz", - "integrity": "sha512-0TO2yJ5YHYr7M2zzT7gDU1tbwHxEUWBCLt0lscSNpcdAfFyJOVEpRYNS7EXVcTLNj/25QO8gulHC5JtTzSE2UQ==", + "version": "2.1.32", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.32.tgz", + "integrity": "sha512-hJGaVS4G4c9TSMYh2n6SQAGrC4RnfU+daP8G7cSCmaqNjiOoUY0VHCMS42pxnQmVF1GWwFhbHWn3RIxCqTmZ9A==", "dev": true, "requires": { - "mime-db": "1.45.0" + "mime-db": "1.49.0" } }, "mimic-fn": { @@ -5380,12 +5410,6 @@ "yargs": "^15.0.2" } }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "dev": true - }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -5728,9 +5752,9 @@ "dev": true }, "pretty-bytes": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.5.0.tgz", - "integrity": "sha512-p+T744ZyjjiaFlMUZZv6YPC5JrkNj8maRmPaQCWFJFplUAzpIUTRaTcS+7wmZtUoFXHtESJb23ISliaWyz3SHA==", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz", + "integrity": "sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==", "dev": true }, "printj": { @@ -5826,9 +5850,9 @@ "dev": true }, "ramda": { - "version": "0.26.1", - "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.26.1.tgz", - "integrity": "sha512-hLWjpy7EnsDBb0p+Z3B7rPi3GDeRG5ZtiI33kJhTt+ORCd38AbAIjB/9zRIUoeTbE/AVX5ZkU7m6bznsvrf8eQ==", + "version": "0.27.1", + "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.27.1.tgz", + "integrity": "sha512-PgIdVpn5y5Yns8vqb8FzBUEYn98V3xcPgawAkkgj0YJ0qDsnHCiNmZYfOGMgOvoB0eWFLpYbhxUR3mxfDIMvpw==", "dev": true }, "randombytes": { @@ -6127,9 +6151,9 @@ } }, "rxjs": { - "version": "6.6.3", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.3.tgz", - "integrity": "sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ==", + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", "dev": true, "requires": { "tslib": "^1.9.0" diff --git a/tests/package.json b/tests/package.json index b4a3a8c45a7c..b9c37a33fd80 100644 --- a/tests/package.json +++ b/tests/package.json @@ -6,7 +6,7 @@ }, "devDependencies": { "@cypress/code-coverage": "^3.9.4", - "cypress": "^6.4.0", + "cypress": "^6.9.1", "cypress-file-upload": "^5.0.2", "cypress-localstorage-commands": "^1.3.1", "cypress-plugin-tab": "^1.0.5" From 5ed81c359045cd763e696e3ab74b5514e2861c12 Mon Sep 17 00:00:00 2001 From: gudipudiramanakumar <47365328+gudipudiramanakumar@users.noreply.github.com> Date: Tue, 19 Oct 2021 01:19:02 +0530 Subject: [PATCH 07/17] Improved clear in cvat core and implemented remove range Added arguments of startframe and endframe to clear method in annotation-collection, and also added the updating of the states with payload on removeannotationsinrangeasync action in the reducer. --- cvat-core/src/annotations-collection.js | 48 ++++++++++++++++++- cvat-core/src/annotations.js | 8 +++- cvat-core/src/session.js | 8 ++-- cvat-ui/src/actions/annotation-actions.ts | 23 +++++---- .../top-bar/remove-range-confirm.tsx | 5 +- cvat-ui/src/reducers/annotation-reducer.ts | 19 +++++--- 6 files changed, 85 insertions(+), 26 deletions(-) diff --git a/cvat-core/src/annotations-collection.js b/cvat-core/src/annotations-collection.js index 26486bbe013d..b475db84dd3d 100644 --- a/cvat-core/src/annotations-collection.js +++ b/cvat-core/src/annotations-collection.js @@ -553,7 +553,52 @@ return groupIdx; } - clear() { + + clear(startframe, endframe, deltrack_keyframes_only) { + let objects_removable = []; + //If only a range of annotations need to be cleared + if (startframe!=undefined && endframe !=undefined ){ + for(let frame=startframe; frame<=endframe; frame++){ + const shapes = this.shapes[frame] || []; + const tags = this.tags[frame] || []; + objects_removable = objects_removable.concat(shapes,tags); + this.shapes[frame]=[]; + this.tags[frame]=[]; + } + const {tracks} = this; + tracks.forEach((track)=>{ + if(track.frame<=endframe){ + if(deltrack_keyframes_only){ + for(let keyframe in track.shapes){ + if (keyframe <= endframe) + delete track.shapes[keyframe]; + } + } + else if(track.frame>=startframe){ + objects_removable.push(track); + var index = tracks.indexOf(track); + if (index > -1) + tracks.splice(index, 1); + } + } + }); + + + + objects_removable.forEach((object)=>{ + console.log(object.clientID); + console.log(object); + delete this.objects[object.clientID]; + }); + + this.count = this.count - objects_removable.length; + console.log("Count"); + console.log(this.count); + + this.flush = true; + return; + } + //If all annotations need to be cleared this.shapes = {}; this.tags = {}; this.tracks = []; @@ -561,6 +606,7 @@ this.count = 0; this.flush = true; + } statistics() { diff --git a/cvat-core/src/annotations.js b/cvat-core/src/annotations.js index 07ce90f9e2f0..1b278601415b 100644 --- a/cvat-core/src/annotations.js +++ b/cvat-core/src/annotations.js @@ -172,13 +172,17 @@ return false; } - async function clearAnnotations(session, reload) { + async function clearAnnotations(session, reload, startframe, endframe) { checkObjectType('reload', reload, 'boolean', null); const sessionType = session instanceof Task ? 'task' : 'job'; const cache = getCache(sessionType); if (cache.has(session)) { - cache.get(session).collection.clear(); + if(startframe!=undefined && endframe !=undefined){ + cache.get(session).collection.clear(startframe,endframe, deltrack_keyframes_only = true); + }else{ + cache.get(session).collection.clear(); + } } if (reload) { diff --git a/cvat-core/src/session.js b/cvat-core/src/session.js index eaba48bc078f..e8e26a1291d0 100644 --- a/cvat-core/src/session.js +++ b/cvat-core/src/session.js @@ -37,8 +37,8 @@ return result; }, - async clear(reload = false) { - const result = await PluginRegistry.apiWrapper.call(this, prototype.annotations.clear, reload); + async clear(reload = false, startframe, endframe) { + const result = await PluginRegistry.apiWrapper.call(this, prototype.annotations.clear, reload, startframe, endframe); return result; }, @@ -1897,8 +1897,8 @@ return result; }; - Job.prototype.annotations.clear.implementation = async function (reload) { - const result = await clearAnnotations(this, reload); + Job.prototype.annotations.clear.implementation = async function (reload, startframe, endframe) { + const result = await clearAnnotations(this, reload, startframe, endframe); return result; }; diff --git a/cvat-ui/src/actions/annotation-actions.ts b/cvat-ui/src/actions/annotation-actions.ts index a3104a57b1a0..e49947754990 100644 --- a/cvat-ui/src/actions/annotation-actions.ts +++ b/cvat-ui/src/actions/annotation-actions.ts @@ -510,22 +510,21 @@ export function changePropagateFrames(frames: number): AnyAction { //To remove annotation objects present in given range of frames export function removeAnnotationsinRangeAsync(sessionInstance: any, startFrame: number, endFrame: number, force: boolean): ThunkAction{ return async (dispatch: ActionCreator): Promise => { - const { filters, showAllInterpolationTracks } = receiveAnnotationsParameters(); try { - - for(let frame = startFrame; frame<=endFrame; frame++){ - await dispatch(changeFrameAsync(frame)); - - const states = await sessionInstance.annotations.get(frame, showAllInterpolationTracks, filters ); - - states.forEach(async (state: any) => { - await dispatch(removeObjectAsync(sessionInstance,state,force)); - }); - } + await sessionInstance.annotations.clear(false,startFrame,endFrame); + await sessionInstance.actions.clear(); + const history = await sessionInstance.actions.get(); + const { + filters, frame, showAllInterpolationTracks, jobInstance, + } = receiveAnnotationsParameters(); + const states = await jobInstance.annotations.get(frame, showAllInterpolationTracks, filters); dispatch({ type: AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE_SUCCESS, - payload: { }, + payload: { + history, + states, + }, }); }catch(error){ diff --git a/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx b/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx index 33903e07d0e4..d3dae445b1dc 100644 --- a/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx +++ b/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx @@ -37,7 +37,10 @@ export default function RemoveRangeConfirmComponent(props: Props): JSX.Element { okType='primary' okText='Yes' cancelText='Cancel' - onOk={()=>{removeinRange(startFrame,endFrame);}} + onOk={()=>{ + removeinRange(startFrame,endFrame); + cancel(); + }} onCancel={cancel} title='Confirm to remove annotations in range' visible={visible} diff --git a/cvat-ui/src/reducers/annotation-reducer.ts b/cvat-ui/src/reducers/annotation-reducer.ts index 853616a8f1a4..12f4eda6da53 100644 --- a/cvat-ui/src/reducers/annotation-reducer.ts +++ b/cvat-ui/src/reducers/annotation-reducer.ts @@ -108,11 +108,6 @@ const defaultState: AnnotationState = { collecting: false, data: null, }, - removeinrange: { - sessionInstance: null, - startFrame: 0, - endFrame: 0, - }, aiToolsRef: React.createRef(), colors: [], sidebarCollapsed: false, @@ -952,7 +947,19 @@ export default (state = defaultState, action: AnyAction): AnnotationState => { } //Added Remove Annotations in Range case AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE_SUCCESS: { - console.log("REMOVE_ANNOTATIONS_INRANGE_SUCCESS"); + const { history } = action.payload; + const { states } = action.payload; + return { + ...state, + annotations: { + ...state.annotations, + history, + states, + selectedStatesID: [], + activatedStateID: null, + collapsed: {}, + }, + }; } case AnnotationActionTypes.UPDATE_CANVAS_CONTEXT_MENU: { const { From 25bbb49b951b6d523132e4aeb41324a4a16d60fa Mon Sep 17 00:00:00 2001 From: gudipudiramanakumar <47365328+gudipudiramanakumar@users.noreply.github.com> Date: Tue, 19 Oct 2021 02:05:35 +0530 Subject: [PATCH 08/17] Matching only the needed parts There are few additional old files that were needed to be removed to be completely matched with develop branch of cvat --- tests/.nyc_output/out.json | 1 - tests/coverage/clover.xml | 6 - tests/coverage/coverage-final.json | 1 - tests/coverage/coverage-summary.json | 2 - tests/coverage/lcov-report/base.css | 224 ------------------ .../coverage/lcov-report/block-navigation.js | 79 ------ tests/coverage/lcov-report/favicon.png | Bin 540 -> 0 bytes tests/coverage/lcov-report/index.html | 96 -------- tests/coverage/lcov-report/prettify.css | 1 - tests/coverage/lcov-report/prettify.js | 2 - .../lcov-report/sort-arrow-sprite.png | Bin 209 -> 0 bytes tests/coverage/lcov-report/sorter.js | 170 ------------- tests/coverage/lcov.info | 0 tests/package-lock.json | 6 - 14 files changed, 588 deletions(-) delete mode 100644 tests/coverage/clover.xml delete mode 100644 tests/coverage/coverage-final.json delete mode 100644 tests/coverage/coverage-summary.json delete mode 100644 tests/coverage/lcov-report/base.css delete mode 100644 tests/coverage/lcov-report/block-navigation.js delete mode 100644 tests/coverage/lcov-report/favicon.png delete mode 100644 tests/coverage/lcov-report/index.html delete mode 100644 tests/coverage/lcov-report/prettify.css delete mode 100644 tests/coverage/lcov-report/prettify.js delete mode 100644 tests/coverage/lcov-report/sort-arrow-sprite.png delete mode 100644 tests/coverage/lcov-report/sorter.js delete mode 100644 tests/coverage/lcov.info diff --git a/tests/.nyc_output/out.json b/tests/.nyc_output/out.json index 9e26dfeeb6e6..e69de29bb2d1 100644 --- a/tests/.nyc_output/out.json +++ b/tests/.nyc_output/out.json @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/tests/coverage/clover.xml b/tests/coverage/clover.xml deleted file mode 100644 index c07df5c4594b..000000000000 --- a/tests/coverage/clover.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/tests/coverage/coverage-final.json b/tests/coverage/coverage-final.json deleted file mode 100644 index 0967ef424bce..000000000000 --- a/tests/coverage/coverage-final.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/tests/coverage/coverage-summary.json b/tests/coverage/coverage-summary.json deleted file mode 100644 index 80354549d23f..000000000000 --- a/tests/coverage/coverage-summary.json +++ /dev/null @@ -1,2 +0,0 @@ -{"total": {"lines":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"},"statements":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"},"functions":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"},"branches":{"total":0,"covered":0,"skipped":0,"pct":"Unknown"}} -} diff --git a/tests/coverage/lcov-report/base.css b/tests/coverage/lcov-report/base.css deleted file mode 100644 index f418035b469a..000000000000 --- a/tests/coverage/lcov-report/base.css +++ /dev/null @@ -1,224 +0,0 @@ -body, html { - margin:0; padding: 0; - height: 100%; -} -body { - font-family: Helvetica Neue, Helvetica, Arial; - font-size: 14px; - color:#333; -} -.small { font-size: 12px; } -*, *:after, *:before { - -webkit-box-sizing:border-box; - -moz-box-sizing:border-box; - box-sizing:border-box; - } -h1 { font-size: 20px; margin: 0;} -h2 { font-size: 14px; } -pre { - font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace; - margin: 0; - padding: 0; - -moz-tab-size: 2; - -o-tab-size: 2; - tab-size: 2; -} -a { color:#0074D9; text-decoration:none; } -a:hover { text-decoration:underline; } -.strong { font-weight: bold; } -.space-top1 { padding: 10px 0 0 0; } -.pad2y { padding: 20px 0; } -.pad1y { padding: 10px 0; } -.pad2x { padding: 0 20px; } -.pad2 { padding: 20px; } -.pad1 { padding: 10px; } -.space-left2 { padding-left:55px; } -.space-right2 { padding-right:20px; } -.center { text-align:center; } -.clearfix { display:block; } -.clearfix:after { - content:''; - display:block; - height:0; - clear:both; - visibility:hidden; - } -.fl { float: left; } -@media only screen and (max-width:640px) { - .col3 { width:100%; max-width:100%; } - .hide-mobile { display:none!important; } -} - -.quiet { - color: #7f7f7f; - color: rgba(0,0,0,0.5); -} -.quiet a { opacity: 0.7; } - -.fraction { - font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; - font-size: 10px; - color: #555; - background: #E8E8E8; - padding: 4px 5px; - border-radius: 3px; - vertical-align: middle; -} - -div.path a:link, div.path a:visited { color: #333; } -table.coverage { - border-collapse: collapse; - margin: 10px 0 0 0; - padding: 0; -} - -table.coverage td { - margin: 0; - padding: 0; - vertical-align: top; -} -table.coverage td.line-count { - text-align: right; - padding: 0 5px 0 20px; -} -table.coverage td.line-coverage { - text-align: right; - padding-right: 10px; - min-width:20px; -} - -table.coverage td span.cline-any { - display: inline-block; - padding: 0 5px; - width: 100%; -} -.missing-if-branch { - display: inline-block; - margin-right: 5px; - border-radius: 3px; - position: relative; - padding: 0 4px; - background: #333; - color: yellow; -} - -.skip-if-branch { - display: none; - margin-right: 10px; - position: relative; - padding: 0 4px; - background: #ccc; - color: white; -} -.missing-if-branch .typ, .skip-if-branch .typ { - color: inherit !important; -} -.coverage-summary { - border-collapse: collapse; - width: 100%; -} -.coverage-summary tr { border-bottom: 1px solid #bbb; } -.keyline-all { border: 1px solid #ddd; } -.coverage-summary td, .coverage-summary th { padding: 10px; } -.coverage-summary tbody { border: 1px solid #bbb; } -.coverage-summary td { border-right: 1px solid #bbb; } -.coverage-summary td:last-child { border-right: none; } -.coverage-summary th { - text-align: left; - font-weight: normal; - white-space: nowrap; -} -.coverage-summary th.file { border-right: none !important; } -.coverage-summary th.pct { } -.coverage-summary th.pic, -.coverage-summary th.abs, -.coverage-summary td.pct, -.coverage-summary td.abs { text-align: right; } -.coverage-summary td.file { white-space: nowrap; } -.coverage-summary td.pic { min-width: 120px !important; } -.coverage-summary tfoot td { } - -.coverage-summary .sorter { - height: 10px; - width: 7px; - display: inline-block; - margin-left: 0.5em; - background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; -} -.coverage-summary .sorted .sorter { - background-position: 0 -20px; -} -.coverage-summary .sorted-desc .sorter { - background-position: 0 -10px; -} -.status-line { height: 10px; } -/* yellow */ -.cbranch-no { background: yellow !important; color: #111; } -/* dark red */ -.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 } -.low .chart { border:1px solid #C21F39 } -.highlighted, -.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{ - background: #C21F39 !important; -} -/* medium red */ -.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE } -/* light red */ -.low, .cline-no { background:#FCE1E5 } -/* light green */ -.high, .cline-yes { background:rgb(230,245,208) } -/* medium green */ -.cstat-yes { background:rgb(161,215,106) } -/* dark green */ -.status-line.high, .high .cover-fill { background:rgb(77,146,33) } -.high .chart { border:1px solid rgb(77,146,33) } -/* dark yellow (gold) */ -.status-line.medium, .medium .cover-fill { background: #f9cd0b; } -.medium .chart { border:1px solid #f9cd0b; } -/* light yellow */ -.medium { background: #fff4c2; } - -.cstat-skip { background: #ddd; color: #111; } -.fstat-skip { background: #ddd; color: #111 !important; } -.cbranch-skip { background: #ddd !important; color: #111; } - -span.cline-neutral { background: #eaeaea; } - -.coverage-summary td.empty { - opacity: .5; - padding-top: 4px; - padding-bottom: 4px; - line-height: 1; - color: #888; -} - -.cover-fill, .cover-empty { - display:inline-block; - height: 12px; -} -.chart { - line-height: 0; -} -.cover-empty { - background: white; -} -.cover-full { - border-right: none !important; -} -pre.prettyprint { - border: none !important; - padding: 0 !important; - margin: 0 !important; -} -.com { color: #999 !important; } -.ignore-none { color: #999; font-weight: normal; } - -.wrapper { - min-height: 100%; - height: auto !important; - height: 100%; - margin: 0 auto -48px; -} -.footer, .push { - height: 48px; -} diff --git a/tests/coverage/lcov-report/block-navigation.js b/tests/coverage/lcov-report/block-navigation.js deleted file mode 100644 index c7ff5a5cac80..000000000000 --- a/tests/coverage/lcov-report/block-navigation.js +++ /dev/null @@ -1,79 +0,0 @@ -/* eslint-disable */ -var jumpToCode = (function init() { - // Classes of code we would like to highlight in the file view - var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no']; - - // Elements to highlight in the file listing view - var fileListingElements = ['td.pct.low']; - - // We don't want to select elements that are direct descendants of another match - var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > ` - - // Selecter that finds elements on the page to which we can jump - var selector = - fileListingElements.join(', ') + - ', ' + - notSelector + - missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b` - - // The NodeList of matching elements - var missingCoverageElements = document.querySelectorAll(selector); - - var currentIndex; - - function toggleClass(index) { - missingCoverageElements - .item(currentIndex) - .classList.remove('highlighted'); - missingCoverageElements.item(index).classList.add('highlighted'); - } - - function makeCurrent(index) { - toggleClass(index); - currentIndex = index; - missingCoverageElements.item(index).scrollIntoView({ - behavior: 'smooth', - block: 'center', - inline: 'center' - }); - } - - function goToPrevious() { - var nextIndex = 0; - if (typeof currentIndex !== 'number' || currentIndex === 0) { - nextIndex = missingCoverageElements.length - 1; - } else if (missingCoverageElements.length > 1) { - nextIndex = currentIndex - 1; - } - - makeCurrent(nextIndex); - } - - function goToNext() { - var nextIndex = 0; - - if ( - typeof currentIndex === 'number' && - currentIndex < missingCoverageElements.length - 1 - ) { - nextIndex = currentIndex + 1; - } - - makeCurrent(nextIndex); - } - - return function jump(event) { - switch (event.which) { - case 78: // n - case 74: // j - goToNext(); - break; - case 66: // b - case 75: // k - case 80: // p - goToPrevious(); - break; - } - }; -})(); -window.addEventListener('keydown', jumpToCode); diff --git a/tests/coverage/lcov-report/favicon.png b/tests/coverage/lcov-report/favicon.png deleted file mode 100644 index 6691817834a957c938e7f09640a37a645fb31457..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 540 zcmV+%0^|LOP)wSzy{h>9elhJ=8GnBQmf?)AI(^#wDA_`!QTxaXXE&bjxo zTGCc%V|W`}Lwz0rDO*qBbGY-M@aNENIZ1rK?nOAibaC*vb%CF;I_~lkJawax%_+1J zLn(#pv_v{f0`v`Cfp6()7MB(>IoTAiQdKxgxX?VyV&KVZ7b$vn<8|Z<9$35C+G_8SH0x6Y(xB&~bmn%r}ceRwbc0000 - - - - Code coverage report for All files - - - - - - - - - -
-
-

All files

-
- -
- Unknown% - Statements - 0/0 -
- - -
- Unknown% - Branches - 0/0 -
- - -
- Unknown% - Functions - 0/0 -
- - -
- Unknown% - Lines - 0/0 -
- - -
-

- Press n or j to go to the next uncovered block, b, p or k for the previous block. -

-
-
-
- - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
-
-
-
- - - - - - - - - \ No newline at end of file diff --git a/tests/coverage/lcov-report/prettify.css b/tests/coverage/lcov-report/prettify.css deleted file mode 100644 index b317a7cda31a..000000000000 --- a/tests/coverage/lcov-report/prettify.css +++ /dev/null @@ -1 +0,0 @@ -.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/tests/coverage/lcov-report/prettify.js b/tests/coverage/lcov-report/prettify.js deleted file mode 100644 index b3225238f26e..000000000000 --- a/tests/coverage/lcov-report/prettify.js +++ /dev/null @@ -1,2 +0,0 @@ -/* eslint-disable */ -window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/tests/coverage/lcov-report/sort-arrow-sprite.png b/tests/coverage/lcov-report/sort-arrow-sprite.png deleted file mode 100644 index 03f704a609c6fd0dbfdac63466a7d7c958b5cbf3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 209 zcmeAS@N?(olHy`uVBq!ia0vp^>_9Bd!3HEZxJ@+%Qj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS>Jii$m5978H@?Fn+^JD|Y9yzj{W`447Gxa{7*dM7nnnD-Lb z6^}Hx2)'; - } - } - return cols; - } - // attaches a data attribute to every tr element with an object - // of data values keyed by column name - function loadRowData(tableRow) { - var tableCols = tableRow.querySelectorAll('td'), - colNode, - col, - data = {}, - i, - val; - for (i = 0; i < tableCols.length; i += 1) { - colNode = tableCols[i]; - col = cols[i]; - val = colNode.getAttribute('data-value'); - if (col.type === 'number') { - val = Number(val); - } - data[col.key] = val; - } - return data; - } - // loads all row data - function loadData() { - var rows = getTableBody().querySelectorAll('tr'), - i; - - for (i = 0; i < rows.length; i += 1) { - rows[i].data = loadRowData(rows[i]); - } - } - // sorts the table using the data for the ith column - function sortByIndex(index, desc) { - var key = cols[index].key, - sorter = function(a, b) { - a = a.data[key]; - b = b.data[key]; - return a < b ? -1 : a > b ? 1 : 0; - }, - finalSorter = sorter, - tableBody = document.querySelector('.coverage-summary tbody'), - rowNodes = tableBody.querySelectorAll('tr'), - rows = [], - i; - - if (desc) { - finalSorter = function(a, b) { - return -1 * sorter(a, b); - }; - } - - for (i = 0; i < rowNodes.length; i += 1) { - rows.push(rowNodes[i]); - tableBody.removeChild(rowNodes[i]); - } - - rows.sort(finalSorter); - - for (i = 0; i < rows.length; i += 1) { - tableBody.appendChild(rows[i]); - } - } - // removes sort indicators for current column being sorted - function removeSortIndicators() { - var col = getNthColumn(currentSort.index), - cls = col.className; - - cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); - col.className = cls; - } - // adds sort indicators for current column being sorted - function addSortIndicators() { - getNthColumn(currentSort.index).className += currentSort.desc - ? ' sorted-desc' - : ' sorted'; - } - // adds event listeners for all sorter widgets - function enableUI() { - var i, - el, - ithSorter = function ithSorter(i) { - var col = cols[i]; - - return function() { - var desc = col.defaultDescSort; - - if (currentSort.index === i) { - desc = !currentSort.desc; - } - sortByIndex(i, desc); - removeSortIndicators(); - currentSort.index = i; - currentSort.desc = desc; - addSortIndicators(); - }; - }; - for (i = 0; i < cols.length; i += 1) { - if (cols[i].sortable) { - // add the click event handler on the th so users - // dont have to click on those tiny arrows - el = getNthColumn(i).querySelector('.sorter').parentElement; - if (el.addEventListener) { - el.addEventListener('click', ithSorter(i)); - } else { - el.attachEvent('onclick', ithSorter(i)); - } - } - } - } - // adds sorting functionality to the UI - return function() { - if (!getTable()) { - return; - } - cols = loadColumns(); - loadData(); - addSortIndicators(); - enableUI(); - }; -})(); - -window.addEventListener('load', addSorting); diff --git a/tests/coverage/lcov.info b/tests/coverage/lcov.info deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/tests/package-lock.json b/tests/package-lock.json index 10e8a06fc8de..5c2556e3764f 100644 --- a/tests/package-lock.json +++ b/tests/package-lock.json @@ -1446,12 +1446,6 @@ "any-observable": "^0.3.0" } }, - "@types/node": { - "version": "12.12.50", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.50.tgz", - "integrity": "sha512-5ImO01Fb8YsEOYpV+aeyGYztcYcjGsBvN4D7G5r1ef2cuQOpymjWNQi5V0rKHE6PC2ru3HkoUr/Br2/8GUA84w==", - "dev": true - }, "@types/sinonjs__fake-timers": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-6.0.3.tgz", From d72833d9896c8c01978dc0f20039ea0927c2a8d7 Mon Sep 17 00:00:00 2001 From: gudipudiramanakumar <47365328+gudipudiramanakumar@users.noreply.github.com> Date: Tue, 19 Oct 2021 02:07:21 +0530 Subject: [PATCH 09/17] Delete out.json --- tests/.nyc_output/out.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 tests/.nyc_output/out.json diff --git a/tests/.nyc_output/out.json b/tests/.nyc_output/out.json deleted file mode 100644 index e69de29bb2d1..000000000000 From abca64f8350eff397bc06990aab77c3cdf112d4b Mon Sep 17 00:00:00 2001 From: gudipudiramanakumar <47365328+gudipudiramanakumar@users.noreply.github.com> Date: Tue, 19 Oct 2021 02:22:57 +0530 Subject: [PATCH 10/17] Update annotations-collection.js --- cvat-core/src/annotations-collection.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cvat-core/src/annotations-collection.js b/cvat-core/src/annotations-collection.js index a1448965284f..81c9c764ade1 100644 --- a/cvat-core/src/annotations-collection.js +++ b/cvat-core/src/annotations-collection.js @@ -570,7 +570,7 @@ if(track.frame<=endframe){ if(deltrack_keyframes_only){ for(let keyframe in track.shapes){ - if (keyframe <= endframe) + if (keyframe>=startframe && keyframe <= endframe) delete track.shapes[keyframe]; } } @@ -586,14 +586,10 @@ objects_removable.forEach((object)=>{ - console.log(object.clientID); - console.log(object); delete this.objects[object.clientID]; }); this.count = this.count - objects_removable.length; - console.log("Count"); - console.log(this.count); this.flush = true; return; From fb30089ab693dfa06b569d9416493f70f86744b6 Mon Sep 17 00:00:00 2001 From: gudipudiramanakumar <47365328+gudipudiramanakumar@users.noreply.github.com> Date: Tue, 19 Oct 2021 18:20:50 +0530 Subject: [PATCH 11/17] Added a checkbox to remove range modal Added a checkbox to remove range modal that can be used to select if only the keyframes should be deleted in tracks or the whole track --- cvat-core/src/annotations-collection.js | 2 +- cvat-core/src/annotations.js | 4 +- cvat-core/src/session.js | 8 ++-- cvat-ui/src/actions/annotation-actions.ts | 4 +- .../top-bar/annotation-menu.tsx | 2 +- .../top-bar/dist/remove-range-confirm.js | 46 +++++++++++++++++++ .../top-bar/remove-range-confirm.tsx | 11 +++-- .../top-bar/annotation-menu.tsx | 16 ++----- 8 files changed, 68 insertions(+), 25 deletions(-) create mode 100644 cvat-ui/src/components/annotation-page/top-bar/dist/remove-range-confirm.js diff --git a/cvat-core/src/annotations-collection.js b/cvat-core/src/annotations-collection.js index 81c9c764ade1..87b5e36f52af 100644 --- a/cvat-core/src/annotations-collection.js +++ b/cvat-core/src/annotations-collection.js @@ -570,7 +570,7 @@ if(track.frame<=endframe){ if(deltrack_keyframes_only){ for(let keyframe in track.shapes){ - if (keyframe>=startframe && keyframe <= endframe) + if (keyframe >= startframe && keyframe <= endframe) delete track.shapes[keyframe]; } } diff --git a/cvat-core/src/annotations.js b/cvat-core/src/annotations.js index 1b278601415b..2043a8ebddc8 100644 --- a/cvat-core/src/annotations.js +++ b/cvat-core/src/annotations.js @@ -172,14 +172,14 @@ return false; } - async function clearAnnotations(session, reload, startframe, endframe) { + async function clearAnnotations(session, reload, startframe, endframe, deltrack_keyframes_only) { checkObjectType('reload', reload, 'boolean', null); const sessionType = session instanceof Task ? 'task' : 'job'; const cache = getCache(sessionType); if (cache.has(session)) { if(startframe!=undefined && endframe !=undefined){ - cache.get(session).collection.clear(startframe,endframe, deltrack_keyframes_only = true); + cache.get(session).collection.clear(startframe,endframe, deltrack_keyframes_only); }else{ cache.get(session).collection.clear(); } diff --git a/cvat-core/src/session.js b/cvat-core/src/session.js index e8e26a1291d0..79eb0e7715ce 100644 --- a/cvat-core/src/session.js +++ b/cvat-core/src/session.js @@ -37,8 +37,8 @@ return result; }, - async clear(reload = false, startframe, endframe) { - const result = await PluginRegistry.apiWrapper.call(this, prototype.annotations.clear, reload, startframe, endframe); + async clear(reload = false, startframe, endframe, deltrack_keyframes_only = true) { + const result = await PluginRegistry.apiWrapper.call(this, prototype.annotations.clear, reload, startframe, endframe, deltrack_keyframes_only); return result; }, @@ -1897,8 +1897,8 @@ return result; }; - Job.prototype.annotations.clear.implementation = async function (reload, startframe, endframe) { - const result = await clearAnnotations(this, reload, startframe, endframe); + Job.prototype.annotations.clear.implementation = async function (reload, startframe, endframe, deltrack_keyframes_only) { + const result = await clearAnnotations(this, reload, startframe, endframe, deltrack_keyframes_only); return result; }; diff --git a/cvat-ui/src/actions/annotation-actions.ts b/cvat-ui/src/actions/annotation-actions.ts index 0bc271848cd5..bc3f67f4af0e 100644 --- a/cvat-ui/src/actions/annotation-actions.ts +++ b/cvat-ui/src/actions/annotation-actions.ts @@ -508,10 +508,10 @@ export function changePropagateFrames(frames: number): AnyAction { //To remove annotation objects present in given range of frames -export function removeAnnotationsinRangeAsync(sessionInstance: any, startFrame: number, endFrame: number, force: boolean): ThunkAction{ +export function removeAnnotationsinRangeAsync(sessionInstance: any, startFrame: number, endFrame: number, deltrack_keyframes_only: boolean): ThunkAction{ return async (dispatch: ActionCreator): Promise => { try { - await sessionInstance.annotations.clear(false,startFrame,endFrame); + await sessionInstance.annotations.clear(false,startFrame,endFrame,deltrack_keyframes_only); await sessionInstance.actions.clear(); const history = await sessionInstance.actions.get(); const { diff --git a/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx b/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx index 39cd71f428a9..1589cedf88a9 100644 --- a/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx +++ b/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx @@ -25,7 +25,7 @@ interface Props { onClickMenu(params: MenuInfo): void; onUploadAnnotations(format: string, file: File): void; stopFrame: number; - removeRange(startnumber: number, endnumber: number): void; + removeRange(startnumber: number, endnumber: number, deltrack_keyframes_only:boolean): void; setForceExitAnnotationFlag(forceExit: boolean): void; saveAnnotations(jobInstance: any, afterSave?: () => void): void; } diff --git a/cvat-ui/src/components/annotation-page/top-bar/dist/remove-range-confirm.js b/cvat-ui/src/components/annotation-page/top-bar/dist/remove-range-confirm.js new file mode 100644 index 000000000000..65d5074507a6 --- /dev/null +++ b/cvat-ui/src/components/annotation-page/top-bar/dist/remove-range-confirm.js @@ -0,0 +1,46 @@ +"use strict"; +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT +exports.__esModule = true; +var react_1 = require("react"); +var react_2 = require("react"); +var modal_1 = require("antd/lib/modal"); +var input_number_1 = require("antd/lib/input-number"); +var Text_1 = require("antd/lib/typography/Text"); +var math_1 = require("utils/math"); +var checkbox_1 = require("antd/lib/checkbox"); +function RemoveRangeConfirmComponent(props) { + var visible = props.visible, stopFrame = props.stopFrame, removeinRange = props.removeinRange, cancel = props.cancel; + var minStartFrames = 0; + var _a = react_2.useState(0), startFrame = _a[0], managestart = _a[1]; + var _b = react_2.useState(1), endFrame = _b[0], manageend = _b[1]; + var _c = react_2.useState(false), deltrack_keyframes_only = _c[0], managedeltrack_keyframes_only = _c[1]; + var minEndFrames = Math.max(startFrame, 1); + return (react_1["default"].createElement(modal_1["default"], { okType: 'primary', okText: 'Yes', cancelText: 'Cancel', onOk: function () { + removeinRange(startFrame, endFrame, deltrack_keyframes_only); + cancel(); + }, onCancel: cancel, title: 'Confirm to remove annotations in range', visible: visible }, + react_1["default"].createElement("div", { className: 'cvat-propagate-confirm' }, + react_1["default"].createElement(Text_1["default"], null, "Do you want to remove the annotations on"), + react_1["default"].createElement(input_number_1["default"], { className: 'cvat-propagate-confirm-object-on-frames', size: 'small', min: minStartFrames, max: stopFrame, value: startFrame, onChange: function (value) { + if (typeof value !== 'undefined') { + value = Math.floor(math_1.clamp(+value, 0, stopFrame - 1)); + managestart(value); + } + } }), + startFrame > 1 ? react_1["default"].createElement(Text_1["default"], null, " frames ") : react_1["default"].createElement(Text_1["default"], null, " frame "), + react_1["default"].createElement(Text_1["default"], null, "up to the "), + react_1["default"].createElement(input_number_1["default"], { className: 'cvat-propagate-confirm-object-up-to-frame', size: 'small', min: minEndFrames, max: stopFrame, value: endFrame, onChange: function (value) { + if (typeof value !== 'undefined') { + value = Math.floor(math_1.clamp(+value, 1, stopFrame)); + manageend(value); + } + } }), + react_1["default"].createElement(Text_1["default"], null, "frame"), + ",", + react_1["default"].createElement("br", null), + react_1["default"].createElement("br", null), + react_1["default"].createElement(checkbox_1["default"], { onChange: function () { managedeltrack_keyframes_only(!deltrack_keyframes_only); } }, "Delete only track keyframes")))); +} +exports["default"] = RemoveRangeConfirmComponent; diff --git a/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx b/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx index d3dae445b1dc..5c19d15a783e 100644 --- a/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx +++ b/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx @@ -1,4 +1,4 @@ -// Copyright (C) 2020-2021 Intel Corporation +// Copyright (C) 2021 Intel Corporation // // SPDX-License-Identifier: MIT @@ -9,11 +9,12 @@ import Modal from 'antd/lib/modal'; import InputNumber from 'antd/lib/input-number'; import Text from 'antd/lib/typography/Text'; import { clamp } from 'utils/math'; +import Checkbox from 'antd/lib/checkbox'; interface Props { visible: boolean; stopFrame: number; - removeinRange(startnumber:number, endnumber:number): void; + removeinRange(startnumber:number, endnumber:number, deltrack_keyframes_only:boolean): void; cancel(): void; } @@ -29,6 +30,7 @@ export default function RemoveRangeConfirmComponent(props: Props): JSX.Element { const [startFrame, managestart] = useState(0); const [endFrame, manageend] = useState(1); + const [deltrack_keyframes_only, managedeltrack_keyframes_only] = useState(false); const minEndFrames = Math.max(startFrame,1); @@ -38,7 +40,7 @@ export default function RemoveRangeConfirmComponent(props: Props): JSX.Element { okText='Yes' cancelText='Cancel' onOk={()=>{ - removeinRange(startFrame,endFrame); + removeinRange(startFrame,endFrame,deltrack_keyframes_only); cancel(); }} onCancel={cancel} @@ -75,7 +77,8 @@ export default function RemoveRangeConfirmComponent(props: Props): JSX.Element { } }} /> - frame + frame,



+ { managedeltrack_keyframes_only(!deltrack_keyframes_only);}}>Delete only track keyframes ); diff --git a/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx b/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx index 45a0beb2e8c5..63a7b17d1e81 100644 --- a/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx +++ b/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx @@ -18,7 +18,6 @@ import { switchRequestReviewDialog as switchRequestReviewDialogAction, switchSubmitReviewDialog as switchSubmitReviewDialogAction, setForceExitAnnotationFlag as setForceExitAnnotationFlagAction, - removeAnnotationsinRange as removeAnnotationsinRangeAction, removeAnnotationsinRangeAsync as removeAnnotationsinRangeAsyncAction, } from 'actions/annotation-actions'; import { exportActions } from 'actions/export-actions'; @@ -35,8 +34,7 @@ interface DispatchToProps { loadAnnotations(job: any, loader: any, file: File): void; showExportModal(task: any): void; removeAnnotations(sessionInstance: any): void; - removeAnnotationsinRange(sessionInstance: any): void; - removeAnnotationinRangeAsync(sessionInstance: any, startnumber:number, endnumber:number): void; + removeAnnotationinRangeAsync(sessionInstance: any, startnumber:number, endnumber:number, deltrack_keyframes_only:boolean): void; switchRequestReviewDialog(visible: boolean): void; switchSubmitReviewDialog(visible: boolean): void; setForceExitAnnotationFlag(forceExit: boolean): void; @@ -83,11 +81,8 @@ function mapDispatchToProps(dispatch: any): DispatchToProps { removeAnnotations(sessionInstance: any): void { dispatch(removeAnnotationsAsync(sessionInstance)); }, - removeAnnotationsinRange(sessionInstance: any){ - dispatch(removeAnnotationsinRangeAction(sessionInstance)); - }, - removeAnnotationinRangeAsync(sessionInstance:any, startnumber: number, endnumber: number){ - dispatch(removeAnnotationsinRangeAsyncAction(sessionInstance, startnumber, endnumber, false)); + removeAnnotationinRangeAsync(sessionInstance:any, startnumber: number, endnumber: number, deltrack_keyframes_only:boolean){ + dispatch(removeAnnotationsinRangeAsyncAction(sessionInstance, startnumber, endnumber, deltrack_keyframes_only)); }, switchRequestReviewDialog(visible: boolean): void { dispatch(switchRequestReviewDialogAction(visible)); @@ -119,7 +114,6 @@ function AnnotationMenuContainer(props: Props): JSX.Element { loadActivity, loadAnnotations, showExportModal, - removeAnnotationsinRange, removeAnnotationinRangeAsync, removeAnnotations, switchRequestReviewDialog, @@ -159,8 +153,8 @@ function AnnotationMenuContainer(props: Props): JSX.Element { } }; - const removeRange = (startFrame: number, endFrame: number) : void=>{ - removeAnnotationinRangeAsync(jobInstance, startFrame ,endFrame); + const removeRange = (startFrame: number, endFrame: number, deltrack_keyframes_only:boolean) : void=>{ + removeAnnotationinRangeAsync(jobInstance, startFrame ,endFrame, deltrack_keyframes_only); } const isReviewer = jobInstance.reviewer?.id === user.id || user.isSuperuser; From 2e714f1946300872e96cddb920fe5f1049dff00b Mon Sep 17 00:00:00 2001 From: gudipudiramanakumar <47365328+gudipudiramanakumar@users.noreply.github.com> Date: Wed, 20 Oct 2021 13:51:22 +0530 Subject: [PATCH 12/17] ESLint fixed All the updated files were formatted as per ESLint except one line in that even cvat base is also overlooking i.e. Row 162, Column 15: "JSX props should not use functions" in cvat\cvat-ui\src\components\annotation-page\top-bar\annotation-menu.tsx. --- cvat-core/src/annotations-collection.js | 49 ++++++++----------- cvat-core/src/annotations.js | 8 +-- cvat-core/src/session.js | 8 +-- cvat-ui/src/actions/annotation-actions.ts | 13 +++-- .../top-bar/annotation-menu.tsx | 16 +++--- .../top-bar/remove-range-confirm.tsx | 28 ++++++----- .../top-bar/annotation-menu.tsx | 17 ++++--- cvat-ui/src/reducers/annotation-reducer.ts | 2 +- 8 files changed, 69 insertions(+), 72 deletions(-) diff --git a/cvat-core/src/annotations-collection.js b/cvat-core/src/annotations-collection.js index 87b5e36f52af..a8a7f3b9946e 100644 --- a/cvat-core/src/annotations-collection.js +++ b/cvat-core/src/annotations-collection.js @@ -553,48 +553,42 @@ return groupIdx; } - - clear(startframe, endframe, deltrack_keyframes_only) { - let objects_removable = []; - //If only a range of annotations need to be cleared - if (startframe!=undefined && endframe !=undefined ){ - for(let frame=startframe; frame<=endframe; frame++){ + clear(startframe, endframe, delTrackKeyframesOnly) { + let objectsRemovable = []; + // If only a range of annotations need to be cleared + if (startframe !== undefined && endframe !== undefined) { + for (let frame = startframe; frame <= endframe; frame++) { const shapes = this.shapes[frame] || []; const tags = this.tags[frame] || []; - objects_removable = objects_removable.concat(shapes,tags); - this.shapes[frame]=[]; - this.tags[frame]=[]; + objectsRemovable = objectsRemovable.concat(shapes, tags); + this.shapes[frame] = []; + this.tags[frame] = []; } - const {tracks} = this; - tracks.forEach((track)=>{ - if(track.frame<=endframe){ - if(deltrack_keyframes_only){ - for(let keyframe in track.shapes){ - if (keyframe >= startframe && keyframe <= endframe) - delete track.shapes[keyframe]; + const { tracks } = this; + tracks.forEach((track) => { + if (track.frame <= endframe) { + if (delTrackKeyframesOnly) { + for (const keyframe in track.shapes) { + if (keyframe >= startframe && keyframe <= endframe) { delete track.shapes[keyframe]; } } - } - else if(track.frame>=startframe){ - objects_removable.push(track); - var index = tracks.indexOf(track); - if (index > -1) - tracks.splice(index, 1); + } else if (track.frame >= startframe) { + objectsRemovable.push(track); + const index = tracks.indexOf(track); + if (index > -1) { tracks.splice(index, 1); } } } }); - - - objects_removable.forEach((object)=>{ + objectsRemovable.forEach((object) => { delete this.objects[object.clientID]; }); - this.count = this.count - objects_removable.length; + this.count -= objectsRemovable.length; this.flush = true; return; } - //If all annotations need to be cleared + // If all annotations need to be cleared this.shapes = {}; this.tags = {}; this.tracks = []; @@ -602,7 +596,6 @@ this.count = 0; this.flush = true; - } statistics() { diff --git a/cvat-core/src/annotations.js b/cvat-core/src/annotations.js index 2043a8ebddc8..10f69c34d309 100644 --- a/cvat-core/src/annotations.js +++ b/cvat-core/src/annotations.js @@ -172,15 +172,15 @@ return false; } - async function clearAnnotations(session, reload, startframe, endframe, deltrack_keyframes_only) { + async function clearAnnotations(session, reload, startframe, endframe, delTrackKeyframesOnly) { checkObjectType('reload', reload, 'boolean', null); const sessionType = session instanceof Task ? 'task' : 'job'; const cache = getCache(sessionType); if (cache.has(session)) { - if(startframe!=undefined && endframe !=undefined){ - cache.get(session).collection.clear(startframe,endframe, deltrack_keyframes_only); - }else{ + if (startframe !== undefined && endframe !== undefined) { + cache.get(session).collection.clear(startframe, endframe, delTrackKeyframesOnly); + } else { cache.get(session).collection.clear(); } } diff --git a/cvat-core/src/session.js b/cvat-core/src/session.js index 79eb0e7715ce..29efe0bdb15b 100644 --- a/cvat-core/src/session.js +++ b/cvat-core/src/session.js @@ -37,8 +37,8 @@ return result; }, - async clear(reload = false, startframe, endframe, deltrack_keyframes_only = true) { - const result = await PluginRegistry.apiWrapper.call(this, prototype.annotations.clear, reload, startframe, endframe, deltrack_keyframes_only); + async clear(reload = false, startframe, endframe, delTrackKeyframesOnly = true) { + const result = await PluginRegistry.apiWrapper.call(this, prototype.annotations.clear, reload, startframe, endframe, delTrackKeyframesOnly); return result; }, @@ -1897,8 +1897,8 @@ return result; }; - Job.prototype.annotations.clear.implementation = async function (reload, startframe, endframe, deltrack_keyframes_only) { - const result = await clearAnnotations(this, reload, startframe, endframe, deltrack_keyframes_only); + Job.prototype.annotations.clear.implementation = async function (reload, startframe, endframe, delTrackKeyframesOnly) { + const result = await clearAnnotations(this, reload, startframe, endframe, delTrackKeyframesOnly); return result; }; diff --git a/cvat-ui/src/actions/annotation-actions.ts b/cvat-ui/src/actions/annotation-actions.ts index bc3f67f4af0e..50b022d63402 100644 --- a/cvat-ui/src/actions/annotation-actions.ts +++ b/cvat-ui/src/actions/annotation-actions.ts @@ -506,12 +506,12 @@ export function changePropagateFrames(frames: number): AnyAction { }; } - -//To remove annotation objects present in given range of frames -export function removeAnnotationsinRangeAsync(sessionInstance: any, startFrame: number, endFrame: number, deltrack_keyframes_only: boolean): ThunkAction{ +// To remove annotation objects present in given range of frames +// eslint-disable-next-line max-len +export function removeAnnotationsinRangeAsync(sessionInstance: any, startFrame: number, endFrame: number, delTrackKeyframesOnly: boolean): ThunkAction { return async (dispatch: ActionCreator): Promise => { try { - await sessionInstance.annotations.clear(false,startFrame,endFrame,deltrack_keyframes_only); + await sessionInstance.annotations.clear(false, startFrame, endFrame, delTrackKeyframesOnly); await sessionInstance.actions.clear(); const history = await sessionInstance.actions.get(); const { @@ -526,8 +526,7 @@ export function removeAnnotationsinRangeAsync(sessionInstance: any, startFrame: states, }, }); - - }catch(error){ + } catch (error) { dispatch({ type: AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE_FAILED, payload: { @@ -535,7 +534,7 @@ export function removeAnnotationsinRangeAsync(sessionInstance: any, startFrame: }, }); } - } + }; } export function removeObjectAsync(sessionInstance: any, objectState: any, force: boolean): ThunkAction { diff --git a/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx b/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx index 1589cedf88a9..8978040e6c83 100644 --- a/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx +++ b/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx @@ -2,11 +2,10 @@ // // SPDX-License-Identifier: MIT -import React from 'react'; -import { useState } from 'react'; +import React, { useState } from 'react'; + import Menu from 'antd/lib/menu'; import Modal from 'antd/lib/modal'; -import Button from 'antd/lib/button'; // eslint-disable-next-line import/no-extraneous-dependencies import { MenuInfo } from 'rc-menu/lib/interface'; @@ -93,7 +92,7 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { Modal.confirm({ title: 'Remove Annotations', content: - 'Select whether to remove all annotations from the job or remove within a range' + '\n' + + 'Select whether to remove all annotations from the job or remove within a range\n' + 'It will stay on the server till you save the job. Continue?', className: 'cvat-modal-confirm-remove-annotation', onOk: () => { @@ -115,13 +114,13 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { }, okButtonProps: { type: 'primary', - danger: true + danger: true, }, okText: 'Remove All', onCancel: () => { toggleOpenRemoveRangeComponent(!openRemoveRangeComponent); }, - cancelText: "Select Range", + cancelText: 'Select Range', cancelButtonProps: { type: 'primary', }, @@ -157,7 +156,6 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { const is2d = jobInstance.task.dimension === DimensionType.DIM_2D; - return ( {LoadSubmenu({ @@ -200,8 +198,8 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { visible={openRemoveRangeComponent} removeinRange={removeRange} stopFrame={stopFrame} - cancel= {()=>{toggleOpenRemoveRangeComponent(!openRemoveRangeComponent)}} - > + cancel={() => { toggleOpenRemoveRangeComponent(!openRemoveRangeComponent); }} + /> ); } diff --git a/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx b/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx index 5c19d15a783e..670623251786 100644 --- a/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx +++ b/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx @@ -2,19 +2,18 @@ // // SPDX-License-Identifier: MIT -import React from 'react'; -import { useState } from 'react'; +import React, { useState } from 'react'; import Modal from 'antd/lib/modal'; import InputNumber from 'antd/lib/input-number'; import Text from 'antd/lib/typography/Text'; -import { clamp } from 'utils/math'; import Checkbox from 'antd/lib/checkbox'; +import { clamp } from 'utils/math'; interface Props { visible: boolean; stopFrame: number; - removeinRange(startnumber:number, endnumber:number, deltrack_keyframes_only:boolean): void; + removeinRange(startnumber:number, endnumber:number, delTrackKeyframesOnly:boolean): void; cancel(): void; } @@ -30,17 +29,17 @@ export default function RemoveRangeConfirmComponent(props: Props): JSX.Element { const [startFrame, managestart] = useState(0); const [endFrame, manageend] = useState(1); - const [deltrack_keyframes_only, managedeltrack_keyframes_only] = useState(false); + const [delTrackKeyframesOnly, managedelTrackKeyframesOnly] = useState(false); - const minEndFrames = Math.max(startFrame,1); + const minEndFrames = Math.max(startFrame, 1); return ( { - removeinRange(startFrame,endFrame,deltrack_keyframes_only); + onOk={() => { + removeinRange(startFrame, endFrame, delTrackKeyframesOnly); cancel(); }} onCancel={cancel} @@ -57,7 +56,7 @@ export default function RemoveRangeConfirmComponent(props: Props): JSX.Element { value={startFrame} onChange={(value: number | undefined | string) => { if (typeof value !== 'undefined') { - value=Math.floor(clamp(+value, 0, stopFrame-1)); + value = Math.floor(clamp(+value, 0, stopFrame - 1)); managestart(value); } }} @@ -72,13 +71,18 @@ export default function RemoveRangeConfirmComponent(props: Props): JSX.Element { value={endFrame} onChange={(value: number | undefined | string) => { if (typeof value !== 'undefined') { - value= Math.floor(clamp(+value, 1, stopFrame)); + value = Math.floor(clamp(+value, 1, stopFrame)); manageend(value); } }} /> - frame,



- { managedeltrack_keyframes_only(!deltrack_keyframes_only);}}>Delete only track keyframes + frame + , +
+
+ { managedelTrackKeyframesOnly(!delTrackKeyframesOnly); }}> + Delete only track keyframes +
); diff --git a/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx b/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx index 63a7b17d1e81..f241cd5ce48c 100644 --- a/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx +++ b/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx @@ -34,7 +34,8 @@ interface DispatchToProps { loadAnnotations(job: any, loader: any, file: File): void; showExportModal(task: any): void; removeAnnotations(sessionInstance: any): void; - removeAnnotationinRangeAsync(sessionInstance: any, startnumber:number, endnumber:number, deltrack_keyframes_only:boolean): void; + // eslint-disable-next-line max-len + removeAnnotationinRangeAsync(sessionInstance: any, startnumber:number, endnumber:number, delTrackKeyframesOnly:boolean): void; switchRequestReviewDialog(visible: boolean): void; switchSubmitReviewDialog(visible: boolean): void; setForceExitAnnotationFlag(forceExit: boolean): void; @@ -81,8 +82,10 @@ function mapDispatchToProps(dispatch: any): DispatchToProps { removeAnnotations(sessionInstance: any): void { dispatch(removeAnnotationsAsync(sessionInstance)); }, - removeAnnotationinRangeAsync(sessionInstance:any, startnumber: number, endnumber: number, deltrack_keyframes_only:boolean){ - dispatch(removeAnnotationsinRangeAsyncAction(sessionInstance, startnumber, endnumber, deltrack_keyframes_only)); + // eslint-disable-next-line max-len + removeAnnotationinRangeAsync(sessionInstance:any, startnumber: number, endnumber: number, delTrackKeyframesOnly:boolean) { + // eslint-disable-next-line max-len + dispatch(removeAnnotationsinRangeAsyncAction(sessionInstance, startnumber, endnumber, delTrackKeyframesOnly)); }, switchRequestReviewDialog(visible: boolean): void { dispatch(switchRequestReviewDialogAction(visible)); @@ -153,9 +156,9 @@ function AnnotationMenuContainer(props: Props): JSX.Element { } }; - const removeRange = (startFrame: number, endFrame: number, deltrack_keyframes_only:boolean) : void=>{ - removeAnnotationinRangeAsync(jobInstance, startFrame ,endFrame, deltrack_keyframes_only); - } + const removeRange = (startFrame: number, endFrame: number, delTrackKeyframesOnly:boolean) : void => { + removeAnnotationinRangeAsync(jobInstance, startFrame, endFrame, delTrackKeyframesOnly); + }; const isReviewer = jobInstance.reviewer?.id === user.id || user.isSuperuser; @@ -172,7 +175,7 @@ function AnnotationMenuContainer(props: Props): JSX.Element { saveAnnotations={saveAnnotations} jobInstance={jobInstance} isReviewer={isReviewer} - stopFrame= {stopFrame} + stopFrame={stopFrame} /> ); } diff --git a/cvat-ui/src/reducers/annotation-reducer.ts b/cvat-ui/src/reducers/annotation-reducer.ts index a4537a514b15..afe26365c8e3 100644 --- a/cvat-ui/src/reducers/annotation-reducer.ts +++ b/cvat-ui/src/reducers/annotation-reducer.ts @@ -930,7 +930,7 @@ export default (state = defaultState, action: AnyAction): AnnotationState => { }, }; } - //Added Remove Annotations in Range + // Added Remove Annotations in Range case AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE_SUCCESS: { const { history } = action.payload; const { states } = action.payload; From 6cc2403d89a2f35380eeea450e70646aa9757c7b Mon Sep 17 00:00:00 2001 From: gudipudiramanakumar <47365328+gudipudiramanakumar@users.noreply.github.com> Date: Wed, 20 Oct 2021 20:44:31 +0530 Subject: [PATCH 13/17] More ESLint and other updates Changed all the suggested changes and also removed unnecessary files in dist. Removed unnecessary explicit removals in objects and additional wrappers. --- cvat-core/src/annotations-collection.js | 7 --- cvat-core/src/annotations.js | 6 +-- cvat-core/src/session.js | 2 +- cvat-ui/src/actions/annotation-actions.ts | 11 +++-- .../top-bar/annotation-menu.tsx | 2 +- .../top-bar/dist/remove-range-confirm.js | 46 ------------------- .../top-bar/annotation-menu.tsx | 19 +++----- 7 files changed, 15 insertions(+), 78 deletions(-) delete mode 100644 cvat-ui/src/components/annotation-page/top-bar/dist/remove-range-confirm.js diff --git a/cvat-core/src/annotations-collection.js b/cvat-core/src/annotations-collection.js index a8a7f3b9946e..3276ac9ce191 100644 --- a/cvat-core/src/annotations-collection.js +++ b/cvat-core/src/annotations-collection.js @@ -579,13 +579,6 @@ } }); - objectsRemovable.forEach((object) => { - delete this.objects[object.clientID]; - }); - - this.count -= objectsRemovable.length; - - this.flush = true; return; } // If all annotations need to be cleared diff --git a/cvat-core/src/annotations.js b/cvat-core/src/annotations.js index 10f69c34d309..9b9cd6955cab 100644 --- a/cvat-core/src/annotations.js +++ b/cvat-core/src/annotations.js @@ -178,11 +178,7 @@ const cache = getCache(sessionType); if (cache.has(session)) { - if (startframe !== undefined && endframe !== undefined) { - cache.get(session).collection.clear(startframe, endframe, delTrackKeyframesOnly); - } else { - cache.get(session).collection.clear(); - } + cache.get(session).collection.clear(startframe, endframe, delTrackKeyframesOnly); } if (reload) { diff --git a/cvat-core/src/session.js b/cvat-core/src/session.js index 29efe0bdb15b..0914e9a892c8 100644 --- a/cvat-core/src/session.js +++ b/cvat-core/src/session.js @@ -37,7 +37,7 @@ return result; }, - async clear(reload = false, startframe, endframe, delTrackKeyframesOnly = true) { + async clear(reload = false, startframe = undefined, endframe = undefined, delTrackKeyframesOnly = true) { const result = await PluginRegistry.apiWrapper.call(this, prototype.annotations.clear, reload, startframe, endframe, delTrackKeyframesOnly); return result; }, diff --git a/cvat-ui/src/actions/annotation-actions.ts b/cvat-ui/src/actions/annotation-actions.ts index 50b022d63402..56db3be23fbd 100644 --- a/cvat-ui/src/actions/annotation-actions.ts +++ b/cvat-ui/src/actions/annotation-actions.ts @@ -507,16 +507,17 @@ export function changePropagateFrames(frames: number): AnyAction { } // To remove annotation objects present in given range of frames -// eslint-disable-next-line max-len -export function removeAnnotationsinRangeAsync(sessionInstance: any, startFrame: number, endFrame: number, delTrackKeyframesOnly: boolean): ThunkAction { +export function removeAnnotationsinRangeAsync( + startFrame: number, endFrame: number, delTrackKeyframesOnly: boolean, +): ThunkAction { return async (dispatch: ActionCreator): Promise => { try { - await sessionInstance.annotations.clear(false, startFrame, endFrame, delTrackKeyframesOnly); - await sessionInstance.actions.clear(); - const history = await sessionInstance.actions.get(); const { filters, frame, showAllInterpolationTracks, jobInstance, } = receiveAnnotationsParameters(); + await jobInstance.annotations.clear(false, startFrame, endFrame, delTrackKeyframesOnly); + await jobInstance.actions.clear(); + const history = await jobInstance.actions.get(); const states = await jobInstance.annotations.get(frame, showAllInterpolationTracks, filters); dispatch({ diff --git a/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx b/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx index 8978040e6c83..e71972b5ac70 100644 --- a/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx +++ b/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx @@ -157,7 +157,7 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { const is2d = jobInstance.task.dimension === DimensionType.DIM_2D; return ( - + onClickMenuWrapper(params)} className='cvat-annotation-menu' selectable={false}> {LoadSubmenu({ loaders, loadActivity, diff --git a/cvat-ui/src/components/annotation-page/top-bar/dist/remove-range-confirm.js b/cvat-ui/src/components/annotation-page/top-bar/dist/remove-range-confirm.js deleted file mode 100644 index 65d5074507a6..000000000000 --- a/cvat-ui/src/components/annotation-page/top-bar/dist/remove-range-confirm.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; -// Copyright (C) 2021 Intel Corporation -// -// SPDX-License-Identifier: MIT -exports.__esModule = true; -var react_1 = require("react"); -var react_2 = require("react"); -var modal_1 = require("antd/lib/modal"); -var input_number_1 = require("antd/lib/input-number"); -var Text_1 = require("antd/lib/typography/Text"); -var math_1 = require("utils/math"); -var checkbox_1 = require("antd/lib/checkbox"); -function RemoveRangeConfirmComponent(props) { - var visible = props.visible, stopFrame = props.stopFrame, removeinRange = props.removeinRange, cancel = props.cancel; - var minStartFrames = 0; - var _a = react_2.useState(0), startFrame = _a[0], managestart = _a[1]; - var _b = react_2.useState(1), endFrame = _b[0], manageend = _b[1]; - var _c = react_2.useState(false), deltrack_keyframes_only = _c[0], managedeltrack_keyframes_only = _c[1]; - var minEndFrames = Math.max(startFrame, 1); - return (react_1["default"].createElement(modal_1["default"], { okType: 'primary', okText: 'Yes', cancelText: 'Cancel', onOk: function () { - removeinRange(startFrame, endFrame, deltrack_keyframes_only); - cancel(); - }, onCancel: cancel, title: 'Confirm to remove annotations in range', visible: visible }, - react_1["default"].createElement("div", { className: 'cvat-propagate-confirm' }, - react_1["default"].createElement(Text_1["default"], null, "Do you want to remove the annotations on"), - react_1["default"].createElement(input_number_1["default"], { className: 'cvat-propagate-confirm-object-on-frames', size: 'small', min: minStartFrames, max: stopFrame, value: startFrame, onChange: function (value) { - if (typeof value !== 'undefined') { - value = Math.floor(math_1.clamp(+value, 0, stopFrame - 1)); - managestart(value); - } - } }), - startFrame > 1 ? react_1["default"].createElement(Text_1["default"], null, " frames ") : react_1["default"].createElement(Text_1["default"], null, " frame "), - react_1["default"].createElement(Text_1["default"], null, "up to the "), - react_1["default"].createElement(input_number_1["default"], { className: 'cvat-propagate-confirm-object-up-to-frame', size: 'small', min: minEndFrames, max: stopFrame, value: endFrame, onChange: function (value) { - if (typeof value !== 'undefined') { - value = Math.floor(math_1.clamp(+value, 1, stopFrame)); - manageend(value); - } - } }), - react_1["default"].createElement(Text_1["default"], null, "frame"), - ",", - react_1["default"].createElement("br", null), - react_1["default"].createElement("br", null), - react_1["default"].createElement(checkbox_1["default"], { onChange: function () { managedeltrack_keyframes_only(!deltrack_keyframes_only); } }, "Delete only track keyframes")))); -} -exports["default"] = RemoveRangeConfirmComponent; diff --git a/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx b/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx index f241cd5ce48c..eda6c6e9b91e 100644 --- a/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx +++ b/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx @@ -25,7 +25,7 @@ import { exportActions } from 'actions/export-actions'; interface StateToProps { annotationFormats: any; jobInstance: any; - stopFrame: any; + stopFrame: number; loadActivity: string | null; user: any; } @@ -34,8 +34,7 @@ interface DispatchToProps { loadAnnotations(job: any, loader: any, file: File): void; showExportModal(task: any): void; removeAnnotations(sessionInstance: any): void; - // eslint-disable-next-line max-len - removeAnnotationinRangeAsync(sessionInstance: any, startnumber:number, endnumber:number, delTrackKeyframesOnly:boolean): void; + removeAnnotationsinRange(startnumber:number, endnumber:number, delTrackKeyframesOnly:boolean): void; switchRequestReviewDialog(visible: boolean): void; switchSubmitReviewDialog(visible: boolean): void; setForceExitAnnotationFlag(forceExit: boolean): void; @@ -82,10 +81,8 @@ function mapDispatchToProps(dispatch: any): DispatchToProps { removeAnnotations(sessionInstance: any): void { dispatch(removeAnnotationsAsync(sessionInstance)); }, - // eslint-disable-next-line max-len - removeAnnotationinRangeAsync(sessionInstance:any, startnumber: number, endnumber: number, delTrackKeyframesOnly:boolean) { - // eslint-disable-next-line max-len - dispatch(removeAnnotationsinRangeAsyncAction(sessionInstance, startnumber, endnumber, delTrackKeyframesOnly)); + removeAnnotationsinRange(startnumber: number, endnumber: number, delTrackKeyframesOnly:boolean) { + dispatch(removeAnnotationsinRangeAsyncAction(startnumber, endnumber, delTrackKeyframesOnly)); }, switchRequestReviewDialog(visible: boolean): void { dispatch(switchRequestReviewDialogAction(visible)); @@ -117,7 +114,7 @@ function AnnotationMenuContainer(props: Props): JSX.Element { loadActivity, loadAnnotations, showExportModal, - removeAnnotationinRangeAsync, + removeAnnotationsinRange, removeAnnotations, switchRequestReviewDialog, switchSubmitReviewDialog, @@ -156,10 +153,6 @@ function AnnotationMenuContainer(props: Props): JSX.Element { } }; - const removeRange = (startFrame: number, endFrame: number, delTrackKeyframesOnly:boolean) : void => { - removeAnnotationinRangeAsync(jobInstance, startFrame, endFrame, delTrackKeyframesOnly); - }; - const isReviewer = jobInstance.reviewer?.id === user.id || user.isSuperuser; return ( @@ -170,7 +163,7 @@ function AnnotationMenuContainer(props: Props): JSX.Element { loadActivity={loadActivity} onUploadAnnotations={onUploadAnnotations} onClickMenu={onClickMenu} - removeRange={removeRange} + removeRange={removeAnnotationsinRange} setForceExitAnnotationFlag={setForceExitAnnotationFlag} saveAnnotations={saveAnnotations} jobInstance={jobInstance} From c7a4a03d1602562df4bd3a4eede747257f81c1ef Mon Sep 17 00:00:00 2001 From: gudipudiramanakumar <47365328+gudipudiramanakumar@users.noreply.github.com> Date: Wed, 20 Oct 2021 21:01:13 +0530 Subject: [PATCH 14/17] Update annotation-menu.tsx Fixed the mistake of wrong variable name. --- .../src/components/annotation-page/top-bar/annotation-menu.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx b/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx index e71972b5ac70..17fd23f5661d 100644 --- a/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx +++ b/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx @@ -103,7 +103,7 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { 'It will stay on the server till you save the job. Continue?', className: 'cvat-modal-confirm-remove-annotation', onOk: () => { - onClickMenu(copyParams); + onClickMenu(params); }, okButtonProps: { type: 'primary', From e5c23b09390a8661c0ebf4c6ec192ea690ff7460 Mon Sep 17 00:00:00 2001 From: gudipudiramanakumar <47365328+gudipudiramanakumar@users.noreply.github.com> Date: Thu, 21 Oct 2021 14:15:29 +0530 Subject: [PATCH 15/17] Update remove-range-confirm.tsx Additional ESLint Issue fixed --- .../annotation-page/top-bar/remove-range-confirm.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx b/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx index 670623251786..dc348d965830 100644 --- a/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx +++ b/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx @@ -56,8 +56,8 @@ export default function RemoveRangeConfirmComponent(props: Props): JSX.Element { value={startFrame} onChange={(value: number | undefined | string) => { if (typeof value !== 'undefined') { - value = Math.floor(clamp(+value, 0, stopFrame - 1)); - managestart(value); + const newvalue = Math.floor(clamp(+value, 0, stopFrame - 1)); + managestart(newvalue); } }} /> @@ -71,8 +71,8 @@ export default function RemoveRangeConfirmComponent(props: Props): JSX.Element { value={endFrame} onChange={(value: number | undefined | string) => { if (typeof value !== 'undefined') { - value = Math.floor(clamp(+value, 1, stopFrame)); - manageend(value); + const newvalue = Math.floor(clamp(+value, 1, stopFrame)); + manageend(newvalue); } }} /> From 455466fa98353d86557b3f48d697212804ea62ee Mon Sep 17 00:00:00 2001 From: gudipudiramanakumar <47365328+gudipudiramanakumar@users.noreply.github.com> Date: Sat, 23 Oct 2021 16:01:59 +0530 Subject: [PATCH 16/17] Changed the approach of removeAnnotations modal Changed the approach of removeAnnotations modal so that it could match the implementation of all the other components --- cvat-core/src/annotations-collection.js | 30 +++---- cvat-ui/src/actions/annotation-actions.ts | 49 +++------- .../top-bar/annotation-menu.tsx | 89 +++++++++++-------- .../top-bar/remove-range-confirm.tsx | 89 ------------------- .../top-bar/annotation-menu.tsx | 18 ++-- cvat-ui/src/reducers/annotation-reducer.ts | 15 +--- 6 files changed, 81 insertions(+), 209 deletions(-) delete mode 100644 cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx diff --git a/cvat-core/src/annotations-collection.js b/cvat-core/src/annotations-collection.js index 3276ac9ce191..beb63a47cf65 100644 --- a/cvat-core/src/annotations-collection.js +++ b/cvat-core/src/annotations-collection.js @@ -554,13 +554,9 @@ } clear(startframe, endframe, delTrackKeyframesOnly) { - let objectsRemovable = []; - // If only a range of annotations need to be cleared if (startframe !== undefined && endframe !== undefined) { + // If only a range of annotations need to be cleared for (let frame = startframe; frame <= endframe; frame++) { - const shapes = this.shapes[frame] || []; - const tags = this.tags[frame] || []; - objectsRemovable = objectsRemovable.concat(shapes, tags); this.shapes[frame] = []; this.tags[frame] = []; } @@ -572,23 +568,25 @@ if (keyframe >= startframe && keyframe <= endframe) { delete track.shapes[keyframe]; } } } else if (track.frame >= startframe) { - objectsRemovable.push(track); const index = tracks.indexOf(track); if (index > -1) { tracks.splice(index, 1); } } } }); - - return; + } else if (startframe === undefined && endframe === undefined) { + // If all annotations need to be cleared + this.shapes = {}; + this.tags = {}; + this.tracks = []; + this.objects = {}; // by id + this.count = 0; + + this.flush = true; + } else { + // If inputs provided were wrong + throw Error('Could not remove the annotations, please provide both inputs or' + + ' leave the inputs below empty to remove all the annotations from this job'); } - // If all annotations need to be cleared - this.shapes = {}; - this.tags = {}; - this.tracks = []; - this.objects = {}; // by id - this.count = 0; - - this.flush = true; } statistics() { diff --git a/cvat-ui/src/actions/annotation-actions.ts b/cvat-ui/src/actions/annotation-actions.ts index 56db3be23fbd..ad01f4404388 100644 --- a/cvat-ui/src/actions/annotation-actions.ts +++ b/cvat-ui/src/actions/annotation-actions.ts @@ -165,8 +165,6 @@ export enum AnnotationActionTypes { UPLOAD_JOB_ANNOTATIONS_FAILED = 'UPLOAD_JOB_ANNOTATIONS_FAILED', REMOVE_JOB_ANNOTATIONS_SUCCESS = 'REMOVE_JOB_ANNOTATIONS_SUCCESS', REMOVE_JOB_ANNOTATIONS_FAILED = 'REMOVE_JOB_ANNOTATIONS_FAILED', - REMOVE_ANNOTATIONS_INRANGE_SUCCESS = 'REMOVE_ANNOTATIONS_INRANGE_SUCCESS', - REMOVE_ANNOTATIONS_INRANGE_FAILED = 'REMOVE_ANNOTATIONS_INRANGE_FAILED', UPDATE_CANVAS_CONTEXT_MENU = 'UPDATE_CANVAS_CONTEXT_MENU', UNDO_ACTION_SUCCESS = 'UNDO_ACTION_SUCCESS', UNDO_ACTION_FAILED = 'UNDO_ACTION_FAILED', @@ -308,17 +306,24 @@ export function updateCanvasContextMenu( }; } -export function removeAnnotationsAsync(sessionInstance: any): ThunkAction { +export function removeAnnotationsAsync( + startFrame: number, endFrame: number, delTrackKeyframesOnly: boolean, +): ThunkAction { return async (dispatch: ActionCreator): Promise => { try { - await sessionInstance.annotations.clear(); - await sessionInstance.actions.clear(); - const history = await sessionInstance.actions.get(); + const { + filters, frame, showAllInterpolationTracks, jobInstance, + } = receiveAnnotationsParameters(); + await jobInstance.annotations.clear(false, startFrame, endFrame, delTrackKeyframesOnly); + await jobInstance.actions.clear(); + const history = await jobInstance.actions.get(); + const states = await jobInstance.annotations.get(frame, showAllInterpolationTracks, filters); dispatch({ type: AnnotationActionTypes.REMOVE_JOB_ANNOTATIONS_SUCCESS, payload: { history, + states, }, }); } catch (error) { @@ -506,38 +511,6 @@ export function changePropagateFrames(frames: number): AnyAction { }; } -// To remove annotation objects present in given range of frames -export function removeAnnotationsinRangeAsync( - startFrame: number, endFrame: number, delTrackKeyframesOnly: boolean, -): ThunkAction { - return async (dispatch: ActionCreator): Promise => { - try { - const { - filters, frame, showAllInterpolationTracks, jobInstance, - } = receiveAnnotationsParameters(); - await jobInstance.annotations.clear(false, startFrame, endFrame, delTrackKeyframesOnly); - await jobInstance.actions.clear(); - const history = await jobInstance.actions.get(); - const states = await jobInstance.annotations.get(frame, showAllInterpolationTracks, filters); - - dispatch({ - type: AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE_SUCCESS, - payload: { - history, - states, - }, - }); - } catch (error) { - dispatch({ - type: AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE_FAILED, - payload: { - error, - }, - }); - } - }; -} - export function removeObjectAsync(sessionInstance: any, objectState: any, force: boolean): ThunkAction { return async (dispatch: ActionCreator): Promise => { try { diff --git a/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx b/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx index 17fd23f5661d..52118eaaa4c8 100644 --- a/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx +++ b/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx @@ -2,18 +2,20 @@ // // SPDX-License-Identifier: MIT -import React, { useState } from 'react'; +import React from 'react'; import Menu from 'antd/lib/menu'; import Modal from 'antd/lib/modal'; +import Text from 'antd/lib/typography/Text'; +import { + InputNumber, Tooltip, Checkbox, Collapse, +} from 'antd'; // eslint-disable-next-line import/no-extraneous-dependencies import { MenuInfo } from 'rc-menu/lib/interface'; import LoadSubmenu from 'components/actions-menu/load-submenu'; import { DimensionType } from '../../../reducers/interfaces'; -import RemoveAnnotationsRangeComponent from './remove-range-confirm'; - interface Props { taskMode: string; loaders: any[]; @@ -24,7 +26,7 @@ interface Props { onClickMenu(params: MenuInfo): void; onUploadAnnotations(format: string, file: File): void; stopFrame: number; - removeRange(startnumber: number, endnumber: number, deltrack_keyframes_only:boolean): void; + removeAnnotations(startnumber: number, endnumber: number, delTrackKeyframesOnly:boolean): void; setForceExitAnnotationFlag(forceExit: boolean): void; saveAnnotations(jobInstance: any, afterSave?: () => void): void; } @@ -49,13 +51,11 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { stopFrame, onClickMenu, onUploadAnnotations, - removeRange, + removeAnnotations, setForceExitAnnotationFlag, saveAnnotations, } = props; - const [openRemoveRangeComponent, toggleOpenRemoveRangeComponent] = useState(false); - const jobStatus = jobInstance.status; const taskID = jobInstance.task.id; @@ -89,41 +89,58 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { } if (params.key === Actions.REMOVE_ANNO) { + let removeFrom: any; + let removeUpTo: any; + let removeOnlyKeyframes: any = false; + const { Panel } = Collapse; Modal.confirm({ title: 'Remove Annotations', - content: - 'Select whether to remove all annotations from the job or remove within a range\n' + - 'It will stay on the server till you save the job. Continue?', + content: ( +
+ You are going to remove the annotations from the client. + It will stay on the server till you save the job. Continue? +
+
+ + Select Range} key={1}> + From: + { + removeFrom = value; + }} + /> + To: + { removeUpTo = value; }} + /> + +
+
+ { + removeOnlyKeyframes = check.target.checked; + }} + > + Delete only keyframes for tracks + +
+
+
+
+ ), className: 'cvat-modal-confirm-remove-annotation', onOk: () => { - Modal.confirm({ - title: 'All the annotations will be removed', - content: - 'You are going to remove all the annotations from the client. ' + - 'It will stay on the server till you save the job. Continue?', - className: 'cvat-modal-confirm-remove-annotation', - onOk: () => { - onClickMenu(params); - }, - okButtonProps: { - type: 'primary', - danger: true, - }, - okText: 'Delete', - }); + removeAnnotations(removeFrom, removeUpTo, removeOnlyKeyframes); }, okButtonProps: { type: 'primary', danger: true, }, - okText: 'Remove All', - onCancel: () => { - toggleOpenRemoveRangeComponent(!openRemoveRangeComponent); - }, - cancelText: 'Select Range', - cancelButtonProps: { - type: 'primary', - }, + okText: 'Delete', }); } else if (params.key === Actions.REQUEST_REVIEW) { checkUnsavedChanges(params); @@ -194,12 +211,6 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { Submit the review )} {jobStatus === 'completed' && Renew the job} - { toggleOpenRemoveRangeComponent(!openRemoveRangeComponent); }} - />
); } diff --git a/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx b/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx deleted file mode 100644 index dc348d965830..000000000000 --- a/cvat-ui/src/components/annotation-page/top-bar/remove-range-confirm.tsx +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (C) 2021 Intel Corporation -// -// SPDX-License-Identifier: MIT - -import React, { useState } from 'react'; - -import Modal from 'antd/lib/modal'; -import InputNumber from 'antd/lib/input-number'; -import Text from 'antd/lib/typography/Text'; -import Checkbox from 'antd/lib/checkbox'; -import { clamp } from 'utils/math'; - -interface Props { - visible: boolean; - stopFrame: number; - removeinRange(startnumber:number, endnumber:number, delTrackKeyframesOnly:boolean): void; - cancel(): void; -} - -export default function RemoveRangeConfirmComponent(props: Props): JSX.Element { - const { - visible, - stopFrame, - removeinRange, - cancel, - } = props; - - const minStartFrames = 0; - - const [startFrame, managestart] = useState(0); - const [endFrame, manageend] = useState(1); - const [delTrackKeyframesOnly, managedelTrackKeyframesOnly] = useState(false); - - const minEndFrames = Math.max(startFrame, 1); - - return ( - { - removeinRange(startFrame, endFrame, delTrackKeyframesOnly); - cancel(); - }} - onCancel={cancel} - title='Confirm to remove annotations in range' - visible={visible} - > -
- Do you want to remove the annotations on - { - if (typeof value !== 'undefined') { - const newvalue = Math.floor(clamp(+value, 0, stopFrame - 1)); - managestart(newvalue); - } - }} - /> - {startFrame > 1 ? frames : frame } - up to the - { - if (typeof value !== 'undefined') { - const newvalue = Math.floor(clamp(+value, 1, stopFrame)); - manageend(newvalue); - } - }} - /> - frame - , -
-
- { managedelTrackKeyframesOnly(!delTrackKeyframesOnly); }}> - Delete only track keyframes - -
-
- ); -} diff --git a/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx b/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx index eda6c6e9b91e..bd2121595bb5 100644 --- a/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx +++ b/cvat-ui/src/containers/annotation-page/top-bar/annotation-menu.tsx @@ -13,12 +13,11 @@ import AnnotationMenuComponent, { Actions } from 'components/annotation-page/top import { updateJobAsync } from 'actions/tasks-actions'; import { uploadJobAnnotationsAsync, - removeAnnotationsAsync, saveAnnotationsAsync, switchRequestReviewDialog as switchRequestReviewDialogAction, switchSubmitReviewDialog as switchSubmitReviewDialogAction, setForceExitAnnotationFlag as setForceExitAnnotationFlagAction, - removeAnnotationsinRangeAsync as removeAnnotationsinRangeAsyncAction, + removeAnnotationsAsync as removeAnnotationsAsyncAction, } from 'actions/annotation-actions'; import { exportActions } from 'actions/export-actions'; @@ -33,8 +32,7 @@ interface StateToProps { interface DispatchToProps { loadAnnotations(job: any, loader: any, file: File): void; showExportModal(task: any): void; - removeAnnotations(sessionInstance: any): void; - removeAnnotationsinRange(startnumber:number, endnumber:number, delTrackKeyframesOnly:boolean): void; + removeAnnotations(startnumber:number, endnumber:number, delTrackKeyframesOnly:boolean): void; switchRequestReviewDialog(visible: boolean): void; switchSubmitReviewDialog(visible: boolean): void; setForceExitAnnotationFlag(forceExit: boolean): void; @@ -78,11 +76,8 @@ function mapDispatchToProps(dispatch: any): DispatchToProps { showExportModal(task: any): void { dispatch(exportActions.openExportModal(task)); }, - removeAnnotations(sessionInstance: any): void { - dispatch(removeAnnotationsAsync(sessionInstance)); - }, - removeAnnotationsinRange(startnumber: number, endnumber: number, delTrackKeyframesOnly:boolean) { - dispatch(removeAnnotationsinRangeAsyncAction(startnumber, endnumber, delTrackKeyframesOnly)); + removeAnnotations(startnumber: number, endnumber: number, delTrackKeyframesOnly:boolean) { + dispatch(removeAnnotationsAsyncAction(startnumber, endnumber, delTrackKeyframesOnly)); }, switchRequestReviewDialog(visible: boolean): void { dispatch(switchRequestReviewDialogAction(visible)); @@ -114,7 +109,6 @@ function AnnotationMenuContainer(props: Props): JSX.Element { loadActivity, loadAnnotations, showExportModal, - removeAnnotationsinRange, removeAnnotations, switchRequestReviewDialog, switchSubmitReviewDialog, @@ -134,8 +128,6 @@ function AnnotationMenuContainer(props: Props): JSX.Element { const [action] = params.keyPath; if (action === Actions.EXPORT_TASK_DATASET) { showExportModal(jobInstance.task); - } else if (action === Actions.REMOVE_ANNO) { - removeAnnotations(jobInstance); } else if (action === Actions.REQUEST_REVIEW) { switchRequestReviewDialog(true); } else if (action === Actions.SUBMIT_REVIEW) { @@ -163,7 +155,7 @@ function AnnotationMenuContainer(props: Props): JSX.Element { loadActivity={loadActivity} onUploadAnnotations={onUploadAnnotations} onClickMenu={onClickMenu} - removeRange={removeAnnotationsinRange} + removeAnnotations={removeAnnotations} setForceExitAnnotationFlag={setForceExitAnnotationFlag} saveAnnotations={saveAnnotations} jobInstance={jobInstance} diff --git a/cvat-ui/src/reducers/annotation-reducer.ts b/cvat-ui/src/reducers/annotation-reducer.ts index afe26365c8e3..72d84616350d 100644 --- a/cvat-ui/src/reducers/annotation-reducer.ts +++ b/cvat-ui/src/reducers/annotation-reducer.ts @@ -917,21 +917,8 @@ export default (state = defaultState, action: AnyAction): AnnotationState => { }, }; } + // Added Remove Annotations case AnnotationActionTypes.REMOVE_JOB_ANNOTATIONS_SUCCESS: { - const { history } = action.payload; - return { - ...state, - annotations: { - ...state.annotations, - history, - activatedStateID: null, - collapsed: {}, - states: [], - }, - }; - } - // Added Remove Annotations in Range - case AnnotationActionTypes.REMOVE_ANNOTATIONS_INRANGE_SUCCESS: { const { history } = action.payload; const { states } = action.payload; return { From 8b0dc6796991a33ee084181a361ec76860492103 Mon Sep 17 00:00:00 2001 From: gudipudiramanakumar <47365328+gudipudiramanakumar@users.noreply.github.com> Date: Tue, 26 Oct 2021 16:38:53 +0530 Subject: [PATCH 17/17] Added to changelog Fixed type annotations in the annotation-menu component for remove annotations, and updated cvat-ui and cvat-core npm versions. --- CHANGELOG.md | 1 + cvat-core/package-lock.json | 4 ++-- cvat-core/package.json | 2 +- cvat-ui/package-lock.json | 4 ++-- cvat-ui/package.json | 2 +- .../components/annotation-page/top-bar/annotation-menu.tsx | 6 +++--- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 969f1844f6b6..8a4901ec5a30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Progress bar for manifest creating () - Add a tutorial on attaching cloud storage AWS-S3 () and Azure Blob Container () +- The feature to remove annotations in a specified range of frames () ### Changed diff --git a/cvat-core/package-lock.json b/cvat-core/package-lock.json index a3ed6aba99af..940de2eb3a6e 100644 --- a/cvat-core/package-lock.json +++ b/cvat-core/package-lock.json @@ -1,12 +1,12 @@ { "name": "cvat-core", - "version": "3.16.1", + "version": "3.17.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "cvat-core", - "version": "3.16.1", + "version": "3.17.0", "license": "MIT", "dependencies": { "axios": "^0.21.4", diff --git a/cvat-core/package.json b/cvat-core/package.json index ac58beec6fcc..fa63b2d80aba 100644 --- a/cvat-core/package.json +++ b/cvat-core/package.json @@ -1,6 +1,6 @@ { "name": "cvat-core", - "version": "3.16.1", + "version": "3.17.0", "description": "Part of Computer Vision Tool which presents an interface for client-side integration", "main": "babel.config.js", "scripts": { diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index 0e292cc20c8d..6c676a570aa3 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,12 +1,12 @@ { "name": "cvat-ui", - "version": "1.24.1", + "version": "1.25.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "cvat-ui", - "version": "1.24.1", + "version": "1.25.0", "license": "MIT", "dependencies": { "@ant-design/icons": "^4.6.3", diff --git a/cvat-ui/package.json b/cvat-ui/package.json index c703b786bac5..a7a9ef5c1d89 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.24.1", + "version": "1.25.0", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": { diff --git a/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx b/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx index 52118eaaa4c8..72ff834dd43f 100644 --- a/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx +++ b/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx @@ -89,9 +89,9 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { } if (params.key === Actions.REMOVE_ANNO) { - let removeFrom: any; - let removeUpTo: any; - let removeOnlyKeyframes: any = false; + let removeFrom: number; + let removeUpTo: number; + let removeOnlyKeyframes = false; const { Panel } = Collapse; Modal.confirm({ title: 'Remove Annotations',