umbraco / Umbraco.UIBuilder.Issues

Back office UI builder for Umbraco
3 stars 2 forks source link

Angular error when adding a custom action in the ContainerMenu #73

Closed jemayn closed 9 months ago

jemayn commented 10 months ago

Describe the bug I've added a custom action that I want to trigger from the containermenu. It gets added just fine, but when I click it and try to execute it throws an error:

angular.js:15697  Error: [$injector:unpr] http://errors.angularjs.org/1.8.3/$injector/unpr?p0=uibMenuActionServiceProvider%20%3C-%20uibMenuActionService
    at angular.js:99:1
    at angular.js:4991:19
    at Object.d [as get] (angular.js:5151:32)
    at angular.js:4996:28
    at Object.d [as get] (angular.js:5151:32)
    at Object.executeMenuAction (umbraco.services.min.js?d=638345992050000000:1:71214)
    at scope.executeMenuItem (umbraco.directives.min.js?d=638345992050000000:1:173214)
    at fn (eval at compile (angular.js:16548:15), <anonymous>:4:238)
    at e (angular.js:29123:13)
    at m.$eval (angular.js:19523:16)

Steps To Reproduce Steps to reproduce the behavior:

  1. Add a custom action:
public class ImportAction : Umbraco.UIBuilder.Configuration.Actions.Action<ActionResult>
{
    public override string Alias => "importDealers";
    public override string Name => "Import dealers from old site";
    public override string Icon => "icon-page-down";

    public override ActionResult Execute(string collectionAlias, object[] entityIds)
    {
        return new ActionResult(true);
    }
}
  1. Set it to the ContainerMenu in the configurator:
.AddAction<ImportAction>(actionConfig => actionConfig
                            .SetVisibility(x => x.ActionType == ActionType.ContainerMenu))
  1. It shows up just fine in the backoffice, but when clicking it the error occurs. image

Expected behavior I'd expect it to hit the action code

Environment (please complete the following information):


This item has been added to our backlog AB#34766

mastrup commented 9 months ago

The same happens when setting ActionType.EntityMenu.

angular.js:15697 Error: [$injector:unpr] http://errors.angularjs.org/1.8.3/$injector/unpr?p0=uibMenuActionServiceProvider%20%3C-%20uibMenuActionService
    at angular.js:99:1
    at angular.js:4991:19
    at Object.d [as get] (angular.js:5151:32)
    at angular.js:4996:28
    at Object.d [as get] (angular.js:5151:32)
    at Object.executeMenuAction (umbraco.services.min.js?d=638367150300000000:1:71061)
    at scope.executeMenuItem (umbraco.directives.min.js?d=638367150300000000:1:171957)
    at fn (eval at compile (angular.js:16548:15), <anonymous>:4:238)
    at e (angular.js:29123:13)
    at m.$eval (angular.js:19523:16)
acoumb commented 9 months ago

Hi @jemayn, @mastrup,

I have released version 12.0.2 of Umbraco.UIBuilder with a fix to this issue.

Thank you, Adrian