mirror of https://github.com/statping/statping
parent
43d750a7ed
commit
db7be1a11d
|
@ -18,7 +18,7 @@ services:
|
|||
|
||||
env:
|
||||
global:
|
||||
- VERSION=0.34
|
||||
- VERSION=0.35
|
||||
- DB_HOST=localhost
|
||||
- DB_USER=travis
|
||||
- DB_PASS=
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
FROM alpine:latest
|
||||
|
||||
ENV VERSION=v0.34
|
||||
ENV VERSION=v0.35
|
||||
|
||||
RUN apk --no-cache add libstdc++ ca-certificates
|
||||
RUN wget -q https://github.com/hunterlong/statup/releases/download/$VERSION/statup-linux-alpine.tar.gz && \
|
||||
|
|
|
@ -115,3 +115,12 @@ func CreateAllAssets() {
|
|||
}
|
||||
utils.Log(1, "Statup assets have been inserted")
|
||||
}
|
||||
|
||||
func DeleteAllAssets() {
|
||||
err := os.RemoveAll("assets")
|
||||
if err != nil {
|
||||
utils.Log(1, fmt.Sprintf("There was an issue deleting Statup Assets, %v", err))
|
||||
return
|
||||
}
|
||||
utils.Log(1, "Statup assets have been deleted")
|
||||
}
|
||||
|
|
|
@ -9,8 +9,12 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
r *mux.Router
|
||||
)
|
||||
|
||||
func Router() *mux.Router {
|
||||
r := mux.NewRouter()
|
||||
r = mux.NewRouter()
|
||||
r.Handle("/", http.HandlerFunc(IndexHandler))
|
||||
LocalizedAssets(r)
|
||||
r.Handle("/charts.js", http.HandlerFunc(RenderServiceChartsHandler))
|
||||
|
@ -38,6 +42,7 @@ func Router() *mux.Router {
|
|||
r.Handle("/settings", http.HandlerFunc(SaveSettingsHandler)).Methods("POST")
|
||||
r.Handle("/settings/css", http.HandlerFunc(SaveSASSHandler)).Methods("POST")
|
||||
r.Handle("/settings/build", http.HandlerFunc(SaveAssetsHandler)).Methods("GET")
|
||||
r.Handle("/settings/delete_assets", http.HandlerFunc(DeleteAssetsHandler)).Methods("GET")
|
||||
r.Handle("/settings/notifier/{id}", http.HandlerFunc(SaveNotificationHandler)).Methods("POST")
|
||||
r.Handle("/plugins/download/{name}", http.HandlerFunc(PluginsDownloadHandler))
|
||||
r.Handle("/plugins/{name}/save", http.HandlerFunc(PluginSavedHandler)).Methods("POST")
|
||||
|
|
|
@ -73,6 +73,17 @@ func SaveAssetsHandler(w http.ResponseWriter, r *http.Request) {
|
|||
http.Redirect(w, r, "/settings", http.StatusSeeOther)
|
||||
}
|
||||
|
||||
func DeleteAssetsHandler(w http.ResponseWriter, req *http.Request) {
|
||||
if !IsAuthenticated(req) {
|
||||
http.Redirect(w, req, "/", http.StatusSeeOther)
|
||||
return
|
||||
}
|
||||
core.DeleteAllAssets()
|
||||
core.UsingAssets = false
|
||||
LocalizedAssets(r)
|
||||
http.Redirect(w, req, "/settings", http.StatusSeeOther)
|
||||
}
|
||||
|
||||
func SaveNotificationHandler(w http.ResponseWriter, r *http.Request) {
|
||||
var err error
|
||||
if !IsAuthenticated(r) {
|
||||
|
|
|
@ -48,6 +48,9 @@ func TestRunAll(t *testing.T) {
|
|||
t.Run(dbt+" load database config", func(t *testing.T) {
|
||||
RunMySQLMakeConfig(t, dbt)
|
||||
})
|
||||
t.Run(dbt+" run database migrations", func(t *testing.T) {
|
||||
RunDatabaseMigrations(t, dbt)
|
||||
})
|
||||
t.Run(dbt+" Sample Data", func(t *testing.T) {
|
||||
RunInsertMysqlSample(t)
|
||||
})
|
||||
|
@ -221,6 +224,11 @@ func RunMySQLMakeConfig(t *testing.T, db string) {
|
|||
assert.Nil(t, err)
|
||||
}
|
||||
|
||||
func RunDatabaseMigrations(t *testing.T, db string) {
|
||||
err := core.RunDatabaseUpgrades()
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
|
||||
func RunInsertMysqlSample(t *testing.T) {
|
||||
err := core.LoadSampleData()
|
||||
assert.Nil(t, err)
|
||||
|
|
|
@ -55,10 +55,12 @@ HTML, BODY {
|
|||
color: #a5a5a5; }
|
||||
|
||||
.lower_canvas {
|
||||
height: 55px;
|
||||
height: 3.4rem;
|
||||
width: 100%;
|
||||
background-color: #48d338;
|
||||
padding: 17px 10px; }
|
||||
padding: 15px 10px;
|
||||
margin-left: 0 !important;
|
||||
margin-right: 0 !important; }
|
||||
|
||||
.lower_canvas SPAN {
|
||||
font-size: 1rem;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -32,6 +32,15 @@ $('select#service_type').on('change', function() {
|
|||
|
||||
});
|
||||
|
||||
$('select#service_check_type').on('change', function() {
|
||||
var selected = $('#service_check_type option:selected').val();
|
||||
if (selected == "POST") {
|
||||
$("#post_data").parent().parent().removeClass("d-none");
|
||||
} else {
|
||||
$("#post_data").parent().parent().addClass("d-none");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$(function() {
|
||||
var pathname = window.location.pathname;
|
||||
|
|
|
@ -64,10 +64,12 @@ HTML,BODY {
|
|||
}
|
||||
|
||||
.lower_canvas {
|
||||
height: 55px;
|
||||
height: 3.4rem;
|
||||
width: 100%;
|
||||
background-color: #48d338;
|
||||
padding: 17px 10px;
|
||||
padding: 15px 10px;
|
||||
margin-left: 0 !important;
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
|
||||
.lower_canvas SPAN {
|
||||
|
|
|
@ -43,7 +43,7 @@ CREATE TABLE hits (
|
|||
id SERIAL PRIMARY KEY,
|
||||
service INTEGER NOT NULL REFERENCES services(id) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
latency float,
|
||||
created_at TIMESTAMP WITHOUT TIME zone
|
||||
created_at TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE failures (
|
||||
|
@ -51,7 +51,7 @@ CREATE TABLE failures (
|
|||
issue text,
|
||||
method text,
|
||||
service INTEGER NOT NULL REFERENCES services(id) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
created_at TIMESTAMP WITHOUT TIME zone
|
||||
created_at TIMESTAMP
|
||||
);
|
||||
|
||||
CREATE TABLE checkins (
|
||||
|
|
|
@ -90,10 +90,12 @@
|
|||
<canvas id="service_{{ $s.Id }}"></canvas>
|
||||
</div>
|
||||
{{ end }}
|
||||
<div class="lower_canvas full-col-12 text-white{{if not $s.Online}} bg-danger{{end}}">
|
||||
<div class="col-12">
|
||||
<span class="col-10 d-none d-md-inline">{{.SmallText}}</span>
|
||||
<a href="/service/{{ $s.Id }}" class="btn {{if $s.Online}}btn-success{{else}}btn-danger{{end}} btn-sm float-right col-sm-4 col-md-2 dyn-dark">View Service</a>
|
||||
<div class="row lower_canvas full-col-12 text-white{{if not $s.Online}} bg-danger{{end}}">
|
||||
<div class="col-10 text-truncate">
|
||||
<span class="d-none d-md-inline">{{.SmallText}}</span>
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-2">
|
||||
<a href="/service/{{ $s.Id }}" class="btn {{if $s.Online}}btn-success{{else}}btn-danger{{end}} btn-sm float-right dyn-dark btn-block">View Service</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
|
||||
<div class="container col-md-7 col-sm-12 mt-md-5 bg-light">
|
||||
|
||||
<div class="col-4 offset-4">
|
||||
<img width="100%" src="https://assets.statup.io/statup-words.png">
|
||||
</div>
|
||||
|
||||
<div class="col-8 offset-2 mt-3">
|
||||
|
||||
{{ if .Error }}
|
||||
|
@ -27,15 +31,15 @@
|
|||
|
||||
<form action="/dashboard" method="POST">
|
||||
<div class="form-group row">
|
||||
<label for="inputEmail3" class="col-sm-2 col-form-label">Username</label>
|
||||
<label for="username" class="col-sm-2 col-form-label">Username</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="text" name="username" class="form-control" id="inputEmail3" placeholder="Username">
|
||||
<input type="text" name="username" class="form-control" id="username" placeholder="Username" autocapitalize="false" spellcheck="false">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="inputPassword3" class="col-sm-2 col-form-label">Password</label>
|
||||
<label for="password" class="col-sm-2 col-form-label">Password</label>
|
||||
<div class="col-sm-10">
|
||||
<input type="password" name="password" class="form-control" id="inputPassword3" placeholder="Password">
|
||||
<input type="password" name="password" class="form-control" id="password" placeholder="Password">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
|
|
|
@ -86,7 +86,7 @@
|
|||
<div class="form-group row">
|
||||
<label for="service_name" class="col-sm-4 col-form-label">Service Name</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="name" class="form-control" id="service_name" value="{{$s.Name}}" placeholder="Name" required>
|
||||
<input type="text" name="name" class="form-control" id="service_name" value="{{$s.Name}}" placeholder="Name" required spellcheck="false">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
|
@ -101,7 +101,7 @@
|
|||
<div class="form-group row">
|
||||
<label for="service_url" class="col-sm-4 col-form-label">Application Endpoint (URL)</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="domain" class="form-control" id="service_url" value="{{$s.Domain}}" placeholder="https://google.com" required>
|
||||
<input type="text" name="domain" class="form-control" id="service_url" value="{{$s.Domain}}" placeholder="https://google.com" required autocapitalize="false" spellcheck="false">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row{{if eq $s.Type "tcp"}} d-none{{end}}">
|
||||
|
@ -116,13 +116,13 @@
|
|||
<div class="form-group row{{if eq $s.Type "tcp"}} d-none{{end}}">
|
||||
<label for="post_data" class="col-sm-4 col-form-label">Optional Post Data (JSON)</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="post_data" class="form-control" id="post_data" rows="3">{{$s.PostData}}</textarea>
|
||||
<textarea name="post_data" class="form-control" id="post_data" rows="3" autocapitalize="false" spellcheck="false">{{$s.PostData}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row{{if eq $s.Type "tcp"}} d-none{{end}}">
|
||||
<label for="service_response" class="col-sm-4 col-form-label">Expected Response (Regex)</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="expected" class="form-control" id="service_response" rows="3">{{$s.Expected}}</textarea>
|
||||
<textarea name="expected" class="form-control" id="service_response" rows="3" autocapitalize="false" spellcheck="false">{{$s.Expected}}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row{{if eq $s.Type "tcp"}} d-none{{end}}">
|
||||
|
@ -146,7 +146,7 @@
|
|||
<div class="form-group row">
|
||||
<label for="service_timeout" class="col-sm-4 col-form-label">Timeout in Seconds</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" name="timeout" class="form-control" value="{{$s.Timeout}}" id="service_timeout" placeholder="30">
|
||||
<input type="number" name="timeout" class="form-control" value="{{$s.Timeout}}" id="service_timeout" min="1" placeholder="30">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
|
@ -165,7 +165,7 @@
|
|||
<h3>Last Response</h3>
|
||||
<textarea rows="8" class="form-control" readonly>{{ $s.LastResponse }}</textarea>
|
||||
<div class="form-group row mt-2">
|
||||
<label for="last_status_code" class="col-sm-3 col-form-label">Status Code</label>
|
||||
<label for="last_status_code" class="col-sm-3 col-form-label">HTTP Status Code</label>
|
||||
<div class="col-sm-2">
|
||||
<input type="text" id="last_status_code" class="form-control" value="{{ $s.LastStatusCode }}" readonly>
|
||||
</div>
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
<div class="form-group row">
|
||||
<label for="service_name" class="col-sm-4 col-form-label">Service Name</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="name" class="form-control" id="service_name" placeholder="Name" required>
|
||||
<input type="text" name="name" class="form-control" id="service_name" placeholder="Name" required spellcheck="false">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
|
@ -69,7 +69,7 @@
|
|||
<div class="form-group row">
|
||||
<label for="service_url" class="col-sm-4 col-form-label">Application Endpoint (URL)</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="text" name="domain" class="form-control" id="service_url" placeholder="https://google.com" required>
|
||||
<input type="text" name="domain" class="form-control" id="service_url" placeholder="https://google.com" required autocapitalize="false" spellcheck="false">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
|
@ -81,16 +81,16 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="form-group row d-none">
|
||||
<label for="post_data" class="col-sm-4 col-form-label">Post Data (JSON)</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="post_data" class="form-control" id="post_data" rows="3"></textarea>
|
||||
<textarea name="post_data" class="form-control" id="post_data" rows="3" autocapitalize="false" spellcheck="false"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="service_response" class="col-sm-4 col-form-label">Expected Response (Regex)</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="expected" class="form-control" id="service_response" rows="3"></textarea>
|
||||
<textarea name="expected" class="form-control" id="service_response" rows="3" autocapitalize="false" spellcheck="false"></textarea>
|
||||
<small id="emailHelp" class="form-text text-muted">You can insert <a target="_blank" href="https://regex101.com/r/I5bbj9/1">Regex</a> to validate the response</small>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -115,7 +115,7 @@
|
|||
<div class="form-group row">
|
||||
<label for="service_timeout" class="col-sm-4 col-form-label">Timeout in Seconds</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="number" name="timeout" class="form-control" id="service_timeout" placeholder="30">
|
||||
<input type="number" name="timeout" class="form-control" id="service_timeout" min="1" placeholder="30">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
|
|
|
@ -121,6 +121,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary btn-block mt-2">Save Style</button>
|
||||
<a href="/settings/delete_assets" class="btn btn-danger btn-block">Delete Assets</a>
|
||||
</form>
|
||||
{{end}}
|
||||
</div>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<div class="form-group row">
|
||||
<label for="email" class="col-sm-4 col-form-label">Email Address</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="email" name="email" class="form-control" id="email" value="{{.Email}}" placeholder="user@domain.com" required>
|
||||
<input type="email" name="email" class="form-control" id="email" value="{{.Email}}" placeholder="user@domain.com" required autocapitalize="false" spellcheck="false">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
<div class="form-group row">
|
||||
<label for="username" class="col-sm-4 col-form-label">Username</label>
|
||||
<div class="col-sm-4">
|
||||
<input type="text" name="username" class="form-control" id="username" placeholder="Username" required>
|
||||
<input type="text" name="username" class="form-control" id="username" placeholder="Username" required autocapitalize="false" spellcheck="false">
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<span class="switch">
|
||||
|
@ -63,7 +63,7 @@
|
|||
<div class="form-group row">
|
||||
<label for="email" class="col-sm-4 col-form-label">Email Address</label>
|
||||
<div class="col-sm-8">
|
||||
<input type="email" name="email" class="form-control" id="email" placeholder="user@domain.com" required>
|
||||
<input type="email" name="email" class="form-control" id="email" placeholder="user@domain.com" required autocapitalize="false" spellcheck="false">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
|
|
Loading…
Reference in New Issue