public async Task <IActionResult> List() { var model = new ImportProfileListModel(); var lastExecutionInfos = (await _taskStore.GetExecutionInfoQuery(false) .ApplyCurrentMachineNameFilter() .ApplyTaskFilter(0, true) .ToListAsync()) .ToDictionarySafe(x => x.TaskDescriptorId); var profiles = await _db.ImportProfiles .Include(x => x.Task) .AsNoTracking() .OrderBy(x => x.EntityTypeId) .ThenBy(x => x.Name) .ToListAsync(); foreach (var profile in profiles) { var profileModel = new ImportProfileModel(); lastExecutionInfos.TryGetValue(profile.TaskId, out var lastExecutionInfo); await PrepareProfileModel(profileModel, profile, lastExecutionInfo, false); profileModel.TaskModel = await profile.Task.MapAsync(lastExecutionInfo); model.Profiles.Add(profileModel); } return(View(model)); }
public async Task <IActionResult> TaskList() { var models = new List <TaskModel>(); var moduleCatalog = Services.ApplicationContext.ModuleCatalog; var tasks = await _taskStore.GetAllTasksAsync(true, false); var lastExecutionInfos = (await _taskStore.GetExecutionInfoQuery(false) .ApplyCurrentMachineNameFilter() .ApplyTaskFilter(0, true) .ToListAsync()) .ToDictionarySafe(x => x.TaskDescriptorId); foreach (var task in tasks) { var normalizedTypeName = _taskActivator.GetNormalizedTypeName(task); var taskType = _taskActivator.GetTaskClrType(normalizedTypeName); if (moduleCatalog.IsActiveModuleAssembly(taskType?.Assembly)) { lastExecutionInfos.TryGetValue(task.Id, out var lastExecutionInfo); var model = await task.MapAsync(lastExecutionInfo); model.LastRunInfo = await this.InvokeViewAsync("_LastRun", model); model.NextRunInfo = await this.InvokeViewAsync("_NextRun", model); models.Add(model); } } var gridModel = new GridModel <TaskModel> { Rows = models, Total = models.Count }; return(Json(gridModel)); }
public async Task <IActionResult> List() { var model = new List <ExportProfileModel>(); var providers = _exportProfileService.LoadAllExportProviders(0, false) .ToDictionarySafe(x => x.Metadata.SystemName); var profiles = await _db.ExportProfiles .AsNoTracking() .Include(x => x.Task) .Include(x => x.Deployments) .OrderBy(x => x.IsSystemProfile).ThenBy(x => x.Name) .ToListAsync(); var lastExecutionInfos = (await _taskStore.GetExecutionInfoQuery(false) .ApplyCurrentMachineNameFilter() .ApplyTaskFilter(0, true) .ToListAsync()) .ToDictionarySafe(x => x.TaskDescriptorId); foreach (var profile in profiles) { if (providers.TryGetValue(profile.ProviderSystemName, out var provider)) { var profileModel = new ExportProfileModel(); lastExecutionInfos.TryGetValue(profile.TaskId, out var lastExecutionInfo); await PrepareProfileModel(profileModel, profile, provider, lastExecutionInfo, false); var fileDetailsModel = await CreateFileDetailsModel(profile, null); profileModel.FileCount = fileDetailsModel.FileCount; // TODO: (mg) (core) add Task model. model.Add(profileModel); } } return(View(model)); }