mirror of https://github.com/statping/statping
user api fix - message fixes - checkin fix
parent
3e433ea8bf
commit
07899b05a3
2
Makefile
2
Makefile
|
@ -1,4 +1,4 @@
|
||||||
VERSION=0.79.89
|
VERSION=0.79.9
|
||||||
BINARY_NAME=statup
|
BINARY_NAME=statup
|
||||||
GOPATH:=$(GOPATH)
|
GOPATH:=$(GOPATH)
|
||||||
GOCMD=go
|
GOCMD=go
|
||||||
|
|
|
@ -94,6 +94,13 @@ func (c Core) CurrentTime() string {
|
||||||
return current.Format(ansic)
|
return current.Format(ansic)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Messages will return the current local time
|
||||||
|
func (c Core) Messages() []*Message {
|
||||||
|
var message []*Message
|
||||||
|
messagesDb().Where("service = ?", 0).Limit(10).Find(&message)
|
||||||
|
return message
|
||||||
|
}
|
||||||
|
|
||||||
// UsingAssets will return true if /assets folder is present
|
// UsingAssets will return true if /assets folder is present
|
||||||
func (c Core) UsingAssets() bool {
|
func (c Core) UsingAssets() bool {
|
||||||
return source.UsingAssets(utils.Directory)
|
return source.UsingAssets(utils.Directory)
|
||||||
|
|
|
@ -76,6 +76,9 @@ func apiUserUpdateHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
decoder := json.NewDecoder(r.Body)
|
decoder := json.NewDecoder(r.Body)
|
||||||
decoder.Decode(&user)
|
decoder.Decode(&user)
|
||||||
|
if user.Password != "" {
|
||||||
|
user.Password = utils.HashPassword(user.Password)
|
||||||
|
}
|
||||||
err = user.Update()
|
err = user.Update()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
sendErrorJson(fmt.Errorf("issue updating user #%v: %v", user.Id, err), w, r)
|
sendErrorJson(fmt.Errorf("issue updating user #%v: %v", user.Id, err), w, r)
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-3">
|
<div class="col-3">
|
||||||
<label for="submit" class="col-form-label"></label>
|
<label for="submit" class="col-form-label"></label>
|
||||||
<input type="hidden" name="service_id" class="form-control" id="checkin_name" placeholder="New Checkin">
|
<input type="hidden" name="service_id" class="form-control" id="service_id" value="{{.Id}}">
|
||||||
<button type="submit" id="submit" class="btn btn-success d-block">Save Checkin</button>
|
<button type="submit" id="submit" class="btn btn-success d-block">Save Checkin</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -25,13 +25,13 @@
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="password" class="col-sm-4 col-form-label">Password</label>
|
<label for="password" class="col-sm-4 col-form-label">Password</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input type="password" name="password" class="form-control" id="password" {{if ne .Id 0}}value="##########"{{end}} placeholder="Password" required>
|
<input type="password" name="password" class="form-control" id="password" {{if ne .Id 0}}value=""{{end}} placeholder="Password" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="password_confirm" class="col-sm-4 col-form-label">Confirm Password</label>
|
<label for="password_confirm" class="col-sm-4 col-form-label">Confirm Password</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
<input type="password" name="password_confirm" class="form-control" id="password_confirm" {{if ne .Id 0}}value="##########"{{end}} placeholder="Confirm Password" required>
|
<input type="password" name="password_confirm" class="form-control" id="password_confirm" {{if ne .Id 0}}value=""{{end}} placeholder="Confirm Password" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
|
|
|
@ -8,8 +8,24 @@
|
||||||
<h5 class="col-12 text-center mb-5 header-desc">{{ .Description }}</h5>
|
<h5 class="col-12 text-center mb-5 header-desc">{{ .Description }}</h5>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if .Messages }}
|
||||||
|
<div class="col-12">
|
||||||
|
{{range .Messages}}
|
||||||
|
<div class="alert alert-warning" role="alert">
|
||||||
|
<h3>{{.Title}}</h3>
|
||||||
|
<span class="mb-3">{{safe .Description}}</span>
|
||||||
|
<div class="d-block mt-2 mb-4">
|
||||||
|
<span class="float-left small">Starts at {{.StartOn}}</span>
|
||||||
|
<span class="float-right small">Ends on {{.EndOn}}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
{{end}}
|
||||||
|
|
||||||
<div class="col-12 full-col-12 mb-5">
|
<div class="col-12 full-col-12 mb-5">
|
||||||
<div class="list-group online_list">
|
|
||||||
|
<div class="list-group online_list">
|
||||||
{{ range Services }}
|
{{ range Services }}
|
||||||
<a href="#" class="service_li list-group-item list-group-item-action {{if not .Online}}bg-danger text-white{{ end }}" data-id="{{.Id}}">
|
<a href="#" class="service_li list-group-item list-group-item-action {{if not .Online}}bg-danger text-white{{ end }}" data-id="{{.Id}}">
|
||||||
{{ .Name }}
|
{{ .Name }}
|
||||||
|
@ -32,8 +48,9 @@
|
||||||
<p class="mb-0">If this is a bug, please make an issue in the Statup Github Repo. <a href="https://github.com/hunterlong/statup" class="btn btn-sm btn-outline-danger float-right">Statup Github Repo</a></p>
|
<p class="mb-0">If this is a bug, please make an issue in the Statup Github Repo. <a href="https://github.com/hunterlong/statup" class="btn btn-sm btn-outline-danger float-right">Statup Github Repo</a></p>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{ range Services }}
|
{{ range Services }}
|
||||||
<div class="mt-4" id="service_id_{{.Id}}">
|
<div class="mb-4" id="service_id_{{.Id}}">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<a href="/message/{{.Id}}" class="btn btn-outline-secondary"><i class="fas fa-exclamation-triangle"></i> Edit</a>
|
<a href="/message/{{.Id}}" class="btn btn-outline-secondary"><i class="fas fa-exclamation-triangle"></i> Edit</a>
|
||||||
<a href="/api/messages/{{.Id}}" class="ajax_delete btn btn-danger confirm-btn" data-method="DELETE" data-obj="message_{{.Id}}" data-id="{{.Id}}"><i class="fas fa-times"></i></a>
|
<a href="/api/messages/{{.Id}}" class="ajax_delete btn btn-danger" data-method="DELETE" data-obj="message_{{.Id}}" data-id="{{.Id}}"><i class="fas fa-times"></i></a>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -141,7 +141,7 @@
|
||||||
{{ if lt $ch.Expected 0}}{{Duration $ch.Expected}} ago{{else}}in {{Duration $ch.Expected}}{{end}}
|
{{ if lt $ch.Expected 0}}{{Duration $ch.Expected}} ago{{else}}in {{Duration $ch.Expected}}{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</td>
|
</td>
|
||||||
<td><a href="/api/checkin/{{$ch.Id}}" data-method="DELETE" data-obj="checkin_{{$ch.Id}}" data-id="{{$ch.Id}}" class="ajax_delete btn btn-sm btn-danger">Delete</a></td>
|
<td><a href="/api/checkin/{{$ch.ApiKey}}" data-method="DELETE" data-obj="checkin_{{$ch.Id}}" data-id="{{$ch.Id}}" class="ajax_delete btn btn-sm btn-danger">Delete</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{{end}}
|
{{end}}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
{{template "nav"}}
|
{{template "nav"}}
|
||||||
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
|
|
||||||
{{if ne (len .) 0}}
|
{{if ne (len .) 0}}
|
||||||
<h3>Services</h3>
|
<h3>Services</h3>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
|
|
Loading…
Reference in New Issue