From 38182ed53954ef5183bfb4752991c6e9e83dbec1 Mon Sep 17 00:00:00 2001
From: Petr Stribny <petr@stribny.name>
Date: Thu, 13 Mar 2025 09:43:31 +0000
Subject: [PATCH] Remove dashboard feature flag

---
 backend/src/baserow/contrib/dashboard/apps.py | 159 +++++++++---------
 backend/src/baserow/core/feature_flags.py     |   1 -
 ...boards_with_summary_and_chart_widgets.json |   8 +
 .../backend/src/baserow_enterprise/apps.py    |  11 +-
 .../modules/baserow_enterprise/plugin.js      |  13 +-
 .../modules/core/plugins/featureFlags.js      |   1 -
 web-frontend/modules/dashboard/plugin.js      |   7 +-
 7 files changed, 96 insertions(+), 104 deletions(-)
 create mode 100644 changelog/entries/unreleased/feature/2206_introduce_dashboards_with_summary_and_chart_widgets.json

diff --git a/backend/src/baserow/contrib/dashboard/apps.py b/backend/src/baserow/contrib/dashboard/apps.py
index 5bfbf1af4..71db1c2e7 100644
--- a/backend/src/baserow/contrib/dashboard/apps.py
+++ b/backend/src/baserow/contrib/dashboard/apps.py
@@ -1,7 +1,5 @@
 from django.apps import AppConfig
 
-from baserow.core.feature_flags import FF_DASHBOARDS, feature_flag_is_enabled
-
 
 class DashboardConfig(AppConfig):
     name = "baserow.contrib.dashboard"
@@ -18,105 +16,102 @@ class DashboardConfig(AppConfig):
 
         from .application_types import DashboardApplicationType
 
-        if feature_flag_is_enabled(FF_DASHBOARDS):
-            application_type_registry.register(DashboardApplicationType())
+        application_type_registry.register(DashboardApplicationType())
 
-            from baserow.contrib.dashboard.object_scopes import DashboardObjectScopeType
+        from baserow.contrib.dashboard.object_scopes import DashboardObjectScopeType
 
-            object_scope_type_registry.register(DashboardObjectScopeType())
+        object_scope_type_registry.register(DashboardObjectScopeType())
 
-            from baserow.contrib.dashboard.data_sources.object_scopes import (
-                DashboardDataSourceObjectScopeType,
-            )
+        from baserow.contrib.dashboard.data_sources.object_scopes import (
+            DashboardDataSourceObjectScopeType,
+        )
 
-            object_scope_type_registry.register(DashboardDataSourceObjectScopeType())
+        object_scope_type_registry.register(DashboardDataSourceObjectScopeType())
 
-            from baserow.contrib.dashboard.widgets.object_scopes import (
-                WidgetObjectScopeType,
-            )
+        from baserow.contrib.dashboard.widgets.object_scopes import (
+            WidgetObjectScopeType,
+        )
 
-            object_scope_type_registry.register(WidgetObjectScopeType())
+        object_scope_type_registry.register(WidgetObjectScopeType())
 
-            from baserow.contrib.dashboard.widgets.operations import (
-                CreateWidgetOperationType,
-                DeleteWidgetOperationType,
-                ListWidgetsOperationType,
-                ReadWidgetOperationType,
-                RestoreWidgetOperationType,
-                UpdateWidgetOperationType,
-            )
+        from baserow.contrib.dashboard.widgets.operations import (
+            CreateWidgetOperationType,
+            DeleteWidgetOperationType,
+            ListWidgetsOperationType,
+            ReadWidgetOperationType,
+            RestoreWidgetOperationType,
+            UpdateWidgetOperationType,
+        )
 
-            operation_type_registry.register(ListWidgetsOperationType())
-            operation_type_registry.register(ReadWidgetOperationType())
-            operation_type_registry.register(CreateWidgetOperationType())
-            operation_type_registry.register(UpdateWidgetOperationType())
-            operation_type_registry.register(DeleteWidgetOperationType())
-            operation_type_registry.register(RestoreWidgetOperationType())
+        operation_type_registry.register(ListWidgetsOperationType())
+        operation_type_registry.register(ReadWidgetOperationType())
+        operation_type_registry.register(CreateWidgetOperationType())
+        operation_type_registry.register(UpdateWidgetOperationType())
+        operation_type_registry.register(DeleteWidgetOperationType())
+        operation_type_registry.register(RestoreWidgetOperationType())
 
-            from baserow.contrib.dashboard.data_sources.operations import (
-                CreateDashboardDataSourceOperationType,
-                DeleteDashboardDataSourceOperationType,
-                DispatchDashboardDataSourceOperationType,
-                ListDashboardDataSourcesOperationType,
-                ReadDashboardDataSourceOperationType,
-                UpdateDashboardDataSourceOperationType,
-            )
+        from baserow.contrib.dashboard.data_sources.operations import (
+            CreateDashboardDataSourceOperationType,
+            DeleteDashboardDataSourceOperationType,
+            DispatchDashboardDataSourceOperationType,
+            ListDashboardDataSourcesOperationType,
+            ReadDashboardDataSourceOperationType,
+            UpdateDashboardDataSourceOperationType,
+        )
 
