Config for history
This commit is contained in:
parent
a180ae3b92
commit
a4a0fb2b48
4 changed files with 6 additions and 7 deletions
|
|
@ -41,6 +41,7 @@ func saveConfigHandler(w http.ResponseWriter, r *http.Request) {
|
|||
AppConfig.Color = r.FormValue("color")
|
||||
AppConfig.IgnoreIP = r.FormValue("ignoreip")
|
||||
AppConfig.LogLevel = r.FormValue("loglevel")
|
||||
AppConfig.HistDays = r.FormValue("history")
|
||||
|
||||
timeout := r.FormValue("timeout")
|
||||
AppConfig.Timeout, err = strconv.Atoi(timeout)
|
||||
|
|
|
|||
|
|
@ -9,8 +9,6 @@ import (
|
|||
func lineHandler(w http.ResponseWriter, r *http.Request) {
|
||||
var guiData models.GuiData
|
||||
|
||||
updateAllHosts()
|
||||
|
||||
guiData.Config = AppConfig
|
||||
guiData.Hosts = []models.Host{}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ func sortByIPs(method string) {
|
|||
}
|
||||
|
||||
func sortHandler(w http.ResponseWriter, r *http.Request) {
|
||||
var guiData models.GuiData
|
||||
|
||||
sortMethod := r.FormValue("sort_method")
|
||||
|
||||
|
|
@ -76,10 +75,7 @@ func sortHandler(w http.ResponseWriter, r *http.Request) {
|
|||
updateAllHosts()
|
||||
}
|
||||
|
||||
guiData.Config = AppConfig
|
||||
guiData.Hosts = AllHosts
|
||||
|
||||
execTemplate(w, "line", guiData)
|
||||
http.Redirect(w, r, r.Header.Get("Referer"), 302)
|
||||
}
|
||||
|
||||
func sortByField(method string, field string) {
|
||||
|
|
|
|||
|
|
@ -69,6 +69,10 @@
|
|||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Keep history (days)</td>
|
||||
<td><input name="history" type="text" class="form-control" value="{{ .Config.HistDays }}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><button type="submit" class="btn btn-primary">Save</button></td>
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Reference in a new issue