Closed rebelinux closed 7 months ago
Example:
Currently, the default style of each report module aligns to the vendor's branding guidelines (colours, fonts, logos etc). However, most vendors require permission to use their logos and other branding.
To standardise the look and feel of all reports, and to standardise the report construct, I am looking to use one default style for all report modules.
Users will still be able to create their own report style, to customise the report style to their needs.
Although I remember you telling me that you didn't plan to put the base64 of the logo in the JSON file. I've been thinking more about this change and I'm interested in furthering the discussion a bit more.
Currently, to modify the logo it is essential to know the path where the report is installed:
PS C:\Users\jocolon> Get-Module -ListAvailable -Name AsBuiltReport.Microsoft.DHCP
Directory: **C:\Users\jocolon\Documents\WindowsPowerShell\Modules**
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 0.2.0 AsBuiltReport.Microsoft.DHCP Invoke-AsBuiltReport.Microsoft.DHCP
PS C:\Users\jocolon>
Then it is required to modify the 'AsBuiltReport.Microsoft.DHCP.Style.ps1' file with the custom Base64 string:
if ($ReportConfig.Report.ShowCoverPageImage) {
Try {
Image -Text 'AsBuiltReport Logo' -Align 'Center' -Percent 45 -Base64 "AsBuiltReport Base64 string"
} Catch {
Write-PScriboMessage -IsWarning "Unable to display cover page image. Please set 'ShowCoverPageImage' to 'false' in the report JSON configuration file to avoid this error."
}
}
The next step would be to force the changes to be applied:
PS C:\Users\jocolon> Import-Module AsBuiltReport.Microsoft.DHCP -Force
PS C:\Users\jocolon>
There are several disadvantages to this process:
I would like to propose this:
Add a new section inside the AsBuiltReport.Microsoft.DHCP.json file. In this example the 'Logo' variable would be empty by default.
{
"Report": {
"Name": "Microsoft DHCP As Built Report",
"Version": "1.0",
"Status": "Released",
"ShowCoverPageImage": true,
"ShowTableOfContents": true,
"ShowHeaderFooter": true,
"ShowTableCaptions": true
},
"Options": {
"ShowDefinitionInfo": false,
"PSDefaultAuthentication": "Negotiate",
"ServerDiscovery": "Domain",
"Exclude": {
"Domains": [],
"DCs": []
}
},
"InfoLevel": {
"_comment_": "0 = Disabled, 1 = Enabled, 2 = Adv Summary, 3 = Detailed",
"DHCP": 1
},
"HealthCheck": {
"DHCP": {
"Summary": true,
"Credential": true,
"Statistics": true,
"BP": true
}
},
// The Logo variable is empty by default
"Style": {
"Image": {
"Percent": 20,
"Logo": ""
}
}
}
The code inside the AsBuiltReport.Microsoft.DHCP.Style.ps1 file will validate if the Logo variable has a value. If no value is found, the default AsbuiltReport logo will be displayed.
# Cover Page Image
if ($ReportConfig.Report.ShowCoverPageImage -and (-Not $ReportConfig.Style.Image.Logo)) {
Try {
Image -Text 'AsBuiltReport Logo' -Align 'Center' -Percent 45 -Base64 "AsBuiltReport Base64 string"
BlankLine -Count 1
} Catch {
Write-PScriboMessage -IsWarning "Unable to display cover page image. Please set 'ShowCoverPageImage' to 'false' in the report JSON configuration file to avoid this error."
}
} else {
try {
Image -Text 'AsBuiltReport Logo' -Align 'Center' -Percent $ReportConfig.Style.Image.Percent -Base64 $($ReportConfig.Style.Image.Logo)
BlankLine -Count 1
} Catch {
Write-PScriboMessage -IsWarning "Unable to display cover page image. Please set 'ShowCoverPageImage' to 'false' in the report JSON configuration file to avoid this error."
}
}
In case the user wishes to specify a different logo, the command New-AsBuiltReportConfig should be used.
PS C:\Users\jocolon\> New-AsBuiltReportConfig -Report Microsoft.DHCP -FolderPath C:\Users\jocolon\
AsBuiltReport.Microsoft.DHCP report configuration file 'AsBuiltReport.Microsoft.DHCP.json' created in 'C:\Users\jocolon\'.
PS C:\Users\jocolon\>
{
"Report": {
"Name": "Microsoft DHCP As Built Report",
"Version": "1.0",
"Status": "Released",
"ShowCoverPageImage": true,
"ShowTableOfContents": true,
"ShowHeaderFooter": true,
"ShowTableCaptions": true
},
"Options": {
"ShowDefinitionInfo": false,
"PSDefaultAuthentication": "Negotiate",
"ServerDiscovery": "Domain",
"Exclude": {
"Domains": [],
"DCs": []
}
},
"InfoLevel": {
"_comment_": "0 = Disabled, 1 = Enabled, 2 = Adv Summary, 3 = Detailed",
"DHCP": 1
},
"HealthCheck": {
"DHCP": {
"Summary": true,
"Credential": true,
"Statistics": true,
"BP": true
}
},
"Style": {
"Image": {
"Percent": 20,
// Modified to specified custom logo
"Logo": "Custom Logo Base64 string"
}
}
}
Subsequently, the user will only need to run the New-AsBuiltReport command with the -ReportConfigFilePath parameter pointing to the modified JSON template. In this case, the modifications will not be lost when the user updates the AsBuiltReport.Microsoft.DHCP module.
Branch with changes: https://github.com/rebelinux/AsBuiltReport.Microsoft.DHCP/tree/LogoInJson
I am writing this here because the slack chat has a time limit on past messages!
If users wish to change the style and look of a report then they should be creating a customised style script. Some examples have been added to the Core module already, and instructions to develop a script is documented here.
If we incorporate an option to change the logo, then users will likely expect other changes (colours, fonts etc) can be made via this option also. A style script can extend beyond just logos, fonts and colours.
Personally, I use a custom style script to incorporate other document sections and unique information in addition to what the report extracts.
I think there should only be one method to customise the look and feel of a report, and that method should remain as it is currently, by creating a custom style.
Is your feature request related to a problem? Please describe.
It would be good in my opinion that the default logo of the report be the AsBuiltReport project icon.
Describe the solution you'd like
We could add the ability for the user to set the logo of their choice, using the report configuration file (JSON).