feat(logs): jq filtering, feat(import): directory picker, refactor(admin): move routes to seperate file
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
76
templates/pages/admin-import.tmpl
Normal file
76
templates/pages/admin-import.tmpl
Normal file
@@ -0,0 +1,76 @@
|
||||
{{ template "base" . }}
|
||||
{{ define "title" }}Admin - Import{{ end }}
|
||||
{{ define "header" }}<a class="whitespace-pre" href="../admin">Admin - Import</a>{{ end }}
|
||||
{{ define "content" }}
|
||||
<div class="overflow-x-auto">
|
||||
<div class="inline-block min-w-full overflow-hidden rounded shadow">
|
||||
{{ if .SelectedDirectory }}
|
||||
<div class="flex flex-col grow gap-2 p-4 rounded shadow-lg bg-white dark:bg-gray-700 text-gray-500 dark:text-white">
|
||||
<p class="text-lg font-semibold text-gray-500">Selected Import Directory</p>
|
||||
<form class="flex gap-4 flex-col" action="./import" method="POST">
|
||||
<input type="text" name="directory" value="{{ .SelectedDirectory }}" class="hidden" />
|
||||
<div class="flex justify-between gap-4 w-full">
|
||||
<div class="flex gap-4 items-center">
|
||||
<span>{{ template "svg/import" }}</span>
|
||||
<p class="font-medium text-lg break-all">{{ .SelectedDirectory }}</p>
|
||||
</div>
|
||||
<div class="flex flex-col justify-around gap-2 mr-4">
|
||||
<div class="inline-flex gap-2 items-center">
|
||||
<input checked type="radio" id="copy" name="type" value="COPY" />
|
||||
<label for="copy">Copy</label>
|
||||
</div>
|
||||
<div class="inline-flex gap-2 items-center">
|
||||
<input type="radio" id="direct" name="type" value="DIRECT" />
|
||||
<label for="direct">Direct</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit"
|
||||
class="px-10 py-2 text-base font-semibold text-center text-white transition duration-200 ease-in bg-black shadow-md hover:text-black hover:bg-white focus:outline-none focus:ring-2">
|
||||
<span class="w-full">Import Directory</span>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
{{ end }}
|
||||
{{ if not .SelectedDirectory }}
|
||||
<table class="min-w-full leading-normal bg-white dark:bg-gray-700 text-sm">
|
||||
<thead class="text-gray-800 dark:text-gray-400">
|
||||
<tr>
|
||||
<th class="p-3 font-normal text-left border-b border-gray-200 dark:border-gray-800 w-12"></th>
|
||||
<th class="p-3 font-normal text-left border-b border-gray-200 dark:border-gray-800 break-all">{{ .CurrentPath }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="text-black dark:text-white">
|
||||
{{ if not (eq .CurrentPath "/") }}
|
||||
<tr>
|
||||
<td class="p-3 border-b border-gray-200 text-gray-800 dark:text-gray-400"></td>
|
||||
<td class="p-3 border-b border-gray-200">
|
||||
<a href="./import?directory={{$.CurrentPath}}/../">
|
||||
<p>../</p>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ if not .Data }}
|
||||
<tr>
|
||||
<td class="text-center p-3" colspan="2">No Folder</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ range $item := .Data }}
|
||||
<tr>
|
||||
<td class="p-3 border-b border-gray-200 text-gray-800 dark:text-gray-400">
|
||||
<a href="./import?select={{ $.CurrentPath }}/{{ $item }}">{{ template "svg/import" }}</a>
|
||||
</td>
|
||||
<td class="p-3 border-b border-gray-200">
|
||||
<a href="./import?directory={{ $.CurrentPath }}/{{ $item }}">
|
||||
<p>{{ $item }}</p>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
@@ -2,6 +2,27 @@
|
||||
{{ define "title" }}Admin - Logs{{ end }}
|
||||
{{ define "header" }}<a class="whitespace-pre" href="../admin">Admin - Logs</a>{{ end }}
|
||||
{{ define "content" }}
|
||||
<div class="flex flex-col gap-2 grow p-4 mb-4 rounded shadow-lg bg-white dark:bg-gray-700 text-gray-500 dark:text-white">
|
||||
<form class="flex gap-4 flex-col lg:flex-row" action="./logs" method="GET">
|
||||
<div class="flex flex-col w-full grow">
|
||||
<div class="flex relative">
|
||||
<span class="inline-flex items-center px-3 border-t bg-white border-l border-b border-gray-300 text-gray-500 shadow-sm text-sm">
|
||||
{{ template "svg/search2" (dict "Size" 15) }}
|
||||
</span>
|
||||
<input type="text"
|
||||
id="filter"
|
||||
name="filter"
|
||||
value="{{ .Filter }}"
|
||||
class="flex-1 appearance-none rounded-none border border-gray-300 w-full py-2 px-2 bg-white text-gray-700 placeholder-gray-400 shadow-sm text-base focus:outline-none focus:ring-2 focus:ring-purple-600 focus:border-transparent"
|
||||
placeholder="JQ Filter" />
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit"
|
||||
class="px-10 py-2 text-base font-semibold text-center text-white transition duration-200 ease-in bg-black shadow-md hover:text-black hover:bg-white focus:outline-none focus:ring-2">
|
||||
<span class="w-full">Filter</span>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="flex flex-col-reverse text-black dark:text-white"
|
||||
style="font-family: monospace">
|
||||
{{ range $log := .Data }}
|
||||
|
||||
@@ -2,128 +2,84 @@
|
||||
{{ define "title" }}Admin - General{{ end }}
|
||||
{{ define "header" }}<a class="whitespace-pre" href="./admin">Admin - General</a>{{ end }}
|
||||
{{ define "content" }}
|
||||
<div class="w-full flex flex-col md:flex-row gap-4">
|
||||
<div>
|
||||
<div class="flex flex-col p-4 items-center rounded shadow-lg md:w-60 lg:w-80 bg-white dark:bg-gray-700 text-gray-500 dark:text-white">
|
||||
{{ template "svg/user" (dict "Size" 60) }}
|
||||
<p class="text-lg">{{ .Authorization.UserName }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col gap-4 grow">
|
||||
<div class="flex flex-col gap-2 grow p-4 rounded shadow-lg bg-white dark:bg-gray-700 text-gray-500 dark:text-white">
|
||||
<p class="text-lg font-semibold mb-2">Import Documents</p>
|
||||
<form class="flex gap-4 flex-col" action="./admin" method="POST">
|
||||
<input type="text" name="action" value="IMPORT" class="hidden" />
|
||||
<div class="flex gap-4">
|
||||
<div class="flex grow relative">
|
||||
<span class="inline-flex items-center px-3 border-t bg-white border-l border-b border-gray-300 text-gray-500 shadow-sm text-sm">
|
||||
{{ template "svg/import" (dict "Size" 15) }}
|
||||
</span>
|
||||
<input type="text"
|
||||
name="import_directory"
|
||||
class="flex-1 appearance-none rounded-none border border-gray-300 w-full py-2 px-4 bg-white text-gray-700 placeholder-gray-400 shadow-sm text-base focus:outline-none focus:ring-2 focus:ring-purple-600 focus:border-transparent"
|
||||
placeholder="Directory" />
|
||||
<div class="w-full flex flex-col gap-4 grow">
|
||||
<div class="flex flex-col gap-2 grow p-4 rounded shadow-lg bg-white dark:bg-gray-700 text-gray-500 dark:text-white">
|
||||
<p class="text-lg font-semibold mb-2">Backup & Restore</p>
|
||||
<div class="flex flex-col gap-4">
|
||||
<form class="flex justify-between" action="./admin" method="POST">
|
||||
<input type="text" name="action" value="BACKUP" class="hidden" />
|
||||
<div class="flex gap-8 items-center">
|
||||
<div>
|
||||
<input type="checkbox" id="backup_covers" name="backup_types" value="COVERS" />
|
||||
<label for="backup_covers">Covers</label>
|
||||
</div>
|
||||
<div class="flex flex-col mr-4">
|
||||
<div class="inline-flex gap-2">
|
||||
<input checked type="radio" id="copy" name="import_type" value="COPY" />
|
||||
<label for="copy">Copy</label>
|
||||
</div>
|
||||
<div class="inline-flex gap-2">
|
||||
<input type="radio" id="direct" name="import_type" value="DIRECT" />
|
||||
<label for="direct">Direct</label>
|
||||
</div>
|
||||
<div>
|
||||
<input type="checkbox"
|
||||
id="backup_documents"
|
||||
name="backup_types"
|
||||
value="DOCUMENTS" />
|
||||
<label for="backup_documents">Documents</label>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit"
|
||||
class="px-10 py-2 text-base font-semibold text-center text-white transition duration-200 ease-in bg-black shadow-md hover:text-black hover:bg-white focus:outline-none focus:ring-2">
|
||||
<span class="w-full">Import Directory</span>
|
||||
class="w-40 px-10 py-2 text-base font-semibold text-center text-white transition duration-200 ease-in bg-black shadow-md hover:text-black hover:bg-white focus:outline-none focus:ring-2">
|
||||
<span class="w-full">Backup</span>
|
||||
</button>
|
||||
</form>
|
||||
<form method="POST"
|
||||
enctype="multipart/form-data"
|
||||
action="./admin"
|
||||
class="flex justify-between grow">
|
||||
<input type="text" name="action" value="RESTORE" class="hidden" />
|
||||
<div class="flex items-center w-1/2">
|
||||
<input type="file" accept=".zip" name="restore_file" class="w-full" />
|
||||
</div>
|
||||
<button type="submit"
|
||||
class="w-40 px-10 py-2 text-base font-semibold text-center text-white transition duration-200 ease-in bg-black shadow-md hover:text-black hover:bg-white focus:outline-none focus:ring-2">
|
||||
<span class="w-full">Restore</span>
|
||||
</button>
|
||||
</form>
|
||||
{{ if .PasswordErrorMessage }}
|
||||
<span class="text-red-400 text-xs">{{ .PasswordErrorMessage }}</span>
|
||||
{{ else if .PasswordMessage }}
|
||||
<span class="text-green-400 text-xs">{{ .PasswordMessage }}</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="flex flex-col gap-2 grow p-4 rounded shadow-lg bg-white dark:bg-gray-700 text-gray-500 dark:text-white">
|
||||
<p class="text-lg font-semibold mb-2">Backup & Restore</p>
|
||||
<div class="flex flex-col gap-4">
|
||||
<form class="flex justify-between" action="./admin" method="POST">
|
||||
<input type="text" name="action" value="BACKUP" class="hidden" />
|
||||
<div class="flex gap-8 items-center">
|
||||
<div>
|
||||
<input type="checkbox" id="backup_covers" name="backup_types" value="COVERS" />
|
||||
<label for="backup_covers">Covers</label>
|
||||
</div>
|
||||
<div>
|
||||
<input type="checkbox"
|
||||
id="backup_documents"
|
||||
name="backup_types"
|
||||
value="DOCUMENTS" />
|
||||
<label for="backup_documents">Documents</label>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit"
|
||||
class="w-40 px-10 py-2 text-base font-semibold text-center text-white transition duration-200 ease-in bg-black shadow-md hover:text-black hover:bg-white focus:outline-none focus:ring-2">
|
||||
<span class="w-full">Backup</span>
|
||||
</button>
|
||||
</form>
|
||||
<form method="POST"
|
||||
enctype="multipart/form-data"
|
||||
action="./admin"
|
||||
class="flex justify-between grow">
|
||||
<input type="text" name="action" value="RESTORE" class="hidden" />
|
||||
<div class="flex items-center w-1/2">
|
||||
<input type="file" accept=".zip" name="restore_file" class="w-full" />
|
||||
</div>
|
||||
<button type="submit"
|
||||
class="w-40 px-10 py-2 text-base font-semibold text-center text-white transition duration-200 ease-in bg-black shadow-md hover:text-black hover:bg-white focus:outline-none focus:ring-2">
|
||||
<span class="w-full">Restore</span>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
{{ if .PasswordErrorMessage }}
|
||||
<span class="text-red-400 text-xs">{{ .PasswordErrorMessage }}</span>
|
||||
{{ else if .PasswordMessage }}
|
||||
<span class="text-green-400 text-xs">{{ .PasswordMessage }}</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="flex flex-col grow p-4 rounded shadow-lg bg-white dark:bg-gray-700 text-gray-500 dark:text-white">
|
||||
<p class="text-lg font-semibold">Tasks</p>
|
||||
<table class="min-w-full bg-white dark:bg-gray-700 text-sm">
|
||||
<tbody class="text-black dark:text-white">
|
||||
<tr>
|
||||
<td class="pl-0">
|
||||
<p>Metadata Matching</p>
|
||||
</td>
|
||||
<td class="py-2 float-right">
|
||||
<form action="./admin" method="POST">
|
||||
<input type="text" name="action" value="METADATA_MATCH" class="hidden" />
|
||||
<button type="submit"
|
||||
class="w-40 px-10 py-2 text-base font-semibold text-center text-white transition duration-200 ease-in bg-black shadow-md hover:text-black hover:bg-white focus:outline-none focus:ring-2">
|
||||
<span class="w-full">Run</span>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>Cache Tables</p>
|
||||
</td>
|
||||
<td class="py-2 float-right">
|
||||
<form action="./admin" method="POST">
|
||||
<input type="text" name="action" value="CACHE_TABLES" class="hidden" />
|
||||
<button type="submit"
|
||||
class="w-40 px-10 py-2 text-base font-semibold text-center text-white transition duration-200 ease-in bg-black shadow-md hover:text-black hover:bg-white focus:outline-none focus:ring-2">
|
||||
<span class="w-full">Run</span>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{{ if .PasswordErrorMessage }}
|
||||
<span class="text-red-400 text-xs">{{ .PasswordErrorMessage }}</span>
|
||||
{{ else if .PasswordMessage }}
|
||||
<span class="text-green-400 text-xs">{{ .PasswordMessage }}</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
<div class="flex flex-col grow p-4 rounded shadow-lg bg-white dark:bg-gray-700 text-gray-500 dark:text-white">
|
||||
<p class="text-lg font-semibold">Tasks</p>
|
||||
<table class="min-w-full bg-white dark:bg-gray-700 text-sm">
|
||||
<tbody class="text-black dark:text-white">
|
||||
<tr>
|
||||
<td class="pl-0">
|
||||
<p>Metadata Matching</p>
|
||||
</td>
|
||||
<td class="py-2 float-right">
|
||||
<form action="./admin" method="POST">
|
||||
<input type="text" name="action" value="METADATA_MATCH" class="hidden" />
|
||||
<button type="submit"
|
||||
class="w-40 px-10 py-2 text-base font-semibold text-center text-white transition duration-200 ease-in bg-black shadow-md hover:text-black hover:bg-white focus:outline-none focus:ring-2">
|
||||
<span class="w-full">Run</span>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<p>Cache Tables</p>
|
||||
</td>
|
||||
<td class="py-2 float-right">
|
||||
<form action="./admin" method="POST">
|
||||
<input type="text" name="action" value="CACHE_TABLES" class="hidden" />
|
||||
<button type="submit"
|
||||
class="w-40 px-10 py-2 text-base font-semibold text-center text-white transition duration-200 ease-in bg-black shadow-md hover:text-black hover:bg-white focus:outline-none focus:ring-2">
|
||||
<span class="w-full">Run</span>
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
||||
|
||||
Reference in New Issue
Block a user