Skip to content

Commit

Permalink
ui fixes for logged-in user
Browse files Browse the repository at this point in the history
  • Loading branch information
reddec committed Jan 19, 2022
1 parent 19d96ea commit ef7719e
Showing 1 changed file with 112 additions and 111 deletions.
223 changes: 112 additions & 111 deletions internal/static/assets/templates/details.gotemplate
Original file line number Diff line number Diff line change
Expand Up @@ -13,127 +13,128 @@
<a href="./../logout">Logout</a>
</div>
{{end}}
<div class="left-menu">
<a href="./../">All ingresses</a>
<hr/>
{{range $ns := .Namespaces}}
<small>{{$ns}}</small><br/>
<ul style="margin-top: 0">
{{range $ingress := (index $.ByNamespace $ns)}}
{{if not $ingress.Static}}
<li>
{{if eq $ingress.UID $.Ingress.UID}}
{{$ingress.Label}}
{{else}}
<a href="{{$ingress.UID}}">{{$ingress.Label}}</a>
{{end}}
</li>
{{end}}
{{end}}
</ul>
{{end}}
</div>
<div class="content">
<!-- general info -->
<form class="card">

<div class="header">
<div class="title">
{{with $.Ingress.Logo}}
<h2>
<img loading="lazy" src="{{.}}" alt="{{$.Ingress.ID}}">
</h2>
<div class="main">
<div class="left-menu">
<a href="./../">All ingresses</a>
<hr/>
{{range $ns := .Namespaces}}
<small>{{$ns}}</small><br/>
<ul style="margin-top: 0">
{{range $ingress := (index $.ByNamespace $ns)}}
{{if not $ingress.Static}}
<li>
{{if eq $ingress.UID $.Ingress.UID}}
{{$ingress.Label}}
{{else}}
<a href="{{$ingress.UID}}">{{$ingress.Label}}</a>
{{end}}
</li>
{{end}}
{{end}}
{{with $.Ingress.Label}}
<h2 class="hidden-link">{{.}}</h2>
</ul>
{{end}}
</div>
<div class="content">
<!-- general info -->
<form class="card">

<div class="header">
<div class="title">
{{with $.Ingress.Logo}}
<h2>
<img loading="lazy" src="{{.}}" alt="{{$.Ingress.ID}}">
</h2>
{{end}}
{{with $.Ingress.Label}}
<h2 class="hidden-link">{{.}}</h2>
{{end}}
</div>
{{with $.Ingress.Namespace}}
<small>namespace</small><br/>
<h3 style="margin-bottom: 0; margin-top: 0">
{{.}}
</h3>
{{end}}
</div>
{{with $.Ingress.Namespace}}
<small>namespace</small><br/>
<h3 style="margin-bottom: 0; margin-top: 0">
{{with $.Ingress.Description}}
<p class="description">
<small>description</small><br/>
{{.}}
</h3>
</p>
{{end}}
</div>
{{with $.Ingress.Description}}
<p class="description">
<small>description</small><br/>
{{.}}
</p>
{{end}}
<p class="description">
<small>ingress class</small><br/>
{{if $.Ingress.Class}}
<code>{{$.Ingress.Class}}</code>
{{else}}
<span class="warn" title="Ingress class should be defined">routed using default ingress</span>
{{end}}
</p>
<!-- links and pods -->
<div class="description">
<small>links</small><br/>
<ul style="margin-top: 0">
{{range $ref := $.Ingress.Refs}}
<li>
<a href="{{$ref.URL}}" target="_blank">
{{- $ref.URL -}}
</a>
&nbsp;—&nbsp;{{- if $ref.Pods -}}
served by {{$ref.Pods}} host{{if gt $ref.Pods 1}}s{{end}}
{{- else -}}
<span class="warn">no hosts!</span>
{{- end -}}
</li>
<small>ingress class</small><br/>
{{if $.Ingress.Class}}
<code>{{$.Ingress.Class}}</code>
{{else}}
<span class="warn" title="Ingress class should be defined">routed using default ingress</span>
{{end}}
</ul>
</div>
</form>

