Esempio n. 1
0
        /// <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();
        }
Esempio n. 2
0
        public ResourceGroupTabPage AddTab(PBIProvisioningContext context)
        {
            var page = new ResourceGroupTabPage(new MigrationTabForm(context));

            AddPage(page, context.DisplayName);

            return(page);
        }
Esempio n. 3
0
 public PBIProvisioningContext(PBIProvisioningContext previousContext)
 {
     DisplayName         = previousContext.DisplayName;
     Environment         = previousContext.Environment;
     Subscription        = previousContext.Subscription;
     ResourceGroupName   = previousContext.ResourceGroupName;
     WorkspaceCollection = previousContext.WorkspaceCollection;
     WorkspaceId         = previousContext.WorkspaceId;
 }
Esempio n. 4
0
        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());
        }
Esempio n. 5
0
        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);
            }
        }
Esempio n. 6
0
        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));
            }
        }