Skip to content

Commit

Permalink
Don't display telemetry actions when no telemetry (#6568)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNK authored Oct 31, 2024
1 parent a764cca commit 34d6aab
Showing 1 changed file with 34 additions and 34 deletions.
68 changes: 34 additions & 34 deletions src/Aspire.Dashboard/Components/Controls/ResourceActions.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,44 +81,44 @@ protected override void OnParametersSet()

// Show telemetry menu items if there is telemetry for the resource.
var hasTelemetryApplication = TelemetryRepository.GetApplicationByCompositeName(Resource.Name) != null;
var telemetryTooltip = !hasTelemetryApplication ? Loc[nameof(Resources.Resources.ResourceActionTelemetryTooltip)] : string.Empty;
_menuItems.Add(new MenuButtonItem { IsDivider = true });
_menuItems.Add(new MenuButtonItem
if (hasTelemetryApplication)
{
Text = Loc[nameof(Resources.Resources.ResourceActionStructuredLogsText)],
Icon = s_structuredLogsIcon,
OnClick = () =>
var telemetryTooltip = !hasTelemetryApplication ? Loc[nameof(Resources.Resources.ResourceActionTelemetryTooltip)] : string.Empty;
_menuItems.Add(new MenuButtonItem { IsDivider = true });
_menuItems.Add(new MenuButtonItem
{
NavigationManager.NavigateTo(DashboardUrls.StructuredLogsUrl(resource: GetResourceName(Resource)));
return Task.CompletedTask;
},
Tooltip = telemetryTooltip,
IsDisabled = !hasTelemetryApplication
});
_menuItems.Add(new MenuButtonItem
{
Text = Loc[nameof(Resources.Resources.ResourceActionTracesText)],
Icon = s_tracesIcon,
OnClick = () =>
Text = Loc[nameof(Resources.Resources.ResourceActionStructuredLogsText)],
Icon = s_structuredLogsIcon,
OnClick = () =>
{
NavigationManager.NavigateTo(DashboardUrls.StructuredLogsUrl(resource: GetResourceName(Resource)));
return Task.CompletedTask;
},
Tooltip = telemetryTooltip
});
_menuItems.Add(new MenuButtonItem
{
NavigationManager.NavigateTo(DashboardUrls.TracesUrl(resource: GetResourceName(Resource)));
return Task.CompletedTask;
},
Tooltip = telemetryTooltip,
IsDisabled = !hasTelemetryApplication
});
_menuItems.Add(new MenuButtonItem
{
Text = Loc[nameof(Resources.Resources.ResourceActionMetricsText)],
Icon = s_metricsIcon,
OnClick = () =>
Text = Loc[nameof(Resources.Resources.ResourceActionTracesText)],
Icon = s_tracesIcon,
OnClick = () =>
{
NavigationManager.NavigateTo(DashboardUrls.TracesUrl(resource: GetResourceName(Resource)));
return Task.CompletedTask;
},
Tooltip = telemetryTooltip
});
_menuItems.Add(new MenuButtonItem
{
NavigationManager.NavigateTo(DashboardUrls.MetricsUrl(resource: GetResourceName(Resource)));
return Task.CompletedTask;
},
Tooltip = telemetryTooltip,
IsDisabled = !hasTelemetryApplication
});
Text = Loc[nameof(Resources.Resources.ResourceActionMetricsText)],
Icon = s_metricsIcon,
OnClick = () =>
{
NavigationManager.NavigateTo(DashboardUrls.MetricsUrl(resource: GetResourceName(Resource)));
return Task.CompletedTask;
},
Tooltip = telemetryTooltip
});
}

// If display is desktop then we display highlighted commands next to the ... button.
if (ViewportInformation.IsDesktop)
Expand Down

0 comments on commit 34d6aab

Please sign in to comment.