Skip to content

Commit b1f041f

Browse files
authored
Merge pull request #60 from hmrc/BDOG-39
BDOG-39 hide new reference.conf configuration by default, and allow t…
2 parents 4c11f62 + 9a7805c commit b1f041f

File tree

5 files changed

+57
-32
lines changed

5 files changed

+57
-32
lines changed

app/assets/config-explorer.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,12 @@ aside {
242242
}
243243
}
244244

245+
.hide-refconf-only {
246+
.refconf-only {
247+
display: none;
248+
}
249+
}
250+
245251
.grid-row > .grid-item {
246252
font-family: monospace;
247253

app/uk/gov/hmrc/cataloguefrontend/CatalogueController.scala

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -220,18 +220,17 @@ class CatalogueController @Inject()(
220220

221221
Ok(
222222
teamInfoPage(
223-
team.name,
224-
repos = team.repos.getOrElse(Map()),
225-
activityDates =
226-
TeamActivityDates(team.firstActiveDate, team.lastActiveDate, team.firstServiceCreationDate),
227-
errorOrTeamMembers = convertToDisplayableTeamMembers(team.name, teamMembers),
228-
teamDetails,
229-
TeamChartData.deploymentThroughput(team.name, teamIndicators.map(_.throughput)),
230-
TeamChartData.deploymentStability(team.name, teamIndicators.map(_.stability)),
231-
umpMyTeamsPageUrl(team.name),
232-
leakDetectionService.teamHasLeaks(team, reposWithLeaks),
233-
leakDetectionService.hasLeaks(reposWithLeaks),
234-
teamDependencies.filter(_.hasOutOfDateDependencies)
223+
teamName = team.name,
224+
repos = team.repos.getOrElse(Map()),
225+
activityDates = TeamActivityDates(team.firstActiveDate, team.lastActiveDate, team.firstServiceCreationDate),
226+
errorOrTeamMembers = convertToDisplayableTeamMembers(team.name, teamMembers),
227+
errorOrTeamDetails = teamDetails,
228+
throughputChartData = TeamChartData.deploymentThroughput(team.name, teamIndicators.map(_.throughput)),
229+
stabilityChartData = TeamChartData.deploymentStability(team.name, teamIndicators.map(_.stability)),
230+
umpMyTeamsUrl = umpMyTeamsPageUrl(team.name),
231+
leaksFoundForTeam = leakDetectionService.teamHasLeaks(team, reposWithLeaks),
232+
hasLeaks = leakDetectionService.hasLeaks(reposWithLeaks),
233+
dependencies = teamDependencies.filter(_.hasOutOfDateDependencies)
235234
)
236235
)
237236
case _ => NotFound(error_404_template())

app/uk/gov/hmrc/cataloguefrontend/service/ConfigService.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,11 @@ object ConfigService {
5151

5252
def friendlySourceName(source: String, environment: String): String = {
5353
source match {
54-
case "applicationConf" => "Microservice application.conf file"
55-
case "baseConfig" => "App-config-base"
56-
case "appConfigEnvironment" => s"App-config-$environment"
57-
case "appConfigCommonFixed" => "App-config-common fixed settings"
54+
case "referenceConf" => "Microservice reference.conf files"
55+
case "applicationConf" => "Microservice application.conf file"
56+
case "baseConfig" => "App-config-base"
57+
case "appConfigEnvironment" => s"App-config-$environment"
58+
case "appConfigCommonFixed" => "App-config-common fixed settings"
5859
case "appConfigCommonOverridable" => "App-config-common overridable settings"
5960
case _ => source
6061
}

app/views/ServiceConfigPage.scala.html

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<script src="@routes.Assets.at("split.js")"></script>
2929
<script src="@routes.Assets.at("config-explorer.js")"></script>
3030
</head>
31-
<body>
31+
<body class="hide-refconf-only">
3232
<header class="opaque">
3333
<h1 id="service-header">Config: @serviceName</h1>
3434
<i class="glyphicon glyphicon-question-sign help-icon"></i>
@@ -45,21 +45,23 @@ <h1 id="service-header">Config: @serviceName</h1>
4545
}
4646
</div>
4747
@for((key: String, envSources: Map[String, Seq[ConfigSourceValue]]) <- ListMap(configByKey.toSeq.sortWith(_._1 < _._1):_*)) {
48-
<div id="config-row-@key" class="grid-row">
49-
<div id="config-key-@key" class="grid-item sticky-column truncate-content" style="width:310px;">@key</div>
50-
@for((env, i) <- environments.zipWithIndex) {
51-
<div class="grid-item column-@env" style="width:510px;">
52-
<ul>
53-
@for(sourceValue: ConfigSourceValue <- sortBySourcePrecedence(envSources.get(env))) {
54-
<li class="config-value" title="@friendlySourceName(sourceValue.source, env)">
55-
<span class="truncate-content">@sourceValue.value</span>
56-
<a class="glyphicon glyphicon-circle-arrow-right" target="raw" href="config/raw#@env-@sourceValue.source-@key"></a>
57-
</li>
58-
}
59-
</ul>
60-
</div>
61-
}
62-
</div>
48+
@defining(envSources.forall(_._2.map(_.source) == List("referenceConf"))) { isRefconfOnly =>
49+
<div id="config-row-@key" class="grid-row @if(isRefconfOnly) {refconf-only} else {}">
50+
<div id="config-key-@key" class="grid-item sticky-column truncate-content" style="width:310px;">@key</div>
51+
@for((env, i) <- environments.zipWithIndex) {
52+
<div class="grid-item column-@env" style="width:510px;">
53+
<ul>
54+
@for(sourceValue: ConfigSourceValue <- sortBySourcePrecedence(envSources.get(env))) {
55+
<li class="config-value" title="@friendlySourceName(sourceValue.source, env)">
56+
<span class="truncate-content">@sourceValue.value</span>
57+
<a class="glyphicon glyphicon-circle-arrow-right" target="raw" href="config/raw#@env-@sourceValue.source-@key"></a>
58+
</li>
59+
}
60+
</ul>
61+
</div>
62+
}
63+
</div>
64+
}
6365
}
6466
</div>
6567
</section>
@@ -75,6 +77,10 @@ <h2>Columns</h2>
7577
</ul>
7678
<h2>Values</h2>
7779
<ul>
80+
<li>
81+
<input type="checkbox" id="show-referenceConf" checked="checked" />
82+
<label for="show-referenceConf">Show referenceConf</label>
83+
</li>
7884
<li>
7985
<input type="checkbox" id="show-evictions" checked="checked" />
8086
<label for="show-evictions">Show evictions</label>
@@ -86,6 +92,11 @@ <h2>Values</h2>
8692
</ul>
8793
</aside>
8894
<aside id="help">
95+
<h2>What am I seeing?</h2>
96+
<ul class="bullets">
97+
<li>The Microservice reference.conf files, application.conf files and the App-config-base are extracted from the latest slug build. They <i>might</i> not correspond to what is actually deployed in the environment, and actually represent what the resulting configuration would be if the latest slug is deployed into that environment.</li>
98+
<li>The App-config environment and common configuration are looked up in the corresponding github project.</li>
99+
</ul>
89100
<h2>How to use the config explorer</h2>
90101
<ul class="bullets">
91102
<li>Drag the handles to the left of column headers to re-size columns</li>
@@ -94,6 +105,7 @@ <h2>How to use the config explorer</h2>
94105
<li>Crossed out values indicate an eviction according to their precendence in the config hierarchy</li>
95106
<li>Click the arrow to the right of a value to see the config item in context</li>
96107
<li>Toggle environments on/off and adjust formatting using the hamburger menu</li>
108+
<li>Toggle inclusion of values from reference.conf files using the hamburger menu. Note reference.conf values are always shown if they have been overridden</li>
97109
<li>Ctrl-f to search for a key or value (uses browser find)</li>
98110
</ul>
99111
</aside>
@@ -126,6 +138,9 @@ <h2>How to use the config explorer</h2>
126138
document.querySelector("#show-evictions").addEventListener("change", e => {
127139
document.querySelector("body").classList.toggle("hide-evictions");
128140
});
141+
document.querySelector("#show-referenceConf").addEventListener("change", e => {
142+
document.querySelector("body").classList.toggle("hide-refconf-only");
143+
});
129144

130145
document.querySelector("#word-wrap").addEventListener("change", e => {
131146
document.querySelector("body").classList.toggle("word-wrap");

public/config-explorer.css

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)