From e6182697c6cc3ab507a8a9617117d4661f4dfd6e Mon Sep 17 00:00:00 2001
From: Raul Martin <raul@humansignal.com>
Date: Wed, 29 Jan 2025 10:51:40 -0800
Subject: [PATCH 1/2] 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           | 48 ++++++++-----------
 .../SidePanels/OutlinerPanel/ViewControls.tsx | 21 +++-----
 web/libs/editor/src/utils/feature-flags.ts    |  6 ---
 .../editor/tests/integration/feature-flags.ts |  1 -
 6 files changed, 29 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 344eba1d1d17..28a7fb32834a 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..3395567e6779 100644
--- a/web/libs/editor/src/components/SidePanels/OutlinerPanel/ViewControls.scss
+++ b/web/libs/editor/src/components/SidePanels/OutlinerPanel/ViewControls.scss
@@ -8,10 +8,11 @@
   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%);
 
+
   &__sort {
     display: flex;
     align-items: center;
@@ -36,11 +37,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 +63,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<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",
           };
@@ -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"]}
@@ -115,7 +115,7 @@ export const ViewControls: FC<ViewControlsProps> = observer(
             />
           </Elem>
         )}
-        {isFF(FF_LSDV_4992) ? <ToggleRegionsVisibilityButton regions={regions} /> : null}
+        <ToggleRegionsVisibilityButton regions={regions} />
       </Block>
     );
   },
@@ -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 }}>
diff --git a/web/libs/editor/src/utils/feature-flags.ts b/web/libs/editor/src/utils/feature-flags.ts
index 4f94495cd710..58a0fd8ade76 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,

From d08ef13a55f6ca435a460b3b6293405dd083ba26 Mon Sep 17 00:00:00 2001
From: Raul Martin <raul@humansignal.com>
Date: Wed, 29 Jan 2025 14:09:32 -0800
Subject: [PATCH 2/2] missed a reference

---
 .../src/components/SidePanels/OutlinerPanel/ViewControls.tsx    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/web/libs/editor/src/components/SidePanels/OutlinerPanel/ViewControls.tsx b/web/libs/editor/src/components/SidePanels/OutlinerPanel/ViewControls.tsx
index f9f6f6f44fe9..22133e57b561 100644
--- a/web/libs/editor/src/components/SidePanels/OutlinerPanel/ViewControls.tsx
+++ b/web/libs/editor/src/components/SidePanels/OutlinerPanel/ViewControls.tsx
@@ -200,7 +200,7 @@ const Grouping = <T extends string>({
             <DirectionIndicator direction={direction} name={value} value={value} wrap={false} />
           )
         }
-        tooltip={(isFF(FF_LSDV_4992) && readableValue.tooltip) || undefined}
+        tooltip={readableValue.tooltip || undefined}
         tooltipTheme="dark"
       >
         {readableValue.selectedLabel}