2
0
Files
gitcaddy-server/templates/repo/vault/list.tmpl
logikonline 5c9385f4a2 feat(vault): add user-facing warnings for key configuration issues
Adds dedicated error page and warnings for vault encryption key problems including missing configuration, fallback key usage, and decryption failures. Displays context-specific messages to help users understand and fix key configuration issues. Includes detection of crypto errors in vault operations and graceful error handling throughout the UI.
2026-02-04 13:54:54 -05:00

140 lines
6.3 KiB
Handlebars

{{template "repo/vault/layout_head" (dict "ctxData" . "pageClass" "repository vault secrets")}}
{{if not .VaultConfigured}}
<div class="ui placeholder segment tw-text-center">
<div class="ui icon header">
{{svg "octicon-alert" 48}}
<h2>{{ctx.Locale.Tr "vault.config_error_title"}}</h2>
<p>{{ctx.Locale.Tr "vault.config_error_message"}}</p>
{{if .VaultConfigError}}
<p><code>{{.VaultConfigError}}</code></p>
{{end}}
<p class="text grey">{{ctx.Locale.Tr "vault.config_error_fix"}}</p>
</div>
</div>
{{else}}
{{if .VaultUsingFallbackKey}}
<div class="ui warning message">
<div class="header">{{svg "octicon-alert" 16}} {{ctx.Locale.Tr "vault.fallback_key_warning_title"}}</div>
<p>{{ctx.Locale.Tr "vault.fallback_key_warning_message"}}</p>
{{if .IsRepoAdmin}}<p class="tw-text-sm">{{ctx.Locale.Tr "vault.fallback_key_warning_fix"}}</p>{{end}}
</div>
{{end}}
<div class="ui segment">
<div class="tw-flex tw-items-center tw-justify-between tw-w-full">
<h4 class="ui header tw-mb-0">
{{svg "octicon-lock" 20}} {{ctx.Locale.Tr "vault.secrets"}}
<div class="sub header">{{ctx.Locale.Tr "vault.secrets_description"}}</div>
</h4>
<div class="tw-flex tw-items-center tw-gap-2 tw-ml-auto">
<select class="ui dropdown" id="type-filter" onchange="window.location.href='{{.RepoLink}}/vault?type=' + this.value">
<option value="">{{ctx.Locale.Tr "vault.all_types"}}</option>
<option value="generic" {{if eq .FilterType "generic"}}selected{{end}}>{{ctx.Locale.Tr "vault.type_generic"}}</option>
<option value="password" {{if eq .FilterType "password"}}selected{{end}}>{{ctx.Locale.Tr "vault.type_password"}}</option>
<option value="api_key" {{if eq .FilterType "api_key"}}selected{{end}}>{{ctx.Locale.Tr "vault.type_api_key"}}</option>
<option value="certificate" {{if eq .FilterType "certificate"}}selected{{end}}>{{ctx.Locale.Tr "vault.type_certificate"}}</option>
<option value="ssh_key" {{if eq .FilterType "ssh_key"}}selected{{end}}>{{ctx.Locale.Tr "vault.type_ssh_key"}}</option>
<option value="file" {{if eq .FilterType "file"}}selected{{end}}>{{ctx.Locale.Tr "vault.type_file"}}</option>
</select>
{{if .CanWrite}}
<a class="ui primary button" href="{{.RepoLink}}/vault/secrets/new">
{{svg "octicon-plus" 16}} {{ctx.Locale.Tr "vault.new_secret"}}
</a>
{{end}}
</div>
</div>
</div>
{{if .Secrets}}
{{range $type, $secrets := .SecretsByType}}
<div class="ui segment">
<h5 class="ui header">
{{if eq $type "generic"}}{{svg "octicon-key" 16}} {{ctx.Locale.Tr "vault.type_generic"}}
{{else if eq $type "password"}}{{svg "octicon-lock" 16}} {{ctx.Locale.Tr "vault.type_password"}}
{{else if eq $type "api_key"}}{{svg "octicon-key-asterisk" 16}} {{ctx.Locale.Tr "vault.type_api_key"}}
{{else if eq $type "certificate"}}{{svg "octicon-shield-check" 16}} {{ctx.Locale.Tr "vault.type_certificate"}}
{{else if eq $type "ssh_key"}}{{svg "octicon-key" 16}} {{ctx.Locale.Tr "vault.type_ssh_key"}}
{{else if eq $type "file"}}{{svg "octicon-file" 16}} {{ctx.Locale.Tr "vault.type_file"}}
{{else}}{{svg "octicon-key" 16}} {{$type}}
{{end}}
<span class="ui grey label">{{len $secrets}}</span>
</h5>
<table class="ui very basic striped table">
<thead>
<tr>
<th class="tw-w-full">{{ctx.Locale.Tr "vault.secret_name"}}</th>
<th class="tw-text-center tw-whitespace-nowrap" style="width: 70px;">{{ctx.Locale.Tr "vault.version"}}</th>
<th class="tw-text-center tw-whitespace-nowrap" style="width: 120px;">{{ctx.Locale.Tr "vault.updated"}}</th>
<th class="tw-text-center tw-whitespace-nowrap" style="width: 120px;">{{ctx.Locale.Tr "actions"}}</th>
</tr>
</thead>
<tbody>
{{range $secrets}}
<tr{{if .IsDeleted}} class="negative"{{end}}>
<td>
<a href="{{$.RepoLink}}/vault/secrets/{{.Name}}">
{{svg "octicon-key" 16}} <strong>{{.Name}}</strong>
</a>
{{if .Description}}
<br><small class="text grey">{{.Description}}</small>
{{end}}
{{if .IsDeleted}}
<span class="ui red label">{{ctx.Locale.Tr "vault.deleted"}}</span>
{{end}}
</td>
<td class="tw-text-center tw-whitespace-nowrap">v{{.CurrentVersion}}</td>
<td class="tw-text-center tw-whitespace-nowrap">{{DateUtils.TimeSince .UpdatedUnix}}</td>
<td class="tw-text-center tw-whitespace-nowrap">
<a class="ui tiny button" href="{{$.RepoLink}}/vault/secrets/{{.Name}}">
{{svg "octicon-eye" 14}} {{ctx.Locale.Tr "view"}}
</a>
{{if $.CanWrite}}
{{if .IsDeleted}}
<form class="ui inline tw-inline" action="{{$.RepoLink}}/vault/secrets/{{.Name}}/restore" method="post">
{{$.CsrfTokenHtml}}
<button class="ui tiny green button">
{{svg "octicon-history" 14}} {{ctx.Locale.Tr "vault.restore"}}
</button>
</form>
{{else}}
<form class="ui inline tw-inline" action="{{$.RepoLink}}/vault/secrets/{{.Name}}/delete" method="post">
{{$.CsrfTokenHtml}}
<button class="ui tiny red button">
{{svg "octicon-trash" 14}} {{ctx.Locale.Tr "delete"}}
</button>
</form>
{{end}}
{{end}}
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{end}}
{{else}}
<div class="ui placeholder segment tw-text-center">
<div class="ui icon header">
{{svg "octicon-lock" 48}}
<h2>{{ctx.Locale.Tr "vault.no_secrets"}}</h2>
<p>{{ctx.Locale.Tr "vault.no_secrets_description"}}</p>
</div>
{{if .CanWrite}}
<div class="tw-mt-4">
<a class="ui primary button" href="{{.RepoLink}}/vault/secrets/new">
{{svg "octicon-plus" 16}} {{ctx.Locale.Tr "vault.create_first_secret"}}
</a>
</div>
{{end}}
</div>
{{end}}
{{if .ShowDeleted}}
<div class="ui segment">
<div class="ui checkbox">
<input type="checkbox" id="show-deleted" {{if .IncludeDeleted}}checked{{end}} onchange="window.location.href='{{.RepoLink}}/vault?include_deleted=' + this.checked">
<label for="show-deleted">{{ctx.Locale.Tr "vault.show_deleted"}}</label>
</div>
</div>
{{end}}
{{end}}
{{template "repo/vault/layout_footer" .}}