Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fb optic 1542/remove a buch of stale feature flags #6931

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions label_studio/core/feature_flags/stale_feature_flags.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,13 @@
'fflag_fix_front_lsdv_4988_dynamic_no_label_120523_short': True,
'fflag_fix_back_lsdv_4648_annotator_filter_29052023_short': True,
'fflag_feat_back_lsdv_5035_use_created_at_from_draft_for_annotation_256052023_short': True,
'fflag_fix_front_lsdv_4992_hide_all_regions_04052023_short': True,
'ff_back_dev_4664_remove_storage_file_on_export_delete_29032023_short': False,
'fflag_feat_front_lops_86_datasets_storage_edit_short': False,
'fflag_fix_back_lsdv_4929_limit_exports_10042023_short': True,
'fflag_feat_front_lsdv_4620_richtext_opimization_060423_short': True,
'ff_back_dev_3865_filters_anno_171222_short': True,
'fflag_feat_front_dev_3873_labeling_ui_improvements_short': True,
'fflag_feat_back_dev_3756_queue_enrollment_min_short': False,
'fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short': True,
'fflag_fix_front_dev_3617_taxonomy_memory_leaks_fix': True,
'ff_front_dev_2432_auto_save_polygon_draft_210622_short': True,
'ff_front_dev_1495_avatar_mess_210122_short': True,
'ff_front_1170_outliner_030222_short': True,
Expand Down
11 changes: 3 additions & 8 deletions web/apps/labelstudio/src/pages/CreateProject/Config/Preview.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { Spinner } from "../../../components";
import { cn } from "../../../utils/bem";
import { FF_DEV_3617, isFF } from "../../../utils/feature-flags";
import "./Config.scss";
import { EMPTY_CONFIG } from "./Template";
import { API_CONFIG } from "../../../config/ApiConfig";
Expand Down Expand Up @@ -75,7 +74,7 @@ export const Preview = ({ config, data, error, loading, project }) => {
task,
interfaces: ["side-column"],
// with SharedStore we should use more late event
[isFF(FF_DEV_3617) ? "onStorageInitialized" : "onLabelStudioLoad"](LS) {
onStorageInitialized(LS) {
LS.settings.bottomSidePanel = true;

const initAnnotation = () => {
Expand All @@ -86,12 +85,8 @@ export const Preview = ({ config, data, error, loading, project }) => {
setStoreReady(true);
};

if (isFF(FF_DEV_3617)) {
// and even then we need to wait a little even after the store is initialized
setTimeout(initAnnotation);
} else {
initAnnotation();
}
// and even then we need to wait a little even after the store is initialized
setTimeout(initAnnotation);
},
});

Expand Down
6 changes: 0 additions & 6 deletions web/apps/labelstudio/src/utils/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ export const FF_DEV_1658 = "ff_front_dev_1658_notification_center_170222_short";
// Model version selector per model backend
export const FF_DEV_1682 = "ff_front_dev_1682_model_version_dropdown_070622_short";

/**
* Addresses the memory leak issue in Taxonomy with Repeater
* @link https://app.launchdarkly.com/default/production/features/fflag_fix_front_dev_3617_taxonomy_memory_leaks_fix
*/
export const FF_DEV_3617 = "fflag_fix_front_dev_3617_taxonomy_memory_leaks_fix";

// Fixes how presigned urls are generated and accessed to remove possibility of CORS errors.
export const FF_LSDV_4711 = "fflag_fix_all_lsdv_4711_cors_errors_accessing_task_data_short";
// Enables "Enterprise Awareness" features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { OutlinerTree } from "./OutlinerTree";
import { ViewControls } from "./ViewControls";
import "./OutlinerPanel.scss";
import { IconInfo } from "../../../assets/icons/outliner";
import { FF_LSDV_4992, FF_OUTLINER_OPTIM, isFF } from "../../../utils/feature-flags";
import { FF_OUTLINER_OPTIM, isFF } from "../../../utils/feature-flags";

interface OutlinerPanelProps extends PanelProps {
regions: any;
Expand All @@ -18,9 +18,8 @@ interface OutlinerTreeComponentProps {

const OutlinerFFClasses: string[] = [];

if (isFF(FF_LSDV_4992)) {
OutlinerFFClasses.push("ff_hide_all_regions");
}
OutlinerFFClasses.push("ff_hide_all_regions");

if (isFF(FF_OUTLINER_OPTIM)) {
OutlinerFFClasses.push("ff_outliner_optim");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
align-items: center;
grid-auto-flow: column;
grid-auto-columns: min-content;
grid-column-gap: 8px;
grid-column-gap: 4px;
background-color: var(--sand_0);
box-shadow: 0 1px 0 rgb(0 0 0 / 10%);

Expand Down Expand Up @@ -36,11 +36,13 @@
}

.button {
height: 40px;
font-size: 14px;
height: 24px;
font-size: 11px;
font-weight: 400;
padding: 0;
justify-content: flex-start;
white-space: nowrap;
box-shadow: none;

&_newUI {
font-size: 12px;
Expand All @@ -60,34 +62,23 @@
&:focus {
box-shadow: none;
}
}

&_FF_LSDV_4992 {
grid-column-gap: 4px;

.button {
height: 24px;
font-size: 11px;
white-space: nowrap;
box-shadow: none;

&:hover {
background: var(--sand_200);
border-radius: 4px;
}
&:hover {
background: var(--sand_200);
border-radius: 4px;
}

&[disabled] {
background-color: var(--sand_0);
color: var(--sand_400);
}
&[disabled] {
background-color: var(--sand_0);
color: var(--sand_400);
}

&_type_text {
padding: 0 2px !important;
}
&_type_text {
padding: 0 2px !important;
}

&.dropdown__trigger {
padding: 0 6px 0 2px;
}
&.dropdown__trigger {
padding: 0 6px 0 2px;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { Menu } from "../../../common/Menu/Menu";
import { BemWithSpecifiContext } from "../../../utils/bem";
import { SidePanelsContext } from "../SidePanelsContext";
import "./ViewControls.scss";
import { FF_DEV_3873, FF_LSDV_4992, isFF } from "../../../utils/feature-flags";
import { FF_DEV_3873, isFF } from "../../../utils/feature-flags";
import { observer } from "mobx-react";

const { Block, Elem } = BemWithSpecifiContext();
Expand Down Expand Up @@ -56,14 +56,14 @@ export const ViewControls: FC<ViewControlsProps> = observer(
case "label":
return {
label: "Group by Label",
selectedLabel: isFF(FF_DEV_3873) ? (isFF(FF_LSDV_4992) ? "By Label" : "Label") : "Grouped by Label",
selectedLabel: isFF(FF_DEV_3873) ? "By Label" : "Grouped by Label",
icon: <IconTagAlt />,
tooltip: "Grouped by Label",
};
case "type":
return {
label: "Group by Tool",
selectedLabel: isFF(FF_DEV_3873) ? (isFF(FF_LSDV_4992) ? "By Tool" : "Tool") : "Grouped by Tool",
selectedLabel: isFF(FF_DEV_3873) ? "By Tool" : "Grouped by Tool",
icon: <IconCursor />,
tooltip: "Grouped by Tool",
};
Expand Down Expand Up @@ -95,7 +95,7 @@ export const ViewControls: FC<ViewControlsProps> = observer(
);

return (
<Block name="view-controls" mod={{ collapsed: context.locked, FF_LSDV_4992: isFF(FF_LSDV_4992) }}>
<Block name="view-controls" mod={{ collapsed: context.locked }}>
<Grouping
value={grouping}
options={["manual", "type", "label"]}
Expand All @@ -115,7 +115,7 @@ export const ViewControls: FC<ViewControlsProps> = observer(
/>
</Elem>
)}
{isFF(FF_LSDV_4992) ? <ToggleRegionsVisibilityButton regions={regions} /> : null}
<ToggleRegionsVisibilityButton regions={regions} />
</Block>
);
},
Expand Down Expand Up @@ -183,16 +183,7 @@ const Grouping = <T extends string>({

// mods are already set in the button from type, so use it only in new UI
const extraStyles = isFF(FF_DEV_3873) ? { mod: { newUI: true } } : undefined;
const style = isFF(FF_LSDV_4992)
? {}
: {
padding: "0",
whiteSpace: "nowrap",
};

if (isFF(FF_DEV_3873)) {
style.padding = "0 12px 0 2px";
}
const style = isFF(FF_DEV_3873) ? { padding: "0 12px 0 2px" } : {};

return (
<Dropdown.Trigger content={dropdownContent} style={{ width: 200 }}>
Expand Down
9 changes: 2 additions & 7 deletions web/libs/editor/src/mixins/DrawingTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { types } from "mobx-state-tree";
import Utils from "../utils";
import throttle from "lodash.throttle";
import { MIN_SIZE } from "../tools/Base";
import { FF_DEV_3666, FF_DEV_3793, isFF } from "../utils/feature-flags";
import { FF_DEV_3793, isFF } from "../utils/feature-flags";
import { RELATIVE_STAGE_HEIGHT, RELATIVE_STAGE_WIDTH } from "../components/ImageView/Image";

const DrawingTool = types
Expand Down Expand Up @@ -175,12 +175,7 @@ const DrawingTool = types
},

canStartDrawing() {
return (
!self.isIncorrectControl() &&
(!isFF(FF_DEV_3666) || !self.isIncorrectLabel()) &&
self.canStart() &&
!self.annotation.isDrawing
);
return !self.isIncorrectControl() && !self.isIncorrectLabel() && self.canStart() && !self.annotation.isDrawing;
},

startDrawing(x, y) {
Expand Down
9 changes: 1 addition & 8 deletions web/libs/editor/src/mixins/SelectedModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { types } from "mobx-state-tree";

import Tree from "../core/Tree";
import { isDefined } from "../utils/utilities";
import { FF_DEV_3666, isFF } from "../utils/feature-flags";

const SelectedModelMixin = types
.model()
Expand Down Expand Up @@ -82,13 +81,7 @@ const SelectedModelMixin = types
},

checkMaxUsages() {
if (isFF(FF_DEV_3666)) {
return self.tiedChildren.filter((c) => !c.canBeUsed());
}
const list = self.tiedChildren.filter((c) => !c.canBeUsed());

if (list.length) list.forEach((c) => c.setSelected(false));
return list;
return self.tiedChildren.filter((c) => !c.canBeUsed());
},

selectFirstVisible() {
Expand Down
4 changes: 2 additions & 2 deletions web/libs/editor/src/stores/Annotation/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Types from "../../core/Types";
import { StoreExtender } from "../../mixins/SharedChoiceStore/extender";
import { ViewModel } from "../../tags/visual";
import Utils from "../../utils";
import { FF_DEV_3034, FF_DEV_3391, FF_DEV_3617, FF_SIMPLE_INIT, isFF } from "../../utils/feature-flags";
import { FF_DEV_3034, FF_DEV_3391, FF_SIMPLE_INIT, isFF } from "../../utils/feature-flags";
import { emailFromCreatedBy } from "../../utils/utilities";
import { Annotation } from "./Annotation";
import { HistoryItem } from "./HistoryItem";
Expand Down Expand Up @@ -563,4 +563,4 @@ const AnnotationStoreModel = types
};
});

export default types.compose("AnnotationStore", AnnotationStoreModel, ...(isFF(FF_DEV_3617) ? [StoreExtender] : []));
export default types.compose("AnnotationStore", AnnotationStoreModel, StoreExtender);
48 changes: 20 additions & 28 deletions web/libs/editor/src/tags/control/Taxonomy/Taxonomy.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { SharedStoreMixin } from "../../../mixins/SharedChoiceStore/mixin";
import VisibilityMixin from "../../../mixins/Visibility";
import { parseValue } from "../../../utils/data";
import {
FF_DEV_3617,
FF_LEAP_218,
FF_LSDV_4583,
FF_TAXONOMY_ASYNC,
Expand Down Expand Up @@ -218,7 +217,7 @@ const Model = types
pid: types.optional(types.string, guidGenerator),

type: "taxonomy",
[isFF(FF_DEV_3617) ? "_children" : "children"]: Types.unionArray(["choice"]),
_children: Types.unionArray(["choice"]),
})
.volatile(() => ({
maxUsagesReached: false,
Expand All @@ -227,22 +226,17 @@ const Model = types
_api: "", // will be filled after the first load in updateValue()
_items: [], // items loaded via API
}))
.views((self) =>
isFF(FF_DEV_3617)
? {
get children() {
return self._children;
},
set children(val) {
self._children = val;
},
get isLabeling() {
return isFF(FF_TAXONOMY_LABELING) && self.labeling;
},
}
: {},
)
.views((self) => ({
get children() {
return self._children;
},
set children(val) {
self._children = val;
},
get isLabeling() {
return isFF(FF_TAXONOMY_LABELING) && self.labeling;
},

get userLabels() {
return self.annotation.store.userLabels;
},
Expand Down Expand Up @@ -362,7 +356,7 @@ const Model = types

const children = ChildrenSnapshots.get(self.name) ?? [];

if (isFF(FF_DEV_3617) && self.store && children.length !== self.children.length) {
if (self.store && children.length !== self.children.length) {
// we have to update it during config parsing to let other code work
// with correctly added children.
// looks like there are no obstacles to do it in the same tick
Expand Down Expand Up @@ -559,17 +553,15 @@ const Model = types
};
})
.preProcessSnapshot((sn) => {
if (isFF(FF_DEV_3617)) {
const children = sn._children ?? sn.children;

if (children && !ChildrenSnapshots.has(sn.name)) {
ChildrenSnapshots.set(sn.name, children);
}
const children = sn._children ?? sn.children;

delete sn._children;
delete sn.children;
if (children && !ChildrenSnapshots.has(sn.name)) {
ChildrenSnapshots.set(sn.name, children);
}

delete sn._children;
delete sn.children;

return sn;
});

Expand All @@ -582,7 +574,7 @@ const TaxonomyModel = types.compose(
AnnotationMixin,
RequiredMixin,
Model,
...(isFF(FF_DEV_3617) ? [SharedStoreMixin] : []),
SharedStoreMixin,
PerRegionMixin,
...(isFF(FF_LSDV_4583) ? [PerItemMixin] : []),
...(isFF(FF_TAXONOMY_LABELING) ? [TaxonomyLabelingResult] : []),
Expand Down Expand Up @@ -614,7 +606,7 @@ const HtxTaxonomy = observer(({ item }) => {
// they are indicated by loading icon on the item itself
const firstLoad = item.isLoadedByApi ? !item.items.length : true;

if (item.loading && isFF(FF_DEV_3617) && firstLoad) {
if (item.loading && isFF(FF_TAXONOMY_ASYNC) && firstLoad) {
return (
<div className={className} style={visibleStyle}>
<div className={styles.taxonomy__loading}>
Expand Down
Loading
Loading