mirror of https://github.com/statping/statping
timezone fix - service tabs - statup app updates
parent
f27222dc21
commit
c4b1a5390d
1
Makefile
1
Makefile
|
@ -192,7 +192,6 @@ databases:
|
||||||
#
|
#
|
||||||
# Download and Install dependencies
|
# Download and Install dependencies
|
||||||
#
|
#
|
||||||
|
|
||||||
# run dep to install all required golang dependecies
|
# run dep to install all required golang dependecies
|
||||||
dep:
|
dep:
|
||||||
dep ensure -vendor-only
|
dep ensure -vendor-only
|
||||||
|
|
|
@ -393,6 +393,13 @@ func (s *Service) Update(restart bool) error {
|
||||||
utils.Log(3, fmt.Sprintf("Failed to update service %v. %v", s.Name, err))
|
utils.Log(3, fmt.Sprintf("Failed to update service %v. %v", s.Name, err))
|
||||||
return err.Error
|
return err.Error
|
||||||
}
|
}
|
||||||
|
// clear the notification queue for a service
|
||||||
|
if !s.AllowNotifications.Bool {
|
||||||
|
for _, n := range CoreApp.Notifications {
|
||||||
|
notif := n.(*notifier.Notification)
|
||||||
|
notif.ResetUniqueQueue(s.Id)
|
||||||
|
}
|
||||||
|
}
|
||||||
if restart {
|
if restart {
|
||||||
s.Close()
|
s.Close()
|
||||||
s.Start()
|
s.Start()
|
||||||
|
|
|
@ -93,6 +93,9 @@ var handlerFuncs = func(w http.ResponseWriter, r *http.Request) template.FuncMap
|
||||||
"safe": func(html string) template.HTML {
|
"safe": func(html string) template.HTML {
|
||||||
return template.HTML(html)
|
return template.HTML(html)
|
||||||
},
|
},
|
||||||
|
"safeURL": func(u string) template.URL {
|
||||||
|
return template.URL(u)
|
||||||
|
},
|
||||||
"Auth": func() bool {
|
"Auth": func() bool {
|
||||||
return IsAuthenticated(r)
|
return IsAuthenticated(r)
|
||||||
},
|
},
|
||||||
|
|
|
@ -18,6 +18,7 @@ package handlers
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"github.com/hunterlong/statup/core"
|
"github.com/hunterlong/statup/core"
|
||||||
"github.com/hunterlong/statup/types"
|
"github.com/hunterlong/statup/types"
|
||||||
|
@ -66,12 +67,17 @@ func reorderServiceHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
var newOrder []*serviceOrder
|
var newOrder []*serviceOrder
|
||||||
decoder := json.NewDecoder(r.Body)
|
decoder := json.NewDecoder(r.Body)
|
||||||
decoder.Decode(&newOrder)
|
if err := decoder.Decode(&newOrder); err != nil {
|
||||||
|
utils.Log(3, fmt.Sprint("error decoding reordering services: %v", err.Error()))
|
||||||
|
}
|
||||||
for _, s := range newOrder {
|
for _, s := range newOrder {
|
||||||
service := core.SelectService(s.Id)
|
service := core.SelectService(s.Id)
|
||||||
service.Order = s.Order
|
service.Order = s.Order
|
||||||
service.Update(false)
|
if err := service.Update(false); err != nil {
|
||||||
|
utils.Log(3, fmt.Sprint("error reordering services: %v", err.Error()))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
w.Write([]byte("ok"))
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +178,6 @@ func apiServiceUpdateHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
go service.Check(true)
|
go service.Check(true)
|
||||||
|
|
||||||
sendJsonAction(service, "update", w, r)
|
sendJsonAction(service, "update", w, r)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
package handlers
|
package handlers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"github.com/hunterlong/statup/core"
|
"github.com/hunterlong/statup/core"
|
||||||
"github.com/hunterlong/statup/source"
|
"github.com/hunterlong/statup/source"
|
||||||
|
@ -39,6 +40,7 @@ func saveSettingsHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
http.Redirect(w, r, "/", http.StatusSeeOther)
|
http.Redirect(w, r, "/", http.StatusSeeOther)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
var err error
|
||||||
r.ParseForm()
|
r.ParseForm()
|
||||||
app := core.CoreApp
|
app := core.CoreApp
|
||||||
name := r.PostForm.Get("project")
|
name := r.PostForm.Get("project")
|
||||||
|
@ -65,8 +67,14 @@ func saveSettingsHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
timeFloat, _ := strconv.ParseFloat(timezone, 10)
|
timeFloat, _ := strconv.ParseFloat(timezone, 10)
|
||||||
app.Timezone = float32(timeFloat)
|
app.Timezone = float32(timeFloat)
|
||||||
|
|
||||||
|
utils.Log(1, fmt.Sprintf("timezone: %v", timezone))
|
||||||
|
utils.Log(1, fmt.Sprintf("tzone: %f", app.Timezone))
|
||||||
|
|
||||||
app.UseCdn = types.NewNullBool(r.PostForm.Get("enable_cdn") == "on")
|
app.UseCdn = types.NewNullBool(r.PostForm.Get("enable_cdn") == "on")
|
||||||
core.CoreApp, _ = core.UpdateCore(app)
|
core.CoreApp, err = core.UpdateCore(app)
|
||||||
|
if err != nil {
|
||||||
|
utils.Log(3, fmt.Sprintf("issue updating Core: %v", err.Error()))
|
||||||
|
}
|
||||||
//notifiers.OnSettingsSaved(core.CoreApp.ToCore())
|
//notifiers.OnSettingsSaved(core.CoreApp.ToCore())
|
||||||
ExecuteResponse(w, r, "settings.html", core.CoreApp, "/settings")
|
ExecuteResponse(w, r, "settings.html", core.CoreApp, "/settings")
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,12 +175,10 @@ $('form.ajax_form').on('submit', function() {
|
||||||
let alerter = form.find('#alerter');
|
let alerter = form.find('#alerter');
|
||||||
var arrayData = [];
|
var arrayData = [];
|
||||||
let newArr = {};
|
let newArr = {};
|
||||||
|
console.log(values);
|
||||||
Spinner(button);
|
Spinner(button);
|
||||||
values.forEach(function(k, v) {
|
values.forEach(function(k, v) {
|
||||||
if (k.name === "password_confirm") {
|
if (k.name === "password_confirm" || k.value === "") {
|
||||||
return
|
|
||||||
}
|
|
||||||
if (k.value === "") {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (k.value === "on") {
|
if (k.value === "on") {
|
||||||
|
@ -231,7 +229,6 @@ $('form.ajax_form').on('submit', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
function CreateService(output) {
|
function CreateService(output) {
|
||||||
console.log('creating service', output)
|
|
||||||
let form = output.form;
|
let form = output.form;
|
||||||
let data = output.data.output;
|
let data = output.data.output;
|
||||||
let objTbl = `<tr id="service_${data.id}">
|
let objTbl = `<tr id="service_${data.id}">
|
||||||
|
|
|
@ -76,13 +76,13 @@
|
||||||
|
|
||||||
{{if Auth}}
|
{{if Auth}}
|
||||||
<nav class="nav nav-pills flex-column flex-sm-row mt-3" id="service_tabs" role="serviceLists">
|
<nav class="nav nav-pills flex-column flex-sm-row mt-3" id="service_tabs" role="serviceLists">
|
||||||
<a class="flex-sm-fill text-sm-center nav-link active" id="failures-tab" data-toggle="tab" href="#failures" role="tab" aria-controls="failures" aria-selected="true">Failures</a>
|
<a class="flex-sm-fill text-sm-center nav-link active" id="edit-tab" data-toggle="tab" href="#edit" role="tab" aria-controls="edit" aria-selected="false">Edit Service</a>
|
||||||
|
<a class="flex-sm-fill text-sm-center nav-link" id="failures-tab" data-toggle="tab" href="#failures" role="tab" aria-controls="failures" aria-selected="true">Failures</a>
|
||||||
<a class="flex-sm-fill text-sm-center nav-link" id="checkins-tab" data-toggle="tab" href="#checkins" role="tab" aria-controls="checkins" aria-selected="false">Checkins</a>
|
<a class="flex-sm-fill text-sm-center nav-link" id="checkins-tab" data-toggle="tab" href="#checkins" role="tab" aria-controls="checkins" aria-selected="false">Checkins</a>
|
||||||
<a class="flex-sm-fill text-sm-center nav-link" id="response-tab" data-toggle="tab" href="#response" role="tab" aria-controls="response" aria-selected="false">Response</a>
|
<a class="flex-sm-fill text-sm-center nav-link" id="response-tab" data-toggle="tab" href="#response" role="tab" aria-controls="response" aria-selected="false">Response</a>
|
||||||
<a class="flex-sm-fill text-sm-center nav-link" id="edit-tab" data-toggle="tab" href="#edit" role="tab" aria-controls="edit" aria-selected="false">Edit Service</a>
|
|
||||||
</nav>
|
</nav>
|
||||||
<div class="tab-content" id="myTabContent">
|
<div class="tab-content" id="myTabContent">
|
||||||
<div class="tab-pane fade show active" id="failures" role="serviceLists" aria-labelledby="failures-tab">
|
<div class="tab-pane fade" id="failures" role="serviceLists" aria-labelledby="failures-tab">
|
||||||
{{$failures := $s.LimitedFailures 16}}
|
{{$failures := $s.LimitedFailures 16}}
|
||||||
{{ if $failures }}
|
{{ if $failures }}
|
||||||
<div class="list-group mt-3 mb-4">
|
<div class="list-group mt-3 mb-4">
|
||||||
|
@ -164,7 +164,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade" id="edit" role="serviceLists" aria-labelledby="edit-tab">
|
<div class="tab-pane fade show active" id="edit" role="serviceLists" aria-labelledby="edit-tab">
|
||||||
{{template "form_service" $s}}
|
{{template "form_service" $s}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
var o = {service: parseInt(dId), order: i};
|
var o = {service: parseInt(dId), order: i};
|
||||||
newOrder.push(o);
|
newOrder.push(o);
|
||||||
});
|
});
|
||||||
|
console.log(JSON.stringify(newOrder));
|
||||||
$.post("/services/reorder", JSON.stringify(newOrder), function(data, status){
|
$.post("/services/reorder", JSON.stringify(newOrder), function(data, status){
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -60,37 +60,37 @@
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="timezone">Timezone</label><span class="mt-1 small float-right">Current: {{.CurrentTime}}</span>
|
<label for="timezone">Timezone</label><span class="mt-1 small float-right">Current: {{.CurrentTime}}</span>
|
||||||
<select class="form-control" name="timezone" id="timezone">
|
<select class="form-control" name="timezone" id="timezone">
|
||||||
<option value="-12.0" {{if eq (ToString .Timezone) "-12"}}selected{{end}}>(GMT -12:00) Eniwetok, Kwajalein</option>
|
<option value="-12.0" {{if eq (ToString .Timezone) "-12.000000"}}selected{{end}}>(GMT -12:00) Eniwetok, Kwajalein</option>
|
||||||
<option value="-11.0" {{if eq (ToString .Timezone) "-11"}}selected{{end}}>(GMT -11:00) Midway Island, Samoa</option>
|
<option value="-11.0" {{if eq (ToString .Timezone) "-11.000000"}}selected{{end}}>(GMT -11:00) Midway Island, Samoa</option>
|
||||||
<option value="-10.0" {{if eq (ToString .Timezone) "-10"}}selected{{end}}>(GMT -10:00) Hawaii</option>
|
<option value="-10.0" {{if eq (ToString .Timezone) "-10.000000"}}selected{{end}}>(GMT -10:00) Hawaii</option>
|
||||||
<option value="-9.0" {{if eq (ToString .Timezone) "-9"}}selected{{end}}>(GMT -9:00) Alaska</option>
|
<option value="-9.0" {{if eq (ToString .Timezone) "-9.000000"}}selected{{end}}>(GMT -9:00) Alaska</option>
|
||||||
<option value="-8.0" {{if eq (ToString .Timezone) "-8"}}selected{{end}}>(GMT -8:00) Pacific Time (US & Canada)</option>
|
<option value="-8.0" {{if eq (ToString .Timezone) "-8.000000"}}selected{{end}}>(GMT -8:00) Pacific Time (US & Canada)</option>
|
||||||
<option value="-7.0" {{if eq (ToString .Timezone) "-7"}}selected{{end}}>(GMT -7:00) Mountain Time (US & Canada)</option>
|
<option value="-7.0" {{if eq (ToString .Timezone) "-7.000000"}}selected{{end}}>(GMT -7:00) Mountain Time (US & Canada)</option>
|
||||||
<option value="-6.0" {{if eq (ToString .Timezone) "-6"}}selected{{end}}>(GMT -6:00) Central Time (US & Canada), Mexico City</option>
|
<option value="-6.0" {{if eq (ToString .Timezone) "-6.000000"}}selected{{end}}>(GMT -6:00) Central Time (US & Canada), Mexico City</option>
|
||||||
<option value="-5.0" {{if eq (ToString .Timezone) "-5"}}selected{{end}}>(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima</option>
|
<option value="-5.0" {{if eq (ToString .Timezone) "-5.000000"}}selected{{end}}>(GMT -5:00) Eastern Time (US & Canada), Bogota, Lima</option>
|
||||||
<option value="-4.0" {{if eq (ToString .Timezone) "-4"}}selected{{end}}>(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz</option>
|
<option value="-4.0" {{if eq (ToString .Timezone) "-4.000000"}}selected{{end}}>(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz</option>
|
||||||
<option value="-3.5" {{if eq (ToString .Timezone) "-3.5"}}selected{{end}}>(GMT -3:30) Newfoundland</option>
|
<option value="-3.5" {{if eq (ToString .Timezone) "-3.500000"}}selected{{end}}>(GMT -3:30) Newfoundland</option>
|
||||||
<option value="-3.0" {{if eq (ToString .Timezone) "-3"}}selected{{end}}>(GMT -3:00) Brazil, Buenos Aires, Georgetown</option>
|
<option value="-3.0" {{if eq (ToString .Timezone) "-3.000000"}}selected{{end}}>(GMT -3:00) Brazil, Buenos Aires, Georgetown</option>
|
||||||
<option value="-2.0" {{if eq (ToString .Timezone) "-2"}}selected{{end}}>(GMT -2:00) Mid-Atlantic</option>
|
<option value="-2.0" {{if eq (ToString .Timezone) "-2.000000"}}selected{{end}}>(GMT -2:00) Mid-Atlantic</option>
|
||||||
<option value="-1.0" {{if eq (ToString .Timezone) "-1"}}selected{{end}}>(GMT -1:00 hour) Azores, Cape Verde Islands</option>
|
<option value="-1.0" {{if eq (ToString .Timezone) "-1.000000"}}selected{{end}}>(GMT -1:00 hour) Azores, Cape Verde Islands</option>
|
||||||
<option value="0.0" {{if eq (ToString .Timezone) "0"}}selected{{end}}>(GMT) Western Europe Time, London, Lisbon, Casablanca</option>
|
<option value="0.0" {{if eq (ToString .Timezone) "0.000000"}}selected{{end}}>(GMT) Western Europe Time, London, Lisbon, Casablanca</option>
|
||||||
<option value="1.0" {{if eq (ToString .Timezone) "1"}}selected{{end}}>(GMT +1:00 hour) Brussels, Copenhagen, Madrid, Paris</option>
|
<option value="1.0" {{if eq (ToString .Timezone) "1.000000"}}selected{{end}}>(GMT +1:00 hour) Brussels, Copenhagen, Madrid, Paris</option>
|
||||||
<option value="2.0" {{if eq (ToString .Timezone) "2"}}selected{{end}}>(GMT +2:00) Kaliningrad, South Africa</option>
|
<option value="2.0" {{if eq (ToString .Timezone) "2.000000"}}selected{{end}}>(GMT +2:00) Kaliningrad, South Africa</option>
|
||||||
<option value="3.0" {{if eq (ToString .Timezone) "3"}}selected{{end}}>(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg</option>
|
<option value="3.0" {{if eq (ToString .Timezone) "3.000000"}}selected{{end}}>(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg</option>
|
||||||
<option value="3.5" {{if eq (ToString .Timezone) "3.5"}}selected{{end}}>(GMT +3:30) Tehran</option>
|
<option value="3.5" {{if eq (ToString .Timezone) "3.500000"}}selected{{end}}>(GMT +3:30) Tehran</option>
|
||||||
<option value="4.0" {{if eq (ToString .Timezone) "4"}}selected{{end}}>(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi</option>
|
<option value="4.0" {{if eq (ToString .Timezone) "4.000000"}}selected{{end}}>(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi</option>
|
||||||
<option value="4.5" {{if eq (ToString .Timezone) "4.5"}}selected{{end}}>(GMT +4:30) Kabul</option>
|
<option value="4.5" {{if eq (ToString .Timezone) "4.500000"}}selected{{end}}>(GMT +4:30) Kabul</option>
|
||||||
<option value="5.0" {{if eq (ToString .Timezone) "5"}}selected{{end}}>(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent</option>
|
<option value="5.0" {{if eq (ToString .Timezone) "5.000000"}}selected{{end}}>(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent</option>
|
||||||
<option value="5.5" {{if eq (ToString .Timezone) "5.5"}}selected{{end}}>(GMT +5:30) Bombay, Calcutta, Madras, New Delhi</option>
|
<option value="5.5" {{if eq (ToString .Timezone) "5.500000"}}selected{{end}}>(GMT +5:30) Bombay, Calcutta, Madras, New Delhi</option>
|
||||||
<option value="5.75" {{if eq (ToString .Timezone) "5.75"}}selected{{end}}>(GMT +5:45) Kathmandu</option>
|
<option value="5.75" {{if eq (ToString .Timezone) "5.750000"}}selected{{end}}>(GMT +5:45) Kathmandu</option>
|
||||||
<option value="6.0" {{if eq (ToString .Timezone) "6"}}selected{{end}}>(GMT +6:00) Almaty, Dhaka, Colombo</option>
|
<option value="6.0" {{if eq (ToString .Timezone) "6.000000"}}selected{{end}}>(GMT +6:00) Almaty, Dhaka, Colombo</option>
|
||||||
<option value="7.0" {{if eq (ToString .Timezone) "7"}}selected{{end}}>(GMT +7:00) Bangkok, Hanoi, Jakarta</option>
|
<option value="7.0" {{if eq (ToString .Timezone) "7.000000"}}selected{{end}}>(GMT +7:00) Bangkok, Hanoi, Jakarta</option>
|
||||||
<option value="8.0" {{if eq (ToString .Timezone) "8"}}selected{{end}}>(GMT +8:00) Beijing, Perth, Singapore, Hong Kong</option>
|
<option value="8.0" {{if eq (ToString .Timezone) "8.000000"}}selected{{end}}>(GMT +8:00) Beijing, Perth, Singapore, Hong Kong</option>
|
||||||
<option value="9.0" {{if eq (ToString .Timezone) "9"}}selected{{end}}>(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk</option>
|
<option value="9.0" {{if eq (ToString .Timezone) "9.000000"}}selected{{end}}>(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk</option>
|
||||||
<option value="9.5" {{if eq (ToString .Timezone) "9.5"}}selected{{end}}>(GMT +9:30) Adelaide, Darwin</option>
|
<option value="9.5" {{if eq (ToString .Timezone) "9.500000"}}selected{{end}}>(GMT +9:30) Adelaide, Darwin</option>
|
||||||
<option value="10.0" {{if eq (ToString .Timezone) "10.5"}}selected{{end}}>(GMT +10:00) Eastern Australia, Guam, Vladivostok</option>
|
<option value="10.0" {{if eq (ToString .Timezone) "10.500000"}}selected{{end}}>(GMT +10:00) Eastern Australia, Guam, Vladivostok</option>
|
||||||
<option value="11.0" {{if eq (ToString .Timezone) "11"}}selected{{end}}>(GMT +11:00) Magadan, Solomon Islands, New Caledonia</option>
|
<option value="11.0" {{if eq (ToString .Timezone) "11.000000"}}selected{{end}}>(GMT +11:00) Magadan, Solomon Islands, New Caledonia</option>
|
||||||
<option value="12.0" {{if eq (ToString .Timezone) "12"}}selected{{end}}>(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka</option>
|
<option value="12.0" {{if eq (ToString .Timezone) "12.000000"}}selected{{end}}>(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -119,6 +119,7 @@
|
||||||
<div class="row align-content-center">
|
<div class="row align-content-center">
|
||||||
<img class="rounded text-center" width="300" height="300" src="https://chart.googleapis.com/chart?chs=500x500&cht=qr&chl={{ QrAuth }}">
|
<img class="rounded text-center" width="300" height="300" src="https://chart.googleapis.com/chart?chs=500x500&cht=qr&chl={{ QrAuth }}">
|
||||||
</div>
|
</div>
|
||||||
|
<a class="btn btn-sm btn-primary" href={{safeURL QrAuth}}>Open in Statup App</a>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue