diff --git a/src/main/kotlin/nl/avisi/structurizr/site/generatr/StructurizrUtilities.kt b/src/main/kotlin/nl/avisi/structurizr/site/generatr/StructurizrUtilities.kt index 67043ced..c880f463 100644 --- a/src/main/kotlin/nl/avisi/structurizr/site/generatr/StructurizrUtilities.kt +++ b/src/main/kotlin/nl/avisi/structurizr/site/generatr/StructurizrUtilities.kt @@ -11,6 +11,9 @@ val Model.includedSoftwareSystems: List val SoftwareSystem.includedSoftwareSystem get() = this.location != Location.External +val SoftwareSystem.includedProperties + get() = this.properties.filterNot { (name, _) -> name == "structurizr.dsl.identifier" } + fun SoftwareSystem.hasDecisions() = documentation.decisions.isNotEmpty() fun SoftwareSystem.hasDocumentationSections() = documentation.sections.size >= 2 diff --git a/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemHomePageViewModel.kt b/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemHomePageViewModel.kt index e8ad170e..54b286d1 100644 --- a/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemHomePageViewModel.kt +++ b/src/main/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemHomePageViewModel.kt @@ -1,12 +1,13 @@ package nl.avisi.structurizr.site.generatr.site.model import com.structurizr.model.SoftwareSystem +import nl.avisi.structurizr.site.generatr.includedProperties import nl.avisi.structurizr.site.generatr.site.GeneratorContext class SoftwareSystemHomePageViewModel(generatorContext: GeneratorContext, softwareSystem: SoftwareSystem) : SoftwareSystemPageViewModel(generatorContext, softwareSystem, Tab.HOME) { - val hasProperties = softwareSystem.properties.any() - val propertiesTable = createPropertiesTableViewModel(softwareSystem.properties) + val hasProperties = softwareSystem.includedProperties.any() + val propertiesTable = createPropertiesTableViewModel(softwareSystem.includedProperties) val content = markdownToHtml(this, softwareSystem.info(), generatorContext.svgFactory) private fun SoftwareSystem.info() = documentation.sections diff --git a/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemHomePageViewModelTest.kt b/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemHomePageViewModelTest.kt index 9812b6d8..d1d4f4e2 100644 --- a/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemHomePageViewModelTest.kt +++ b/src/test/kotlin/nl/avisi/structurizr/site/generatr/site/model/SoftwareSystemHomePageViewModelTest.kt @@ -84,4 +84,22 @@ class SoftwareSystemHomePageViewModelTest : ViewModelTest() { .isEqualTo(createPropertiesTableViewModel(softwareSystem.properties)) } } + + @Test + fun `internal properties present`() { + val generatorContext = generatorContext() + val softwareSystem: SoftwareSystem = generatorContext.workspace.model.addSoftwareSystem("Software system") + .apply { + description = "It's a system." + addProperty("structurizr.dsl.identifier", "id") + } + val viewModel = SoftwareSystemHomePageViewModel(generatorContext, softwareSystem) + + assertThat(viewModel) + .all { + prop(SoftwareSystemHomePageViewModel::hasProperties).isEqualTo(false) + prop(SoftwareSystemHomePageViewModel::propertiesTable) + .isEqualTo(createPropertiesTableViewModel(mapOf())) + } + } }