[add] better log page, [add] admin users page, [add] admin nav
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-20 14:26:26 -05:00
parent a65750ae21
commit f0a2d2cf69
20 changed files with 265 additions and 77 deletions

View File

@@ -141,28 +141,28 @@
class="flex items-center justify-start w-full p-2 pl-6 my-2 transition-colors duration-200 border-l-4 {{if eq .RouteName "home"}}border-purple-500 dark:text-white{{else}}border-transparent text-gray-400 hover:text-gray-800 dark:hover:text-gray-100{{end}}"
href="/"
>
<span class="text-left">{{ template "svg/home" (dict "Size" 20) }}</span>
{{ template "svg/home" (dict "Size" 20) }}
<span class="mx-4 text-sm font-normal">Home</span>
</a>
<a
class="flex items-center justify-start w-full p-2 pl-6 my-2 transition-colors duration-200 border-l-4 {{if eq .RouteName "documents"}}border-purple-500 dark:text-white{{else}}border-transparent text-gray-400 hover:text-gray-800 dark:hover:text-gray-100{{end}}"
href="/documents"
>
<span class="text-left">{{ template "svg/documents" (dict "Size" 20) }}</span>
{{ template "svg/documents" (dict "Size" 20) }}
<span class="mx-4 text-sm font-normal">Documents</span>
</a>
<a
class="flex items-center justify-start w-full p-2 pl-6 my-2 transition-colors duration-200 border-l-4 {{if eq .RouteName "progress"}}border-purple-500 dark:text-white{{else}}border-transparent text-gray-400 hover:text-gray-800 dark:hover:text-gray-100{{end}}"
href="/progress"
>
<span class="text-left">{{ template "svg/activity" (dict "Size" 20) }}</span>
{{ template "svg/activity" (dict "Size" 20) }}
<span class="mx-4 text-sm font-normal">Progress</span>
</a>
<a
class="flex items-center justify-start w-full p-2 pl-6 my-2 transition-colors duration-200 border-l-4 {{if eq .RouteName "activity"}}border-purple-500 dark:text-white{{else}}border-transparent text-gray-400 hover:text-gray-800 dark:hover:text-gray-100{{end}}"
href="/activity"
>
<span class="text-left">{{ template "svg/activity" (dict "Size" 20) }}</span>
{{ template "svg/activity" (dict "Size" 20) }}
<span class="mx-4 text-sm font-normal">Activity</span>
</a>
{{ if .Config.SearchEnabled }}
@@ -170,12 +170,36 @@
class="flex items-center justify-start w-full p-2 pl-6 my-2 transition-colors duration-200 border-l-4 {{if eq .RouteName "search"}}border-purple-500 dark:text-white{{else}}border-transparent text-gray-400 hover:text-gray-800 dark:hover:text-gray-100{{end}}"
href="/search"
>
<span class="text-left">{{ template "svg/search" (dict "Size" 20) }}</span>
{{ template "svg/search" (dict "Size" 20) }}
<span class="mx-4 text-sm font-normal">Search</span>
</a>
{{ end }}
{{ if .Authorization.IsAdmin }}
<div class="flex flex-col gap-4 p-2 pl-6 my-2 transition-colors duration-200 border-l-4 {{if hasPrefix .RouteName "admin"}}dark:text-white border-purple-500{{else}}border-transparent text-gray-400{{end}}">
<a href="/admin" class="flex justify-start w-full {{if not (hasPrefix .RouteName "admin")}}text-gray-400 hover:text-gray-800 dark:hover:text-gray-100{{end}}">
{{ template "svg/settings" (dict "Size" 20) }}
<span class="mx-4 text-sm font-normal">Admin</span>
</a>
{{ if hasPrefix .RouteName "admin" }}
<a href="/admin" style="padding-left: 1.75em;" class="flex justify-start w-full {{if not (eq .RouteName "admin")}}text-gray-400 hover:text-gray-800 dark:hover:text-gray-100{{end}}">
<span class="mx-4 text-sm font-normal">General</span>
</a>
<a href="/admin/users" style="padding-left: 1.75em;" class="flex justify-start w-full {{if not (eq .RouteName "admin-users")}}text-gray-400 hover:text-gray-800 dark:hover:text-gray-100{{end}}">
<span class="mx-4 text-sm font-normal">Users</span>
</a>
<a href="/admin/logs" style="padding-left: 1.75em;" class="flex justify-start w-full {{if not (eq .RouteName "admin-logs")}}text-gray-400 hover:text-gray-800 dark:hover:text-gray-100{{end}}">
<span class="mx-4 text-sm font-normal">Logs</span>
</a>
{{ end }}
</div>
{{ end }}
</div>
<a class="flex justify-center items-center p-6 w-full absolute bottom-0" target="_blank" href="https://gitea.va.reichard.io/evan/AnthoLume">
<a class="flex flex-col gap-2 justify-center items-center p-6 w-full absolute bottom-0 text-black dark:text-white" target="_blank" href="https://gitea.va.reichard.io/evan/AnthoLume">
<svg
xmlns="http://www.w3.org/2000/svg"
class="text-black dark:text-white"
@@ -211,6 +235,7 @@
/>
</g>
</svg>
<span class="text-xs">{{ .Config.Version }}</span>
</a>
</div>
</div>
@@ -231,19 +256,6 @@
aria-orientation="vertical"
aria-labelledby="options-menu"
>
{{ if .Authorization.IsAdmin }}
<a
href="/admin"
class="block px-4 py-2 text-md text-gray-700 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-100 dark:hover:text-white dark:hover:bg-gray-600"
role="menuitem"
>
<span class="flex flex-col">
<span>Administration</span>
</span>
</a>
{{ end }}
<a
href="/settings"
class="block px-4 py-2 text-md text-gray-700 hover:bg-gray-100 hover:text-gray-900 dark:text-gray-100 dark:hover:text-white dark:hover:bg-gray-600"

