Skip to content

Commit

Permalink
Merge pull request #299 from JoeyBarnes/main
Browse files Browse the repository at this point in the history
Updated policy tab for individual alerts to utilize new templated policy generation process
  • Loading branch information
JoeyBarnes authored Aug 2, 2024
2 parents e5122fb + 87a0257 commit 4645d7d
Showing 1 changed file with 15 additions and 31 deletions.
46 changes: 15 additions & 31 deletions docs/layouts/partials/templates/template-tabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,35 +51,19 @@
{{ $data := readFile $file }}
{{ highlight $data "bicep" }}
</div>
{{ $name := .alert.name }}
{{ $category := .category }}
{{ $type := .type }}
{{ range $idx, $value := .alert.deployments }}
<input
type="radio"
class="gdoc-tabs__control hidden"
name="{{ anchorize $name }}"
id="{{ anchorize $name }}-{{ add $idx 3 }}"
/>
<label for="{{ anchorize $name }}-{{ add $idx 3 }}" class="gdoc-tabs__label">
{{ $value.type }}
</label>
{{ $file := path.Join "services/" $category $type $value.template }}
<div class="gdoc-markdown--nested gdoc-tabs__content">
<table>
<tr><td>Name</td><td>{{ $value.name }}</td></tr>
<tr><td>Template</td><td>{{ $value.template }} <a href="{{ relURL $file }}" download>(Download)</a></td></tr>
<tr><td>Tags</td><td>{{ delimit $value.tags "," }}</td></tr>
<tr><td>Properties</td>
<td>
{{ range $key, $value := $value.properties }}
{{ $key }}: {{ $value }}<br>
{{ end }}
</td>
</tr>
</table>
{{ $data := readFile $file }}
{{ highlight $data "json" }}
</div>
{{ end }}
<input
type="radio"
class="gdoc-tabs__control hidden"
name="{{ anchorize .alert.name }}"
id="{{ anchorize .alert.name }}-3"
/>
<label for="{{ anchorize .alert.name }}-3" class="gdoc-tabs__label">
Policy
</label>
<div class="gdoc-markdown--nested gdoc-tabs__content">
{{ $filename := printf "%s.json" $alert_name | printf "%s"}}
{{ $file := path.Join "services" $category $type "templates/policy" $filename }}
{{ $data := readFile $file }}
{{ highlight $data "json" }}
</div>
</div>

0 comments on commit 4645d7d

Please sign in to comment.