Skip to content
Permalink
Browse files

bulk import - issue #144

  • Loading branch information...
hunterlong committed May 14, 2019
1 parent 359c00c commit 355e7e325b53a95762c1eaaa7937e2303eed8157
@@ -196,13 +196,13 @@ func (s *Service) lastFailure() *Failure {
// // Online since Monday 3:04:05PM, Jan _2 2006
func (s *Service) SmallText() string {
last := s.LimitedFailures(1)
hits, _ := s.LimitedHits(1)
//hits, _ := s.LimitedHits(1)
zone := CoreApp.Timezone
if s.Online {
if len(last) == 0 {
return fmt.Sprintf("Online since %v", utils.Timezoner(s.CreatedAt, zone).Format("Monday 3:04:05PM, Jan _2 2006"))
} else {
return fmt.Sprintf("Online, last Failure was %v", utils.Timezoner(hits[0].CreatedAt, zone).Format("Monday 3:04:05PM, Jan _2 2006"))
return fmt.Sprintf("Online, last Failure was %v", utils.Timezoner(last[0].CreatedAt, zone).Format("Monday 3:04:05PM, Jan _2 2006"))
}
}
if len(last) > 0 {
@@ -159,12 +159,12 @@ func commaToService(s []string) (*types.Service, error) {
return nil, err
}

allowNotifications, err := strconv.ParseBool(s[10])
allowNotifications, err := strconv.ParseBool(s[11])
if err != nil {
return nil, err
}

public, err := strconv.ParseBool(s[11])
public, err := strconv.ParseBool(s[12])
if err != nil {
return nil, err
}
@@ -182,9 +182,9 @@ func commaToService(s []string) (*types.Service, error) {
Timeout: int(utils.ToInt(timeout.Seconds())),
AllowNotifications: types.NewNullBool(allowNotifications),
Public: types.NewNullBool(public),
GroupId: int(utils.ToInt(s[12])),
Headers: types.NewNullString(s[13]),
Permalink: types.NewNullString(s[14]),
GroupId: int(utils.ToInt(s[13])),
Headers: types.NewNullString(s[14]),
Permalink: types.NewNullString(s[15]),
}

return newService, nil
@@ -90,7 +90,7 @@ $('.toggle-service').on('click',function(e) {
let obj = $(this);
let serviceId = obj.attr("data-id");
let online = obj.attr("data-online");
let d = confirm("Do you want to "+online ? "stop" : "start"+" checking this service?");
let d = confirm("Do you want to "+(online ? "stop" : "start")+" checking this service?");
if (d) {
$.ajax({
url: "/api/services/" + serviceId + "/running",
@@ -150,9 +150,11 @@ async function RenderChart(chart, service, start=0, end=9999999999, group="hour"
chartData = await ChartLatency(service, start, end, "minute", retry);
}
chart.render();
chart.updateSeries([{
data: chartData
}]);
if (chartData) {
chart.updateSeries([{
data: chartData
}]);
}
}


File renamed without changes.
@@ -55,7 +55,7 @@

{{if not .Domain}}
<div class="alert alert-danger" role="alert">
Your Statup server does not have a dedicated URL!
Your Statping server does not have a dedicated URL!
</div>
{{end}}

@@ -123,14 +123,31 @@

</form>

<h3>Additional Settings</h3>
<h3 class="mt-4">Bulk Import Services</h3>
You can import multiple services based on a CSV file with the format shown on the <a href="https://github.com/hunterlong/statping/wiki/Bulk-Import-Services" target="_blank">Bulk Import Wiki</a>.

<div class="card">
<div class="card-body">
<form action="/settings/bulk_import" method="POST" enctype="multipart/form-data" class="form-inline">
<div class="form-group col-10">
<input type="file" name="file" class="form-control-file" accept=".csv">
</div>
<div class="form-group">
<button type="submit" class="btn btn-outline-success right">Import</button>
</div>
</form>
</div>
</div>


<h3 class="mt-4">Additional Settings</h3>

<div class="row">
<a href="/settings/export" class="btn btn-sm btn-secondary float-right">Export Settings</a>
<div class="col-12">
<a href="/settings/export" class="btn btn-sm btn-secondary float-right">Export Settings</a>
{{if .Domain}}
<a href="#" class="btn btn-sm btn-secondary float-right ml-1">Authentication QR Code</a>
{{end}}
</div>

{{if .Domain}}
<div class="row align-content-center">
@@ -139,19 +156,8 @@
<a class="btn btn-sm btn-primary" href={{safeURL QrAuth}}>Open in Statping App</a>
{{end}}


<h3 class="mt-3">Bulk Import Services</h3>
You can import multiple services based on a CSV file with the format shown on the <a href="https://github.com/hunterlong/statping/wiki/Bulk-Import-Services" target="_blank">Bulk Import Wiki</a>.

<form action="/settings/bulk_import" method="POST" enctype="multipart/form-data" class="form-inline">
<div class="form-group">
<input type="file" name="file" class="form-control-file" accept=".csv">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success ml-3">Upload</button>
</div>
</form>

</div>
</div>
</div>

<div class="tab-pane" id="v-pills-style" role="tabpanel" aria-labelledby="v-pills-style-tab">

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

0 comments on commit 355e7e3

Please sign in to comment.
You can’t perform that action at this time.