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