public async Task <IViewComponentResult> InvokeAsync(FeatureIndexOptions options) { // Get features var features = await _shellDescriptorManager.GetFeaturesAsync(); // No features if (features == null) { return(View(new FeaturesIndexViewModel() { Options = options })); } // Filter features by category if (!string.IsNullOrEmpty(options.Category)) { features = features.Where(f => f.Descriptor?.Category != null && f.Descriptor.Category.Equals(options.Category, StringComparison.OrdinalIgnoreCase)); } if (options.HideEnabled) { features = features.Where(f => f.IsEnabled == false); } return(View(new FeaturesIndexViewModel() { Options = options, Features = features })); }
public async Task <IViewComponentResult> InvokeAsync(FeatureIndexOptions options) { var descriptor = await _tourDescriptorStore.GetAsync(); // Build view model var coreIndexViewModel = new TourIndexViewModel() { Steps = descriptor.Steps }; return(View(new TourIndexViewModel() { Steps = descriptor.Steps })); }
public Task <IViewComponentResult> InvokeAsync(FeatureIndexOptions options) { return(Task.FromResult((IViewComponentResult)View())); }
public async Task <IActionResult> Index(FeatureIndexOptions opts) { // Ensure we have permission if (!await _authorizationService.AuthorizeAsync(User, Permissions.ManageFeatures)) { return(Unauthorized()); } if (opts == null) { opts = new FeatureIndexOptions(); } var category = await GetCategoriesNameAsync(opts.Category); // Ensure the supplied category is valid if (string.IsNullOrEmpty(category)) { return(NotFound()); } if (category.ToLower() != "all") { // Build page title _pageTitleBuilder.AddSegment(S[category], int.MaxValue); // Build breadcrumb _breadCrumbManager.Configure(builder => { builder .Add(S["Home"], home => home .Action("Index", "Admin", "Plato.Admin") .LocalNav()) .Add(S["Features"], features => features .Action("Index", "Admin", "Plato.Features", new RouteValueDictionary() { ["opts.category"] = "" }) .LocalNav()) .Add(S[category]); }); } else { _breadCrumbManager.Configure(builder => { builder.Add(S["Home"], home => home .Action("Index", "Admin", "Plato.Admin") .LocalNav() ).Add(S["Features"]); }); } opts.Category = category; var model = new FeaturesIndexViewModel() { Options = opts }; return(View((LayoutViewModel)await _viewProvider.ProvideIndexAsync(model, this))); }