Skip to content

Commit

Permalink
refactor: LEAP-1320: Remove Stale Feature Flag - ff_front_dev_2290_dr…
Browse files Browse the repository at this point in the history
…aft_in_annotation_history_short
  • Loading branch information
luarmr committed Jan 8, 2025
1 parent a8b839f commit fa0d3a8
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 36 deletions.
1 change: 0 additions & 1 deletion label_studio/core/feature_flags/stale_feature_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
'ff_front_dev_2432_auto_save_polygon_draft_210622_short': True,
'ff_front_dev_2575_projects_list_performance_280622_short': True,
'ff_front_dev_2431_delete_polygon_points_080622_short': True,
'ff_front_dev_2290_draft_in_annotation_history_short': True,
'ff_dev_2128_html_in_labels_150422_short': True,
'ff_front_dev_1495_avatar_mess_210122_short': True,
'ff_front_1170_outliner_030222_short': True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ const AnnotationHistoryComponent: FC<any> = ({
selectedHistory,
history,
enabled = true,
showDraft = false,
inline = false,
}) => {
const annotation = annotationStore.selected;
Expand All @@ -119,15 +118,15 @@ const AnnotationHistoryComponent: FC<any> = ({

return (
<Block name="annotation-history" mod={{ inline }}>
{showDraft && <DraftState annotation={annotation} isSelected={isDraftSelected} inline={inline} />}
<DraftState annotation={annotation} isSelected={isDraftSelected} inline={inline} />

{enabled &&
history.length > 0 &&
history.map((item: any) => {
const { id, user, createdDate } = item;
const isLastItem = lastItem?.id === item.id;
const isSelected =
isLastItem && !selectedHistory && showDraft ? !isDraftSelected : selectedHistory?.id === item.id;
isLastItem && !selectedHistory ? !isDraftSelected : selectedHistory?.id === item.id;
const hiddenUser = infoIsHidden ? { email: currentUser?.id === user.id ? "Me" : "User" } : null;

return (
Expand All @@ -142,10 +141,6 @@ const AnnotationHistoryComponent: FC<any> = ({
disabled={item.results.length === 0}
hideInfo={infoIsHidden}
onClick={async () => {
if (!showDraft) {
annotationStore.selectHistory(isSelected ? null : item);
return;
}
if (hasChanges) {
annotation.saveDraftImmediately();
// wait for draft to be saved before switching to history
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { inject, observer } from "mobx-react";
import { Space } from "../../common/Space/Space";
import { Block, Elem } from "../../utils/bem";
import { FF_DEV_2290, isFF } from "../../utils/feature-flags";
import { DraftPanel } from "../DraftPanel/DraftPanel";
import { AnnotationHistory } from "./AnnotationHistory.tsx";
import { useRegionsCopyPaste } from "../../hooks/useRegionsCopyPaste";
Expand All @@ -11,8 +10,6 @@ const injector = inject("store");

export const CurrentEntity = injector(
observer(({ entity, showHistory = true }) => {
const showDraftInHistory = isFF(FF_DEV_2290);

useRegionsCopyPaste(entity);

return entity ? (
Expand Down Expand Up @@ -48,7 +45,7 @@ export const CurrentEntity = injector(
{/* </Space>
</Elem> */}

{!showDraftInHistory && <DraftPanel item={entity} />}
<DraftPanel item={entity} />

{/* {showHistory && !entity.userGenerate && ( */}
{showHistory && (
Expand All @@ -57,7 +54,7 @@ export const CurrentEntity = injector(
<Elem name="id">#{entity.pk ?? entity.id}</Elem>
</Elem>
)}
<AnnotationHistory enabled={showHistory} showDraft={showDraftInHistory} />
<AnnotationHistory enabled={showHistory} />
</Block>
) : null;
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { inject, observer } from "mobx-react";
import type { FC } from "react";
import { Block, Elem } from "../../../utils/bem";
import { FF_DEV_2290, isFF } from "../../../utils/feature-flags";
import { Comments as CommentsComponent } from "../../Comments/Comments";
import { AnnotationHistory } from "../../CurrentEntity/AnnotationHistory";
import { PanelBase, type PanelProps } from "../PanelBase";
Expand Down Expand Up @@ -90,24 +89,19 @@ const RelationsTab: FC<any> = inject("store")(
const HistoryTab: FC<any> = inject("store")(
observer(({ store, currentEntity }) => {
const showAnnotationHistory = store.hasInterface("annotations:history");
const showDraftInHistory = isFF(FF_DEV_2290);

return (
<>
<Block name="history">
{!showDraftInHistory ? (
<DraftPanel item={currentEntity} />
) : (
<Elem name="section-tab">
<Elem name="section-head">
Annotation History
<span>#{currentEntity.pk ?? currentEntity.id}</span>
</Elem>
<Elem name="section-content">
<AnnotationHistory inline showDraft={showDraftInHistory} enabled={showAnnotationHistory} />
</Elem>
<Elem name="section-tab">
<Elem name="section-head">
Annotation History
<span>#{currentEntity.pk ?? currentEntity.id}</span>
</Elem>
<Elem name="section-content">
<AnnotationHistory inline enabled={showAnnotationHistory} />
</Elem>
)}
</Elem>
</Block>
</>
);
Expand All @@ -133,8 +127,6 @@ const GeneralPanel: FC<any> = inject("store")(
observer(({ store, currentEntity }) => {
const { relationStore } = currentEntity;
const showAnnotationHistory = store.hasInterface("annotations:history");
const showDraftInHistory = isFF(FF_DEV_2290);

return (
<>
{!showDraftInHistory ? (
Expand All @@ -146,7 +138,7 @@ const GeneralPanel: FC<any> = inject("store")(
<span>#{currentEntity.pk ?? currentEntity.id}</span>
</Elem>
<Elem name="section-content">
<AnnotationHistory inline showDraft={showDraftInHistory} enabled={showAnnotationHistory} />
<AnnotationHistory enabled={showAnnotationHistory} />
</Elem>
</Elem>
)}
Expand Down
3 changes: 0 additions & 3 deletions web/libs/editor/src/utils/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ export const FF_DEV_1713 = "ff_front_DEV_1713_audio_ui_150222_short";
// Allow to use html inside <Label/> tags
export const FF_DEV_2128 = "ff_dev_2128_html_in_labels_150422_short";

// Show draft as the topmost item in annotation history
export const FF_DEV_2290 = "ff_front_dev_2290_draft_in_annotation_history_short";

export const FF_DEV_2431 = "ff_front_dev_2431_delete_polygon_points_080622_short";

export const FF_DEV_2432 = "ff_front_dev_2432_auto_save_polygon_draft_210622_short";
Expand Down
3 changes: 0 additions & 3 deletions web/libs/frontend-test/src/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ export const FF_DEV_1713 = "ff_front_DEV_1713_audio_ui_150222_short";
// Allow to use html inside <Label/> tags
export const FF_DEV_2128 = "ff_dev_2128_html_in_labels_150422_short";

// Show draft as the topmost item in annotation history
export const FF_DEV_2290 = "ff_front_dev_2290_draft_in_annotation_history_short";

export const FF_DEV_2431 = "ff_front_dev_2431_delete_polygon_points_080622_short";

export const FF_DEV_2432 = "ff_front_dev_2432_auto_save_polygon_draft_210622_short";
Expand Down

0 comments on commit fa0d3a8

Please sign in to comment.