Skip to content

Commit

Permalink
Include resource name in message
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesNK committed Sep 19, 2024
1 parent 0280025 commit d7fefb8
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/Aspire.Dashboard/Components/Pages/Resources.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,23 +309,20 @@ private async Task ExecuteResourceCommandAsync(ResourceViewModel resource, Comma
}
}

//var resourceName = resource.IsExecutable(allowSubtypes: true)
// ? resource.DisplayName
// : resource.Name;
var resourceName = resource.Name;
var response = await DashboardClient.ExecuteResourceCommandAsync(resource.Name, resource.ResourceType, command, CancellationToken.None);

var response = await DashboardClient.ExecuteResourceCommandAsync(resourceName, resource.ResourceType, command, CancellationToken.None);
var messageResourceName = GetResourceName(resource);

if (response.Kind == ResourceCommandResponseKind.Succeeded)
{
ToastService.ShowSuccess(string.Format(CultureInfo.InvariantCulture, Loc[nameof(Dashboard.Resources.Resources.ResourceCommandSuccess)], command.DisplayName));
ToastService.ShowSuccess(string.Format(CultureInfo.InvariantCulture, Loc[nameof(Dashboard.Resources.Resources.ResourceCommandSuccess)], command.DisplayName + " " + messageResourceName));
}
else
{
ToastService.ShowCommunicationToast(new ToastParameters<CommunicationToastContent>()
{
Intent = ToastIntent.Error,
Title = string.Format(CultureInfo.InvariantCulture, Loc[nameof(Dashboard.Resources.Resources.ResourceCommandFailed)], command.DisplayName),
Title = string.Format(CultureInfo.InvariantCulture, Loc[nameof(Dashboard.Resources.Resources.ResourceCommandFailed)], command.DisplayName + " " + messageResourceName),
PrimaryAction = Loc[nameof(Dashboard.Resources.Resources.ResourceCommandToastViewLogs)],
OnPrimaryAction = EventCallback.Factory.Create<ToastResult>(this, () => NavigationManager.NavigateTo(DashboardUrls.ConsoleLogsUrl(resource: resource.Name))),
Content = new CommunicationToastContent()
Expand Down

0 comments on commit d7fefb8

Please sign in to comment.