<!-- TLS -->
{{if $.Ingress.TLS}}
<form class="card">
{{if $.Ingress.Cert.Expiration.IsZero}}
<span title="TLS enabled but status not yet known">TLS status unknown</span>
{{else}}
<p>
<small>issuer</small><br/>
{{$.Ingress.Cert.Issuer}}
</p>
<p>
<small>subject(s)</small><br/>
{{range $i, $subject := $.Ingress.Cert.Domains}}
{{if $i}},{{end}}
{{$subject}}
</p>
<!-- links and pods -->
<div class="description">
<small>links</small><br/>
<ul style="margin-top: 0">
{{range $ref := $.Ingress.Refs}}
<li>
<a href="{{$ref.URL}}" target="_blank">
{{- $ref.URL -}}
</a>
&nbsp;—&nbsp;{{- if $ref.Pods -}}
served by {{$ref.Pods}} host{{if gt $ref.Pods 1}}s{{end}}
{{- else -}}
<span class="warn">no hosts!</span>
{{- end -}}
</li>
{{end}}
</p>
<p>
<small>certificate expiration</small><br/>
{{$.Ingress.Cert.Expiration}}
</p>
{{if not $.Ingress.IsTLSExpired}}
</ul>
</div>
</form>

<!-- TLS -->
{{if $.Ingress.TLS}}
<form class="card">
{{if $.Ingress.Cert.Expiration.IsZero}}
<span title="TLS enabled but status not yet known">TLS status unknown</span>
{{else}}
<p>
<small>expires after</small><br/>
{{$.Ingress.WhenTLSExpires}}
<small>issuer</small><br/>
{{$.Ingress.Cert.Issuer}}
</p>
<p>
<small>subject(s)</small><br/>
{{range $i, $subject := $.Ingress.Cert.Domains}}
{{if $i}},{{end}}
{{$subject}}
{{end}}
</p>
<p>
<small>certificate expiration</small><br/>
{{$.Ingress.Cert.Expiration}}
</p>
{{if not $.Ingress.IsTLSExpired}}
<p>
<small>expires after</small><br/>
{{$.Ingress.WhenTLSExpires}}
</p>
{{end}}
{{if $.Ingress.IsTLSExpired}}
<span class="warn"
title="TLS certificate expired at {{$.Ingress.Cert.Expiration}}">❌ TLS expired</span>
{{else if $.Ingress.IsTLSSoonExpire}}
Expires after {{$.Ingress.WhenTLSExpires}}
<span class="danger" title="TLS certificate will expire after {{$.Ingress.WhenTLSExpires}}">🔔 TLS soon expire</span>
{{else}}
<span class="success"
title="TLS enabled, valid until {{$.Ingress.Cert.Expiration}}">🛡 TLS enabled️</span>
{{end}}
{{end}}
{{if $.Ingress.IsTLSExpired}}
<span class="warn"
title="TLS certificate expired at {{$.Ingress.Cert.Expiration}}">❌ TLS expired</span>
{{else if $.Ingress.IsTLSSoonExpire}}
Expires after {{$.Ingress.WhenTLSExpires}}
<span class="danger" title="TLS certificate will expire after {{$.Ingress.WhenTLSExpires}}">🔔 TLS soon expire</span>
{{else}}
<span class="success"
title="TLS enabled, valid until {{$.Ingress.Cert.Expiration}}">🛡 TLS enabled️</span>
{{end}}
{{end}}
</form>
{{else}}
<form class="card">
<span class="warn" title="Insecure connections">🔓 TLS not enabled</span>
</form>
{{end}}

</form>
{{else}}
<form class="card">
<span class="warn" title="Insecure connections">🔓 TLS not enabled</span>
</form>
{{end}}
</div>
</div>
</body>
<style>
Expand All @@ -151,7 +152,7 @@
}
}

body {
.main {
display: flex;
flex-wrap: wrap;
}
Expand Down

0 comments on commit ef7719e

Please sign in to comment.