sadpandajoe commented on code in PR #37141:
URL: https://github.com/apache/superset/pull/37141#discussion_r3698294615


##########
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx:
##########
@@ -470,13 +486,14 @@ const DashboardBuilder = () => {
     dashboardFiltersOpen,
     toggleDashboardFiltersOpen,
     nativeFiltersEnabled,
+    hasFilters,
   } = useNativeFilters();
 
   const [containerRef, isSticky] = useElementOnScreen<HTMLDivElement>(
     ELEMENT_ON_SCREEN_OPTIONS,
   );
 
-  const showFilterBar = !editMode && nativeFiltersEnabled;
+  const showFilterBar = isNotMobile && !editMode && nativeFiltersEnabled;

Review Comment:
   This removes the normal filter bar for narrow embedded/`standalone=2` 
dashboards, while their hidden `DashboardHeader` also removes the only trigger 
for the replacement drawer, leaving native filters unreachable. Should mobile 
mode exclude embedded/standalone dashboards as the docs promise, or provide a 
header-independent drawer trigger?



##########
superset-frontend/src/features/home/RightMenu.tsx:
##########
@@ -644,6 +654,64 @@ const RightMenu = ({
     handleLogout,
   ]);
 
+  // Build mobile menu items - consumption only (no create/admin actions)
+  const mobileMenuItems = useMemo(() => {
+    const items: MenuItem[] = [];
+
+    // Add Dashboards link at top (from main menu)
+    // Match on the FAB-internal `name`, which is stable across locales
+    // (`label` is translated and would break in non-English deployments)
+    const dashboardsMenu = menu?.find(item => item.name === 'Dashboards');
+    if (dashboardsMenu) {
+      const dashboardUrl = dashboardsMenu.url || '/dashboard/list/';
+      items.push({
+        key: 'dashboards',
+        label: isFrontendRoute(dashboardUrl) ? (
+          <Link to={dashboardUrl}>{t('Dashboards')}</Link>

Review Comment:
   On deployments under `APPLICATION_ROOT`, `dashboardUrl` already includes the 
prefix, so passing it directly to this basename-aware `Link` produces paths 
like `/app/prefix/app/prefix/dashboard/list/`. Should this mirror the existing 
desktop links and call `stripAppRoot(dashboardUrl)`?



##########
superset-frontend/src/dashboard/components/Header/useHeaderActionsDropdownMenu.tsx:
##########
@@ -205,6 +218,52 @@ export const useHeaderActionsMenu = ({
 
     const menuItems: MenuItem[] = [];
 
+    // Mobile-only: show dashboard info items in menu
+    if (isMobile && !editMode) {

Review Comment:
   The mobile menu adds its consumption-only metadata here but then still falls 
through to the shared `Save as` and `Embed dashboard` mutations below for users 
with those permissions. Should those authoring entries be excluded when 
`isMobile` so this surface is actually consumption-only?



##########
superset-frontend/playwright/tests/mobile/mobile-dashboard.spec.ts:
##########
@@ -0,0 +1,288 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { test, expect, devices, Page } from '@playwright/test';
+
+// NOTE: These tests exercise the mobile consumption experience and require
+// the MOBILE_CONSUMPTION_MODE feature flag to be enabled in the target
+// environment (FEATURE_FLAGS = {"MOBILE_CONSUMPTION_MODE": True}).
+import { TIMEOUT } from '../../utils/constants';
+import { URL } from '../../utils/urls';
+
+/**
+ * Mobile dashboard viewing tests verify that dashboards can be viewed
+ * and interacted with on mobile devices.
+ *
+ * These tests assume the World Bank's Health sample dashboard exists.
+ */
+
+// Use iPhone 12 viewport for mobile tests
+const mobileViewport = devices['iPhone 12'];
+
+/**
+ * Navigates to the dashboard list, clicks the first available dashboard
+ * card, and waits for navigation into that dashboard. Skips the current
+ * test when no dashboards are available to open.
+ */
+async function openFirstDashboard(page: Page): Promise<void> {
+  await page.goto(URL.DASHBOARD_LIST);
+  await page.waitForLoadState('networkidle');
+
+  const cards = page.locator('[data-test="styled-card"]');
+  const cardCount = await cards.count();
+
+  test.skip(cardCount === 0, 'No dashboards available to open on mobile');
+
+  await cards.first().click();
+
+  await page.waitForURL(url => /\/dashboard\/(?!list)/.test(url.pathname), {
+    timeout: TIMEOUT.PAGE_LOAD,
+  });
+}
+
+/**
+ * Navigates to the World Bank's Health dashboard and returns a locator
+ * for its mobile filter button. Skips the current test when the fixture
+ * has no native filters configured.
+ */
+async function getMobileFilterButton(page: Page) {
+  // Navigate directly to the World Bank's Health dashboard, which this
+  // spec's fixtures require, rather than an arbitrary first card from
+  // the list. Whether it has native filters configured depends on the
+  // fixture, so callers skip themselves when none are present.
+  await page.goto('dashboard/world_health/');
+  await page.waitForLoadState('networkidle');
+
+  // Give filters time to load
+  await page.waitForTimeout(2000);
+
+  const filterButton = page
+    .locator('[data-test="filter-icon"]')

Review Comment:
   Both drawer tests always skip because the product trigger is 
`[data-test="mobile-filters-trigger"]` with `aria-label="Open filters"`; none 
of these selectors matches it. Could this target the real trigger and fail when 
a filter-enabled fixture does not render it, so the headline drawer path is 
actually exercised?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to