Core

/views/vadmin/Settings.html (4.8 KB)

 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{% import (
"{{{ .Package }}}/app"
"{{{ .Package }}}/app/controller/cutil"{{{ if .HasAccount }}}
"{{{ .Package }}}/app/lib/user"{{{ end }}}
"{{{ .Package }}}/app/util"
"{{{ .Package }}}/views/components"
"{{{ .Package }}}/views/layout"{{{ if.HasAccount }}}
"{{{ .Package }}}/views/vauth"{{{ end }}}
) %}

{% code type Settings struct {
layout.Basic{{{ if .HasAccount }}}
Perms user.Permissions{{{ end }}}
} %}

{% func (p *Settings) Body(as *app.State, ps *cutil.PageState) %}
<div class="card">
{%- if util.AppSource != "" -%}
<div class="right"><a target="_blank" rel="noopener noreferrer" href="{%s util.AppSource %}"><button>Github</button></a></div>
{%- endif -%}
<h3 title="github:{%s as.BuildInfo.Commit %}">{%= components.SVGRefIcon(`cog`, ps) %}{%s util.AppName %} {%s as.BuildInfo.String() %}</h3>
{%- if util.AppLegal != "" -%}
<div class="mt">{%s= util.AppLegal %}</div>
{%- endif -%}
{%- if util.AppURL != "" -%}
<p><a target="_blank" rel="noopener noreferrer" href="{%s= util.AppURL %}">{%s= util.AppURL %}</a></p>
{%- endif -%}
</div>{{{ if.HasModule "audit" }}}

<div class="card">
<h3>Audits</h3>
<ul class="mt">
<li><a href="/admin/audit">{%= components.SVGRefIcon(`cog`, ps) %}View audit logs</a></li>
</ul>
</div>{{{ end }}}{{{ if.HasModule "databaseui" }}}

<div class="card">
<h3>{%= components.SVGRefIcon(`database`, ps) %}Database Management</h3>
<ul class="mt">
<li><a href="/admin/database">Database management</a></li>
</ul>
</div>{{{ end }}}

<div class="card">
<h3>{%= components.SVGRefIcon(`archive`, ps) %}Admin Functions</h3>
{%= settingsLink("/admin/server", "archive", "App Information", "All sorts of info about the server and runtime", ps) %}
{%= settingsLink("/admin/modules", "archive", "Go Modules", "The Go modules used by " + util.AppName, ps) %}{{{ if.HasModule "migration" }}}
{%= settingsLink("/admin/migrations", "archive", "Database Migrations", "Shows the full content of all database SQL migrations", ps) %}{{{ end }}}{{{ if .HasModule "queue" }}}
{%= settingsLink("/admin/queue", "archive", "Queue Statistics", "Manages the queue consumers and producers", ps) %}{{{ end }}}
{%= settingsLink("/theme", "archive", "Edit Themes", "Configure the design themes available to end users", ps) %}{{{ if .HasModule "process" }}}
{%= settingsLink("/admin/exec", "archive", "Managed Processes", "Manage OS processes from within this app", ps) %}{{{ end }}}{{{ if .HasModule "scripting" }}}
{%= settingsLink("/admin/scripting", "archive", "Script Files", "View and run the JavaScript files managed by the server", ps) %}{{{ end }}}
{%= settingsLink("/admin/logs", "archive", "Recent Logs", "Displays the 100 most recent app logs", ps) %}
<div class="clear"></div>
</div>
<div class="card">
<h3>{%= components.SVGRefIcon(`bolt`, ps) %}HTTP Methods</h3>
{%= settingsLink("/admin/sitemap", "bolt", "Sitemap", "Displays the HTTP actions that are available, with documentation", ps) %}
{%= settingsLink("/admin/routes", "bolt", "HTTP routes", "Enumerates all registered HTTP routes, by method", ps) %}
{%= settingsLink("/admin/session", "bolt", "User Session", "View the user session, including all cookies and settings", ps) %}
{%= settingsLink("/admin/request", "bolt", "Debug HTTP Request", "Full debug view of an HTTP request from your browser", ps) %}{{{ if .HasModule "websocket" }}}
{%= settingsLink("/admin/sockets", "bolt", "Active WebSockets", "Manage the active WebSockets in this server", ps) %}{{{ end }}}
<div class="clear"></div>
</div>
<div class="card">
<h3>{%= components.SVGRefIcon(`cog`, ps) %}App Profiling</h3>
{%= settingsLink("/admin/memusage", "cog", "Memory Usage", "Detailed memory usage statistics", ps) %}
{%= settingsLink("/admin/gc", "cog", "Collect Garbage", "Runs the Go garbage collector", ps) %}
{%= settingsLink("/admin/heap", "cog", "Write Memory Dump", "Writes a memory dump to <em>./tmp/mem.pprof</em>, use script to view", ps) %}
{%= settingsLink("/admin/cpu/start", "cog", "Start CPU Profile", "Profiles the CPU using <em>./tmp/cpu.pprof</em>, use script to view", ps) %}
{%= settingsLink("/admin/cpu/stop", "cog", "Stop CPU Profile", "Stops the active CPU profile", ps) %}
<div class="clear"></div>
</div>{{{ if.HasAccount }}}

{%= vauth.Authentication(as, ps) %}

{%= vauth.Permissions(p.Perms, as) %}{{{ end }}}
{% endfunc %}

{% func settingsLink(href string, icon string, title string, description string, ps *cutil.PageState) %}{% stripspace %}
<hr class="clear" />
<div class="mts">
<a href="{%s href %}"><strong>{%s title %}</strong></a>
<div><em>{%s= description %}</em></div>
</div>
{% endstripspace %}{% endfunc %}