Skip to content

Commit

Permalink
fix: LEAP-640: Don't save empty draft on View All (#5417)
Browse files Browse the repository at this point in the history
* [submodules] Copy src HumanSignal/label-studio-frontend

Workflow run: https://github.com/HumanSignal/label-studio/actions/runs/7756881613

* ci: Build frontend

Workflow run: https://github.com/HumanSignal/label-studio/actions/runs/7756901971

* [submodules] Copy src HumanSignal/label-studio-frontend

Workflow run: https://github.com/HumanSignal/label-studio/actions/runs/7787223735

* ci: Build frontend

Workflow run: https://github.com/HumanSignal/label-studio/actions/runs/7787245903

* [submodules] Copy src HumanSignal/label-studio-frontend

Workflow run: https://github.com/HumanSignal/label-studio/actions/runs/7816482310

* ci: Build frontend

Workflow run: https://github.com/HumanSignal/label-studio/actions/runs/7816520903

* [submodules] Copy src HumanSignal/label-studio-frontend

Workflow run: https://github.com/HumanSignal/label-studio/actions/runs/7817453930

* ci: Build frontend

Workflow run: https://github.com/HumanSignal/label-studio/actions/runs/7817476503

* Trigger LSE PR

* Rollback simple change

It was added to trigger LSE deps

* ci: Build frontend

Workflow run: https://github.com/HumanSignal/label-studio/actions/runs/7841489368

* [submodules] Copy src HumanSignal/label-studio-frontend

Workflow run: https://github.com/HumanSignal/label-studio/actions/runs/7845938928

* ci: Build frontend

Workflow run: https://github.com/HumanSignal/label-studio/actions/runs/7845965165

* [submodules] Copy src HumanSignal/label-studio-frontend

Workflow run: https://github.com/HumanSignal/label-studio/actions/runs/7846089546

* [submodules] Copy src HumanSignal/label-studio-frontend

Workflow run: https://github.com/HumanSignal/label-studio/actions/runs/7846784041

---------

Co-authored-by: hlomzik <[email protected]>
Co-authored-by: robot-ci-heartex <[email protected]>
Co-authored-by: Yousif Yassi <[email protected]>
Co-authored-by: yyassi-heartex <[email protected]>
  • Loading branch information
5 people authored Feb 9, 2024
1 parent 3388ce6 commit e38dcb8
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 17 deletions.
2 changes: 1 addition & 1 deletion web/dist/libs/editor/main.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/libs/editor/main.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/libs/editor/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/libs/editor/main.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/libs/editor/src/components/NewTaxonomy/NewTaxonomy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ const NewTaxonomy = ({
}}
treeCheckStrictly
showCheckedStrategy={TreeSelect.SHOW_ALL}
treeExpandAction={false}
treeExpandAction="click"
dropdownMatchSelectWidth={dropdownWidth}
placeholder={options.placeholder || 'Click to add...'}
style={style}
Expand Down
1 change: 0 additions & 1 deletion web/libs/editor/src/components/TopBar/Actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export const Actions = ({ store }) => {
const isViewAll = annotationStore.viewingAll;

const onToggleVisibility = useCallback(() => {
!isViewAll && entity.saveDraftImmediatelyWithResults({ useToast: true });
annotationStore.toggleViewingAllAnnotations();
}, [annotationStore]);

Expand Down
19 changes: 8 additions & 11 deletions web/libs/editor/src/components/TopBar/TopBar.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { observer } from 'mobx-react';

import { IconViewAll, LsPlus } from '../../assets/icons';
import { Button } from '../../common/Button/Button';
import { Tooltip } from '../../common/Tooltip/Tooltip';
import { Block, Elem } from '../../utils/bem';
import { FF_DEV_3873, isFF } from '../../utils/feature-flags';
import { AnnotationsCarousel } from '../AnnotationsCarousel/AnnotationsCarousel';
import { DynamicPreannotationsToggle } from '../AnnotationTab/DynamicPreannotationsToggle';
import { Actions } from './Actions';
import { Annotations } from './Annotations';
import { Controls } from './Controls';
import { CurrentTask } from './CurrentTask';
import { FF_DEV_3873, isFF } from '../../utils/feature-flags';
import { Button } from '../../common/Button/Button';
import { Tooltip } from '../../common/Tooltip/Tooltip';
import { IconViewAll, LsPlus } from '../../assets/icons';
import { AnnotationsCarousel } from '../AnnotationsCarousel/AnnotationsCarousel';

import './TopBar.styl';

export const TopBar = observer(({ store }) => {
Expand All @@ -19,11 +21,6 @@ export const TopBar = observer(({ store }) => {

const isViewAll = annotationStore?.viewingAll === true;

const toggleViewAll = () => {
!isViewAll && entity.saveDraftImmediatelyWithResults({ useToast: true });
annotationStore.toggleViewingAllAnnotations();
};

return store ? (
<Block name="topbar" mod={{ newLabelingUI: isFF(FF_DEV_3873) }}>
{isFF(FF_DEV_3873) ? (
Expand All @@ -36,7 +33,7 @@ export const TopBar = observer(({ store }) => {
icon={<IconViewAll />}
type="text"
aria-label="View All"
onClick={toggleViewAll}
onClick={annotationStore.toggleViewingAllAnnotations}
primary={ isViewAll }
style={{
height: 36,
Expand Down
13 changes: 13 additions & 0 deletions web/libs/editor/src/stores/Annotation/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ const AnnotationStoreModel = types
function toggleViewingAll() {
if (self.viewingAllAnnotations || self.viewingAllPredictions) {
if (self.selected) {
// const comments = self.store.commentStore;

// @todo `currentComment` is an object and saving them was not a part of original fix
// @todo so I leave it for next fix coming soon
// if (comments.currentComment) {
// // comment will save draft automatically
// comments.commentFormSubmit();
// } else
if (self.selected.type === 'annotation') {
// save draft if there are changes waiting to be saved — it's handled inside
self.selected.saveDraftImmediately();
}

self.selected.unselectAll();
self.selected.selected = false;
}
Expand Down

0 comments on commit e38dcb8

Please sign in to comment.