Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't display telemetry actions when no telemetry #6568

Merged
merged 1 commit into from
Oct 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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