github.com/kyleu/dbaudit@v0.0.2-0.20240321155047-ff2f2c940496/views/vadmin/Settings.html (about)

     1  <!-- Content managed by Project Forge, see [projectforge.md] for details. -->
     2  {% import (
     3    "github.com/kyleu/dbaudit/app"
     4    "github.com/kyleu/dbaudit/app/controller/cutil"
     5    "github.com/kyleu/dbaudit/app/lib/user"
     6    "github.com/kyleu/dbaudit/app/util"
     7    "github.com/kyleu/dbaudit/views/components"
     8    "github.com/kyleu/dbaudit/views/layout"
     9    "github.com/kyleu/dbaudit/views/vauth"
    10  ) %}
    11  
    12  {% code type Settings struct {
    13    layout.Basic
    14    Perms user.Permissions
    15  } %}
    16  
    17  {% func (p *Settings) Body(as *app.State, ps *cutil.PageState) %}
    18    <div class="card">
    19      {%- if util.AppSource != "" -%}
    20      <div class="right"><a target="_blank" rel="noopener noreferrer" href="{%s util.AppSource %}"><button>GitHub</button></a></div>
    21      {%- endif -%}
    22      <h3 title="github:{%s as.BuildInfo.Commit %}">{%= components.SVGRefIcon(`cog`, ps) %}{%s util.AppName %} {%s as.BuildInfo.String() %}</h3>
    23      {%- if util.AppLegal != "" -%}
    24      <div class="mt">{%s= util.AppLegal %}</div>
    25      {%- endif -%}
    26      {%- if util.AppURL != "" -%}
    27      <p><a target="_blank" rel="noopener noreferrer" href="{%s= util.AppURL %}">{%s= util.AppURL %}</a></p>
    28      {%- endif -%}
    29      <em>This page is for the settings of the application. To change your user preferences, such as themes, <a href="/profile">edit your profile</a>.</em>
    30    </div>
    31  
    32    <div class="card">
    33      <h3>{%= components.SVGRefIcon(`archive`, ps) %}Admin Functions</h3>
    34      {%= settingsLink("/admin/server", "archive", "App Information", "All sorts of info about the server and runtime", ps) %}
    35      {%= settingsLink("/admin/modules", "archive", "Go Modules", "The Go modules used by " + util.AppName, ps) %}
    36      {%= settingsLink("/theme", "archive", "Edit Themes", "Configure the design themes available to end users", ps) %}
    37      {%= settingsLink("/admin/logs", "archive", "Recent Logs", "Displays the 100 most recent app logs", ps) %}
    38      <div class="clear"></div>
    39    </div>
    40    <div class="card">
    41      <h3>{%= components.SVGRefIcon(`bolt`, ps) %}HTTP Methods</h3>
    42      {%= settingsLink("/admin/sitemap", "bolt", "Sitemap", "Displays the HTTP actions that are available, with documentation", ps) %}
    43      {%= settingsLink("/admin/routes", "bolt", "HTTP routes", "Enumerates all registered HTTP routes, by method", ps) %}
    44      {%= settingsLink("/admin/session", "bolt", "User Session", "View the user session, including all cookies and settings", ps) %}
    45      {%= settingsLink("/admin/request", "bolt", "Debug HTTP Request", "Full debug view of an HTTP request from your browser", ps) %}
    46      <div class="clear"></div>
    47    </div>
    48    <div class="card">
    49      <h3>{%= components.SVGRefIcon(`cog`, ps) %}App Profiling</h3>
    50      {%= settingsLink("/admin/memusage", "cog", "Memory Usage", "Detailed memory usage statistics", ps) %}
    51      {%= settingsLink("/admin/gc", "cog", "Collect Garbage", "Runs the Go garbage collector", ps) %}
    52      {%= settingsLink("/admin/heap", "cog", "Write Memory Dump", "Writes a memory dump to <em>./tmp/mem.pprof</em>, use script to view", ps) %}
    53      {%= settingsLink("/admin/cpu/start", "cog", "Start CPU Profile", "Profiles the CPU using <em>./tmp/cpu.pprof</em>, use script to view", ps) %}
    54      {%= settingsLink("/admin/cpu/stop", "cog", "Stop CPU Profile", "Stops the active CPU profile", ps) %}
    55      <div class="clear"></div>
    56    </div>
    57    <div class="card">
    58      <h3>{%= components.SVGRefIcon(`database`, ps) %}Database Management</h3>
    59      {%= settingsLink("/admin/database", "database", "Database Management", "Tools for exploring and manipulating your database", ps) %}
    60      {%= settingsLink("/admin/migrations", "archive", "Migrations", "Shows the full content of all database SQL migrations", ps) %}
    61    </div>
    62  
    63    {%= vauth.Authentication(as, ps) %}
    64  
    65    {%= vauth.Permissions(p.Perms, as) %}
    66  {% endfunc %}
    67  
    68  {% func settingsLink(href string, icon string, title string, description string, ps *cutil.PageState) %}{% stripspace %}
    69    <hr class="clear" />
    70    <div class="mts">
    71      <a href="{%s href %}"><strong>{%s title %}</strong></a>
    72      <div><em>{%s= description %}</em></div>
    73    </div>
    74  {% endstripspace %}{% endfunc %}