summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHorus32015-02-27 19:57:24 +0100
committerHorus32015-02-27 19:57:24 +0100
commitd62b3e273c98049511c1c09892b50f631f0665a5 (patch)
tree267a2e463488f468292aa19446c02555e8311f4d
parent6837ddf68f13a1633ea868ab55d71389ca5bc175 (diff)
downloadstatuspage-d62b3e273c98049511c1c09892b50f631f0665a5.tar.gz
Checks error now on resonse code. Refactoring and styling.
-rwxr-xr-xapp/env.sh1
-rw-r--r--app/fetch.go9
-rw-r--r--app/handler.go4
-rw-r--r--static/js/functions.js2
-rw-r--r--views/index.html2
-rw-r--r--views/jobs_modal.html9
-rw-r--r--views/login.html2
7 files changed, 17 insertions, 12 deletions
diff --git a/app/env.sh b/app/env.sh
index 3e87126..63b0e8e 100755
--- a/app/env.sh
+++ b/app/env.sh
@@ -20,3 +20,4 @@
#export STATUS_SMTP_MAILER="smtp.example.org:25"
#export STATUS_SMTP_PASSWORD="password"
#export STATUS_SMTP_ADRESS="statuspage@example.org"
+
diff --git a/app/fetch.go b/app/fetch.go
index f4be5c0..e56205a 100644
--- a/app/fetch.go
+++ b/app/fetch.go
@@ -60,9 +60,14 @@ func CheckAllPages(h []Host) []Host {
} else {
h[k].Status = resp.Status
h[k].StatusCode = int64(resp.StatusCode)
- h[k].Success = true
+ if h[k].StatusCode < 400 {
+ h[k].Success = true
+ h[k].Class = "success"
+ } else {
+ h[k].Success = false
+ h[k].Class = "danger"
+ }
h[k].Reason = ""
- h[k].Class = "success"
}
}
diff --git a/app/handler.go b/app/handler.go
index e7bc738..69ec45a 100644
--- a/app/handler.go
+++ b/app/handler.go
@@ -271,7 +271,6 @@ func LogoutHandler(w http.ResponseWriter, r *http.Request) {
session, _ := store.Get(r, "_SID")
session.Values["login"] = false
session.Save(r, w)
- log.Println("Logout ", session.Values["login"])
http.Redirect(w, r, "/login", 301)
}
@@ -357,8 +356,6 @@ func DeleteHandler(w http.ResponseWriter, r *http.Request) {
return
}
host := Host{}
- log.Println(r.PostForm)
- log.Println(r.URL.Query())
err = decoder.Decode(&host, r.URL.Query())
if err != nil {
log.Println(err)
@@ -371,6 +368,7 @@ func DeleteHandler(w http.ResponseWriter, r *http.Request) {
query := Db.Where("id = ?", host.Id).Delete(&host)
if query.Error != nil {
session.AddFlash("Deleting failed.", "error")
+ log.Println("Deleting failed.", query.Error)
} else {
session.AddFlash("We removed the host.", "success")
}
diff --git a/static/js/functions.js b/static/js/functions.js
index 8d3c5fb..7b9291b 100644
--- a/static/js/functions.js
+++ b/static/js/functions.js
@@ -61,7 +61,7 @@ $(".delete").confirm({
$(document).ready(function(){
modals = new Array();
-modals[0] = "dd-jobs";
+//modals[0] = "dd-jobs";
modals[1] = "dd-alert";
modals[2] = "dd-alert-danger";
modals[3] = "dd-alert-success";
diff --git a/views/index.html b/views/index.html
index 2c75c8b..b168ff9 100644
--- a/views/index.html
+++ b/views/index.html
@@ -35,7 +35,7 @@
{{range $index, $results := .Hosts}}
<tr class="{{.Class}}">
<td>{{add $index 1}}</td>
- <td>{{.Host}} <a href="{{.Url}}" title="{{.Host}}" target="_blank"> <span class="fa fa-external-link-square"></span></a></td>
+ <td>{{.Host}} <a href="{{.Url}}" title="{{.Url}}" target="_blank"> <span class="fa fa-external-link-square"></span></a></td>
<td>{{.Description}}</td>
<td>{{.Status}}</td>
<!--td>{{.StatusCode}}</td-->
diff --git a/views/jobs_modal.html b/views/jobs_modal.html
index 84c6340..dbd6412 100644
--- a/views/jobs_modal.html
+++ b/views/jobs_modal.html
@@ -1,9 +1,10 @@
<div id="jobs-modal" class="modal fade" tabindex="-1">
- <div class="modal-dialog modal-lg" id="dd-jobs">
+ <div class="modal-dialog modal-lg">
<div class="modal-content">
- <div class="modal-header">
+ <div class="modal-header" id="dd-jobs">
<!--button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button-->
- <button class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
+ <button type="bottom" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
+ <h3>Add a new host!</h3>
</div>
<div class="modal-body">
<form class="form-horizontal" method='post' action='/new'>
@@ -11,7 +12,7 @@
<!-- Form Name -->
<div class="text-center">
- <legend>Add a new host!</legend>
+ <legend> </legend>
</div>
<!-- Text input-->
diff --git a/views/login.html b/views/login.html
index 8e4963e..d7a3865 100644
--- a/views/login.html
+++ b/views/login.html
@@ -50,7 +50,7 @@
<div class="form-group">
<label class="col-md-4 control-label" for="submit"></label>
<div class="col-md-4">
- <button class="btn btn-primary">Submit</button>
+ <button class="btn btn-primary btn-raised">Submit</button>
</div>
</div>