-            operation_type_registry.register(ListDashboardDataSourcesOperationType())
-            operation_type_registry.register(CreateDashboardDataSourceOperationType())
-            operation_type_registry.register(DeleteDashboardDataSourceOperationType())
-            operation_type_registry.register(UpdateDashboardDataSourceOperationType())
-            operation_type_registry.register(ReadDashboardDataSourceOperationType())
-            operation_type_registry.register(DispatchDashboardDataSourceOperationType())
+        operation_type_registry.register(ListDashboardDataSourcesOperationType())
+        operation_type_registry.register(CreateDashboardDataSourceOperationType())
+        operation_type_registry.register(DeleteDashboardDataSourceOperationType())
+        operation_type_registry.register(UpdateDashboardDataSourceOperationType())
+        operation_type_registry.register(ReadDashboardDataSourceOperationType())
+        operation_type_registry.register(DispatchDashboardDataSourceOperationType())
 
-            from baserow.contrib.dashboard.widgets.registries import (
-                widget_type_registry,
-            )
-            from baserow.contrib.dashboard.widgets.widget_types import SummaryWidgetType
+        from baserow.contrib.dashboard.widgets.registries import widget_type_registry
+        from baserow.contrib.dashboard.widgets.widget_types import SummaryWidgetType
 
-            widget_type_registry.register(SummaryWidgetType())
+        widget_type_registry.register(SummaryWidgetType())
 
-            from baserow.contrib.dashboard.widgets.trash_types import (
-                WidgetTrashableItemType,
-            )
+        from baserow.contrib.dashboard.widgets.trash_types import (
+            WidgetTrashableItemType,
+        )
 
-            trash_item_type_registry.register(WidgetTrashableItemType())
+        trash_item_type_registry.register(WidgetTrashableItemType())
 
-            from .ws.pages import DashboardPageType
+        from .ws.pages import DashboardPageType
 
-            page_registry.register(DashboardPageType())
+        page_registry.register(DashboardPageType())
 
-            from baserow.core.registries import permission_manager_type_registry
+        from baserow.core.registries import permission_manager_type_registry
 
-            from .permission_manager import AllowIfTemplatePermissionManagerType
+        from .permission_manager import AllowIfTemplatePermissionManagerType
 
-            prev_manager = permission_manager_type_registry.get(
-                AllowIfTemplatePermissionManagerType.type
-            )
-            permission_manager_type_registry.unregister(
-                AllowIfTemplatePermissionManagerType.type
-            )
-            permission_manager_type_registry.register(
-                AllowIfTemplatePermissionManagerType(prev_manager)
-            )
+        prev_manager = permission_manager_type_registry.get(
+            AllowIfTemplatePermissionManagerType.type
+        )
+        permission_manager_type_registry.unregister(
+            AllowIfTemplatePermissionManagerType.type
+        )
+        permission_manager_type_registry.register(
+            AllowIfTemplatePermissionManagerType(prev_manager)
+        )
 
-            from baserow.contrib.dashboard.data_sources.actions import (
-                UpdateDashboardDataSourceActionType,
-            )
-            from baserow.contrib.dashboard.widgets.actions import (
-                CreateWidgetActionType,
-                DeleteWidgetActionType,
-                UpdateWidgetActionType,
-            )
+        from baserow.contrib.dashboard.data_sources.actions import (
+            UpdateDashboardDataSourceActionType,
+        )
+        from baserow.contrib.dashboard.widgets.actions import (
+            CreateWidgetActionType,
+            DeleteWidgetActionType,
+            UpdateWidgetActionType,
+        )
 
-            from .ws.receivers import (  # noqa: F401
-                dashboard_data_source_updated,
-                widget_created,
-                widget_deleted,
-                widget_updated,
-            )
+        from .ws.receivers import (  # noqa: F401
+            dashboard_data_source_updated,
+            widget_created,
+            widget_deleted,
+            widget_updated,
+        )
 
-            action_type_registry.register(CreateWidgetActionType())
-            action_type_registry.register(UpdateWidgetActionType())
-            action_type_registry.register(DeleteWidgetActionType())
-            action_type_registry.register(UpdateDashboardDataSourceActionType())
+        action_type_registry.register(CreateWidgetActionType())
+        action_type_registry.register(UpdateWidgetActionType())
+        action_type_registry.register(DeleteWidgetActionType())
+        action_type_registry.register(UpdateDashboardDataSourceActionType())
diff --git a/backend/src/baserow/core/feature_flags.py b/backend/src/baserow/core/feature_flags.py
index 586097adb..365062721 100644
--- a/backend/src/baserow/core/feature_flags.py
+++ b/backend/src/baserow/core/feature_flags.py
@@ -2,7 +2,6 @@ from django.conf import settings
 
 from baserow.core.exceptions import FeatureDisabledException
 
-FF_DASHBOARDS = "dashboards"
 FF_ENABLE_ALL = "*"
 
 
