app/views/email.scala.html (87 lines of code) (raw):

@import utils.DateUtils @import views.html.fragments.heading @import org.joda.time.DateTime @(amiableUrl: String, instances: Seq[(Instance, Option[AMI])], owner: Owner, emptyChar: String = "-") <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Instances with old AMIs</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> </head> <body> @if(instances.nonEmpty) { <table style="margin-top: 10px; margin-bottom: 40px;" cellpadding="0" cellspacing="0"> <thead> <tr bgcolor="#aabbd9"> <td colspan="7" bgcolor="#eeeeee" style="font-size: xx-large; color: #3661B0 !important; padding: 40px 40px 30px 40px;"> <div>@{instances.size} instances running old AMIs</div> <div><small>(AMIs built more than 30 days ago)</small></div> </td> </tr> <tr bgcolor="#26a69a"> <th align="left" style="padding: 15px 5px;">Stack</th> <th align="left" style="padding: 15px 5px;">Stage</th> <th align="left" style="padding: 15px 5px;">App</th> <th align="left" style="padding: 15px 5px;">Instance</th> <th align="left" style="padding: 15px 5px;">AMI</th> <th align="left" style="padding: 15px 5px;">AMI age</th> </tr> </thead> <tbody> @for((instance, maybeAmi) <- instances) { <tr> <td style="padding: 5px 5px;"> <a href="@{amiableUrl+routes.AMIable.ssaInstanceAMIs(instance.stack, None, None, None).path}"> @instance.stack.getOrElse(emptyChar) </a> </td> <td style="padding: 5px 5px;"> <a href="@{amiableUrl+routes.AMIable.ssaInstanceAMIs(instance.stack, instance.stage, None, None).path}">@instance.stage.getOrElse(emptyChar)</a> </td> <td style="padding: 5px 5px;"> <a href="@{amiableUrl+routes.AMIable.ssaInstanceAMIs(instance.stack, instance.stage, instance.app.headOption, None).path}">@instance.app</a> </td> <td style="padding: 5px 5px;">@instance.instanceName</td> <td style="padding: 5px 5px;"> @maybeAmi.map { ami => <a href="@{amiableUrl + routes.AMIable.ami(ami.imageId).path}">@ami.imageId</a> } </td> <td style="padding: 5px 5px;">@maybeAmi.flatMap(_.creationDate).map { i => @DateUtils.daysAgo(i) days }</td> </tr> } <tr bgcolor="#212121" style="color: #FFFFFF !important; padding: 30px 30px 30px 30px;"> <td colspan="7" style="padding: 15px 5px;"> You are receiving this email because you are listed as the Owner of the stacks listed below. This is determined by the Owners in prism (see <a href="https://github.com/guardian/prism/blob/main/app/data/Owners.scala">GitHub</a>). <table cellpadding="5px"> <thead> <tr> <th class="ssa-table__heading">Stack</th> <th class="ssa-table__heading">Stage</th> <th class="ssa-table__heading">App</th> <th class="ssa-table__heading">Account</th> </tr> </thead> <tbody> @for(ssa <- owner.stacks) { <tr> <td class="ssa-table__entry">@ssa.stack.getOrElse(emptyChar)</td> <td class="ssa-table__entry">@ssa.stage.getOrElse(emptyChar)</td> <td class="ssa-table__entry">@ssa.app.getOrElse(emptyChar)</td> <td class="ssa-table__entry">@ssa.accountName.getOrElse(emptyChar)</td> </tr> } </tbody> </table> </td> </tr> </tbody> </table> } </body> </html>