2024-02-27 19:29:54 +00:00
|
|
|
package secrets
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
templ (s *SecretsPlugin) index() {
|
2024-02-28 14:39:38 +00:00
|
|
|
<div class="grid-container">
|
2024-02-27 19:29:54 +00:00
|
|
|
<form hx-post="/secrets/add" hx-target="#data">
|
2024-02-28 14:39:38 +00:00
|
|
|
<div class="grid-x">
|
|
|
|
<h2>Secrets</h2>
|
|
|
|
</div>
|
|
|
|
<div class="grid-x">
|
|
|
|
<div class="cell auto">
|
|
|
|
<div class="input-group">
|
|
|
|
<span class="input-group-label">Key</span>
|
|
|
|
<input class="input-group-field" placeholder="Key..." name="key" />
|
|
|
|
</div>
|
2024-02-27 19:29:54 +00:00
|
|
|
</div>
|
2024-02-28 14:39:38 +00:00
|
|
|
<div class="cell auto">
|
|
|
|
<div class="input-group">
|
|
|
|
<span class="input-group-label">Value</span>
|
|
|
|
<input class="input-group-field" placeholder="Value..." name="value" />
|
|
|
|
<div class="input-group-button">
|
|
|
|
<button class="button primary" type="submit">Add Secret</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-02-27 19:29:54 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
2024-02-28 14:39:38 +00:00
|
|
|
<div class="grid-x grid-margin-x">
|
2024-02-27 19:29:54 +00:00
|
|
|
<div id="data">
|
|
|
|
@s.keysList()
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
}
|
|
|
|
|
|
|
|
templ (s *SecretsPlugin) keysList() {
|
2024-02-28 14:39:38 +00:00
|
|
|
<ul class="no-bullet">
|
2024-02-27 19:29:54 +00:00
|
|
|
for _, key := range s.keys() {
|
|
|
|
<li>
|
|
|
|
<button
|
2024-02-28 14:39:38 +00:00
|
|
|
class="button tiny alert middle"
|
|
|
|
style="vertical-align: baseline"
|
2024-02-27 19:29:54 +00:00
|
|
|
hx-delete="/secrets/remove"
|
|
|
|
hx-confirm={ fmt.Sprintf("Are you sure you want to delete %s?", key) }
|
|
|
|
hx-target="#data"
|
|
|
|
hx-include="this"
|
|
|
|
name="key" value={ key }>X</button>
|
|
|
|
{ key }</li>
|
|
|
|
}
|
|
|
|
</ul>
|
|
|
|
}
|