Skip to content

Commit

Permalink
refactor: OPTIC-921: Remove Stale Feature Flag - fflag_feat_front_dev…
Browse files Browse the repository at this point in the history
…_4081_magic_wand_tool (#6701)
  • Loading branch information
luarmr authored Nov 22, 2024
1 parent 6a6b8cf commit 26328a1
Show file tree
Hide file tree
Showing 14 changed files with 10 additions and 33 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 @@ -26,7 +26,6 @@
'fflag_feat_front_lsdv_4659_skipduplicates_060323_short': True,
'fflag_fix_font_lsdv_1148_hotkeys_namespaces_01022023_short': True,
'fflag_fix_back_lsdv_1044_check_annotations_24012023_short': False,
'fflag_feat_front_dev_4081_magic_wand_tool': True,
'fflag_fix_front_dev_4075_taxonomy_overlap_281222_short': True,
'fflag_fix_front_dev_3730_shortcuts_initial_input_22122022_short': True,
'ff_back_dev_3865_filters_anno_171222_short': True,
Expand Down
2 changes: 1 addition & 1 deletion web/libs/editor/examples/image_magic_wand/START.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ Note that in the gcp_cors_config.json example given in this directory that we ha
Magic Wand for image segmentation:

```bash
fflag_feat_front_dev_4081_magic_wand_tool=1 python server.py -c config.json -l ../examples/image_magic_wand/config.xml -i ../examples/image_magic_wand/tasks.json -o output
python server.py -c config.json -l ../examples/image_magic_wand/config.xml -i ../examples/image_magic_wand/tasks.json -o output
```
5 changes: 2 additions & 3 deletions web/libs/editor/src/components/ImageView/ImageView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
FF_DEV_1442,
FF_DEV_3077,
FF_DEV_3793,
FF_DEV_4081,
FF_LSDV_4583_6,
FF_LSDV_4711,
FF_LSDV_4930,
Expand Down Expand Up @@ -451,15 +450,15 @@ const Crosshair = memo(
* of the image to support Magic Wand tool
*/
const CanvasOverlay = observer(({ item }) => {
return isFF(FF_DEV_4081) ? (
return (
<canvas
className={styles.overlay}
ref={(ref) => {
item.setOverlayRef(ref);
}}
style={item.imageTransform}
/>
) : null;
);
});

export default observer(
Expand Down
1 change: 0 additions & 1 deletion web/libs/editor/src/core/feature-flags/flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"fflag_fix_front_dev_3391_interactive_view_all": false,
"fflag_fix_front_dev_3617_taxonomy_memory_leaks_fix": true,
"fflag_feat_front_dev_3873_labeling_ui_improvements_short": true,
"fflag_feat_front_dev_4081_magic_wand_tool": true,
"fflag_feat_front_lsdv_4620_richtext_opimization_060423_short": true,
"fflag_fix_front_lsdv_4620_memory_leaks_100723_short": false
}
2 changes: 1 addition & 1 deletion web/libs/editor/src/examples/image_magic_wand/START.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ Note that in the gcp_cors_config.json example given in this directory that we ha
Magic Wand for image segmentation:

```bash
fflag_feat_front_dev_4081_magic_wand_tool=1 python server.py -c config.json -l ../examples/image_magic_wand/config.xml -i ../examples/image_magic_wand/tasks.json -o output
python server.py -c config.json -l ../examples/image_magic_wand/config.xml -i ../examples/image_magic_wand/tasks.json -o output
```
4 changes: 2 additions & 2 deletions web/libs/editor/src/regions/BrushRegion.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import IsReadyMixin from "../mixins/IsReadyMixin";
import { KonvaRegionMixin } from "../mixins/KonvaRegion";
import { ImageModel } from "../tags/object/Image";
import { colorToRGBAArray, rgbArrayToHex } from "../utils/colors";
import { FF_DEV_3793, FF_DEV_4081, FF_ZOOM_OPTIM, isFF } from "../utils/feature-flags";
import { FF_DEV_3793, FF_ZOOM_OPTIM, isFF } from "../utils/feature-flags";
import { AliveRegion } from "./AliveRegion";
import { RegionWrapper } from "./RegionWrapper";

Expand Down Expand Up @@ -523,7 +523,7 @@ const HtxBrushView = ({ item, setShapeRef }) => {

let img;

if (item.maskDataURL && isFF(FF_DEV_4081)) {
if (item.maskDataURL) {
img = await Canvas.maskDataURL2Image(item.maskDataURL, { color: item.strokeColor });
} else if (item.rle) {
img = Canvas.RLE2Region(item, { color: item.strokeColor });
Expand Down
3 changes: 1 addition & 2 deletions web/libs/editor/src/tags/control/MagicWand.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { customTypes } from "../../core/CustomTypes";
import { AnnotationMixin } from "../../mixins/AnnotationMixin";
import SeparatedControlMixin from "../../mixins/SeparatedControlMixin";
import { ToolManagerMixin } from "../../mixins/ToolManagerMixin";
import { FF_DEV_4081, isFF } from "../../utils/feature-flags";

/**
* The `Magicwand` tag makes it possible to click in a region of an image a user is doing segmentation
Expand Down Expand Up @@ -125,6 +124,6 @@ const HtxView = () => {
return null;
};

isFF(FF_DEV_4081) && Registry.addTag("magicwand", MagicWandModel, HtxView);
Registry.addTag("magicwand", MagicWandModel, HtxView);

export { HtxView, MagicWandModel };
4 changes: 0 additions & 4 deletions web/libs/editor/src/tags/object/Image/Image.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
FF_DEV_3377,
FF_DEV_3666,
FF_DEV_3793,
FF_DEV_4081,
FF_LSDV_4583,
FF_LSDV_4583_6,
FF_LSDV_4711,
Expand Down Expand Up @@ -292,9 +291,6 @@ const Model = types

if (isFF(FF_LSDV_4711) && (!value || value === "none")) return "anonymous";

if (!isFF(FF_DEV_4081)) {
return null;
}
if (!value || value === "none") {
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions web/libs/editor/src/tools/Brush.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ 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, FF_DEV_4081, isFF } from "../utils/feature-flags";
import { FF_DEV_3666, isFF } from "../utils/feature-flags";

const MIN_SIZE = 1;
const MAX_SIZE = 50;
Expand Down Expand Up @@ -54,7 +54,7 @@ const _Tool = types
group: "segmentation",
shortcut: "B",
smart: true,
unselectRegionOnToolChange: !isFF(FF_DEV_4081),
unselectRegionOnToolChange: false,
})
.volatile(() => ({
canInteractWithRegions: false,
Expand Down
3 changes: 1 addition & 2 deletions web/libs/editor/src/tools/Manager.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { destroy } from "mobx-state-tree";
import { guidGenerator } from "../utils/unique";
import { FF_DEV_4081, isFF } from "../utils/feature-flags";

/** @type {Map<any, ToolsManager>} */
const INSTANCES = new Map();
Expand Down Expand Up @@ -56,7 +55,7 @@ class ToolsManager {
const name = tool.toolName ?? toolName;
const key = `${prefix ?? this._prefix}#${name}`;

if (isFF(FF_DEV_4081) && removeDuplicatesNamed && toolName === removeDuplicatesNamed) {
if (removeDuplicatesNamed && toolName === removeDuplicatesNamed) {
const findme = new RegExp(`^.*?#${name}.*$`);

if (Object.keys(this.tools).some((entry) => findme.test(entry))) {
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 @@ -98,9 +98,6 @@ export const FF_DEV_3793 = "fflag_fix_front_dev_3793_relative_coords_short";
*/
export const FF_DEV_4075 = "fflag_fix_front_dev_4075_taxonomy_overlap_281222_short";

// Enable a Magic Wand to be used for quickly thresholding images with segmentation labels.
export const FF_DEV_4081 = "fflag_feat_front_dev_4081_magic_wand_tool";

/**
* Label stream ablation experiment for solving overlap issue
* @link https://app.launchdarkly.com/default/production/features/fflag_fix_back_dev_4174_overlap_issue_experiments_10012023_short
Expand Down
4 changes: 0 additions & 4 deletions web/libs/editor/tests/e2e/tests/image.magic-wand.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ Scenario(
annotations: [annotationEmpty],
};

LabelStudio.setFeatureFlags({
fflag_feat_front_dev_4081_magic_wand_tool: true,
});

I.amOnPage("/");

I.executeScript(initLabelStudio, params);
Expand Down
4 changes: 0 additions & 4 deletions web/libs/editor/tests/e2e/tests/image.selected-region.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ async function testRegion(testType, toolAccelerator, I, LabelStudio, AtImageView
annotations: [annotationEmpty],
};

LabelStudio.setFeatureFlags({
fflag_feat_front_dev_4081_magic_wand_tool: true,
});

I.amOnPage("/");

I.executeScript(initLabelStudio, params);
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 @@ -92,9 +92,6 @@ export const FF_DEV_3793 = "fflag_fix_front_dev_3793_relative_coords_short";
*/
export const FF_DEV_4075 = "fflag_fix_front_dev_4075_taxonomy_overlap_281222_short";

// Enable a Magic Wand to be used for quickly thresholding images with segmentation labels.
export const FF_DEV_4081 = "fflag_feat_front_dev_4081_magic_wand_tool";

/**
* Label stream ablation experiment for solving overlap issue
* @link https://app.launchdarkly.com/default/production/features/fflag_fix_back_dev_4174_overlap_issue_experiments_10012023_short
Expand Down

0 comments on commit 26328a1

Please sign in to comment.