Skip to content

Commit 4c6cd48

Browse files
committed
refactor: LEAP-1310: Remove Stale Feature Flag - fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short
1 parent eb25e22 commit 4c6cd48

File tree

11 files changed

+14
-68
lines changed

11 files changed

+14
-68
lines changed

label_studio/core/feature_flags/stale_feature_flags.py

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
'ff_back_dev_3865_filters_anno_171222_short': True,
1919
'fflag_feat_front_dev_3873_labeling_ui_improvements_short': True,
2020
'fflag_feat_back_dev_3756_queue_enrollment_min_short': False,
21-
'fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short': True,
2221
'ff_front_dev_2432_auto_save_polygon_draft_210622_short': True,
2322
'ff_front_dev_1495_avatar_mess_210122_short': True,
2423
'ff_front_1170_outliner_030222_short': True,

web/libs/editor/src/mixins/DrawingTool.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { types } from "mobx-state-tree";
33
import Utils from "../utils";
44
import throttle from "lodash.throttle";
55
import { MIN_SIZE } from "../tools/Base";
6-
import { FF_DEV_3666, FF_DEV_3793, isFF } from "../utils/feature-flags";
6+
import { FF_DEV_3793, isFF } from "../utils/feature-flags";
77
import { RELATIVE_STAGE_HEIGHT, RELATIVE_STAGE_WIDTH } from "../components/ImageView/Image";
88

99
const DrawingTool = types
@@ -175,12 +175,7 @@ const DrawingTool = types
175175
},
176176

177177
canStartDrawing() {
178-
return (
179-
!self.isIncorrectControl() &&
180-
(!isFF(FF_DEV_3666) || !self.isIncorrectLabel()) &&
181-
self.canStart() &&
182-
!self.annotation.isDrawing
183-
);
178+
return !self.isIncorrectControl() && !self.isIncorrectLabel() && self.canStart() && !self.annotation.isDrawing;
184179
},
185180

186181
startDrawing(x, y) {

web/libs/editor/src/mixins/SelectedModel.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { types } from "mobx-state-tree";
22

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

76
const SelectedModelMixin = types
87
.model()
@@ -82,13 +81,7 @@ const SelectedModelMixin = types
8281
},
8382

8483
checkMaxUsages() {
85-
if (isFF(FF_DEV_3666)) {
86-
return self.tiedChildren.filter((c) => !c.canBeUsed());
87-
}
88-
const list = self.tiedChildren.filter((c) => !c.canBeUsed());
89-
90-
if (list.length) list.forEach((c) => c.setSelected(false));
91-
return list;
84+
return self.tiedChildren.filter((c) => !c.canBeUsed());
9285
},
9386

