Files
pages/templates/pages/import.gohtml
T
Anya Tokugawa c1175d389f Implement Knowledge City platform, organizer and DAV integration
Capture accumulated application, UI, CLI, regression tests and design documentation changes, including task project mapping and default CalDAV list naming.

Keep deployment data, backups, local credentials and build artifacts out of Git. Move the Compose enrollment token to an ignored local environment file.
2026-09-27 14:44:43 +09:00

17 lines
4.5 KiB
Go Template

{{ define "import.gohtml" }}<!doctype html><html lang="{{ .Locale }}"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{{ .Title }}</title><link rel="stylesheet" href="/static/css/main.css"><link rel="stylesheet" href="/static/css/theme/base.css"><link rel="stylesheet" href="{{ .ThemeCSS }}"></head><body>
<header class="topbar"><div class="brand"><a href="/">{{ .WikiName }}</a></div><a href="/v/tree">{{ T "tree.title" }}</a>{{ template "auth-menu" . }}</header><main class="container"><section class="card import-card">
{{ if .Session }}
<p><a href="/v/import">← {{ T "import.title" }}</a></p><h1>{{ .Session.ArchiveName }}</h1>
<dl class="import-summary"><dt>{{ T "import.status" }}</dt><dd><strong>{{ .Session.Status }}</strong></dd><dt>{{ T "import.target" }}</dt><dd><code>{{ .Session.TargetPrefix }}</code></dd><dt>{{ T "import.files" }}</dt><dd>{{ .Session.TotalFiles }} (Markdown: {{ .Session.MarkdownFiles }})</dd></dl>{{ if .Session.Error }}<p class="error">{{ .Session.Error }}</p>{{ end }}
{{ if or (eq .Session.Status "ready") (eq .Session.Status "failed") }}
{{ if eq .Session.Status "failed" }}<p class="error">{{ T "import.retry_pending" }}: {{ len .Items }}</p>{{ end }}
<p class="muted">{{ T "import.preview_help" }}</p><div class="import-actions"><button type="button" data-save-plan>{{ T "import.save_plan" }}</button><select data-conflict><option value="skip">{{ T "import.conflict_skip" }}</option><option value="rename">{{ T "import.conflict_rename" }}</option></select><button type="button" data-commit-import>{{ if eq .Session.Status "failed" }}{{ T "import.retry" }}{{ else }}{{ T "import.commit" }}{{ end }}</button>{{ if eq .Session.Status "failed" }}<button type="button" data-rollback-import>{{ T "import.rollback" }}</button>{{ end }}<span data-import-result></span></div>
<div class="import-table-wrap"><table><thead><tr><th>✓</th><th>#</th><th>{{ T "import.source" }}</th><th>Path</th><th>Type</th><th>Quartier</th><th>Street</th><th>Spot</th><th>{{ T "import.confidence" }}</th></tr></thead><tbody>{{ range .Items }}<tr data-import-item data-sequence="{{ .Sequence }}"><td><input type="checkbox" data-field="selected" {{ if .Selected }}checked{{ end }}></td><td>{{ .Sequence }}</td><td><code>{{ .SourcePath }}</code></td><td><input data-field="target_path" value="{{ .TargetPath }}"></td><td>{{ .ContentType }}</td><td><input data-field="quartier" value="{{ .Quartier }}"></td><td><input data-field="street" value="{{ .Street }}"></td><td><input data-field="spot" value="{{ .Spot }}"></td><td>{{ printf "%.0f%%" (mulFloat .Confidence 100) }}</td></tr>{{ end }}</tbody></table></div>
{{ else if or (eq .Session.Status "queued") (eq .Session.Status "analyzing") (eq .Session.Status "queued_import") (eq .Session.Status "importing") }}<p>{{ T "import.analyzing" }}</p><script>setTimeout(()=>location.reload(),1500)</script>
{{ else if eq .Session.Status "completed" }}<p>{{ T "import.completed" }}</p><button type="button" data-rollback-import>{{ T "import.rollback" }}</button><span data-import-result></span>
{{ else if eq .Session.Status "rolled_back" }}<p>{{ T "import.rolled_back" }}</p>{{ end }}
{{ else }}
<h1>{{ T "import.title" }}</h1><p class="muted">{{ T "import.help" }}</p><form method="post" enctype="multipart/form-data"><label>{{ T "import.target" }}<input name="target_prefix" value="/" required></label><label>{{ T "import.archive" }}<input type="file" name="archive" accept=".zip,.tar,.tar.gz,.tgz,.tar.xz,.txz" required></label><button>{{ T "import.analyze" }}</button></form><h2>{{ T "import.sessions" }}</h2><ul>{{ range .Sessions }}<li><a href="/v/import/{{ .UUID }}">{{ .ArchiveName }}</a> — {{ .Status }} ({{ .TotalFiles }})</li>{{ else }}<li>—</li>{{ end }}</ul>
{{ end }}</section></main>
<style>.import-card{max-width:96rem;margin:1rem auto}.import-card>form{display:grid;gap:1rem;max-width:48rem}.import-card label{display:grid;gap:.4rem}.import-summary{display:grid;grid-template-columns:auto 1fr;gap:.4rem 1rem}.import-summary dd{margin:0}.import-actions{display:flex;gap:.6rem;align-items:center;flex-wrap:wrap;margin:1rem 0}.import-table-wrap{overflow:auto;max-height:70vh}.import-table-wrap table{width:100%;border-collapse:collapse;font-size:.85rem}.import-table-wrap th,.import-table-wrap td{padding:.4rem;border-bottom:1px solid var(--border-soft);text-align:left;white-space:nowrap}.import-table-wrap input{min-width:10rem}.import-table-wrap [data-field=target_path]{min-width:24rem}.error{color:var(--danger)}</style><script src="/static/js/archive-import.js?v=3" defer></script></body></html>{{ end }}