diff --git a/changelog/entries/unreleased/feature/2206_introduce_dashboards_with_summary_and_chart_widgets.json b/changelog/entries/unreleased/feature/2206_introduce_dashboards_with_summary_and_chart_widgets.json
new file mode 100644
index 000000000..8bd5b6536
--- /dev/null
+++ b/changelog/entries/unreleased/feature/2206_introduce_dashboards_with_summary_and_chart_widgets.json
@@ -0,0 +1,8 @@
+{
+    "type": "feature",
+    "message": "Introduce dashboards with summary and chart widgets",
+    "domain": "dashboard",
+    "issue_number": 2206,
+    "bullet_points": [],
+    "created_at": "2025-03-13"
+}
\ No newline at end of file
diff --git a/enterprise/backend/src/baserow_enterprise/apps.py b/enterprise/backend/src/baserow_enterprise/apps.py
index 673e935b6..3e81ebe6b 100755
--- a/enterprise/backend/src/baserow_enterprise/apps.py
+++ b/enterprise/backend/src/baserow_enterprise/apps.py
@@ -3,8 +3,6 @@ from django.db.models.signals import post_migrate
 
 from tqdm import tqdm
 
-from baserow.core.feature_flags import FF_DASHBOARDS, feature_flag_is_enabled
-
 
 class BaserowEnterpriseConfig(AppConfig):
     name = "baserow_enterprise"
@@ -263,11 +261,10 @@ class BaserowEnterpriseConfig(AppConfig):
             LocalBaserowGroupedAggregateRowsUserServiceType,
         )
 
-        if feature_flag_is_enabled(FF_DASHBOARDS):
-            service_type_registry.register(
-                LocalBaserowGroupedAggregateRowsUserServiceType()
-            )
-            widget_type_registry.register(ChartWidgetType())
+        service_type_registry.register(
+            LocalBaserowGroupedAggregateRowsUserServiceType()
+        )
+        widget_type_registry.register(ChartWidgetType())
 
         from baserow.contrib.builder.elements.registries import element_type_registry
         from baserow_enterprise.builder.elements.element_types import (
diff --git a/enterprise/web-frontend/modules/baserow_enterprise/plugin.js b/enterprise/web-frontend/modules/baserow_enterprise/plugin.js
index de56c014f..dbd306566 100644
--- a/enterprise/web-frontend/modules/baserow_enterprise/plugin.js
+++ b/enterprise/web-frontend/modules/baserow_enterprise/plugin.js
@@ -85,7 +85,6 @@ import {
   PhoneNumberFieldType,
   AutonumberFieldType,
 } from '@baserow/modules/database/fieldTypes'
-import { FF_DASHBOARDS } from '@baserow/modules/core/plugins/featureFlags'
 
 export default (context) => {
   const { app, isDev, store } = context
@@ -302,11 +301,9 @@ export default (context) => {
     new PeriodicIntervalFieldsConfigureDataSyncType(context)
   )
 
-  if (app.$featureFlagIsEnabled(FF_DASHBOARDS)) {
-    app.$registry.register('dashboardWidget', new ChartWidgetType(context))
-    app.$registry.register(
-      'chartFieldFormatting',
-      new SingleSelectFormattingType(context)
-    )
-  }
+  app.$registry.register('dashboardWidget', new ChartWidgetType(context))
+  app.$registry.register(
+    'chartFieldFormatting',
+    new SingleSelectFormattingType(context)
+  )
 }
diff --git a/web-frontend/modules/core/plugins/featureFlags.js b/web-frontend/modules/core/plugins/featureFlags.js
index 0941fbd61..9622f2880 100644
--- a/web-frontend/modules/core/plugins/featureFlags.js
+++ b/web-frontend/modules/core/plugins/featureFlags.js
@@ -1,5 +1,4 @@
 const FF_ENABLE_ALL = '*'
-export const FF_DASHBOARDS = 'dashboards'
 
 /**
  * A comma separated list of feature flags used to enable in-progress or not ready
diff --git a/web-frontend/modules/dashboard/plugin.js b/web-frontend/modules/dashboard/plugin.js
index d21f8b1b4..8c4834691 100644
--- a/web-frontend/modules/dashboard/plugin.js
+++ b/web-frontend/modules/dashboard/plugin.js
@@ -11,7 +11,6 @@ import { registerRealtimeEvents } from '@baserow/modules/dashboard/realtime'
 import { DashboardApplicationType } from '@baserow/modules/dashboard/applicationTypes'
 import { SummaryWidgetType } from '@baserow/modules/dashboard/widgetTypes'
 import dashboardApplicationStore from '@baserow/modules/dashboard/store/dashboardApplication'
-import { FF_DASHBOARDS } from '@baserow/modules/core/plugins/featureFlags'
 
 export default (context) => {
   const { app, isDev, store } = context
@@ -37,8 +36,6 @@ export default (context) => {
     dashboardApplicationStore
   )
 
-  if (app.$featureFlagIsEnabled(FF_DASHBOARDS)) {
-    app.$registry.register('application', new DashboardApplicationType(context))
-    app.$registry.register('dashboardWidget', new SummaryWidgetType(context))
-  }
+  app.$registry.register('application', new DashboardApplicationType(context))
+  app.$registry.register('dashboardWidget', new SummaryWidgetType(context))
 }