Files
runner-images/helpers/software-report-base/SoftwareReport.psm1
Maxim Lobanov 6eaa5b44cf Implement Software Report Base Module (#6707)
* Implement first version

* fix tables rendering

* Fix scripts

* update test files

* implement calculate image diff script

* Polish code and make e2e validation

* remove test files

* render add and removed firstly
2022-12-07 14:20:14 +01:00

28 lines
705 B
PowerShell

using module ./SoftwareReport.BaseNodes.psm1
using module ./SoftwareReport.Nodes.psm1
class SoftwareReport {
[HeaderNode] $Root
SoftwareReport([String] $Title) {
$this.Root = [HeaderNode]::new($Title)
}
SoftwareReport([HeaderNode] $Root) {
$this.Root = $Root
}
[String] ToJson() {
return $this.Root.ToJsonObject() | ConvertTo-Json -Depth 10
}
static [SoftwareReport] FromJson($jsonString) {
$jsonObj = $jsonString | ConvertFrom-Json
$rootNode = [NodesFactory]::ParseNodeFromObject($jsonObj)
return [SoftwareReport]::new($rootNode)
}
[String] ToMarkdown() {
return $this.Root.ToMarkdown(1).Trim()
}
}