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