Browse Source

new UI on admin/monitor

pull/1503/head
Unknwon 9 years ago
parent
commit
81b8427438
  1. 11
      cmd/web.go
  2. 20
      config.codekit
  3. 4
      docker/README.md
  4. 2
      public/css/gogs.min.css
  5. 18
      public/less/_admin.less
  6. 1
      public/less/gogs.less
  7. 133
      templates/admin/monitor.tmpl
  8. 29
      templates/admin/navbar.tmpl
  9. 114
      templates/repo/settings/deploy_keys.tmpl

11
cmd/web.go

@ -12,7 +12,6 @@ import (
"net/http" "net/http"
"net/http/fcgi" "net/http/fcgi"
"os" "os"
"os/signal"
"path" "path"
"strings" "strings"
@ -531,16 +530,6 @@ func runWeb(ctx *cli.Context) {
// Not found handler. // Not found handler.
m.NotFound(routers.NotFound) m.NotFound(routers.NotFound)
// Detect kill signal.
c := make(chan os.Signal, 1)
signal.Notify(c, os.Interrupt)
go func() {
for _ = range c {
fmt.Println("Kill signal detected, exiting now...")
os.Exit(0)
}
}()
// Flag for port number in case first time run conflict. // Flag for port number in case first time run conflict.
if ctx.IsSet("port") { if ctx.IsSet("port") {
setting.AppUrl = strings.Replace(setting.AppUrl, setting.HttpPort, ctx.String("port"), 1) setting.AppUrl = strings.Replace(setting.AppUrl, setting.HttpPort, ctx.String("port"), 1)

20
config.codekit

@ -235,6 +235,26 @@
"outputPathIsSetByUser": 0, "outputPathIsSetByUser": 0,
"processed": 1 "processed": 1
}, },
"\/public\/less\/_admin.less": {
"allowInsecureImports": 0,
"createSourceMap": 0,
"disableJavascript": 0,
"fileType": 1,
"ieCompatibility": 1,
"ignore": 1,
"ignoreWasSetByUser": 0,
"inputAbbreviatedPath": "\/public\/less\/_admin.less",
"outputAbbreviatedPath": "\/public\/css\/_admin.css",
"outputPathIsOutsideProject": 0,
"outputPathIsSetByUser": 0,
"outputStyle": 0,
"relativeURLS": 0,
"shouldRunAutoprefixer": 0,
"shouldRunBless": 0,
"strictImports": 0,
"strictMath": 0,
"strictUnits": 0
},
"\/public\/less\/_base.less": { "\/public\/less\/_base.less": {
"allowInsecureImports": 0, "allowInsecureImports": 0,
"createSourceMap": 0, "createSourceMap": 0,

4
docker/README.md

@ -59,3 +59,7 @@ checkVersion()] [E] Binary and template file version does not match
``` ```
Run `rm -fr /var/gogs/gogs/templates/` should fix this it. Just remember to backup templates file if you have made modifications youself. Run `rm -fr /var/gogs/gogs/templates/` should fix this it. Just remember to backup templates file if you have made modifications youself.
## Known Issues
- [Use ctrl+c when clone through SSH makes Docker exit unexpectedly](https://github.com/gogits/gogs/issues/1499)

2
public/css/gogs.min.css vendored

File diff suppressed because one or more lines are too long

18
public/less/_admin.less

@ -0,0 +1,18 @@
.admin {
padding-top: 15px;
padding-bottom: @footer-margin * 3;
.table.segment {
padding: 0;
font-size: 13px;
th {
padding-top: 5px;
padding-bottom: 5px;
}
th, td {
&:first-child {
padding-left: 15px;
}
}
}
}

1
public/less/gogs.less

@ -5,3 +5,4 @@
@import "_install"; @import "_install";
@import "_form"; @import "_form";
@import "_repository"; @import "_repository";
@import "_admin";

133
templates/admin/monitor.tmpl

@ -1,74 +1,65 @@
{{template "ng/base/head" .}} {{template "base/head" .}}
{{template "ng/base/header" .}} <div class="admin monitor">
<div id="admin-wrapper"> <div class="ui container">
<div id="setting-wrapper" class="main-wrapper"> <div class="ui grid">
<div id="admin-setting" class="container clear"> {{template "admin/navbar" .}}
{{template "admin/nav" .}} <div class="twelve wide column content">
<div class="grid-4-5 left"> {{template "base/alert" .}}
<div class="setting-content"> <h4 class="ui top attached header">
{{template "ng/base/alert" .}} {{.i18n.Tr "admin.monitor.cron"}}
<div id="setting-content"> </h4>
<div class="panel panel-radius"> <div class="ui attached table segment">
<div class="panel-header"> <table class="ui very basic striped table">
<strong>{{.i18n.Tr "admin.monitor.cron"}}</strong> <thead>
</div> <tr>
<div class="panel-body admin-panel"> <th>{{.i18n.Tr "admin.monitor.name"}}</th>
<table class="table table-striped"> <th>{{.i18n.Tr "admin.monitor.schedule"}}</th>
<thead> <th>{{.i18n.Tr "admin.monitor.next"}}</th>
<tr> <th>{{.i18n.Tr "admin.monitor.previous"}}</th>
<th>{{.i18n.Tr "admin.monitor.name"}}</th> <th>{{.i18n.Tr "admin.monitor.execute_times"}}</th>
<th>{{.i18n.Tr "admin.monitor.schedule"}}</th> </tr>
<th>{{.i18n.Tr "admin.monitor.next"}}</th> </thead>
<th>{{.i18n.Tr "admin.monitor.previous"}}</th> <tbody>
<th>{{.i18n.Tr "admin.monitor.execute_times"}}</th> {{range .Entries}}
</tr> <tr>
</thead> <td>{{.Description}}</td>
<tbody> <td>{{.Spec}}</td>
{{range .Entries}} <td>{{DateFmtLong .Next}}</td>
<tr> <td>{{if gt .Prev.Year 1 }}{{DateFmtLong .Prev}}{{else}}N/A{{end}}</td>
<td>{{.Description}}</td> <td>{{.ExecTimes}}</td>
<td>{{.Spec}}</td> </tr>
<td>{{.Next}}</td> {{end}}
<td>{{.Prev}}</td> </tbody>
<td>{{.ExecTimes}}</td> </table>
</tr>
{{end}}
</tbody>
</table>
</div>
</div>
<br>
<div class="panel panel-radius">
<div class="panel-header">
<strong>{{.i18n.Tr "admin.monitor.process"}}</strong>
</div>
<div class="panel-body admin-panel">
<table class="table table-striped">
<thead>
<tr>
<th>Pid</th>
<th>{{.i18n.Tr "admin.monitor.desc"}}</th>
<th>{{.i18n.Tr "admin.monitor.start"}}</th>
<th>{{.i18n.Tr "admin.monitor.execute_time"}}</th>
</tr>
</thead>
<tbody>
{{range .Processes}}
<tr>
<td>{{.Pid}}</td>
<td>{{.Description}}</td>
<td>{{.Start}}</td>
<td>{{TimeSince .Start $.Lang}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div> </div>
<h4 class="ui top attached header">
{{.i18n.Tr "admin.monitor.process"}}
</h4>
<div class="ui attached table segment">
<table class="ui very basic striped table">
<thead>
<tr>
<th>Pid</th>
<th>{{.i18n.Tr "admin.monitor.desc"}}</th>
<th>{{.i18n.Tr "admin.monitor.start"}}</th>
<th>{{.i18n.Tr "admin.monitor.execute_time"}}</th>
</tr>
</thead>
<tbody>
{{range .Processes}}
<tr>
<td>{{.Pid}}</td>
<td>{{.Description}}</td>
<td>{{DateFmtLong .Start}}</td>
<td>{{TimeSince .Start $.Lang}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</div>
</div> </div>
</div>
</div> </div>
{{template "ng/base/footer" .}} {{template "base/footer" .}}

29
templates/admin/navbar.tmpl

@ -0,0 +1,29 @@
<div class="four wide column">
<div class="ui vertical menu">
<div class="header item">{{.i18n.Tr "admin_panel"}}</div>
<a class="{{if .PageIsAdminDashboard}}active{{end}} item" href="{{AppSubUrl}}/admin">
{{.i18n.Tr "admin.dashboard"}}
</a>
<a class="{{if .PageIsAdminUsers}}active{{end}} item" href="{{AppSubUrl}}/admin/users">
{{.i18n.Tr "admin.users"}}
</a>
<a class="{{if .PageIsAdminOrganizations}}active{{end}} item" href="{{AppSubUrl}}/admin/orgs">
{{.i18n.Tr "admin.organizations"}}
</a>
<a class="{{if .PageIsAdminRepositories}}active{{end}} item" href="{{AppSubUrl}}/admin/repos">
{{.i18n.Tr "admin.repositories"}}
</a>
<a class="{{if .PageIsAdminAuthentications}}active{{end}} item" href="{{AppSubUrl}}/admin/auths">
{{.i18n.Tr "admin.authentication"}}
</a>
<a class="{{if .PageIsAdminConfig}}active{{end}} item" href="{{AppSubUrl}}/admin/config">
{{.i18n.Tr "admin.config"}}
</a>
<a class="{{if .PageIsAdminNotices}}active{{end}} item" href="{{AppSubUrl}}/admin/notices">
{{.i18n.Tr "admin.notices"}}
</a>
<a class="{{if .PageIsAdminMonitor}}active{{end}} item" href="{{AppSubUrl}}/admin/monitor">
{{.i18n.Tr "admin.monitor"}}
</a>
</div>
</div>

114
templates/repo/settings/deploy_keys.tmpl

@ -2,73 +2,73 @@
<div class="repository settings"> <div class="repository settings">
{{template "repo/header" .}} {{template "repo/header" .}}
<div class="ui container"> <div class="ui container">
<div class="ui grid"> <div class="ui grid">
{{template "repo/settings/navbar" .}} {{template "repo/settings/navbar" .}}
<div class="twelve wide column content"> <div class="twelve wide column content">
{{template "base/alert" .}} {{template "base/alert" .}}
<h4 class="ui top attached header"> <h4 class="ui top attached header">
{{.i18n.Tr "repo.settings.deploy_keys"}} {{.i18n.Tr "repo.settings.deploy_keys"}}
<div class="ui right"> <div class="ui right">
<div id="add-deploy-key" class="ui blue tiny button">{{.i18n.Tr "repo.settings.add_deploy_key"}}</div> <div id="add-deploy-key" class="ui blue tiny button">{{.i18n.Tr "repo.settings.add_deploy_key"}}</div>
</div> </div>
</h4> </h4>
<div class="ui attached segment"> <div class="ui attached segment">
{{if .Deploykeys}} {{if .Deploykeys}}
<div class="ui key list"> <div class="ui key list">
{{range .Deploykeys}} {{range .Deploykeys}}
<div class="item ui grid"> <div class="item ui grid">
<div class="one wide column"> <div class="one wide column">
<i class="ssh-key-state-indicator fa fa-circle{{if .HasRecentActivity}} active invert poping up{{else}}-o{{end}}" {{if .HasRecentActivity}}data-content="{{$.i18n.Tr "settings.key_state_desc"}}" data-variation="inverted"{{end}}></i> <i class="ssh-key-state-indicator fa fa-circle{{if .HasRecentActivity}} active invert poping up{{else}}-o{{end}}" {{if .HasRecentActivity}}data-content="{{$.i18n.Tr "settings.key_state_desc"}}" data-variation="inverted"{{end}}></i>
</div>
<div class="one wide column">
<i class="mega-octicon octicon-key left"></i>
</div>
<div class="eleven wide column">
<strong>{{.Name}}</strong>
<div class="print meta">
{{.Fingerprint}}
</div> </div>
<div class="activity meta"> <div class="one wide column">
<i>{{$.i18n.Tr "settings.add_on"}} <span>{{DateFmtShort .Created}}</span> — <i class="octicon octicon-info"></i> {{if .HasUsed}}{{$.i18n.Tr "settings.last_used"}} <span>{{DateFmtShort .Updated}}</span>{{else}}{{$.i18n.Tr "settings.no_activity"}}{{end}}</i> <i class="mega-octicon octicon-key left"></i>
</div>
<div class="eleven wide column">
<strong>{{.Name}}</strong>
<div class="print meta">
{{.Fingerprint}}
</div>
<div class="activity meta">
<i>{{$.i18n.Tr "settings.add_on"}} <span>{{DateFmtShort .Created}}</span> — <i class="octicon octicon-info"></i> {{if .HasUsed}}{{$.i18n.Tr "settings.last_used"}} <span>{{DateFmtShort .Updated}}</span>{{else}}{{$.i18n.Tr "settings.no_activity"}}{{end}}</i>
</div>
</div>
<div class="two wide column">
<button class="ui red tiny button delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}">
{{$.i18n.Tr "settings.delete_key"}}
</button>
</div> </div>
</div> </div>
<div class="two wide column"> {{end}}
<button class="ui red tiny button delete-button" data-url="{{$.Link}}/delete" data-id="{{.ID}}">
{{$.i18n.Tr "settings.delete_key"}}
</button>
</div>
</div> </div>
{{else}}
{{.i18n.Tr "repo.settings.no_deploy_keys"}}
{{end}} {{end}}
</div> </div>
{{else}} <br>
{{.i18n.Tr "repo.settings.no_deploy_keys"}} <div {{if not .HasError}}class="hide"{{end}} id="add-deploy-key-panel">
{{end}} <h4 class="ui top attached header">
</div> {{.i18n.Tr "repo.settings.add_deploy_key"}}
<br> </h4>
<div {{if not .HasError}}class="hide"{{end}} id="add-deploy-key-panel"> <div class="ui attached segment">
<h4 class="ui top attached header"> <form class="ui form" action="{{.Link}}" method="post">
{{.i18n.Tr "repo.settings.add_deploy_key"}} {{.CsrfTokenHtml}}
</h4> <div class="field {{if .Err_Title}}error{{end}}">
<div class="ui attached segment"> <label>{{.i18n.Tr "repo.settings.title"}}</label>
<form class="ui form" action="{{.Link}}" method="post"> <input name="title" value="{{.title}}" autofocus required>
{{.CsrfTokenHtml}} </div>
<div class="field {{if .Err_Title}}error{{end}}"> <div class="field {{if .Err_Content}}error{{end}}">
<label>{{.i18n.Tr "repo.settings.title"}}</label> <label>{{.i18n.Tr "repo.settings.deploy_key_content"}}</label>
<input name="title" value="{{.title}}" autofocus required> <textarea name="content" required>{{.content}}</textarea>
</div> </div>
<div class="field {{if .Err_Content}}error{{end}}"> <button class="ui green button">
<label>{{.i18n.Tr "repo.settings.deploy_key_content"}}</label> {{.i18n.Tr "repo.settings.add_deploy_key"}}
<textarea name="content" required>{{.content}}</textarea> </button>
</div> </form>
<button class="ui green button"> </div>
{{.i18n.Tr "repo.settings.add_deploy_key"}}
</button>
</form>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
</div> </div>
<div class="ui small basic delete modal"> <div class="ui small basic delete modal">

Loading…
Cancel
Save