From 4f980066a6510d259bc1f5a82ce2062078a62fb5 Mon Sep 17 00:00:00 2001 From: Raul Martin Date: Fri, 17 Jan 2025 14:58:15 -0800 Subject: [PATCH 1/4] refactor: OPTIC-1542: Remove a buch of stale feature flags From eb25e227af1f39d8b9d8346b0ffcb9afc8d7007c Mon Sep 17 00:00:00 2001 From: Raul Martin Date: Fri, 17 Jan 2025 15:28:26 -0800 Subject: [PATCH 2/4] refactor: OPTIC-1543: Remove Stale Feature Flag - fflag_fix_front_dev_3617_taxonomy_memory_leaks_fix --- .../core/feature_flags/stale_feature_flags.py | 1 - .../pages/CreateProject/Config/Preview.jsx | 11 ++--- .../labelstudio/src/utils/feature-flags.ts | 6 --- .../editor/src/stores/Annotation/store.js | 4 +- .../src/tags/control/Taxonomy/Taxonomy.jsx | 48 ++++++++----------- web/libs/editor/src/utils/feature-flags.ts | 6 --- .../editor/tests/e2e/tests/taxonomy.test.js | 1 - web/libs/frontend-test/src/feature-flags.ts | 6 --- 8 files changed, 25 insertions(+), 58 deletions(-) diff --git a/label_studio/core/feature_flags/stale_feature_flags.py b/label_studio/core/feature_flags/stale_feature_flags.py index 2aa3de423868..61cf95f3adc0 100644 --- a/label_studio/core/feature_flags/stale_feature_flags.py +++ b/label_studio/core/feature_flags/stale_feature_flags.py @@ -19,7 +19,6 @@ '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, diff --git a/web/apps/labelstudio/src/pages/CreateProject/Config/Preview.jsx b/web/apps/labelstudio/src/pages/CreateProject/Config/Preview.jsx index 4f909f20f44a..42d6bb7b2a87 100644 --- a/web/apps/labelstudio/src/pages/CreateProject/Config/Preview.jsx +++ b/web/apps/labelstudio/src/pages/CreateProject/Config/Preview.jsx @@ -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"; @@ -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 = () => { @@ -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); }, }); diff --git a/web/apps/labelstudio/src/utils/feature-flags.ts b/web/apps/labelstudio/src/utils/feature-flags.ts index bd318d20a74c..a31928349d32 100644 --- a/web/apps/labelstudio/src/utils/feature-flags.ts +++ b/web/apps/labelstudio/src/utils/feature-flags.ts @@ -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 diff --git a/web/libs/editor/src/stores/Annotation/store.js b/web/libs/editor/src/stores/Annotation/store.js index 840d81feb338..239b1f446e8a 100644 --- a/web/libs/editor/src/stores/Annotation/store.js +++ b/web/libs/editor/src/stores/Annotation/store.js @@ -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"; @@ -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); diff --git a/web/libs/editor/src/tags/control/Taxonomy/Taxonomy.jsx b/web/libs/editor/src/tags/control/Taxonomy/Taxonomy.jsx index b0637ee49d25..29cfb69598b1 100644 --- a/web/libs/editor/src/tags/control/Taxonomy/Taxonomy.jsx +++ b/web/libs/editor/src/tags/control/Taxonomy/Taxonomy.jsx @@ -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, @@ -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, @@ -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; }, @@ -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 @@ -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; }); @@ -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] : []), @@ -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 (
diff --git a/web/libs/editor/src/utils/feature-flags.ts b/web/libs/editor/src/utils/feature-flags.ts index 2c7f2014e17a..840d44f000dc 100644 --- a/web/libs/editor/src/utils/feature-flags.ts +++ b/web/libs/editor/src/utils/feature-flags.ts @@ -50,12 +50,6 @@ export const FF_DEV_3377 = "fflag_fix_front_dev_3377_image_regions_shift_on_resi // Refactoring to use separate trees for every annotation to allow real annotations in View All export const FF_DEV_3391 = "fflag_fix_front_dev_3391_interactive_view_all"; -/** - * 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"; - /** * Fixing maxUsages prop of *labels on region creation. * @link https://app.launchdarkly.com/default/test/features/fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short diff --git a/web/libs/editor/tests/e2e/tests/taxonomy.test.js b/web/libs/editor/tests/e2e/tests/taxonomy.test.js index bc4c1c8e2def..4f9030026ff7 100644 --- a/web/libs/editor/tests/e2e/tests/taxonomy.test.js +++ b/web/libs/editor/tests/e2e/tests/taxonomy.test.js @@ -5,7 +5,6 @@ Feature("Taxonomy"); Before(({ LabelStudio }) => { LabelStudio.setFeatureFlags({ fflag_feat_front_lsdv_5451_async_taxonomy_110823_short: false, - fflag_fix_front_dev_3617_taxonomy_memory_leaks_fix: true, ff_front_dev_1536_taxonomy_user_labels_150222_long: true, ff_front_1170_outliner_030222_short: true, }); diff --git a/web/libs/frontend-test/src/feature-flags.ts b/web/libs/frontend-test/src/feature-flags.ts index 8ee4d6d936c3..bdbf8ad09772 100644 --- a/web/libs/frontend-test/src/feature-flags.ts +++ b/web/libs/frontend-test/src/feature-flags.ts @@ -50,12 +50,6 @@ export const FF_DEV_3377 = "fflag_fix_front_dev_3377_image_regions_shift_on_resi // Refactoring to use separate trees for every annotation to allow real annotations in View All export const FF_DEV_3391 = "fflag_fix_front_dev_3391_interactive_view_all"; -/** - * 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"; - /** * Fixing maxUsages prop of *labels on region creation. * @link https://app.launchdarkly.com/default/test/features/fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short From 4c6cd483b44a88699c1e64e34479fa726c13229b Mon Sep 17 00:00:00 2001 From: Raul Martin Date: Fri, 17 Jan 2025 15:40:41 -0800 Subject: [PATCH 3/4] refactor: LEAP-1310: Remove Stale Feature Flag - fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short --- .../core/feature_flags/stale_feature_flags.py | 1 - web/libs/editor/src/mixins/DrawingTool.js | 9 ++------- web/libs/editor/src/mixins/SelectedModel.js | 9 +-------- web/libs/editor/src/tags/object/Base.js | 10 +++------- web/libs/editor/src/tags/object/Image/Image.js | 12 ++---------- .../editor/src/tags/object/Paragraphs/model.js | 6 +++--- web/libs/editor/src/tools/Brush.jsx | 3 +-- web/libs/editor/src/tools/KeyPoint.js | 4 ++-- web/libs/editor/src/utils/feature-flags.ts | 6 ------ web/libs/editor/tests/e2e/tests/maxUsage.test.js | 16 ---------------- web/libs/frontend-test/src/feature-flags.ts | 6 ------ 11 files changed, 14 insertions(+), 68 deletions(-) diff --git a/label_studio/core/feature_flags/stale_feature_flags.py b/label_studio/core/feature_flags/stale_feature_flags.py index 61cf95f3adc0..5ea027f7a326 100644 --- a/label_studio/core/feature_flags/stale_feature_flags.py +++ b/label_studio/core/feature_flags/stale_feature_flags.py @@ -18,7 +18,6 @@ '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, '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, diff --git a/web/libs/editor/src/mixins/DrawingTool.js b/web/libs/editor/src/mixins/DrawingTool.js index a18f8f22f98d..006268d623c8 100644 --- a/web/libs/editor/src/mixins/DrawingTool.js +++ b/web/libs/editor/src/mixins/DrawingTool.js @@ -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 @@ -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) { diff --git a/web/libs/editor/src/mixins/SelectedModel.js b/web/libs/editor/src/mixins/SelectedModel.js index 2664d59752f0..256276eb2ace 100644 --- a/web/libs/editor/src/mixins/SelectedModel.js +++ b/web/libs/editor/src/mixins/SelectedModel.js @@ -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() @@ -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() { diff --git a/web/libs/editor/src/tags/object/Base.js b/web/libs/editor/src/tags/object/Base.js index 17d06be5aad5..0dd6a2479bb6 100644 --- a/web/libs/editor/src/tags/object/Base.js +++ b/web/libs/editor/src/tags/object/Base.js @@ -2,7 +2,7 @@ import { types } from "mobx-state-tree"; import isMatch from "lodash.ismatch"; import InfoModal from "../../components/Infomodal/Infomodal"; import { AnnotationMixin } from "../../mixins/AnnotationMixin"; -import { FF_DEV_3391, FF_DEV_3666, isFF } from "../../utils/feature-flags"; +import { FF_DEV_3391, isFF } from "../../utils/feature-flags"; import { BaseTag } from "../TagBase"; const ObjectBase = types @@ -73,12 +73,8 @@ const ObjectBase = types const allStates = self.states() || []; let exceeded; - if (isFF(FF_DEV_3666)) { - exceeded = allStates.reduce(checkAndCollect, []).filter((e) => e.selected); - exceeded.forEach((e) => e.setSelected(false)); - } else { - exceeded = allStates.reduce(checkAndCollect, []); - } + exceeded = allStates.reduce(checkAndCollect, []).filter((e) => e.selected); + exceeded.forEach((e) => e.setSelected(false)); const states = self.activeStates() || []; diff --git a/web/libs/editor/src/tags/object/Image/Image.js b/web/libs/editor/src/tags/object/Image/Image.js index 088012dc193c..ad76b0f33288 100644 --- a/web/libs/editor/src/tags/object/Image/Image.js +++ b/web/libs/editor/src/tags/object/Image/Image.js @@ -16,7 +16,6 @@ import ToolsManager from "../../../tools/Manager"; import { parseValue } from "../../../utils/data"; import { FF_DEV_3377, - FF_DEV_3666, FF_DEV_3793, FF_LSDV_4583, FF_LSDV_4583_6, @@ -1106,15 +1105,8 @@ const Model = types }, checkLabels() { - let labelStates; - - if (isFF(FF_DEV_3666)) { - // there should be at least one available label or none of them should be selected - labelStates = self.activeStates() || []; - } else { - // there is should be at least one state selected for *labels object - labelStates = (self.states() || []).filter((s) => s.type.includes("labels")); - } + // there should be at least one available label or none of them should be selected + const labelStates = self.activeStates() || []; const selectedStates = self.getAvailableStates(); return selectedStates.length !== 0 || labelStates.length === 0; diff --git a/web/libs/editor/src/tags/object/Paragraphs/model.js b/web/libs/editor/src/tags/object/Paragraphs/model.js index 292cf76b4fc0..05a94afbe061 100644 --- a/web/libs/editor/src/tags/object/Paragraphs/model.js +++ b/web/libs/editor/src/tags/object/Paragraphs/model.js @@ -9,7 +9,7 @@ import { SyncableMixin } from "../../../mixins/Syncable"; import { ParagraphsRegionModel } from "../../../regions/ParagraphsRegion"; import Utils from "../../../utils"; import { parseValue } from "../../../utils/data"; -import { FF_DEV_2669, FF_DEV_2918, FF_DEV_3666, FF_LSDV_E_278, isFF } from "../../../utils/feature-flags"; +import { FF_DEV_2669, FF_DEV_2918, FF_LSDV_E_278, isFF } from "../../../utils/feature-flags"; import messages from "../../../utils/messages"; import { clamp, isDefined, isValidObjectURL } from "../../../utils/utilities"; import ObjectBase from "../Base"; @@ -516,7 +516,7 @@ const ParagraphsLoadingModel = types.model().actions((self) => ({ addRegions(ranges) { const areas = []; - const states = isFF(FF_DEV_3666) ? self.getAvailableStates() : self.activeStates(); + const states = self.getAvailableStates(); if (states.length === 0) return; @@ -540,7 +540,7 @@ const ParagraphsLoadingModel = types.model().actions((self) => ({ if (isFF(FF_DEV_2918)) { return self.addRegions([range])[0]; } - const states = isFF(FF_DEV_3666) ? self.getAvailableStates() : self.activeStates(); + const states = self.getAvailableStates(); if (states.length === 0) return; diff --git a/web/libs/editor/src/tools/Brush.jsx b/web/libs/editor/src/tools/Brush.jsx index fcebe80dc866..f068860d1b78 100644 --- a/web/libs/editor/src/tools/Brush.jsx +++ b/web/libs/editor/src/tools/Brush.jsx @@ -9,7 +9,6 @@ import { DrawingTool } from "../mixins/DrawingTool"; import { Tool } from "../components/Toolbar/Tool"; import { Range } from "../common/Range/Range"; import { NodeViews } from "../components/Node/Node"; -import { FF_DEV_3666, isFF } from "../utils/feature-flags"; const MIN_SIZE = 1; const MAX_SIZE = 50; @@ -213,7 +212,7 @@ const _Tool = types self.addPoint(x, y); } else { - if (isFF(FF_DEV_3666) && !self.canStartDrawing()) return; + if (!self.canStartDrawing()) return; if (self.tagTypes.stateTypes === self.control.type && !self.control.isSelected) return; self.annotation.history.freeze(); self.mode = "drawing"; diff --git a/web/libs/editor/src/tools/KeyPoint.js b/web/libs/editor/src/tools/KeyPoint.js index 9ccda927a97e..bf83b886aab1 100644 --- a/web/libs/editor/src/tools/KeyPoint.js +++ b/web/libs/editor/src/tools/KeyPoint.js @@ -4,7 +4,7 @@ import BaseTool from "./Base"; import ToolMixin from "../mixins/Tool"; import { NodeViews } from "../components/Node/Node"; import { DrawingTool } from "../mixins/DrawingTool"; -import { FF_DEV_3666, FF_DEV_3793, isFF } from "../utils/feature-flags"; +import { FF_DEV_3793, isFF } from "../utils/feature-flags"; const _Tool = types .model("KeyPointTool", { @@ -29,7 +29,7 @@ const _Tool = types })) .actions((self) => ({ clickEv(ev, [x, y]) { - if (isFF(FF_DEV_3666) && !self.canStartDrawing()) return; + if (!self.canStartDrawing()) return; const c = self.control; diff --git a/web/libs/editor/src/utils/feature-flags.ts b/web/libs/editor/src/utils/feature-flags.ts index 840d44f000dc..9144f551dec6 100644 --- a/web/libs/editor/src/utils/feature-flags.ts +++ b/web/libs/editor/src/utils/feature-flags.ts @@ -50,12 +50,6 @@ export const FF_DEV_3377 = "fflag_fix_front_dev_3377_image_regions_shift_on_resi // Refactoring to use separate trees for every annotation to allow real annotations in View All export const FF_DEV_3391 = "fflag_fix_front_dev_3391_interactive_view_all"; -/** - * Fixing maxUsages prop of *labels on region creation. - * @link https://app.launchdarkly.com/default/test/features/fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short - */ -export const FF_DEV_3666 = "fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short"; - /** * Fixing "Auto Detect" tool undo functionality and bugs with skipNextUndoState. * @link https://app.launchdarkly.com/default/production/features/fflag_fix_front_dev_1284_auto_detect_undo_281022_short diff --git a/web/libs/editor/tests/e2e/tests/maxUsage.test.js b/web/libs/editor/tests/e2e/tests/maxUsage.test.js index ce7cc4e0a3fa..c6e43fd5e199 100644 --- a/web/libs/editor/tests/e2e/tests/maxUsage.test.js +++ b/web/libs/editor/tests/e2e/tests/maxUsage.test.js @@ -140,9 +140,6 @@ Data(maxUsageImageToolsDataTable).Scenario( } I.amOnPage("/"); - LabelStudio.setFeatureFlags({ - fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short: true, - }); LabelStudio.init({ config: createImageToolsConfig({ maxUsage }), data: { @@ -174,9 +171,6 @@ Data(maxUsageImageToolsDataTable).Scenario( const shape = shapes[shapeName]; I.amOnPage("/"); - LabelStudio.setFeatureFlags({ - fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short: true, - }); LabelStudio.init({ config: createImageLabelsConfig({ maxUsage }), data: { @@ -207,7 +201,6 @@ Data(maxUsageDataTable).Scenario( const { maxUsage } = current; LabelStudio.setFeatureFlags({ - fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short: true, ff_front_dev_2715_audio_3_280722_short: true, }); I.amOnPage("/"); @@ -248,9 +241,6 @@ Data(maxUsageDataTable).Scenario( const { maxUsage } = current; I.amOnPage("/"); - LabelStudio.setFeatureFlags({ - fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short: true, - }); LabelStudio.init({ config: ` @@ -286,9 +276,6 @@ Data(maxUsageDataTable).Scenario( const { maxUsage } = current; I.amOnPage("/"); - LabelStudio.setFeatureFlags({ - fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short: true, - }); LabelStudio.init({ config: ` @@ -322,9 +309,6 @@ Data(maxUsageDataTable).Scenario( const { maxUsage } = current; I.amOnPage("/"); - LabelStudio.setFeatureFlags({ - fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short: true, - }); LabelStudio.init({ config: ` diff --git a/web/libs/frontend-test/src/feature-flags.ts b/web/libs/frontend-test/src/feature-flags.ts index bdbf8ad09772..04b82d6c94ff 100644 --- a/web/libs/frontend-test/src/feature-flags.ts +++ b/web/libs/frontend-test/src/feature-flags.ts @@ -50,12 +50,6 @@ export const FF_DEV_3377 = "fflag_fix_front_dev_3377_image_regions_shift_on_resi // Refactoring to use separate trees for every annotation to allow real annotations in View All export const FF_DEV_3391 = "fflag_fix_front_dev_3391_interactive_view_all"; -/** - * Fixing maxUsages prop of *labels on region creation. - * @link https://app.launchdarkly.com/default/test/features/fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short - */ -export const FF_DEV_3666 = "fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short"; - // Use only relative coords internally to improve performance and reduce bugs export const FF_DEV_3793 = "fflag_fix_front_dev_3793_relative_coords_short"; From c37104c8b0afb73b36bd3e62c62ead6355eddbf4 Mon Sep 17 00:00:00 2001 From: Raul Martin Date: Wed, 22 Jan 2025 16:48:27 -0800 Subject: [PATCH 4/4] refactor: OPTIC-1557: Remove Stale Feature Flag - fflag_fix_front_lsdv_4992_hide_all_regions_04052023_short --- .../core/feature_flags/stale_feature_flags.py | 1 - .../OutlinerPanel/OutlinerPanel.tsx | 7 ++- .../OutlinerPanel/ViewControls.scss | 47 ++++++++----------- .../SidePanels/OutlinerPanel/ViewControls.tsx | 21 +++------ web/libs/editor/src/utils/feature-flags.ts | 6 --- .../editor/tests/integration/feature-flags.ts | 1 - 6 files changed, 28 insertions(+), 55 deletions(-) diff --git a/label_studio/core/feature_flags/stale_feature_flags.py b/label_studio/core/feature_flags/stale_feature_flags.py index 5ea027f7a326..5fcff863666d 100644 --- a/label_studio/core/feature_flags/stale_feature_flags.py +++ b/label_studio/core/feature_flags/stale_feature_flags.py @@ -10,7 +10,6 @@ '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, diff --git a/web/libs/editor/src/components/SidePanels/OutlinerPanel/OutlinerPanel.tsx b/web/libs/editor/src/components/SidePanels/OutlinerPanel/OutlinerPanel.tsx index dac3acc42212..b90ab27b28aa 100644 --- a/web/libs/editor/src/components/SidePanels/OutlinerPanel/OutlinerPanel.tsx +++ b/web/libs/editor/src/components/SidePanels/OutlinerPanel/OutlinerPanel.tsx @@ -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; @@ -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"); } diff --git a/web/libs/editor/src/components/SidePanels/OutlinerPanel/ViewControls.scss b/web/libs/editor/src/components/SidePanels/OutlinerPanel/ViewControls.scss index 75773996c1a9..540c6cf4e5c6 100644 --- a/web/libs/editor/src/components/SidePanels/OutlinerPanel/ViewControls.scss +++ b/web/libs/editor/src/components/SidePanels/OutlinerPanel/ViewControls.scss @@ -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%); @@ -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; @@ -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; } } -} \ No newline at end of file +} diff --git a/web/libs/editor/src/components/SidePanels/OutlinerPanel/ViewControls.tsx b/web/libs/editor/src/components/SidePanels/OutlinerPanel/ViewControls.tsx index 8dd8ac1151f6..f9f6f6f44fe9 100644 --- a/web/libs/editor/src/components/SidePanels/OutlinerPanel/ViewControls.tsx +++ b/web/libs/editor/src/components/SidePanels/OutlinerPanel/ViewControls.tsx @@ -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(); @@ -56,14 +56,14 @@ export const ViewControls: FC = 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: , 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: , tooltip: "Grouped by Tool", }; @@ -95,7 +95,7 @@ export const ViewControls: FC = observer( ); return ( - + = observer( /> )} - {isFF(FF_LSDV_4992) ? : null} + ); }, @@ -183,16 +183,7 @@ const Grouping = ({ // 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 ( diff --git a/web/libs/editor/src/utils/feature-flags.ts b/web/libs/editor/src/utils/feature-flags.ts index 9144f551dec6..9968774e44ea 100644 --- a/web/libs/editor/src/utils/feature-flags.ts +++ b/web/libs/editor/src/utils/feature-flags.ts @@ -139,12 +139,6 @@ export const FF_LSDV_4988 = "fflag_fix_front_lsdv_4988_dynamic_no_label_120523_s */ export const FF_LSDV_4930 = "fflag_fix_front_lsdv_4930_selection_tool_fixes_240423_short"; -/** - * Restore "hide all regions" button functionality in the outliner - * @link https://app.launchdarkly.com/default/production/features/fflag_fix_front_lsdv_4992_hide_all_regions_04052023_short - */ -export const FF_LSDV_4992 = "fflag_fix_front_lsdv_4992_hide_all_regions_04052023_short"; - /** * Resetting shared stores on task change to correctly generate dynamic children * @see: fflag_fix_front_dev_3617_taxonomy_memory_leaks_fix: To enable shared store diff --git a/web/libs/editor/tests/integration/feature-flags.ts b/web/libs/editor/tests/integration/feature-flags.ts index 7a698b25775b..77ca0ec7b0ac 100644 --- a/web/libs/editor/tests/integration/feature-flags.ts +++ b/web/libs/editor/tests/integration/feature-flags.ts @@ -3,7 +3,6 @@ import * as FLAGS from "../../src/utils/feature-flags"; export const CURRENT_FLAGS = { [FLAGS.FF_DEV_1170]: true, [FLAGS.FF_LSDV_4930]: true, - [FLAGS.FF_LSDV_4992]: true, [FLAGS.FF_DEV_2715]: true, [FLAGS.FF_LSDV_4620_3]: true, [FLAGS.FF_LSDV_4620_3_ML]: true,