mirror of https://github.com/gogs/gogs.git
admin: show all version in dashboard
And removed version info from footer.pull/5927/head
parent
3a2b2de814
commit
ea75f01ba2
|
@ -9,7 +9,6 @@ sign_out = Sign Out
|
|||
sign_up = Sign Up
|
||||
register = Register
|
||||
website = Website
|
||||
version = Version
|
||||
page = Page
|
||||
template = Template
|
||||
language = Language
|
||||
|
@ -1001,6 +1000,12 @@ first_page = First
|
|||
last_page = Last
|
||||
total = Total: %d
|
||||
|
||||
dashboard.build_info = Build Information
|
||||
dashboard.app_ver = Application version
|
||||
dashboard.git_version = Git version
|
||||
dashboard.go_version = Go version
|
||||
dashboard.build_time = Build time
|
||||
dashboard.build_commit = Build commit
|
||||
dashboard.statistic = Statistics
|
||||
dashboard.operations = Operations
|
||||
dashboard.system_status = System Monitor Status
|
||||
|
@ -1157,14 +1162,12 @@ auths.github_api_endpoint = API Endpoint
|
|||
config.not_set = (not set)
|
||||
config.server_config = Server Configuration
|
||||
config.app_name = Application Name
|
||||
config.app_ver = Application Version
|
||||
config.app_url = Application URL
|
||||
config.domain = Domain
|
||||
config.offline_mode = Offline Mode
|
||||
config.disable_router_log = Disable Router Log
|
||||
config.run_user = Run User
|
||||
config.run_mode = Run Mode
|
||||
config.git_version = Git Version
|
||||
config.static_file_root_path = Static File Root Path
|
||||
config.log_file_root_path = Log File Root Path
|
||||
config.reverse_auth_user = Reverse Authentication User
|
||||
|
|
2
gogs.go
2
gogs.go
|
@ -20,7 +20,7 @@ import (
|
|||
const Version = "0.12.0+dev"
|
||||
|
||||
func init() {
|
||||
setting.AppVer = Version
|
||||
setting.AppVersion = Version
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -66,7 +66,7 @@ func runBackup(c *cli.Context) error {
|
|||
metadata := ini.Empty()
|
||||
metadata.Section("").Key("VERSION").SetValue(com.ToStr(_CURRENT_BACKUP_FORMAT_VERSION))
|
||||
metadata.Section("").Key("DATE_TIME").SetValue(time.Now().String())
|
||||
metadata.Section("").Key("GOGS_VERSION").SetValue(setting.AppVer)
|
||||
metadata.Section("").Key("GOGS_VERSION").SetValue(setting.AppVersion)
|
||||
if err = metadata.SaveTo(metaFile); err != nil {
|
||||
log.Fatal(0, "Fail to save metadata '%s': %v", metaFile, err)
|
||||
}
|
||||
|
|
|
@ -68,8 +68,8 @@ func runRestore(c *cli.Context) error {
|
|||
log.Fatal(0, "Failed to load metadata '%s': %v", metaFile, err)
|
||||
}
|
||||
backupVersion := metadata.Section("").Key("GOGS_VERSION").MustString("999.0")
|
||||
if version.Compare(setting.AppVer, backupVersion, "<") {
|
||||
log.Fatal(0, "Current Gogs version is lower than backup version: %s < %s", setting.AppVer, backupVersion)
|
||||
if version.Compare(setting.AppVersion, backupVersion, "<") {
|
||||
log.Fatal(0, "Current Gogs version is lower than backup version: %s < %s", setting.AppVersion, backupVersion)
|
||||
}
|
||||
formatVersion := metadata.Section("").Key("VERSION").MustInt()
|
||||
if formatVersion == 0 {
|
||||
|
|
|
@ -325,7 +325,6 @@ func Contexter() macaron.Handler {
|
|||
|
||||
c.Data["ShowRegistrationButton"] = setting.Service.ShowRegistrationButton
|
||||
c.Data["ShowFooterBranding"] = setting.ShowFooterBranding
|
||||
c.Data["ShowFooterVersion"] = setting.ShowFooterVersion
|
||||
|
||||
c.renderNoticeBanner()
|
||||
|
||||
|
|
|
@ -29,9 +29,8 @@ const (
|
|||
MONITOR = "admin/monitor"
|
||||
)
|
||||
|
||||
var (
|
||||
startTime = time.Now()
|
||||
)
|
||||
// initTime is the time when the application was initialized.
|
||||
var initTime = time.Now()
|
||||
|
||||
var sysStatus struct {
|
||||
Uptime string
|
||||
|
@ -75,7 +74,7 @@ var sysStatus struct {
|
|||
}
|
||||
|
||||
func updateSystemStatus() {
|
||||
sysStatus.Uptime = tool.TimeSincePro(startTime)
|
||||
sysStatus.Uptime = tool.TimeSincePro(initTime)
|
||||
|
||||
m := new(runtime.MemStats)
|
||||
runtime.ReadMemStats(m)
|
||||
|
@ -126,9 +125,9 @@ const (
|
|||
)
|
||||
|
||||
func Dashboard(c *context.Context) {
|
||||
c.Data["Title"] = c.Tr("admin.dashboard")
|
||||
c.Data["PageIsAdmin"] = true
|
||||
c.Data["PageIsAdminDashboard"] = true
|
||||
c.Title("admin.dashboard")
|
||||
c.PageIs("Admin")
|
||||
c.PageIs("AdminDashboard")
|
||||
|
||||
// Run operation.
|
||||
op, _ := com.StrTo(c.Query("op")).Int()
|
||||
|
@ -165,15 +164,20 @@ func Dashboard(c *context.Context) {
|
|||
} else {
|
||||
c.Flash.Success(success)
|
||||
}
|
||||
c.Redirect(setting.AppSubURL + "/admin")
|
||||
c.SubURLRedirect("/admin")
|
||||
return
|
||||
}
|
||||
|
||||
c.Data["GitVersion"] = setting.Git.Version
|
||||
c.Data["GoVersion"] = runtime.Version()
|
||||
c.Data["BuildTime"] = setting.BuildTime
|
||||
c.Data["BuildCommit"] = setting.BuildCommit
|
||||
|
||||
c.Data["Stats"] = db.GetStatistic()
|
||||
// FIXME: update periodically
|
||||
updateSystemStatus()
|
||||
c.Data["SysStatus"] = sysStatus
|
||||
c.HTML(200, DASHBOARD)
|
||||
c.Success(DASHBOARD)
|
||||
}
|
||||
|
||||
func SendTestMail(c *context.Context) {
|
||||
|
@ -229,7 +233,6 @@ func Config(c *context.Context) {
|
|||
c.Data["DisableGravatar"] = setting.DisableGravatar
|
||||
c.Data["EnableFederatedAvatar"] = setting.EnableFederatedAvatar
|
||||
|
||||
c.Data["GitVersion"] = setting.Git.Version
|
||||
c.Data["Git"] = setting.Git
|
||||
|
||||
type logger struct {
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
func TemplatePreview(c *context.Context) {
|
||||
c.Data["User"] = db.User{Name: "Unknown"}
|
||||
c.Data["AppName"] = setting.AppName
|
||||
c.Data["AppVer"] = setting.AppVer
|
||||
c.Data["AppVersion"] = setting.AppVersion
|
||||
c.Data["AppURL"] = setting.AppURL
|
||||
c.Data["Code"] = "2014031910370000009fff6782aadb2162b4a997acb69d4400888e0b9274657374"
|
||||
c.Data["ActiveCodeLives"] = setting.Service.ActiveCodeLives / 60
|
||||
|
|
|
@ -54,7 +54,7 @@ var (
|
|||
BuildCommit string
|
||||
|
||||
// App settings
|
||||
AppVer string
|
||||
AppVersion string
|
||||
AppName string
|
||||
AppURL string
|
||||
AppSubURL string
|
||||
|
@ -815,7 +815,7 @@ func newLogService() {
|
|||
}
|
||||
|
||||
// Make sure everyone gets version info printed.
|
||||
log.Info("%s %s", AppName, AppVer)
|
||||
log.Info("%s %s", AppName, AppVersion)
|
||||
if !hasConsole {
|
||||
log.Delete(log.CONSOLE)
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import (
|
|||
"html/template"
|
||||
"mime"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
@ -37,9 +36,6 @@ var (
|
|||
func FuncMap() []template.FuncMap {
|
||||
funcMapOnce.Do(func() {
|
||||
funcMap = []template.FuncMap{map[string]interface{}{
|
||||
"GoVer": func() string {
|
||||
return strings.Title(runtime.Version())
|
||||
},
|
||||
"Year": func() int {
|
||||
return time.Now().Year()
|
||||
},
|
||||
|
@ -56,7 +52,7 @@ func FuncMap() []template.FuncMap {
|
|||
return setting.AppURL
|
||||
},
|
||||
"AppVer": func() string {
|
||||
return setting.AppVer
|
||||
return setting.AppVersion
|
||||
},
|
||||
"AppDomain": func() string {
|
||||
return setting.Domain
|
||||
|
|
|
@ -3142,11 +3142,14 @@ footer .ui.language .menu {
|
|||
.admin .table.segment:not(.select) td:first-of-type {
|
||||
padding-left: 15px !important;
|
||||
}
|
||||
.admin code {
|
||||
color: #db2828;
|
||||
}
|
||||
.admin.user .email {
|
||||
max-width: 200px;
|
||||
}
|
||||
.admin dl.admin-dl-horizontal {
|
||||
padding: 20px;
|
||||
padding: 10px 15px;
|
||||
margin: 0;
|
||||
}
|
||||
.admin dl.admin-dl-horizontal dd {
|
||||
|
@ -3171,9 +3174,6 @@ footer .ui.language .menu {
|
|||
background-color: #f7f7f7;
|
||||
padding: 5px;
|
||||
}
|
||||
.admin.config code {
|
||||
color: #db2828;
|
||||
}
|
||||
.admin.config .log-config table tbody tr td:first-child {
|
||||
width: 100px;
|
||||
}
|
||||
|
@ -3234,3 +3234,4 @@ footer .ui.language .menu {
|
|||
.ui.user.list .item .description a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
/*# sourceMappingURL=gogs.css.map */
|
File diff suppressed because one or more lines are too long
|
@ -28,7 +28,11 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
code {
|
||||
color: #db2828;
|
||||
}
|
||||
|
||||
&.user {
|
||||
.email {
|
||||
|
@ -37,7 +41,7 @@
|
|||
}
|
||||
|
||||
dl.admin-dl-horizontal {
|
||||
padding: 20px;
|
||||
padding: 10px 15px;
|
||||
margin: 0;
|
||||
|
||||
dd {
|
||||
|
@ -65,9 +69,6 @@
|
|||
background-color: #f7f7f7;
|
||||
padding: 5px;
|
||||
}
|
||||
code {
|
||||
color: #db2828;
|
||||
}
|
||||
.log-config {
|
||||
table tbody tr td {
|
||||
&:first-child {
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
<dl class="dl-horizontal admin-dl-horizontal">
|
||||
<dt>{{.i18n.Tr "admin.config.app_name"}}</dt>
|
||||
<dd>{{AppName}}</dd>
|
||||
<dt>{{.i18n.Tr "admin.config.app_ver"}}</dt>
|
||||
<dd>{{AppVer}}</dd>
|
||||
<dt>{{.i18n.Tr "admin.config.app_url"}}</dt>
|
||||
<dd>{{.AppURL}}</dd>
|
||||
<dt>{{.i18n.Tr "admin.config.domain"}}</dt>
|
||||
|
@ -267,8 +265,6 @@
|
|||
</h4>
|
||||
<div class="ui attached table segment">
|
||||
<dl class="dl-horizontal admin-dl-horizontal">
|
||||
<dt>{{.i18n.Tr "admin.config.git_version"}}</dt>
|
||||
<dd>{{.GitVersion}}</dd>
|
||||
<dt>{{.i18n.Tr "admin.config.git_disable_diff_highlight"}}</dt>
|
||||
<dd><i class="fa fa{{if .Git.DisableDiffHighlight}}-check{{end}}-square-o"></i></dd>
|
||||
<dt>{{.i18n.Tr "admin.config.git_max_diff_lines"}}</dt>
|
||||
|
|
|
@ -5,6 +5,30 @@
|
|||
{{template "admin/navbar" .}}
|
||||
<div class="twelve wide column content">
|
||||
{{template "base/alert" .}}
|
||||
<h4 class="ui top attached header">
|
||||
{{.i18n.Tr "admin.dashboard.build_info"}}
|
||||
</h4>
|
||||
<div class="ui attached table segment">
|
||||
<dl class="dl-horizontal admin-dl-horizontal">
|
||||
<dt>{{.i18n.Tr "admin.dashboard.app_ver"}}</dt>
|
||||
<dd>{{AppVer}}</dd>
|
||||
<dt>{{.i18n.Tr "admin.dashboard.git_version"}}</dt>
|
||||
<dd>{{.GitVersion}}</dd>
|
||||
<dt>{{.i18n.Tr "admin.dashboard.go_version"}}</dt>
|
||||
<dd>{{.GoVersion}}</dd>
|
||||
<dt>{{.i18n.Tr "admin.dashboard.build_time"}}</dt>
|
||||
<dd>{{.BuildTime}}</dd>
|
||||
<dt>{{.i18n.Tr "admin.dashboard.build_commit"}}</dt>
|
||||
<dd>
|
||||
{{if .BuildCommit}}
|
||||
<a target="_blank" href="https://github.com/gogs/gogs/commit/{{.BuildCommit}}">{{.BuildCommit}} <i class="fa fa-external-link" aria-hidden="true"></i></a>
|
||||
{{else}}
|
||||
N/A
|
||||
{{end}}
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
<h4 class="ui top attached header">
|
||||
{{.i18n.Tr "admin.dashboard.statistic"}}
|
||||
</h4>
|
||||
|
@ -13,6 +37,7 @@
|
|||
{{.i18n.Tr "admin.dashboard.statistic_info" .Stats.Counter.User .Stats.Counter.Org .Stats.Counter.PublicKey .Stats.Counter.Repo .Stats.Counter.Watch .Stats.Counter.Star .Stats.Counter.Action .Stats.Counter.Access .Stats.Counter.Issue .Stats.Counter.Comment .Stats.Counter.Oauth .Stats.Counter.Follow .Stats.Counter.Mirror .Stats.Counter.Release .Stats.Counter.LoginSource .Stats.Counter.Webhook .Stats.Counter.Milestone .Stats.Counter.Label .Stats.Counter.HookTask .Stats.Counter.Team .Stats.Counter.UpdateTask .Stats.Counter.Attachment | Str2HTML}}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<h4 class="ui top attached header">
|
||||
{{.i18n.Tr "admin.dashboard.operations"}}
|
||||
</h4>
|
||||
|
|
|
@ -7,9 +7,14 @@
|
|||
<footer>
|
||||
<div class="ui container">
|
||||
<div class="ui left">
|
||||
© {{Year}} Gogs {{if (or .ShowFooterVersion .PageIsAdmin)}}{{.i18n.Tr "version"}}: {{AppVer}}{{end}} {{if ShowFooterTemplateLoadTime}}{{.i18n.Tr "page"}}: <strong>{{LoadTimes .PageStartTime}}</strong> {{.i18n.Tr "template"}}: <strong>{{call .TmplLoadTimes}}</strong>{{end}}
|
||||
© {{Year}} Gogs
|
||||
</div>
|
||||
<div class="ui right links">
|
||||
{{if ShowFooterTemplateLoadTime}}
|
||||
<span>
|
||||
{{.i18n.Tr "page"}}: <strong>{{LoadTimes .PageStartTime}}</strong> {{.i18n.Tr "template"}}: <strong>{{call .TmplLoadTimes}}</strong>
|
||||
</span>
|
||||
{{end}}
|
||||
{{if .ShowFooterBranding}}
|
||||
<a target="_blank" rel="noopener noreferrer" href="https://github.com/gogs/gogs"><i class="fa fa-github-square"></i><span class="sr-only">GitHub</span></a>
|
||||
<a target="_blank" rel="noopener noreferrer" href="https://twitter.com/GogsHQ"><i class="fa fa-twitter"></i><span class="sr-only">Twitter</span></a>
|
||||
|
@ -26,7 +31,6 @@
|
|||
</div>
|
||||
<a href="/assets/librejs/librejs.html" style="display:none" data-jslicense="1">Javascript Licenses</a>
|
||||
<a target="_blank" rel="noopener noreferrer" href="https://gogs.io">{{.i18n.Tr "website"}}</a>
|
||||
{{if (or .ShowFooterVersion .PageIsAdmin)}}<span class="version">{{GoVer}}</span>{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
<p style="margin-top: 100px"><img src="{{AppSubURL}}/img/404.png" alt="404"/></p>
|
||||
<div class="ui divider"></div>
|
||||
<br>
|
||||
{{if .ShowFooterVersion}}<p>Application Version: {{AppVer}}</p>{{end}}
|
||||
<p>If you think this is an error, please open an issue on <a href="https://github.com/gogits/gogs/issues/new">GitHub</a>.</p>
|
||||
<p>If you think this is an error, please open an issue on <a href="https://github.com/gogs/gogs/issues/new">GitHub</a>.</p>
|
||||
</div>
|
||||
{{template "base/footer" .}}
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
<div class="ui divider"></div>
|
||||
<br>
|
||||
{{if .ErrorMsg}}<p>An error has occurred : {{.ErrorMsg}}</p>{{end}}
|
||||
{{if .ShowFooterVersion}}<p>Application Version: {{AppVer}}</p>{{end}}
|
||||
{{if .IsAdmin}}<p>Application Version: {{AppVer}}</p>{{end}}
|
||||
</div>
|
||||
{{template "base/footer" .}}
|
||||
|
|
Loading…
Reference in New Issue