Skip to content

Commit

Permalink
1.6.0 prep (#738)
Browse files Browse the repository at this point in the history
* In case of no default planner-elements, create a blank plan to avoid planner-webpart error on the front page (#703)

* Timeline configuration, timeline rework + support for project deliveries (#698)

* Timeline improvements

* Update sp-js-provisioning for running hooks (#709)

* Add improvements to document template selector (#712)

* Fix for GtResourceLoad list column (#710)

* Changed list fields to site fields in template

* Handling upgrade of existing sites #610

* Added changelog

* Order of events

* Handling of incorrect field format

* Transcripting upgrade

* Minor formatting

Co-authored-by: Ole Martin Pettersen <olemp@puzzlepart.com>

* More info for #705

* Dynamic and improved aggregated lists for Portfolio (#717)

* Fix syntax for letter 'å' in template (Gevinstoversikt) (#721)

* Minor fixes and imrovements to #717  (#722)

* Update PostInstallUpgrade script to remove unnecessary fields from

* Update PreInstallUpgrade script to remove unnecessary fields from

* Update Aggregated webparts with properties

* Update PreInstallUpgrade script and remove overwrite true from pages

* Fix problem where columns wasn't rendered properly

* Update changelog

* if dataSourceCategory is missing for projects return null (#723)

* Add handling of navigation, keep customer customizations and reapply

* Add some extra checks for dataSourceCategory (Projectlevel)

* Install/upgrade script improvements (#729)

* Improved field descriptions of datasources fields (#728)

* Field types not in sync with 'Prosjektinnholdskolonner' data (#732)

* Add GtColMinWidth to 'Prosjektinnholdskolonner' list + ct

* Add 'updateProjectContentColumn' when editing type/minWidth from webpart

* Use minWidth value from 'Prosjektinnholdskolonner' list for columns

* Initialize dataType for aggregated webpart columns correctly

* 736 sync error (#737)

* Fix for #736

* linting

* Update packages

* Further fixes after serving #736

* Changelog

* lint fix

* Minor changes

Co-authored-by: Remi Blom-Ohlsen <remi.blom-ohlsen@puzzlepart.com>

* Update packages

* Hopefully fixed #736

* Fix for #736 after more testing

* Minor tweak after #736

* 1.6.0

Co-authored-by: Ole Martin Pettersen <olemp@puzzlepart.com>
Co-authored-by: Tarjei E. Ormestøyl <ormestoyl@gmail.com>
  • Loading branch information
3 people authored Jun 27, 2022
1 parent a82f6cc commit 6dc2381
Show file tree
Hide file tree
Showing 137 changed files with 6,453 additions and 2,810 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Install/SiteScripts/*.txt
Install/InstallLog.txt
Install/Scripts/UpgradeSites_Log*
release/*
SharePointFramework/**/.vscode/launch.json
SharePointFramework/**/pnpm-lock.yaml
Expand Down
30 changes: 29 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,34 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

Every change is marked with issue ID.

## 1.6.0 - 16.06.2022

### Added

- Added timeline configuration list (Customize how timeline elements are displayed, their colors, sorting and more) #678
- This applies to Portfolio, Project and Program timelines
- Added possibility to include project deliveries on timeline (beta) #679
- This applies to Portfolio, Project and Program timelines
- Added ability to run hooks in the txt provisioning template #700
- Example: Trigger API's, Flows, Logic Apps, Azure Functions, etc...
- Added 'Prosjektinnholdskolonner' list to define columns which are used for the aggregated webparts #706
- 'Datakilder' has been expanded with 'Prosjekt odata spørring' column to filter the projects in the datasource query

### Changed

- Expanded aggregated webparts with similar functionality as PortfolioOverview #706
- Views, Filters, Grouping has been added to make them more dynamic
- The aggregated webparts are: 'Erfaringslogg', 'Leveranseoversikt' and 'Risikooversikt'
- 'Gevinstoversikt'has been reworked as an aggregated webpart and will work the same
- 'Datakilder' list has been expanded with three new columns connected to 'Prosjektinnholdskolonner' list
- Improvements to styling, sorting and information messages for the Document Template Selector #711

### Fixed

- Fixed issue with syncing of project properties not always triggering #736
- Fixed issue with resource allocation percentage not showing #610. NB: The script UpgradeAllSitesToLatest.ps1 needs to be run to fix the issue for old sites!
- Fixed issue with setup dialog, where having more than 6 default items didn't render well #702

## 1.5.0 - 01.04.2022

### Added
Expand All @@ -18,7 +46,7 @@ Every change is marked with issue ID.
- Gains overview
- Timeline
- Deliveries
- Risks and benefits
- Risks and benefits

### Changed

Expand Down
10 changes: 5 additions & 5 deletions Install/Install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,14 @@ if (-not $SkipDefaultSiteDesignAssociation.IsPresent) {
}
#endregion

#region Remove pages with deprecated client side components
#region Pre install
if ($Upgrade.IsPresent) {
Try {
Write-Host "[INFO] Running pre-install upgrade steps"
try {
Connect-SharePoint -Url $Url -ErrorAction Stop
Write-Host "[INFO] Removing deprecated pages"
."$PSScriptRoot\Scripts\RemoveDeprecatedPages.ps1"
."$PSScriptRoot\Scripts\PreInstallUpgrade.ps1"
Disconnect-PnPOnline
Write-Host "[SUCCESS] Removed deprecated pages" -ForegroundColor Green
Write-Host "[SUCCESS] Successfully ran pre-install upgrade steps" -ForegroundColor Green
}
Catch {}
}
Expand Down
39 changes: 36 additions & 3 deletions Install/Scripts/PostInstallUpgrade.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


$LastInstall = Get-PnPListItem -List "Installasjonslogg" -Query "<View><Query><OrderBy><FieldRef Name='Created' Ascending='False' /></OrderBy></Query></View>" | Select-Object -First 1 -Wait
if ($null -ne $LastInstall) {
$PreviousVersion = $LastInstall.FieldValues["InstallVersion"]
Expand All @@ -8,8 +8,41 @@ if ($null -ne $LastInstall) {
Add-PnPNavigationNode -Location TopNavigationBar -Title "Prosjekttidslinje" -Url "$($Uri.LocalPath)/SitePages/Prosjekttidslinje.aspx"
}
if ($PreviousVersion -lt "1.5.0") {
Write-Host "[INFO] Applying PnP template [1.5.0] to [$Url]"
Write-Host "[INFO] Applying PnP upgrade template [1.5.0] to [$Url]"
Apply-PnPProvisioningTemplate "$BasePath\1.5.0.pnp" -ErrorAction Stop
Write-Host "[SUCCESS] Successfully applied PnP template [1.5.0] to [$Url]" -ForegroundColor Green
}
}
if ($PreviousVersion -lt "1.6.0") {
Write-Host "[INFO] In version v1.6.0 we added Project timeline configuration and reworked the TimelineContent list. Merging data now as part of the upgrade"

$Items = Get-PnPListItem -List "Tidslinjeinnhold"
$Milestone = [Uri]::UnescapeDataString("Milep%C3%A6l")
foreach ($Item in $Items) {
$OldSiteId = $Item.FieldValues["SiteIdLookup"].LookupId
$OldType = $Item.FieldValues["TimelineType"]

if($null -ne $OldSiteId) {
$Item["GtSiteIdLookup"] = $OldSiteId
}

if($null -ne $OldType) {
Switch ($OldType)
{
"Prosjekt" { $Item["GtTimelineTypeLookup"] = 1 }
"Fase" { $Item["GtTimelineTypeLookup"] = 2 }
"Delfase" { $Item["GtTimelineTypeLookup"] = 3 }
$Milestone { $Item["GtTimelineTypeLookup"] = 4 }
}
}

$Item.Update()
Invoke-PnPQuery
}

Remove-PnPField -List "Tidslinjeinnhold" -Identity "SiteIdLookup" -Force -ErrorAction SilentlyContinue
Remove-PnPField -List "Tidslinjeinnhold" -Identity "TimelineType" -Force -ErrorAction SilentlyContinue
Invoke-PnPQuery

Apply-PnPProvisioningTemplate "$BasePath\Navigation.xml" -ErrorAction Stop
}
}
46 changes: 46 additions & 0 deletions Install/Scripts/PreInstallUpgrade.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

$LastInstall = Get-PnPListItem -List "Installasjonslogg" -Query "<View><Query><OrderBy><FieldRef Name='Created' Ascending='False' /></OrderBy></Query></View>" | Select-Object -First 1 -Wait
if ($null -ne $LastInstall) {
$PreviousVersion = $LastInstall.FieldValues["InstallVersion"]

if ($PreviousVersion -lt "1.4.0") {
Write-Host "[INFO] Removing deprecated pages"

$DeprecatedIds = @(
"d8558017-1e3b-4d13-82fa-2520e845297b",
"3ec6bcaf-28bc-4f2e-9e90-77e8cebf0b5f",
"57530c94-4fb2-4ca2-9279-16c57881fa19"
)

$Pages = Get-PnPFolder -Url SitePages -Includes Files | Select-Object -ExpandProperty Files

$Pages | ForEach-Object {
$DeprecatedComponents = Get-PnPClientSideComponent -Page $_.Name | Where-Object { $DeprecatedIds.Contains($_.WebPartId) }
if ($DeprecatedComponents.Count -gt 0) {
Remove-PnPClientSidePage $_.Name -Force -ErrorAction SilentlyContinue
}
}
}

if ($PreviousVersion -lt "1.6.0") {
Get-PnPProvisioningTemplate -Out "$BasePath\Navigation.xml" -Handlers Navigation -Erroraction SilentlyContinue
((Get-Content -path "$BasePath\Navigation.xml" -Raw) -replace 'false', 'true') | Set-Content -Path "$BasePath\Navigation.xml" -Force -ErrorAction SilentlyContinue

Write-Host "[INFO] Removing deprecated pages"
Write-Host "[INFO] In version v1.6.0 we reworked the aggregated webparts and removed the benefits webpart as this is now handled in the aggregated webpart. Removing pages so that we overwrite the old pages correctly"

$PnPClientSidePages = @(
"Gevinstoversikt.aspx",
"Erfaringslogg.aspx",
"Leveranseoversikt.aspx",
"Risikooversikt.aspx"
)

$Pages = Get-PnPFolder -Url SitePages -Includes Files | Select-Object -ExpandProperty Files
$Pages | ForEach-Object {
if ($PnPClientSidePages.Contains($_.Name)) {
Remove-PnPClientSidePage -Identity $_.Name -Force -ErrorAction SilentlyContinue
}
}
}
}
14 changes: 0 additions & 14 deletions Install/Scripts/RemoveDeprecatedPages.ps1

This file was deleted.

92 changes: 78 additions & 14 deletions Install/Scripts/UpgradeAllSitesToLatest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,52 +14,117 @@ function EnsureProjectTimelinePage($Url) {
Write-Host "`t`tCannot connect to site. Do you have access?" -ForegroundColor Red
}
else {
$existingNode = $existingNodes | Where-Object { $_.Title -eq "Prosjekttidslinje" } -ErrorAction SilentlyContinue
$existingNode = $existingNodes | Where-Object { $_.Title -eq "Prosjekttidslinje" -or $_.Title -eq "Programtidslinje" } -ErrorAction SilentlyContinue
if ($null -eq $existingNode) {
Write-Host "`t`tAdding project timeline page"
Write-Host "`t`tAdding project timeline to site"
Write-Host "`t`t`tAdding project timeline page"
$page = Add-PnPClientSidePage -Name "Prosjekttidslinje.aspx" -PromoteAs None -LayoutType SingleWebPartAppPage -CommentsEnabled:$false -Publish
Write-Host "`t`tAdding project timeline app"
Write-Host "`t`t`tAdding project timeline app"
$webpart = Add-PnPClientSideWebPart -Page "Prosjekttidslinje" -Component "Prosjekttidslinje" -WebPartProperties '{"listName":"Tidslinjeinnhold","showFilterButton":true,"showTimeline":true,"showInfoMessage":true,"showCmdTimelineList":true,"showTimelineList":true,"title":"Prosjekttidslinje"}'
$page = Set-PnPClientSidePage -Identity "Prosjekttidslinje" -LayoutType SingleWebPartAppPage -HeaderType None -Publish
Write-Host "`t`tAdding project timeline navigation item"
Write-Host "`t`t`tAdding project timeline navigation item"
$node = Add-PnPNavigationNode -Location QuickLaunch -Title "Prosjekttidslinje" -Url "SitePages/Prosjekttidslinje.aspx"
}
else {
Write-Host "`t`tThe project already has the project timeline page. " -ForegroundColor Yellow
Write-Host "`t`tThe site already has the project timeline page" -ForegroundColor Green
}

}
}

function EnsureResourceLoadIsSiteColumn($Url) {
Connect-PnPOnline -Url $Url -UseWebLogin

$ResourceAllocation = Get-PnPList -Identity "Ressursallokering" -ErrorAction SilentlyContinue
if ($null -ne $ResourceAllocation) {
$ResourceLoadSiteColumn = Get-PnPField -Identity "GtResourceLoad"
$ResourceLoadListColumn = Get-PnPField -Identity "GtResourceLoad" -List $ResourceAllocation
if ($null -ne $ResourceLoadSiteColumn) {
Write-Host "`t`tReplacing GtResourceLoad field"
$PreviousValues = Get-PnPListItem -List $ResourceAllocation -Fields "ID", "GtResourceLoad" | ForEach-Object {
@{Id = $_.Id; GtResourceLoad = $_.FieldValues["GtResourceLoad"] }
}

if ($PreviousValues.length -gt 0) {
Write-Host "`t`t`t" (ConvertTo-Json $PreviousValues -Compress)
}

$ResourceAllocationContentType = Get-PnPContentType -Identity "Ressursallokering" -List "Ressursallokering" -ErrorAction SilentlyContinue
if ($null -ne $ResourceAllocationContentType) {
Write-Host "`t`t`tRemoving old field"
$RemovedColumn = Remove-PnPField -Identity $ResourceLoadListColumn -List $ResourceAllocation -Force


Write-Host "`t`t`tAdding the site field"
$FieldLink = New-Object Microsoft.SharePoint.Client.FieldLinkCreationInformation
$FieldLink.Field = $ResourceLoadSiteColumn
$Output = $ResourceAllocationContentType.FieldLinks.Add($FieldLink)
$ResourceAllocationContentType.Update($false)
$ResourceAllocationContentType.Context.ExecuteQuery()

Write-Host "`t`t`tAdding the site field to default view"
$DefaultView = Get-PnPView -List $ResourceAllocation -Identity "Alle elementer" -ErrorAction SilentlyContinue
if ($null -ne $DefaultView) {
$DefaultView.ViewFields.Add("GtResourceLoad")
$DefaultView.Update()
$DefaultView.Context.ExecuteQuery()
}


if ($PreviousValues.length -gt 0) {
Write-Host "`t`t`tRestoring previous values"
$PreviousValues | ForEach-Object {
$ResourceLoad = $_.GtResourceLoad

if ($ResourceLoad -gt 2 ) {
# Assuming that noone had more than 200% previously
$ResourceLoad = ($ResourceLoad / 100) # Convert to percentage if it wasn't previously
}
$NewValue = Set-PnPListItem -List $ResourceAllocation -Identity $_.Id -Values @{"GtResourceLoad" = $ResourceLoad } -SystemUpdate
}
}

Write-Host "`t`t`tField swap completed" -ForegroundColor Green
}
}
else {
Write-Host "`t`tThe site already has the correct GtResourceLoad field" -ForegroundColor Green
}
}
}

function UpgradeSite($Url) {
EnsureProjectTimelinePage -Url $Url
EnsureResourceLoadIsSiteColumn -Url $Url
}

Write-Host "This script will update all existing sites in a Prosjektportalen installation. This requires you to have the SharePoint admin role"

Set-PnPTraceLog -Off
Start-Transcript -Path "$PSScriptRoot\UpgradeSites_Log-$((Get-Date).ToString('yyyy-MM-dd-HH-mm')).txt"

[System.Uri]$Uri = $PortfolioUrl
$AdminSiteUrl = (@($Uri.Scheme, "://", $Uri.Authority) -join "").Replace(".sharepoint.com", "-admin.sharepoint.com")

Connect-PnPOnline -Url $AdminSiteUrl -UseWebLogin

$PPHubSite = Get-PnPHubSite -Identity $PortfolioUrl

$ProjectsInHub = Get-PP365HubSiteChild -Identity $PPHubSite
Connect-PnPOnline -Url $AdminSiteUrl -UseWebLogin -WarningAction Ignore

# Get current logged in user
$ctx = Get-PnPContext
$ctx.Load($ctx.Web.CurrentUser)
$ctx.ExecuteQuery()
$UserName = $ctx.Web.CurrentUser.LoginName

$PPHubSite = Get-PnPHubSite -Identity $PortfolioUrl
$ProjectsInHub = Get-PP365HubSiteChild -Identity $PPHubSite

Write-Host "The following sites were found to be part of the Project Portal hub:"
$ProjectsInHub | ForEach-Object { Write-Host "`t$_" }

Write-Host "We can grant $UserName admin access to existing projects. This will ensure that all project will be upgraded. If you select no, the script will only upgrade the sites you are already an owner of."
do {
$YesOrNo = Read-Host "Do you want to grant $UserName access to all sites in the hub (listed above)? (y/n)"
}
while ("y","n" -notcontains $YesOrNo)
while ("y", "n" -notcontains $YesOrNo)

if ($YesOrNo -eq "y") {
$ProjectsInHub | ForEach-Object {
Expand All @@ -79,7 +144,7 @@ Write-Host "We can remove $UserName's admin access from existing projects."
do {
$YesOrNo = Read-Host "Do you want to remove $UserName's admin access from all sites in the hub? (y/n)"
}
while ("y","n" -notcontains $YesOrNo)
while ("y", "n" -notcontains $YesOrNo)

if ($YesOrNo -eq "y") {
$ProjectsInHub | ForEach-Object {
Expand All @@ -90,5 +155,4 @@ if ($YesOrNo -eq "y") {
}




Stop-Transcript
Loading

0 comments on commit 6dc2381

Please sign in to comment.