mirror of https://github.com/statping/statping
notifier issue fixes
parent
e87f7ca422
commit
36f8b6214a
|
@ -38,9 +38,6 @@ before_deploy:
|
||||||
- git config --local user.email "info@socialeck.com"
|
- git config --local user.email "info@socialeck.com"
|
||||||
- make tag
|
- make tag
|
||||||
|
|
||||||
after_deploy:
|
|
||||||
- if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" = "false" ]]; then make publish-homebrew; fi
|
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
allow_failures:
|
allow_failures:
|
||||||
- go: master
|
- go: master
|
||||||
|
|
4
Makefile
4
Makefile
|
@ -12,12 +12,12 @@ BUILDVERSION=-ldflags "-X main.VERSION=${VERSION} -X main.COMMIT=$(TRAVIS_COMMIT
|
||||||
RICE=$(GOPATH)/bin/rice
|
RICE=$(GOPATH)/bin/rice
|
||||||
PATH:=/usr/local/bin:$(GOPATH)/bin:$(PATH)
|
PATH:=/usr/local/bin:$(GOPATH)/bin:$(PATH)
|
||||||
PUBLISH_BODY='{ "request": { "branch": "master", "config": { "env": { "VERSION": "${VERSION}", "COMMIT": "$(TRAVIS_COMMIT)" } } } }'
|
PUBLISH_BODY='{ "request": { "branch": "master", "config": { "env": { "VERSION": "${VERSION}", "COMMIT": "$(TRAVIS_COMMIT)" } } } }'
|
||||||
TRAVIS_BUILD_CMD='{ "request": { "branch": "master", "message": "Compile master for Statping v${VERSION}", "config": { "os": [ "linux" ], "language": "go", "go": [ "1.10.x" ], "go_import_path": "github.com/hunterlong/statping", "install": true, "sudo": "required", "services": [ "docker" ], "env": { "VERSION": "${VERSION}" }, "matrix": { "allow_failures": [ { "go": "master" } ], "fast_finish": true }, "before_deploy": [ "git config --local user.name \"hunterlong\"", "git config --local user.email \"info@socialeck.com\"", "git tag v$(VERSION) --force"], "deploy": [ { "provider": "releases", "api_key": "$(GH_TOKEN)", "file_glob": true, "file": "build/*", "skip_cleanup": true } ], "notifications": { "email": false }, "before_script": ["gem install sass"], "script": [ "wget -O statping.gpg $(SIGN_URL)", "gpg --import statping.gpg", "travis_wait 30 docker pull karalabe/xgo-latest", "make release" ], "after_success": [], "after_deploy": [ "make publish-dev" ] } } }'
|
TRAVIS_BUILD_CMD='{ "request": { "branch": "master", "message": "Compile master for Statping v${VERSION}", "config": { "os": [ "linux" ], "language": "go", "go": [ "1.10.x" ], "go_import_path": "github.com/hunterlong/statping", "install": true, "sudo": "required", "services": [ "docker" ], "env": { "VERSION": "${VERSION}" }, "matrix": { "allow_failures": [ { "go": "master" } ], "fast_finish": true }, "before_deploy": [ "git config --local user.name \"hunterlong\"", "git config --local user.email \"info@socialeck.com\"", "git tag v$(VERSION) --force"], "deploy": [ { "provider": "releases", "api_key": "$(GH_TOKEN)", "file_glob": true, "file": "build/*", "skip_cleanup": true } ], "notifications": { "email": false }, "before_script": ["gem install sass"], "script": [ "wget -O statping.gpg $(SIGN_URL)", "gpg --import statping.gpg", "travis_wait 30 docker pull karalabe/xgo-latest", "make release" ], "after_success": [], "after_deploy": [ "make publish-homebrew" ] } } }'
|
||||||
TEST_DIR=$(GOPATH)/src/github.com/hunterlong/statping
|
TEST_DIR=$(GOPATH)/src/github.com/hunterlong/statping
|
||||||
PATH:=$(PATH)
|
PATH:=$(PATH)
|
||||||
|
|
||||||
# build all arch's and release Statping
|
# build all arch's and release Statping
|
||||||
release: dev-deps build-all travis-build
|
release: dev-deps build-all
|
||||||
|
|
||||||
# build and push the images to docker hub
|
# build and push the images to docker hub
|
||||||
docker: docker-build-all docker-publish-all
|
docker: docker-build-all docker-publish-all
|
||||||
|
|
|
@ -300,7 +300,11 @@ CheckNotifier:
|
||||||
utils.Log(2, fmt.Sprintf("notifier %v had an error: %v", notification.Method, err))
|
utils.Log(2, fmt.Sprintf("notifier %v had an error: %v", notification.Method, err))
|
||||||
}
|
}
|
||||||
notification.makeLog(msg.Data)
|
notification.makeLog(msg.Data)
|
||||||
|
if len(notification.Queue) > 1 {
|
||||||
notification.Queue = notification.Queue[1:]
|
notification.Queue = notification.Queue[1:]
|
||||||
|
} else {
|
||||||
|
notification.Queue = nil
|
||||||
|
}
|
||||||
rateLimit = notification.Delay
|
rateLimit = notification.Delay
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ $('.test_notifier').on('click', function(e) {
|
||||||
var btn = $(this);
|
var btn = $(this);
|
||||||
var form = $(this).parents('form:first');
|
var form = $(this).parents('form:first');
|
||||||
var values = form.serialize();
|
var values = form.serialize();
|
||||||
var notifier = form.find('input[name=notifier]').val();
|
var notifier = form.find('input[name=method]').val();
|
||||||
var success = $('#'+notifier+'-success');
|
var success = $('#'+notifier+'-success');
|
||||||
var error = $('#'+notifier+'-error');
|
var error = $('#'+notifier+'-error');
|
||||||
Spinner(btn);
|
Spinner(btn);
|
||||||
|
@ -72,7 +72,6 @@ function Spinner(btn, off = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function SaveNotifier(data) {
|
function SaveNotifier(data) {
|
||||||
console.log(data)
|
|
||||||
let button = data.element.find('button[type=submit]');
|
let button = data.element.find('button[type=submit]');
|
||||||
button.text('Saved!')
|
button.text('Saved!')
|
||||||
button.removeClass('btn-primary')
|
button.removeClass('btn-primary')
|
||||||
|
@ -124,6 +123,11 @@ function AjaxChart(chart, service, start=0, end=9999999999, group="hour") {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('input[type=checkbox]').on('change', function() {
|
||||||
|
var element = $(this).attr('id');
|
||||||
|
$("#"+element+"-value").val(this.checked ? "true" : "false")
|
||||||
|
});
|
||||||
|
|
||||||
function PingAjaxChart(chart, service, start=0, end=9999999999, group="hour") {
|
function PingAjaxChart(chart, service, start=0, end=9999999999, group="hour") {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/api/services/"+service+"/ping?start="+start+"&end="+end+"&group="+group,
|
url: "/api/services/"+service+"/ping?start="+start+"&end="+end+"&group="+group,
|
||||||
|
@ -190,37 +194,35 @@ $('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" || k.value === "") {
|
if (k.name === "password_confirm" || k.value === "" || k.name === "enabled-option") {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (k.value === "on") {
|
if (k.value === "on") {
|
||||||
k.value = (k.value === "on")
|
k.value = (k.value === "on")
|
||||||
}
|
}
|
||||||
if (k.value === "false") {
|
if (k.value === "false" || k.value === "true") {
|
||||||
k.value = false
|
k.value = (k.value === "true")
|
||||||
}
|
|
||||||
if (k.value === "true") {
|
|
||||||
k.value = true
|
|
||||||
}
|
}
|
||||||
if($.isNumeric(k.value)){
|
if($.isNumeric(k.value)){
|
||||||
if (k.name !== "password") {
|
if (k.name !== "password") {
|
||||||
k.value = parseInt(k.value)
|
k.value = parseInt(k.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (k.name === "var1" || k.name === "var2" || k.name === "host" || k.name === "username" || k.name === "password" || k.name === "api_key" || k.name === "api_secret") {
|
||||||
|
k.value = k.value.toString()
|
||||||
|
}
|
||||||
newArr[k.name] = k.value;
|
newArr[k.name] = k.value;
|
||||||
arrayData.push(newArr)
|
arrayData.push(newArr)
|
||||||
});
|
});
|
||||||
let sendData = JSON.stringify(newArr);
|
let sendData = JSON.stringify(newArr);
|
||||||
console.log('sending '+method.toUpperCase()+' '+action+':', newArr);
|
// console.log('sending '+method.toUpperCase()+' '+action+':', sendData);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: action,
|
url: action,
|
||||||
type: method,
|
type: method,
|
||||||
data: sendData,
|
data: sendData,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
console.log(data)
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
if (data.status === 'error') {
|
if (data.status === 'error') {
|
||||||
let alerter = form.find('#alerter');
|
let alerter = form.find('#alerter');
|
||||||
|
|
|
@ -33,8 +33,9 @@
|
||||||
|
|
||||||
<div class="col-3 col-sm-2 mt-1">
|
<div class="col-3 col-sm-2 mt-1">
|
||||||
<span class="switch">
|
<span class="switch">
|
||||||
<input type="checkbox" name="enabled" class="switch" id="switch-{{ $n.Method }}" {{if $n.Enabled.Bool}}checked{{end}}>
|
<input type="checkbox" name="enabled-option" class="switch" id="switch-{{ $n.Method }}" {{if $n.Enabled.Bool}}checked{{end}}>
|
||||||
<label for="switch-{{ $n.Method }}"></label>
|
<label for="switch-{{ $n.Method }}"></label>
|
||||||
|
<input type="hidden" name="enabled" id="switch-{{ $n.Method }}-value" value="{{if $n.Enabled.Bool}}true{{else}}false{{end}}">
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0.80.31
|
0.80.32
|
Loading…
Reference in New Issue