/// <summary> /// this constructor is used when the new tab is created /// </summary> /// <param name="context"></param> public MigrationTabForm(PBIProvisioningContext context) { Init(); MigrationPlan = new MigrationPlan(context); SetRootDirectory(); }
public ResourceGroupTabPage AddTab(PBIProvisioningContext context) { var page = new ResourceGroupTabPage(new MigrationTabForm(context)); AddPage(page, context.DisplayName); return(page); }
public PBIProvisioningContext(PBIProvisioningContext previousContext) { DisplayName = previousContext.DisplayName; Environment = previousContext.Environment; Subscription = previousContext.Subscription; ResourceGroupName = previousContext.ResourceGroupName; WorkspaceCollection = previousContext.WorkspaceCollection; WorkspaceId = previousContext.WorkspaceId; }
private async Task AnalyzeWorkspaceCollection(AnalyzedWorkspaceCollection analyzedWorkspaceCollection) { PBIProvisioningContext localContext = new PBIProvisioningContext(MigrationPlan.Context); localContext.WorkspaceCollection = new PBIWorkspaceCollection { Name = analyzedWorkspaceCollection.WorkspaceCollectionName }; PaaSController controller = new PaaSController(localContext); analyzedWorkspaceCollection.Workspaces = (await controller.GetWorkspaces()).Select(ws => new AnalyzedWorkspace(ws.WorkspaceId)).ToList(); await Task.WhenAll(analyzedWorkspaceCollection.Workspaces.Select(aws => AnalyzeWorkspace(localContext, aws)).ToArray()); }
private async Task Export(List <ReportMigrationData> selectedReports) { foreach (var report in selectedReports) { RunInUIContext(UpdateExportGrid); PBIProvisioningContext localContext = new PBIProvisioningContext(MigrationPlan.Context); localContext.WorkspaceCollection = new PBIWorkspaceCollection { Name = report.PaaSWorkspaceCollectionName }; PaaSController controller = new PaaSController(localContext); string targetFolder = Path.GetDirectoryName(report.PbixPath); if (!Directory.Exists(targetFolder)) { Directory.CreateDirectory(targetFolder); } report.ExportState = ExportState.InProgress; RunInUIContext(UpdateExportGrid); var response = await TryExportToFile(controller, report.PaaSWorkspaceId, report.PaaSReportId, report.PbixPath); if (response != null && response.StatusCode == HttpStatusCode.OK) { if (File.Exists(report.PbixPath)) { report.ExportState = ExportState.Done; report.LastExportStatus = "Download was successful"; } else { report.ExportState = ExportState.Failed; report.LastExportStatus = Errors.Export.PBIXNotCreated; } } else { report.ExportState = ExportState.Failed; report.LastExportStatus = Errors.Export.DownloadFailed; if (response != null) { report.LastExportStatus = response.StatusCode.ToString(); } } RunInUIContext(UpdateExportGrid); } }
private async Task AnalyzeWorkspace(PBIProvisioningContext context, AnalyzedWorkspace analyzedWorkspace) { PBIProvisioningContext localContext = new PBIProvisioningContext(context); localContext.WorkspaceId = analyzedWorkspace.WorkspaceId; PaaSController controller = new PaaSController(localContext); var imports = await controller.GetImports(); var reports = await controller.GetReports(); var datasets = await controller.GetDatasets(); foreach (var report in reports) { var datasources = await controller.GetDatasources(report.DatasetId); var import = imports.Value.FirstOrDefault(i => i.Reports != null && i.Reports.Any(r => string.Equals(r.Id, report.Id, StringComparison.OrdinalIgnoreCase))); var dataset = datasets.FirstOrDefault(d => string.Equals(d.Id, report.DatasetId, StringComparison.OrdinalIgnoreCase)); analyzedWorkspace.Reports.Add(new ReportMigrationData(report, import, dataset, datasources, localContext.WorkspaceCollection.Name, localContext.WorkspaceId)); } }