9487
selectFirstVisible() {

web/libs/editor/src/tags/object/Base.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { types } from "mobx-state-tree";
22
import isMatch from "lodash.ismatch";
33
import InfoModal from "../../components/Infomodal/Infomodal";
44
import { AnnotationMixin } from "../../mixins/AnnotationMixin";
5-
import { FF_DEV_3391, FF_DEV_3666, isFF } from "../../utils/feature-flags";
5+
import { FF_DEV_3391, isFF } from "../../utils/feature-flags";
66
import { BaseTag } from "../TagBase";
77

88
const ObjectBase = types
@@ -73,12 +73,8 @@ const ObjectBase = types
7373
const allStates = self.states() || [];
7474
let exceeded;
7575

76-
if (isFF(FF_DEV_3666)) {
77-
exceeded = allStates.reduce(checkAndCollect, []).filter((e) => e.selected);
78-
exceeded.forEach((e) => e.setSelected(false));
79-
} else {
80-
exceeded = allStates.reduce(checkAndCollect, []);
81-
}
76+
exceeded = allStates.reduce(checkAndCollect, []).filter((e) => e.selected);
77+
exceeded.forEach((e) => e.setSelected(false));
8278

8379
const states = self.activeStates() || [];
8480

web/libs/editor/src/tags/object/Image/Image.js

+2-10
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import ToolsManager from "../../../tools/Manager";
1616
import { parseValue } from "../../../utils/data";
1717
import {
1818
FF_DEV_3377,
19-
FF_DEV_3666,
2019
FF_DEV_3793,
2120
FF_LSDV_4583,
2221
FF_LSDV_4583_6,
@@ -1106,15 +1105,8 @@ const Model = types
11061105
},
11071106

11081107
checkLabels() {
1109-
let labelStates;
1110-
1111-
if (isFF(FF_DEV_3666)) {
1112-
// there should be at least one available label or none of them should be selected
1113-
labelStates = self.activeStates() || [];
1114-
} else {
1115-
// there is should be at least one state selected for *labels object
1116-
labelStates = (self.states() || []).filter((s) => s.type.includes("labels"));
1117-
}
1108+
// there should be at least one available label or none of them should be selected
1109+
const labelStates = self.activeStates() || [];
11181110
const selectedStates = self.getAvailableStates();
11191111

11201112
return selectedStates.length !== 0 || labelStates.length === 0;

web/libs/editor/src/tags/object/Paragraphs/model.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { SyncableMixin } from "../../../mixins/Syncable";
99
import { ParagraphsRegionModel } from "../../../regions/ParagraphsRegion";
1010
import Utils from "../../../utils";
1111
import { parseValue } from "../../../utils/data";
12-
import { FF_DEV_2669, FF_DEV_2918, FF_DEV_3666, FF_LSDV_E_278, isFF } from "../../../utils/feature-flags";
12+
import { FF_DEV_2669, FF_DEV_2918, FF_LSDV_E_278, isFF } from "../../../utils/feature-flags";
1313
import messages from "../../../utils/messages";
1414
import { clamp, isDefined, isValidObjectURL } from "../../../utils/utilities";
1515
import ObjectBase from "../Base";
@@ -516,7 +516,7 @@ const ParagraphsLoadingModel = types.model().actions((self) => ({
516516

517517
addRegions(ranges) {
518518
const areas = [];
519-
const states = isFF(FF_DEV_3666) ? self.getAvailableStates() : self.activeStates();
519+
const states = self.getAvailableStates();
520520

521521
if (states.length === 0) return;
522522

@@ -540,7 +540,7 @@ const ParagraphsLoadingModel = types.model().actions((self) => ({
540540
if (isFF(FF_DEV_2918)) {
541541
return self.addRegions([range])[0];
542542
}
543-
const states = isFF(FF_DEV_3666) ? self.getAvailableStates() : self.activeStates();
543+
const states = self.getAvailableStates();
544544

545545
if (states.length === 0) return;
546546

web/libs/editor/src/tools/Brush.jsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { DrawingTool } from "../mixins/DrawingTool";
99
import { Tool } from "../components/Toolbar/Tool";
1010
import { Range } from "../common/Range/Range";
1111
import { NodeViews } from "../components/Node/Node";
12-
import { FF_DEV_3666, isFF } from "../utils/feature-flags";
1312

1413
const MIN_SIZE = 1;
1514
const MAX_SIZE = 50;
@@ -213,7 +212,7 @@ const _Tool = types
213212

214213
self.addPoint(x, y);
215214
} else {
216-
if (isFF(FF_DEV_3666) && !self.canStartDrawing()) return;
215+
if (!self.canStartDrawing()) return;
217216
if (self.tagTypes.stateTypes === self.control.type && !self.control.isSelected) return;
218217
self.annotation.history.freeze();
219218
self.mode = "drawing";

web/libs/editor/src/tools/KeyPoint.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import BaseTool from "./Base";
44
import ToolMixin from "../mixins/Tool";
55
import { NodeViews } from "../components/Node/Node";
66
import { DrawingTool } from "../mixins/DrawingTool";
7-
import { FF_DEV_3666, FF_DEV_3793, isFF } from "../utils/feature-flags";
7+
import { FF_DEV_3793, isFF } from "../utils/feature-flags";
88

99
const _Tool = types
1010
.model("KeyPointTool", {
@@ -29,7 +29,7 @@ const _Tool = types
2929
}))
3030
.actions((self) => ({
3131
clickEv(ev, [x, y]) {
32-
if (isFF(FF_DEV_3666) && !self.canStartDrawing()) return;
32+
if (!self.canStartDrawing()) return;
3333

3434
const c = self.control;
3535

web/libs/editor/src/utils/feature-flags.ts

-6
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ export const FF_DEV_3377 = "fflag_fix_front_dev_3377_image_regions_shift_on_resi
5050
// Refactoring to use separate trees for every annotation to allow real annotations in View All
5151
export const FF_DEV_3391 = "fflag_fix_front_dev_3391_interactive_view_all";
5252

53-
/**
54-
* Fixing maxUsages prop of *labels on region creation.
55-
* @link https://app.launchdarkly.com/default/test/features/fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short
56-
*/
57-
export const FF_DEV_3666 = "fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short";
58-
5953
/**
6054
* Fixing "Auto Detect" tool undo functionality and bugs with skipNextUndoState.
6155
* @link https://app.launchdarkly.com/default/production/features/fflag_fix_front_dev_1284_auto_detect_undo_281022_short

web/libs/editor/tests/e2e/tests/maxUsage.test.js

-16
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,6 @@ Data(maxUsageImageToolsDataTable).Scenario(
140140
}
141141

142142
I.amOnPage("/");
143-
LabelStudio.setFeatureFlags({
144-
fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short: true,
145-
});
146143
LabelStudio.init({
147144
config: createImageToolsConfig({ maxUsage }),
148145
data: {
@@ -174,9 +171,6 @@ Data(maxUsageImageToolsDataTable).Scenario(
174171
const shape = shapes[shapeName];
175172

176173
I.amOnPage("/");
177-
LabelStudio.setFeatureFlags({
178-
fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short: true,
179-
});
180174
LabelStudio.init({
181175
config: createImageLabelsConfig({ maxUsage }),
182176
data: {
@@ -207,7 +201,6 @@ Data(maxUsageDataTable).Scenario(
207201
const { maxUsage } = current;
208202

209203
LabelStudio.setFeatureFlags({
210-
fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short: true,
211204
ff_front_dev_2715_audio_3_280722_short: true,
212205
});
213206
I.amOnPage("/");
@@ -248,9 +241,6 @@ Data(maxUsageDataTable).Scenario(
248241
const { maxUsage } = current;
249242

250243
I.amOnPage("/");
251-
LabelStudio.setFeatureFlags({
252-
fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short: true,
253-
});
254244
LabelStudio.init({
255245
config: `
256246
<View>
@@ -286,9 +276,6 @@ Data(maxUsageDataTable).Scenario(
286276
const { maxUsage } = current;
287277

288278
I.amOnPage("/");
289-
LabelStudio.setFeatureFlags({
290-
fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short: true,
291-
});
292279
LabelStudio.init({
293280
config: `
294281
<View>
@@ -322,9 +309,6 @@ Data(maxUsageDataTable).Scenario(
322309
const { maxUsage } = current;
323310

324311
I.amOnPage("/");
325-
LabelStudio.setFeatureFlags({
326-
fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short: true,
327-
});
328312
LabelStudio.init({
329313
config: `
330314
<View>

web/libs/frontend-test/src/feature-flags.ts

-6
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ export const FF_DEV_3377 = "fflag_fix_front_dev_3377_image_regions_shift_on_resi
5050
// Refactoring to use separate trees for every annotation to allow real annotations in View All
5151
export const FF_DEV_3391 = "fflag_fix_front_dev_3391_interactive_view_all";
5252

53-
/**
54-
* Fixing maxUsages prop of *labels on region creation.
55-
* @link https://app.launchdarkly.com/default/test/features/fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short
56-
*/
57-
export const FF_DEV_3666 = "fflag_fix_front_dev_3666_max_usages_on_region_creation_171122_short";
58-
5953
// Use only relative coords internally to improve performance and reduce bugs
6054
export const FF_DEV_3793 = "fflag_fix_front_dev_3793_relative_coords_short";
6155

0 commit comments

Comments
 (0)