Add error display

This commit is contained in:
Chandler Swift 2021-10-18 23:01:29 -05:00
parent b9d5c2df46
commit 07da911b05
Signed by: chandlerswift
GPG key ID: A851D929D52FB93F

View file

@ -11,22 +11,44 @@
img { max-width: 100%; box-shadow: 0 0 10px 10px lightgray; }
img:hover { box-shadow: 0 0 10px 10px darkgray}
h3 { margin-top: 100px; }
.errors { padding: 0.5rem; border: 1px solid #f5c6cb; color: #721c24; background: #f8d7da; }
* { line-height: 1.5em; }
</style>
</head>
<body>
<h1>{n}hats.com domains</h1>
{{ $errors := false -}}
{{- range . -}}
{{- with .Error -}}
{{- $errors = true -}}
{{- end -}}
{{- end -}}
{{- if $errors -}}
<div class="errors">
<h4>Errors occurred during processing</h3>
<ol>
{{- range . -}}
{{- if .Error }}
<li>{{.DomainName}}: {{.Error}}</li>
{{ end -}}
{{- end -}}
</ol>
</div>
{{end}}
<h3>Summary</h3>
<ul>
{{range .}}
{{if .Available}}
<li><a href="#{{.DomainName}}">{{.DomainName}}</a> &ndash; Available!</li>
{{else}}
<li><a href="#{{.DomainName}}">{{.DomainName}}</a> &ndash; Registered since {{(parseTime .DomainInfo.CreatedDate).Format "Mon Jan 2 2006" }}</li>
{{if not .Error}}
{{if .Available}}
<li><a href="#{{.DomainName}}">{{.DomainName}}</a> &ndash; Available!</li>
{{else}}
<li><a href="#{{.DomainName}}">{{.DomainName}}</a> &ndash; Registered since {{(parseTime .DomainInfo.CreatedDate).Format "Mon Jan 2 2006" }}</li>
{{end}}
{{end}}
{{end}}
</ul>
{{range .}}
{{if not .Error}}
<h3 id="{{.DomainName}}">{{.DomainName}}</h3>
<dl>
<dt>Fetched</dt>
@ -52,5 +74,6 @@
</a>
{{end}}
{{end}}
{{end}}
</body>
</html>