chore(webui): improve the states id page

This commit is contained in:
Julien Dessaux 2025-04-21 23:49:24 +02:00
parent 9bf75bfd37
commit 6fb2db436d
Signed by: adyxax
GPG key ID: F92E51B86E07177E
4 changed files with 106 additions and 45 deletions

View file

@ -45,7 +45,7 @@
</span>
{{ end }}
<div style="align-self:stretch; display:flex; justify-content:flex-end;">
<button class="primary" type="submit" value="submit">Upload and Create State</button>
<button type="submit" value="submit">Upload and Create State</button>
</div>
</fieldset>
</form>

View file

@ -1,5 +1,6 @@
{{ define "main" }}
<h1>State</h1>
<h1>{{ .State.Path }}</h1>
<h2>Status</h2>
<p>
The state at path
<strong>{{ .State.Path }}</strong>
@ -18,8 +19,54 @@
</span>
{{ end }}
</strong>
Use this page to manage the state or inspect the current and past state versions.
</p>
<p>Use this page to inspect the existing versions.</p>
<h2>Operations</h2>
<div class="flex-row">
<form action="/states/{{ .State.Id }}" method="post">
<fieldset>
<legend>Edit State</legend>
<div class="flex-row">
<label for="path">Path</label>
<input {{ if or .PathDuplicate .PathError }}class="error"{{ end }}
id="path"
name="path"
required
type="text"
value="{{ if eq .Path "" }}{{ .State.Path }}{{ else }}{{ .Path }}{{ end }}">
<button name="action" type="submit" value="edit">Edit State</button>
</div>
{{ if .PathDuplicate }}
<span class="error">This path already exist.</span>
{{ else if .PathError }}
<span class="error">
Path needs to be a valid
<span class="tooltip">
absolute
<span class="tooltip-text">
URL path is considered absolute when it starts with a <code>/</code> character.
</span>
</span>
and
<span class="tooltip">
clean
<span class="tooltip-text">
A URL path is considered clean when it has no relative path elements like <code>../</code>, repeated <code>//</code> and when it does not end with a <code>/</code>.
</span>
</span>
URL path.
</span>
{{ end }}
</fieldset>
</form>
<form action="/states/{{ .State.Id }}" method="post">
<fieldset>
<legend>Danger Zone</legend>
<button action="delete" type="submit" value="delete">Delete State</button>
</fieldset>
</form>
</div>
<h2>Versions</h2>
<article>
<table style="width:100%;">
<thead>