Core

/views/vadmin/Settings.html (6.5 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
{% import (
"{{{ .Package }}}/app"
"{{{ .Package }}}/app/controller/cutil"{{{ if .HasModule "settings" }}}
"{{{ .Package }}}/app/lib/settings"{{{ end }}}{{{ if .HasAccount }}}
"{{{ .Package }}}/app/lib/user"{{{ end }}}
"{{{ .Package }}}/app/util"
"{{{ .Package }}}/views/components"
"{{{ .Package }}}/views/components/view"
"{{{ .Package }}}/views/layout"{{{ if .HasAccount }}}
"{{{ .Package }}}/views/vauth"{{{ end }}}
) %}

{% code type Settings struct {
layout.Basic{{{ if .HasAccount }}}
Perms user.Permissions{{{ end }}}
BuildInfo *app.BuildInfo{{{ if .HasModule "settings" }}}
CurrentSettings *settings.Settings{{{ 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 p.BuildInfo.Commit %}">{%= components.SVGIcon(`cog`, ps) %} {%s util.AppName %} {%s p.BuildInfo.String() %}</h3>
{%- if util.AppLegal != "" -%}
<div class="mt">{%s= util.AppLegal %}</div>
{%- endif -%}
{%- if util.AppURL != "" -%}
<p>{%= view.URL(util.AppURL, "", true, ps) %}</p>
{%- endif -%}
<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>
</div>{{{ if .HasModule "audit" }}}

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

{%- if p.CurrentSettings != nil -%}
<div class="card">
<h3>{%= components.SVGIcon(`cog`, ps) %} App Settings</h3>
<hr />
<div class="overflow full-width">
<table class="min-200 expanded">
<tbody>
{%= view.Fields(settings.SettingsFieldDescs, p.CurrentSettings.ToMap(), ps) %}
</tbody>
</table>
</div>
</div>
{%- endif -%}{{{ end }}}

<div class="card">
<h3>{%= components.SVGIcon(`archive`, ps) %} Admin Functions</h3>
{%= settingsLink("/admin/server", "archive", "App Information", "All sorts of info about the server and runtime", ps) %}
{%= settingsLink("/admin/modules", "robot", "Go Modules", "The Go modules used by " + util.AppName, ps) %}{{{ if .HasModule "queue" }}}
{%= settingsLink("/admin/queue", "archive", "Queue Management", "Manages the queue consumers and producers", ps) %}{{{ end }}}
{%= settingsLink("/theme", "archive", "Edit Themes", "Configure the design themes available to end users", ps) %}{{{ if .HasModule "schedule" }}}
{%= settingsLink("/admin/schedule", "stopwatch", "Scheduled Jobs", "Manage the execution and results from scheduled tasks", ps) %}{{{ end }}}{{{ 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 }}}{{{ if .HasModule "task" }}}
{%= settingsLink("/admin/task", "task", "Task Engine", "See the tasks that have run, and start new runs", ps) %}{{{ end }}}
{%= settingsLink("/admin/logs", "folder", "Recent Logs", "Displays the 100 most recent app logs", ps) %}
<div class="clear"></div>
</div>
<div class="card">
<h3>{%= components.SVGIcon(`bolt`, ps) %} HTTP Methods</h3>
{%= settingsLink("/admin/sitemap", "graph", "Sitemap", "Displays the HTTP actions that are available, with documentation", ps) %}
{%= settingsLink("/admin/routes", "folder", "HTTP routes", "Enumerates all registered HTTP routes, by method", ps) %}
{%= settingsLink("/admin/session", "play", "User Session", "View the user session, including all cookies and settings", ps) %}
{%= settingsLink("/admin/request", "download", "Debug HTTP Request", "Full debug view of an HTTP request from your browser", ps) %}{{{ if .HasModule "websocket" }}}
{%= settingsLink("/admin/sockets", "cog", "Active WebSockets", "Manage the active WebSockets in this server", ps) %}{{{ end }}}{{{ if .HasModule "brands" }}}
{%= settingsLink("/admin/brands", "bolt", "Brand Icons", "Displays the brand icons that are available to this application", ps) %}{{{ end }}}
<div class="clear"></div>
</div>
<div class="card">
<h3>{%= components.SVGIcon(`cog`, ps) %} App Profiling</h3>{{{ if .HasModule "system" }}}
{%= settingsLink("/admin/system", "desktop", "System Status", "Tons of info about the computer running this application", ps) %}{{{ end }}}
{%= settingsLink("/admin/memusage", "desktop", "Memory Usage", "Detailed memory usage statistics for this application", ps) %}
{%= settingsLink("/admin/gc", "cog", "Collect Garbage", "Runs the Go garbage collector", ps) %}{{{ if .DangerousOK }}}
{%= 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) %}{{{ end }}}
<div class="clear"></div>
</div>{{{ if .HasModules "databaseui" "migration" }}}
<div class="card">
<h3>{%= components.SVGIcon(`database`, ps) %} Database Management</h3>{{{ if .HasModule "databaseui" }}}
{%= settingsLink("/admin/database", "database", "Database Management", "Tools for exploring and manipulating your database", ps) %}{{{ end }}}{{{ if .HasModule "migration" }}}
{%= settingsLink("/admin/migrations", "archive", "Migrations", "Shows the full content of all database SQL migrations", ps) %}{{{ end }}}
</div>{{{ end }}}{{{ 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 ml">
<a href="{%s href %}">{%= components.SVGInline(icon, 16, ps) %}{% space %}<strong>{%s title %}</strong></a>
<div><em>{%s= description %}</em></div>
</div>
{% endstripspace %}{% endfunc %}