driftctl/pkg/cmd/scan/output/testdata/output.html

173 lines
5.2 KiB
HTML
Raw Normal View History

2021-06-01 09:38:47 +00:00
<!doctype html>
2021-04-22 16:21:00 +00:00
<html>
<head>
<title>Driftctl scan report</title>
2021-06-01 09:38:47 +00:00
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
2021-04-22 16:21:00 +00:00
<style>body {
2021-06-01 09:38:47 +00:00
font-family: sans-serif;
}
2021-04-22 16:21:00 +00:00
2021-06-01 09:38:47 +00:00
.hide {
display: none;
}</style>
2021-04-22 16:21:00 +00:00
</head>
<body>
<div id="app">
2021-06-01 09:38:47 +00:00
<h1 class="heading title">Driftctl scan report</h1>
2021-04-22 16:21:00 +00:00
<span class="heading subtitle">Coverage 8%</span>
2021-06-07 13:21:57 +00:00
<span class="heading date">Jun 07, 2021</span>
2021-04-22 16:21:00 +00:00
<hr>
<form id="filter-form" action="#">
<input type="text" name="resource-id-filter" placeholder="Search resources..." onkeyup="refreshState()">
<select name="resource-type-filter" onchange="refreshState()">
<option value="">Resource type</option>
2021-06-01 09:38:47 +00:00
2021-04-22 16:21:00 +00:00
<option value="aws_unmanaged_resource">aws_unmanaged_resource</option>
2021-06-01 09:38:47 +00:00
2021-06-07 13:21:57 +00:00
<option value="aws_deleted_resource">aws_deleted_resource</option>
<option value="aws_diff_resource">aws_diff_resource</option>
2021-04-22 16:21:00 +00:00
</select>
</form>
2021-06-01 09:38:47 +00:00
2021-04-22 16:21:00 +00:00
<h2>Unmanaged resources <span class="resource-count-unmanaged">(2)</span></h2>
2021-06-01 09:38:47 +00:00
<div class="resource-item resource-item-unmanaged">
2021-04-22 16:21:00 +00:00
<span class="resource-item-id">unmanaged-id-1</span>
<span class="resource-item-type">aws_unmanaged_resource</span>
</div>
2021-06-01 09:38:47 +00:00
<div class="resource-item resource-item-unmanaged">
2021-04-22 16:21:00 +00:00
<span class="resource-item-id">unmanaged-id-2</span>
<span class="resource-item-type">aws_unmanaged_resource</span>
</div>
2021-06-01 09:38:47 +00:00
2021-04-22 16:21:00 +00:00
2021-06-01 09:38:47 +00:00
2021-04-22 16:21:00 +00:00
<h2>Changed resources <span class="resource-count-changed">(1)</span></h2>
2021-06-01 09:38:47 +00:00
<div class="resource-item resource-item-changed">
2021-04-22 16:21:00 +00:00
<span class="resource-item-id">diff-id-1</span>
<span class="resource-item-type">aws_diff_resource</span>
<div>
2021-06-01 09:38:47 +00:00
2021-04-22 16:21:00 +00:00
<div>~ updated.field: &#34;foobar&#34; =&gt; &#34;barfoo&#34; </div>
2021-06-01 09:38:47 +00:00
2021-04-22 16:21:00 +00:00
<div>&#43; new.field: &lt;nil&gt; =&gt; &#34;newValue&#34; </div>
2021-06-01 09:38:47 +00:00
2021-04-22 16:21:00 +00:00
<div>- a: &#34;oldValue&#34; =&gt; &lt;nil&gt; </div>
2021-06-01 09:38:47 +00:00
2021-04-22 16:21:00 +00:00
</div>
</div>
2021-06-01 09:38:47 +00:00
2021-04-22 16:21:00 +00:00
2021-06-01 09:38:47 +00:00
2021-04-22 16:21:00 +00:00
<h2>Missing resources <span class="resource-count-deleted">(2)</span></h2>
2021-06-01 09:38:47 +00:00
<div class="resource-item resource-item-deleted">
2021-04-22 16:21:00 +00:00
<span class="resource-item-id">deleted-id-1</span>
<span class="resource-item-type">aws_deleted_resource</span>
</div>
2021-06-01 09:38:47 +00:00
<div class="resource-item resource-item-deleted">
2021-04-22 16:21:00 +00:00
<span class="resource-item-id">deleted-id-2</span>
<span class="resource-item-type">aws_deleted_resource</span>
</div>
2021-06-01 09:38:47 +00:00
2021-04-22 16:21:00 +00:00
2021-06-01 09:38:47 +00:00
2021-04-22 16:21:00 +00:00
<h2>Alerts <span class="resource-count-alerts">(1)</span></h2>
2021-06-01 09:38:47 +00:00
<div class="resource-item resource-item-alerts">
2021-04-22 16:21:00 +00:00
<span class="resource-item-type"></span>
<div>
2021-06-01 09:38:47 +00:00
<div>- Ignoring aws_vpc from drift calculation: Listing aws_vpc is forbidden.</div>
<div>- Ignoring aws_sqs from drift calculation: Listing aws_sqs is forbidden.</div>
<div>- Ignoring aws_sns from drift calculation: Listing aws_sns is forbidden.</div>
2021-04-22 16:21:00 +00:00
</div>
</div>
2021-06-01 09:38:47 +00:00
2021-04-22 16:21:00 +00:00
</div>
</body>
<script lang="js">
const resources = document.querySelectorAll('.resource-item')
function hideResource(res) {
2021-06-01 09:38:47 +00:00
res.classList.add('hide')
2021-04-22 16:21:00 +00:00
}
function displayResource(res) {
2021-06-01 09:38:47 +00:00
res.classList.remove('hide')
2021-04-22 16:21:00 +00:00
}
function resourceIdContains(res, query) {
const el = res.querySelector('.resource-item-id')
if (!el) {
2021-06-01 09:38:47 +00:00
return false
2021-04-22 16:21:00 +00:00
}
return el.innerText.toLowerCase().includes(query.toLowerCase())
}
function resourceTypeEqual(res, type) {
const el = res.querySelector('.resource-item-type')
if (!el) {
2021-06-01 09:38:47 +00:00
return false
2021-04-22 16:21:00 +00:00
}
return el.innerText === type
}
2021-06-01 09:38:47 +00:00
function refreshCounters() {
const counterClassMapping = {
'.resource-item-unmanaged': '.resource-count-unmanaged',
'.resource-item-changed': '.resource-count-changed',
'.resource-item-deleted': '.resource-count-deleted',
'.resource-item-alerts': '.resource-count-alerts',
}
for (const resClass in counterClassMapping) {
const countEl = document.querySelector(counterClassMapping[resClass])
if (!countEl){
continue
}
countEl.textContent = Array.from(document.querySelectorAll(resClass)).filter(el => !el.classList.contains('hide')).length
}
}
2021-04-22 16:21:00 +00:00
function refreshState() {
const queryFilterInput = document.querySelector('input[name=resource-id-filter]').value
const typeFilterInput = document.querySelector('select[name=resource-type-filter]').value
for (const res of resources) {
const matchId = !queryFilterInput.length || resourceIdContains(res, queryFilterInput)
const matchType = !typeFilterInput.length || resourceTypeEqual(res, typeFilterInput)
if (matchId && matchType) {
displayResource(res)
continue
}
hideResource(res)
}
2021-06-01 09:38:47 +00:00
refreshCounters()
2021-04-22 16:21:00 +00:00
}
refreshState()
</script>
2021-06-01 09:38:47 +00:00
</html>