protected async Task ReloadSectionsAsync(IEnumerable <string> reloadEntityIds) { if (UIResolver == null || Sections == null) { return; } var newSections = await Sections.ToListAsync(async x => { if (reloadEntityIds.Contains(x.editContext.Entity.Id)) { var reloadedEditContext = await PresentationService.GetEntityAsync(new GetEntityRequestModel { CollectionAlias = x.editContext.CollectionAlias, Id = x.editContext.Entity.Id, ParentPath = x.editContext.Parent?.GetParentPath(), UsageType = x.editContext.UsageType }); return(reloadedEditContext, await UIResolver.GetSectionsForEditContextAsync(reloadedEditContext)); } else { return(x); } }); Sections = newSections; }
protected async Task LoadNodeDataAsync(CancellationToken cancellationToken) { if (CurrentState == null) { throw new InvalidOperationException(); } var editContext = await PresentationService.GetEntityAsync <GetEntityRequestModel, FormEditContext>(new GetEntityRequestModel { CollectionAlias = CurrentState.CollectionAlias, Id = CurrentState.Id, ParentPath = CurrentState.ParentPath, UsageType = CurrentState.UsageType, VariantAlias = CurrentState.VariantAlias }); var resolver = await UIResolverFactory.GetNodeUIResolverAsync(CurrentState.UsageType, CurrentState.CollectionAlias); var buttons = await resolver.GetButtonsForEditContextAsync(editContext); var sections = new[] { (editContext, await resolver.GetSectionsForEditContextAsync(editContext)) }.ToList();
protected async Task <List <(FormEditContext editContext, IEnumerable <SectionUI> sections)> > ReloadSectionsAsync(IEnumerable <string> reloadEntityIds, IListUIResolver uiResolver) { if (Sections == null) { return(new List <(FormEditContext editContext, IEnumerable <SectionUI> sections)>()); } var newSections = await Sections.ToListAsync(async x => { if (reloadEntityIds.Contains <string>(x.editContext.Entity.Id !)) { var reloadedEditContext = await PresentationService.GetEntityAsync <GetEntityRequestModel, FormEditContext>(new GetEntityRequestModel { CollectionAlias = x.editContext.CollectionAlias, Id = x.editContext.Entity.Id, ParentPath = x.editContext.Parent?.GetParentPath(), UsageType = x.editContext.UsageType, VariantAlias = x.editContext.EntityVariantAlias }); return(reloadedEditContext, await uiResolver.GetSectionsForEditContextAsync(reloadedEditContext)); }