Browse Source

feat(dashboards): open widget viewer icon (#65397)

Ogi 1 year ago
parent
commit
93f489f5c9
1 changed files with 12 additions and 3 deletions
  1. 12 3
      static/app/views/dashboards/widgetCard/widgetCardContextMenu.tsx

+ 12 - 3
static/app/views/dashboards/widgetCard/widgetCardContextMenu.tsx

@@ -9,7 +9,7 @@ import type {MenuItemProps} from 'sentry/components/dropdownMenu';
 import {DropdownMenu} from 'sentry/components/dropdownMenu';
 import {isWidgetViewerPath} from 'sentry/components/modals/widgetViewerModal/utils';
 import Tag from 'sentry/components/tag';
-import {IconEllipsis, IconExpand} from 'sentry/icons';
+import {IconEdit, IconEllipsis, IconExpand} from 'sentry/icons';
 import {t} from 'sentry/locale';
 import {space} from 'sentry/styles/space';
 import type {Organization, PageFilters} from 'sentry/types';
@@ -17,6 +17,7 @@ import type {Series} from 'sentry/types/echarts';
 import {trackAnalytics} from 'sentry/utils/analytics';
 import type {TableDataWithTitle} from 'sentry/utils/discover/discoverQuery';
 import type {AggregationOutputType} from 'sentry/utils/discover/fields';
+import {hasDDMExperimentalFeature} from 'sentry/utils/metrics/features';
 import {
   MEPConsumer,
   MEPState,
@@ -91,6 +92,14 @@ function WidgetCardContextMenu({
     }
   };
 
+  const openWidgetViewerIcon =
+    hasDDMExperimentalFeature(organization) &&
+    widget.widgetType === WidgetType.METRICS ? (
+      <IconEdit />
+    ) : (
+      <IconExpand />
+    );
+
   if (isPreview) {
     return (
       <WidgetViewerContext.Consumer>
@@ -132,7 +141,7 @@ function WidgetCardContextMenu({
                   aria-label={t('Open Widget Viewer')}
                   borderless
                   size="xs"
-                  icon={<IconExpand />}
+                  icon={openWidgetViewerIcon}
                   onClick={() => {
                     (seriesData || tableData) &&
                       setData({
@@ -274,7 +283,7 @@ function WidgetCardContextMenu({
                 aria-label={t('Open Widget Viewer')}
                 borderless
                 size="xs"
-                icon={<IconExpand />}
+                icon={openWidgetViewerIcon}
                 onClick={() => {
                   setData({
                     seriesData,