Private/_Menus.ps1
# _Menus.ps1 function Get-MainMenu { param ( ) Set-ToolVariables Set-ProjectVariables $sourceControlConfigMessage = "(Org : $($global:devops_projectFile.OrgName) | Project : $($global:devops_projectFile.Project) | git Repo : $($global:devops_projectFile.gitRepo))" $CICDConfigMessage = "(CI/CD Environment : $($global:devops_projectFile.CICDEnvironmentName) | CI/CD URL : $($global:devops_projectFile.CICDEnvironmentURL))" if (!$global:devops_projectFile) { $Title = "Power Platform DevOps (No Project Selected)" } else { $Title = "Power Platform DevOps ( $($global:devops_projectFile.OrgName) | $($global:devops_projectFile.gitRepo) )" $global:devops_projectTitle = $global:devops_projectFile.gitRepo Set-Location $global:devops_projectLocation } $global:devops_message = @" Welcome to the Power Platform DevOps script. ver: $global:devops_version (latest available version : $latestVersion) branch: $global:devops_Branch basebranch: $global:devops_BaseBranch isdocker : $global:devops_isDocker product : $global:devops_DevOpsProduct org: $global:devops_OrgName project: $global:devops_ProjectName repo : $global:devops_gitRepo projectlocation: $global:devops_projectLocation azure subscription : $global:devops_selectedSubscriptionName ($global:devops_selectedSubscription) azure keyvault : $global:devops_AzureKeyVault tenant id : $global:devops_TenantID client id : $global:devops_ClientID "@ [console]::ForegroundColor = "White" if (!$VerbosePreference -eq "Continue") { Clear-Host } Write-Host $global:devops_logo -ForegroundColor Magenta Write-Host $global:devops_message -ForegroundColor White $Repeater = "=" * $Title.Length Write-Host "================ $Title ================" -ForegroundColor White Write-Host "1: Run Pre-requisite checks (Install / Update)." -ForegroundColor (Set-ColourOption $global:devops_configFile.PreReqsComplete) if (($global:devops_configFile.PreReqsComplete -eq "True")) { if (!$global:devops_projectFile.ProjectAdded) { $project = $false Write-Host "2: Create a New Project or Select and Existing One" -ForegroundColor (Set-ColourOption ($project)) } else { $project = $global:devops_projectFile.ProjectAdded Write-Host "2: Create a New Project or Select and Existing One" -ForegroundColor (Set-ColourOption ($project)) Write-Host "3: Configure Source Control (Azure DevOps / Github)" $sourceControlConfigMessage -ForegroundColor (Set-ColourOption $global:devops_projectFile.SourceControlConfigured) if ($global:devops_projectFile.SourceControlConfigured -eq "True") { if ($global:devops_projectFile.ClientId -eq "") { Write-Host "3a: Configure Service Principal (Recommended)" -ForegroundColor Yellow } Write-Host "4: Configure Continuous Deployment" $CICDConfigMessage -ForegroundColor (Set-ColourOption $global:devops_projectFile.CICDEnvironmentName) Write-Host "B: Git [B]ranch Management" -ForegroundColor Cyan Write-Host "S: Commit and [S]ync changes to Source Control" -ForegroundColor Cyan Write-Host "V: [V]iew current change log for Source Control" -ForegroundColor Cyan } if (!$global:devops_isDocker -or ($host.Name -match 'Visual Studio Code Host')) { Write-Host "O: [O]pen Project in Visual Studio" -ForegroundColor Cyan Write-Host "D: Open Project in Visual Studio Co[D]e" -ForegroundColor Cyan } Write-Host "A: [A]dd Dataverse Solutions" -ForegroundColor Cyan if ($global:devops_DataverseSolutionsAdded) { Write-Host "M: [M]anage Dataverse Solutions (Export, Unpack, Config Data)" -ForegroundColor Cyan } if ($global:devops_projectFile.CICDEnvironmentName -ne "False") { Write-Host "T: Add Additional Deployment Environment [T]arget" -ForegroundColor Cyan } } } Write-Host "C: Advanced [C]onfiguration Management" -ForegroundColor Yellow if ($global:devops_projectFile.CICDEnvironmentName) { Write-Host "R: [R]un Pipeline Deployment" -ForegroundColor Yellow } Write-Host "U: Check for [U]pdates to Capgemini.PowerPlatform.DevOps" -ForegroundColor Yellow Write-Host "Q: Press 'Q' to quit." -ForegroundColor White Write-Host "=================$Repeater=================" -ForegroundColor White Write-Host "" Write-Host "* (White items still need to be completed)" -ForegroundColor White Write-Host "* (Green items are successful)" -ForegroundColor Green Write-Host "* (Red items have Errors)" -ForegroundColor Red Write-Host "* (Purple items are optional)" -ForegroundColor Magenta Write-Host "* (Blue Items are used for Day-to-Day ALM)" -ForegroundColor Cyan Write-Host "" if ($latestVersion -gt $global:devops_version) { Write-Host "There is a newer version available, please run Update-Module Capgemini.PowerPlatform.DevOps to update" -ForegroundColor Yellow Write-Host "" } } function Get-ConfigMenu { param ( [string]$Title = 'Power Platform DevOps' ) $devopsConfigMessage = "(ADO Org : $($global:devops_projectFile.OrgName) | ADO Project : $($global:devops_projectFile.Project) | git Repo : $($global:devops_projectFile.gitRepo))" $CICDConfigMessage = "(CI/CD Environment : $($global:devops_projectFile.CICDEnvironmentName) | CI/CD URL : $($global:devops_projectFile.CICDEnvironmentURL))" if (!$global:devops_projectFile) { $Title = "Power Platform DevOps (No Project Selected)" } else { $Title = "Power Platform DevOps ($($global:devops_projectFile.gitRepo))" $global:devops_projectTitle = $global:devops_projectFile.gitRepo Set-Location $global:devops_projectLocation } $global:devops_message = @" Power Platform DevOps Configuration. ver: $global:devops_version (latest available version : $latestVersion) isdocker: $global:devops_isDocker product : $global:devops_DevOpsProduct project: $global:devops_projectTitle projectlocation: $global:devops_projectLocation repo : $global:devops_gitRepo azure subscription : $global:devops_selectedSubscriptionName ($global:devops_selectedSubscription) azure keyvault : $global:devops_AzureKeyVault tenant id : $global:devops_TenantID client id : $global:devops_ClientID "@ [console]::ForegroundColor = "White" if (!$VerbosePreference -eq "Continue") { Clear-Host } Write-Host $global:devops_logo -ForegroundColor Magenta Write-Host $global:devops_message -ForegroundColor White $Repeater = "=" * $Title.Length Write-Host "================ $Title ================" -ForegroundColor White Write-Host "G: Edit [G]lobal Config File" -ForegroundColor Yellow if ($global:devops_projectFile) { Write-Host "P: Edit [P]roject Config File" -ForegroundColor Yellow Write-Host "A: Setup [A]zure KeyVault" -ForegroundColor Cyan Write-Host "C: [C]onfigure Service Principal" -ForegroundColor Cyan Write-Host "L: Change Dataverse [L]ogin Account" -ForegroundColor Cyan Write-Host "R: [R]refresh Git Access Token" -ForegroundColor Yellow Write-Host "D: [D]elete Git Auth Config Header (Advanced)" -ForegroundColor Yellow } Write-Host "U: [U]pdate Tooling to latest versions" -ForegroundColor Yellow Write-Host "Z: Clear Azure Account Cache (Advanced)" -ForegroundColor Yellow Write-Host "Q: Press 'Q' to return to Main Menu." -ForegroundColor White Write-Host "=================$Repeater=================" -ForegroundColor White Write-Host "" } function Get-SolutionMenu { param ( [string]$SolutionName = '' ) [string]$Title = "Dataverse Solution Management ($SolutionName)" [console]::ForegroundColor = "White" if (!$VerbosePreference -eq "Continue") { Clear-Host } Write-Host $global:devops_logo -ForegroundColor Magenta $Repeater = "=" * $Title.Length Write-Host "================ $Title ================" -ForegroundColor White Write-Host "E: [E]xport & Unpack Solution" -ForegroundColor Cyan Write-Host "C: [C]onfiguruation Data Create/Edit" -ForegroundColor Yellow Write-Host "D: Export Configuration [D]ata" -ForegroundColor Cyan Write-Host "G: [G]enerate Types" -ForegroundColor Cyan Write-Host "P: Deploy [P]lugins" -ForegroundColor Cyan Write-Host "W: Deploy [W]eb Resources" -ForegroundColor Cyan Write-Host "Q: Press 'Q' to return to Main Menu." -ForegroundColor White Write-Host "=================$Repeater=================" -ForegroundColor White Write-Host "" } function Get-BranchMenu { [string]$Title = "Git Branch Management" [console]::ForegroundColor = "White" if (!$VerbosePreference -eq "Continue") { Clear-Host } Write-Host $global:devops_logo -ForegroundColor Magenta $Repeater = "=" * $Title.Length Write-Host "================ $Title ================" -ForegroundColor White Write-Host "S: [S]elect Branch" -ForegroundColor Cyan Write-Host "C: [C]reate New Branch" -ForegroundColor Yellow Write-Host "U: [U]pdate from another branch" -ForegroundColor Yellow Write-Host "P: [P]ush branch upstream" -ForegroundColor Yellow Write-Host "L: Pul[l] latest changes from remote" -ForegroundColor Yellow Write-Host "Q: Press 'Q' to return to Main Menu." -ForegroundColor White Write-Host "=================$Repeater=================" -ForegroundColor White Write-Host "" } function Get-ToolingMenu { [string]$Title = "Tooling Management" [console]::ForegroundColor = "White" if (!$VerbosePreference -eq "Continue") { Clear-Host } Write-Host $global:devops_logo -ForegroundColor Magenta $Repeater = "=" * $Title.Length Write-Host "================ $Title ================" -ForegroundColor White Write-Host "P: [P]ower Apps CLI" -ForegroundColor Yellow Write-Host "X: [X]rm Context" -ForegroundColor Yellow Write-Host "D: Xrm[D]efinitelyTyped" -ForegroundColor Yellow Write-Host "C: [C]onfiguration Migration Utility" -ForegroundColor Yellow Write-Host "Q: Press 'Q' to return to Main Menu." -ForegroundColor White Write-Host "=================$Repeater=================" -ForegroundColor White Write-Host "" } |