View File

@@ -0,0 +1,15 @@
{{template "base" .}} {{define "title"}}Admin - Logs{{end}} {{define
"header"}}
<a class="whitespace-pre" href="../admin">Admin - Logs</a>
{{end}} {{define "content"}}
<div
class="flex flex-col-reverse text-black dark:text-white"
style="font-family: monospace"
>
{{range $log := .Data }}
<span class="whitespace-pre">{{ $log }}</span>
{{end}}
</div>
{{end}}

View File

@@ -0,0 +1,50 @@
{{template "base" .}} {{define "title"}}Admin - Users{{end}} {{define "header"}}
<a class="whitespace-pre" href="../admin">Admin - Users</a>
{{end}} {{define "content"}}
<div class="overflow-x-auto">
<div class="inline-block min-w-full overflow-hidden rounded shadow">
<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 uppercase border-b border-gray-200 dark:border-gray-800 w-12">
{{ template "svg/add" }}
</th>
<th class="p-3 font-normal text-left uppercase border-b border-gray-200 dark:border-gray-800">
User
</th>
<th class="p-3 font-normal text-left uppercase border-b border-gray-200 dark:border-gray-800 text-center">
Permissions
</th>
<th class="p-3 font-normal text-left uppercase border-b border-gray-200 dark:border-gray-800 w-48">
Created
</th>
</tr>
</thead>
<tbody class="text-black dark:text-white">
{{ if not .Data }}
<tr>
<td class="text-center p-3" colspan="2">No Results</td>
</tr>
{{ end }}
{{range $user := .Data }}
<tr>
<td class="p-3 border-b border-gray-200 text-gray-800 dark:text-gray-400">
{{ template "svg/delete" }}
</td>
<td class="p-3 border-b border-gray-200">
<p>{{ $user.ID }}</p>
</td>
<td class="p-3 border-b border-gray-200 text-center min-w-40">
<span class="px-2 py-1 rounded-md text-white dark:text-black {{if $user.Admin}}bg-gray-800 dark:bg-gray-100{{else}}bg-gray-400 dark:bg-gray-600 cursor-pointer{{end}}">admin</span>
<span class="px-2 py-1 rounded-md text-white dark:text-black {{if $user.Admin}}bg-gray-400 dark:bg-gray-600 cursor-pointer{{else}}bg-gray-800 dark:bg-gray-100{{end}}">user</span>
</td>
<td class="p-3 border-b border-gray-200">
<p>{{ $user.CreatedAt }}</p>
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</div>
{{end}}

View File

