-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
A Custom action added via config is not availble for repository entities in ths UI Builder backoffice. In v13 this is available.
Steps To Reproduce
Here's the complete config from Program.cs
.AddUIBuilder( cfg =>
{
cfg.AddSectionAfter("media", "Repositories", sectionConfig => sectionConfig
.Tree(treeConfig => treeConfig
.AddCollection<JobSurvey>(x => x.jobSurveyCd, "JobSurvey", "JobSurveys", "A job survey entity", "icon-notepad", "icon-notepad", collectionConfig => collectionConfig
.SetNameProperty(p => p.recipientName)
.SetSortProperty(p => p.createDate, Umbraco.UIBuilder.SortDirection.Descending)
.SetDateCreatedProperty(p => p.createDate)
.ListView(listViewConfig => listViewConfig
.AddField(p => p.createDate).SetFormat((v, p) => $"{v.ToShortDateString()}").SetHeading("Sent Date")
.AddField(p => p.recipientName).SetHeading("Recipient")
.AddField(p => p.recipientEmail).SetHeading("Email")
.AddField(p => p.recipientPhone).SetHeading("Phone")
.AddField(p => p.market).SetHeading("Market")
.AddField(p => p.surveyScore).SetHeading("Score")
.AddField(p => p.surveyComment).SetFormat((v, p) => $"{(v.Length > 0 ? "Yes" : "No")}").SetHeading("Has Comment")
)
.Editor(editorConfig => editorConfig
.AddTab("General", tabConfig => tabConfig
.AddFieldset("Response", fieldsetConfig => fieldsetConfig
.AddField(p => p.surveyScore).SetDataType("Textstring").SetLabel("Score")
.AddField(p => p.surveyComment).SetDataType("Textarea").SetLabel("Comment")
)
.AddFieldset("Details", fieldsetConfig => fieldsetConfig
.AddField(p => p.jobSurveyLocator).SetLabel("Job Survey Locator").SetDescription("Unique identifier for the job survey, used in Url").MakeReadOnly()
.AddField(p => p.market).MakeRequired().SetLabel("Market Id")
.AddField(p => p.inspectorName).SetLabel("Inspector Name")
.AddField(p => p.recipientName).SetLabel("Recipient Name")
.AddField(p => p.recipientEmail).SetValidationRegex("[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+").SetLabel("Recipient Email")
.AddField(p => p.recipientPhone).SetDescription("Include area code, omit +1, only digits").SetLabel("Recipient Phone")
.AddField(p => p.submitterIP).SetLabel("Submitter IP Address")
)
.AddFieldset("Urls", fieldsetConfig => fieldsetConfig
.AddField(p => p.promoterRedirectUrl).SetLabel("Promoter Redirect Url")
.AddField(p => p.detractorRedirectUrl).SetLabel("Detractor Redirect Url")
.AddField(p => p.passiveRedirectUrl).SetLabel("Passive Redirect Url")
)
)
)
.AddAction(typeof(CreateTestimonialAction),actionConfig => actionConfig
.SetVisibility(x => x.ActionType == ActionType.EntityMenu))
)
));
})
And the Action itself:
using MisWeb.Core.Services;
using Umbraco.UIBuilder.Configuration.Actions;
namespace MisWeb.Core.Actions
{
public class CreateTestimonialAction : Umbraco.UIBuilder.Configuration.Actions.Action<ActionResult>
{
private readonly ISurveyService _surveyService;
public override string Icon => "icon-chat";
public override string Alias => "createtestimonialaction";
public override string Name => "Create Testimonial";
public override bool ConfirmAction => true;
public CreateTestimonialAction(ISurveyService surveyService)
{
_surveyService = surveyService;
}
public override ActionResult Execute(string collectionAlias, object[] entityIds)
{
// create a new testimonial
if(_surveyService.CreateTestimonialFromSurvey(entityIds))
return new ActionResult(true);
return new ActionResult(false);
}
}
}
Environment (please complete the following information):
- Server OS: Windows/.NET 10/IIS Express
- Browser chrome
- Umbraco Version 17.0.0-rc3
- Product Version 17.0.0-rc1
This item has been added to our backlog AB#62393