-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from avisi-cloud/add-workspace-level-adrs
Support workspace-level ADR's
- Loading branch information
Showing
17 changed files
with
172 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
workspace-adrs |
19 changes: 19 additions & 0 deletions
19
docs/example/workspace-adrs/0001-record-architecture-decisions.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# 1. Record architecture decisions | ||
|
||
Date: 2022-06-27 | ||
|
||
## Status | ||
|
||
Accepted | ||
|
||
## Context | ||
|
||
We need to record the architectural decisions made on this project. | ||
|
||
## Decision | ||
|
||
We will use Architecture Decision Records, as [described by Michael Nygard](http://thinkrelevance.com/blog/2011/11/15/documenting-architecture-decisions). | ||
|
||
## Consequences | ||
|
||
See Michael Nygard's article, linked above. For a lightweight ADR toolset, see Nat Pryce's [adr-tools](https://github.com/npryce/adr-tools). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/nl/avisi/structurizr/site/generatr/site/DateFormatter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package nl.avisi.structurizr.site.generatr.site | ||
|
||
import java.time.ZoneId | ||
import java.util.* | ||
|
||
fun formatDate(date: Date): String { | ||
val localDate = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate() | ||
return String.format("%02d-%02d-%04d", localDate.dayOfMonth, localDate.monthValue, localDate.year) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/kotlin/nl/avisi/structurizr/site/generatr/site/components/DecisionsTable.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package nl.avisi.structurizr.site.generatr.site.components | ||
|
||
import com.structurizr.documentation.Decision | ||
import kotlinx.html.* | ||
import nl.avisi.structurizr.site.generatr.site.context.AbstractPageContext | ||
import nl.avisi.structurizr.site.generatr.site.formatDate | ||
|
||
fun DIV.decisionsTable( | ||
context: AbstractPageContext, | ||
decisions: Collection<Decision>, | ||
createContext: (Decision) -> AbstractPageContext | ||
) { | ||
table(classes = "table") { | ||
thead { | ||
tr { | ||
th { +"ID" } | ||
th { +"Datum" } | ||
th { +"Status" } | ||
th { +"Title" } | ||
} | ||
} | ||
tbody { | ||
decisions.sortedBy { it.id.toInt() }.forEach { | ||
tr { | ||
th { +it.id } | ||
td { +formatDate(it.date) } | ||
td { +it.status.toString() } | ||
td { | ||
a(href = createContext(it).urlRelativeTo(context)) { | ||
+it.title | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...in/kotlin/nl/avisi/structurizr/site/generatr/site/context/WorkspaceDecisionPageContext.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package nl.avisi.structurizr.site.generatr.site.context | ||
|
||
import com.structurizr.documentation.Decision | ||
|
||
class WorkspaceDecisionPageContext( | ||
generatorContext: GeneratorContext, | ||
val decision: Decision | ||
) : | ||
AbstractPageContext( | ||
generatorContext, | ||
decision.title, | ||
"decisions/${decision.id}/index.html" | ||
), | ||
WorkspaceDecisionsContext |
3 changes: 3 additions & 0 deletions
3
src/main/kotlin/nl/avisi/structurizr/site/generatr/site/context/WorkspaceDecisionsContext.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package nl.avisi.structurizr.site.generatr.site.context | ||
|
||
interface WorkspaceDecisionsContext |
4 changes: 4 additions & 0 deletions
4
...n/kotlin/nl/avisi/structurizr/site/generatr/site/context/WorkspaceDecisionsPageContext.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package nl.avisi.structurizr.site.generatr.site.context | ||
|
||
class WorkspaceDecisionsPageContext(generatorContext: GeneratorContext) : | ||
AbstractPageContext(generatorContext, "Decisions", "decisions/index.html"), WorkspaceDecisionsContext |
15 changes: 15 additions & 0 deletions
15
src/main/kotlin/nl/avisi/structurizr/site/generatr/site/pages/WorkspaceDecisionPage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package nl.avisi.structurizr.site.generatr.site.pages | ||
|
||
import kotlinx.html.HTML | ||
import nl.avisi.structurizr.site.generatr.site.components.contentDiv | ||
import nl.avisi.structurizr.site.generatr.site.components.page | ||
import nl.avisi.structurizr.site.generatr.site.components.renderedMarkdown | ||
import nl.avisi.structurizr.site.generatr.site.context.WorkspaceDecisionPageContext | ||
|
||
fun HTML.workspaceDecisionPage(context: WorkspaceDecisionPageContext) { | ||
page(context) { | ||
contentDiv { | ||
renderedMarkdown(context, context.decision.content) | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/kotlin/nl/avisi/structurizr/site/generatr/site/pages/WorkspaceDecisionsPage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package nl.avisi.structurizr.site.generatr.site.pages | ||
|
||
import kotlinx.html.HTML | ||
import kotlinx.html.h2 | ||
import nl.avisi.structurizr.site.generatr.site.components.contentDiv | ||
import nl.avisi.structurizr.site.generatr.site.components.decisionsTable | ||
import nl.avisi.structurizr.site.generatr.site.components.page | ||
import nl.avisi.structurizr.site.generatr.site.context.WorkspaceDecisionPageContext | ||
import nl.avisi.structurizr.site.generatr.site.context.WorkspaceDecisionsPageContext | ||
|
||
fun HTML.workspaceDecisionsPage(context: WorkspaceDecisionsPageContext) { | ||
page(context) { | ||
contentDiv { | ||
h2 { +"Architecture decision records" } | ||
decisionsTable(context, context.workspace.documentation.decisions) { decision -> | ||
WorkspaceDecisionPageContext(context.generatorContext, decision) | ||
} | ||
} | ||
} | ||
} |
49 changes: 0 additions & 49 deletions
49
src/main/kotlin/nl/avisi/structurizr/site/generatr/site/pages/softwaresystem/ADRFragment.kt
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
...tlin/nl/avisi/structurizr/site/generatr/site/pages/softwaresystem/DecisionListFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package nl.avisi.structurizr.site.generatr.site.pages.softwaresystem | ||
|
||
import com.structurizr.documentation.Decision | ||
import kotlinx.html.DIV | ||
import kotlinx.html.h1 | ||
import nl.avisi.structurizr.site.generatr.site.components.contentDiv | ||
import nl.avisi.structurizr.site.generatr.site.components.decisionsTable | ||
import nl.avisi.structurizr.site.generatr.site.context.AbstractSoftwareSystemPageContext | ||
import nl.avisi.structurizr.site.generatr.site.context.SoftwareSystemDecisionPageContext | ||
|
||
fun DIV.decisionListFragment(context: AbstractSoftwareSystemPageContext) { | ||
contentDiv { | ||
h1 { +"Architecture decision records" } | ||
decisionsTable(context, context.adrs) { decision: Decision -> | ||
SoftwareSystemDecisionPageContext( | ||
context.generatorContext, | ||
context.softwareSystem, | ||
decision | ||
) | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/kotlin/nl/avisi/structurizr/site/generatr/site/pages/softwaresystem/DecisionPage.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package nl.avisi.structurizr.site.generatr.site.pages.softwaresystem | ||
|
||
import kotlinx.html.HTML | ||
import nl.avisi.structurizr.site.generatr.site.components.contentDiv | ||
import nl.avisi.structurizr.site.generatr.site.components.renderedMarkdown | ||
import nl.avisi.structurizr.site.generatr.site.context.SoftwareSystemDecisionPageContext | ||
|
||
fun HTML.softwareSystemDecisionPage(context: SoftwareSystemDecisionPageContext) { | ||
softwareSystemPage(context) { | ||
contentDiv { | ||
renderedMarkdown(context, context.decision.content) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters