From 8ff6277db444ec5afa05e3b4ed3124391466eeb5 Mon Sep 17 00:00:00 2001 From: Georgii Lobko Date: Tue, 2 Jun 2026 11:41:41 +0200 Subject: [PATCH] chore: AppLayout EBs metrics --- .../__tests__/widget-areas-error-boundaries.test.tsx | 7 +++++++ .../visual-refresh-toolbar/drawer/global-ai-drawer.tsx | 9 ++++++--- .../drawer/global-bottom-drawer.tsx | 2 +- .../visual-refresh-toolbar/drawer/global-drawer.tsx | 2 +- src/app-layout/visual-refresh-toolbar/index.tsx | 2 +- src/app-layout/visual-refresh-toolbar/state/index.tsx | 2 +- .../visual-refresh-toolbar/toolbar/drawer-triggers.tsx | 6 +++--- src/app-layout/visual-refresh-toolbar/toolbar/index.tsx | 6 +++--- .../widget-areas/after-main-slot.tsx | 4 ++-- .../widget-areas/before-main-slot.tsx | 4 ++-- .../widget-areas/bottom-content-slot.tsx | 2 +- .../widget-areas/top-content-slot.tsx | 2 +- src/error-boundary/interfaces.ts | 1 + src/error-boundary/internal.tsx | 7 ++++++- 14 files changed, 36 insertions(+), 20 deletions(-) diff --git a/src/app-layout/__tests__/widget-areas-error-boundaries.test.tsx b/src/app-layout/__tests__/widget-areas-error-boundaries.test.tsx index dd798f2936..bd49c950dd 100644 --- a/src/app-layout/__tests__/widget-areas-error-boundaries.test.tsx +++ b/src/app-layout/__tests__/widget-areas-error-boundaries.test.tsx @@ -5,6 +5,7 @@ import { render } from '@testing-library/react'; import AppLayout from '../../../lib/components/app-layout'; import ErrorBoundary from '../../../lib/components/error-boundary'; +import { metrics } from '../../../lib/components/internal/metrics'; import awsuiPlugins from '../../../lib/components/internal/plugins'; import { DrawerConfig } from '../../../lib/components/internal/plugins/controllers/drawers'; import * as awsuiWidgetPlugins from '../../../lib/components/internal/plugins/widget'; @@ -35,8 +36,10 @@ function renderComponent(jsx: React.ReactElement) { }; } +let sendPanoramaMetricSpy: jest.SpyInstance; beforeEach(() => { jest.resetAllMocks(); + sendPanoramaMetricSpy = jest.spyOn(metrics, 'sendOpsMetricObject').mockImplementation(() => {}); }); describe('AppLayout error boundaries: errors in different areas does not crash the entire app layout', () => { @@ -66,6 +69,10 @@ describe('AppLayout error boundaries: errors in different areas does not crash t expect(onError).toHaveBeenCalled(); } expect(consoleSpy).toHaveBeenCalled(); + expect(sendPanoramaMetricSpy).toHaveBeenCalledWith('awsui-app-layout-error-boundary-fired', { + appLayoutPart: expect.any(String), + errorMessage: expect.any(String), + }); }; test('left drawer content', () => { diff --git a/src/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.tsx b/src/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.tsx index 27b9221e3d..2155695cb1 100644 --- a/src/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.tsx +++ b/src/app-layout/visual-refresh-toolbar/drawer/global-ai-drawer.tsx @@ -131,7 +131,7 @@ export function AppLayoutGlobalAiDrawerImplementation({ } return ( - + {drawerTransitionState => { return ( @@ -192,7 +192,10 @@ export function AppLayoutGlobalAiDrawerImplementation({
-
}> +
} + appLayoutPart="left-drawer-header" + > {activeAiDrawer?.header ??
}
@@ -248,7 +251,7 @@ export function AppLayoutGlobalAiDrawerImplementation({
)}
- +
{activeAiDrawer?.content}
diff --git a/src/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.tsx b/src/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.tsx index 318229db1f..5faa6c3642 100644 --- a/src/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.tsx +++ b/src/app-layout/visual-refresh-toolbar/drawer/global-bottom-drawer.tsx @@ -189,7 +189,7 @@ function AppLayoutGlobalBottomDrawerImplementation({ }, [reportBottomDrawerSize, size]); return ( - + + {state => { return ( diff --git a/src/app-layout/visual-refresh-toolbar/index.tsx b/src/app-layout/visual-refresh-toolbar/index.tsx index 834dafe972..af827b85f9 100644 --- a/src/app-layout/visual-refresh-toolbar/index.tsx +++ b/src/app-layout/visual-refresh-toolbar/index.tsx @@ -105,7 +105,7 @@ function AppLayoutVisualRefreshToolbarWithI18n({ {/* Rendering a hidden copy of breadcrumbs to trigger their deduplication */} {(embeddedViewMode || !toolbarProps) && appLayoutPropsWithI18n.breadcrumbs ? ( - + {appLayoutPropsWithI18n.breadcrumbs} ) : null} diff --git a/src/app-layout/visual-refresh-toolbar/state/index.tsx b/src/app-layout/visual-refresh-toolbar/state/index.tsx index d3968819c6..3ce1047714 100644 --- a/src/app-layout/visual-refresh-toolbar/state/index.tsx +++ b/src/app-layout/visual-refresh-toolbar/state/index.tsx @@ -58,7 +58,7 @@ export const AppLayoutStateProviderInternal = ({ appLayoutProps, stateManager, f export const AppLayoutStateProvider = (props: AppLayoutStateProps) => { return ( - + ); diff --git a/src/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.tsx b/src/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.tsx index 1f5fc8b05f..ef6c403447 100644 --- a/src/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.tsx +++ b/src/app-layout/visual-refresh-toolbar/toolbar/drawer-triggers.tsx @@ -189,7 +189,7 @@ export function DrawerTriggers({ const selected = !expandedDrawerId && item.id === activeDrawerId; const isFeatureNotificationsDrawer = featureNotificationsProps?.drawer?.id === item.id; return ( - + + 0 && ( - + { const isBottom = item?.position === 'bottom'; diff --git a/src/app-layout/visual-refresh-toolbar/toolbar/index.tsx b/src/app-layout/visual-refresh-toolbar/toolbar/index.tsx index b7df9fe324..80cc1e79a2 100644 --- a/src/app-layout/visual-refresh-toolbar/toolbar/index.tsx +++ b/src/app-layout/visual-refresh-toolbar/toolbar/index.tsx @@ -203,7 +203,7 @@ export function AppLayoutToolbarImplementation({ {hasNavigation && (