@@ -1,6 +1,6 @@
{{template "base" .}} {{define "title"}}Administration{{end}} {{define
{{template "base" .}} {{define "title"}}Admin - General{{end}} {{define
"header"}}
<a href="./admin">Administration</a>
<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>
@@ -168,7 +168,6 @@
<td class="py-2 float-right">
<a
href="./admin/logs"
target="_blank"
class="inline-block 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">View</span>

20
templates/svgs/add.svg Normal file
View File

@@ -0,0 +1,20 @@
<svg
width="{{ or .Size 24 }}"
height="{{ or .Size 24 }}"
{{ if .Disabled }}
class="text-gray-200 dark:text-gray-600"
{{ else }}
class="hover:text-gray-800 dark:hover:text-gray-100"
{{ end }}
viewBox="0 0 24 24"
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M12 22C7.28595 22 4.92893 22 3.46447 20.5355C2 19.0711 2 16.714 2 12C2 7.28595 2 4.92893 3.46447 3.46447C4.92893 2 7.28595 2 12 2C16.714 2 19.0711 2 20.5355 3.46447C22 4.92893 22 7.28595 22 12C22 16.714 22 19.0711 20.5355 20.5355C19.0711 22 16.714 22 12 22ZM12 8.25C12.4142 8.25 12.75 8.58579 12.75 9V11.25H15C15.4142 11.25 15.75 11.5858 15.75 12C15.75 12.4142 15.4142 12.75 15 12.75H12.75L12.75 15C12.75 15.4142 12.4142 15.75 12 15.75C11.5858 15.75 11.25 15.4142 11.25 15V12.75H9C8.58579 12.75 8.25 12.4142 8.25 12C8.25 11.5858 8.58579 11.25 9 11.25H11.25L11.25 9C11.25 8.58579 11.5858 8.25 12 8.25Z"
/>
</svg>

After

Width:  |  Height:  |  Size: 972 B

View File

@@ -0,0 +1,20 @@
<svg
width="{{ or .Size 24 }}"
height="{{ or .Size 24 }}"
{{ if .Disabled }}
class="text-gray-200 dark:text-gray-600"
{{ else }}
class="hover:text-gray-800 dark:hover:text-gray-100"
{{ end }}
viewBox="0 0 24 24"
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
>
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M14.2788 2.15224C13.9085 2 13.439 2 12.5 2C11.561 2 11.0915 2 10.7212 2.15224C10.2274 2.35523 9.83509 2.74458 9.63056 3.23463C9.53719 3.45834 9.50065 3.7185 9.48635 4.09799C9.46534 4.65568 9.17716 5.17189 8.69017 5.45093C8.20318 5.72996 7.60864 5.71954 7.11149 5.45876C6.77318 5.2813 6.52789 5.18262 6.28599 5.15102C5.75609 5.08178 5.22018 5.22429 4.79616 5.5472C4.47814 5.78938 4.24339 6.1929 3.7739 6.99993C3.30441 7.80697 3.06967 8.21048 3.01735 8.60491C2.94758 9.1308 3.09118 9.66266 3.41655 10.0835C3.56506 10.2756 3.77377 10.437 4.0977 10.639C4.57391 10.936 4.88032 11.4419 4.88029 12C4.88026 12.5581 4.57386 13.0639 4.0977 13.3608C3.77372 13.5629 3.56497 13.7244 3.41645 13.9165C3.09108 14.3373 2.94749 14.8691 3.01725 15.395C3.06957 15.7894 3.30432 16.193 3.7738 17C4.24329 17.807 4.47804 18.2106 4.79606 18.4527C5.22008 18.7756 5.75599 18.9181 6.28589 18.8489C6.52778 18.8173 6.77305 18.7186 7.11133 18.5412C7.60852 18.2804 8.2031 18.27 8.69012 18.549C9.17714 18.8281 9.46533 19.3443 9.48635 19.9021C9.50065 20.2815 9.53719 20.5417 9.63056 20.7654C9.83509 21.2554 10.2274 21.6448 10.7212 21.8478C11.0915 22 11.561 22 12.5 22C13.439 22 13.9085 22 14.2788 21.8478C14.7726 21.6448 15.1649 21.2554 15.3694 20.7654C15.4628 20.5417 15.4994 20.2815 15.5137 19.902C15.5347 19.3443 15.8228 18.8281 16.3098 18.549C16.7968 18.2699 17.3914 18.2804 17.8886 18.5412C18.2269 18.7186 18.4721 18.8172 18.714 18.8488C19.2439 18.9181 19.7798 18.7756 20.2038 18.4527C20.5219 18.2105 20.7566 17.807 21.2261 16.9999C21.6956 16.1929 21.9303 15.7894 21.9827 15.395C22.0524 14.8691 21.9088 14.3372 21.5835 13.9164C21.4349 13.7243 21.2262 13.5628 20.9022 13.3608C20.4261 13.0639 20.1197 12.558 20.1197 11.9999C20.1197 11.4418 20.4261 10.9361 20.9022 10.6392C21.2263 10.4371 21.435 10.2757 21.5836 10.0835C21.9089 9.66273 22.0525 9.13087 21.9828 8.60497C21.9304 8.21055 21.6957 7.80703 21.2262 7C20.7567 6.19297 20.522 5.78945 20.2039 5.54727C19.7799 5.22436 19.244 5.08185 18.7141 5.15109C18.4722 5.18269 18.2269 5.28136 17.8887 5.4588C17.3915 5.71959 16.7969 5.73002 16.3099 5.45096C15.8229 5.17191 15.5347 4.65566 15.5136 4.09794C15.4993 3.71848 15.4628 3.45833 15.3694 3.23463C15.1649 2.74458 14.7726 2.35523 14.2788 2.15224ZM12.5 15C14.1695 15 15.5228 13.6569 15.5228 12C15.5228 10.3431 14.1695 9 12.5 9C10.8305 9 9.47716 10.3431 9.47716 12C9.47716 13.6569 10.8305 15 12.5 15Z"
/>
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB