Move all sync pages to authenticatedHandler
Still need to fix many templates
This commit is contained in:
parent
85d2d0b95b
commit
dac52a879a
23 changed files with 409 additions and 476 deletions
|
|
@ -51,7 +51,7 @@ func (ts templateSystemDisk) renderOrError(w http.ResponseWriter, template_name
|
|||
buf := &bytes.Buffer{}
|
||||
err = t.Execute(buf, context)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("Failed to render template")
|
||||
log.Error().Err(err).Str("name", template_name).Msg("Failed to render template")
|
||||
RespondError(w, "Failed to render template", err, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
<div
|
||||
class="col-md-6 text-md-end d-flex align-items-center justify-content-md-end"
|
||||
>
|
||||
{{ if .IsSyncOngoing }}
|
||||
{{ if .C.IsSyncOngoing }}
|
||||
<p class="last-refreshed mb-0">
|
||||
<i class="fas fa-sync-alt me-2 syncing"></i>Syncing now...
|
||||
</p>
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
<p class="last-refreshed mb-0">
|
||||
<i class="fas fa-sync-alt me-2"></i>Last updated:
|
||||
<span id="last-refreshed-time"
|
||||
>{{ .LastSync | timeRelativePtr }}</span
|
||||
>{{ .C.LastSync | timeRelativePtr }}</span
|
||||
>
|
||||
<button class="btn btn-sm btn-outline-primary ms-3">
|
||||
Refresh Data
|
||||
|
|
@ -57,7 +57,7 @@
|
|||
<i class="fas fa-clock"></i>
|
||||
</div>
|
||||
<h5 class="card-title">Last Data Refresh</h5>
|
||||
<p class="metric-value">{{ .LastSync | timeRelativePtr }}</p>
|
||||
<p class="metric-value">{{ .C.LastSync | timeRelativePtr }}</p>
|
||||
<!-- <p class="card-text text-muted">Last sync: 12:45 PM</p> -->
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -71,13 +71,13 @@
|
|||
<i class="fas fa-ticket-alt"></i>
|
||||
</div>
|
||||
<h5 class="card-title">Service Requests</h5>
|
||||
{{ if .IsSyncOngoing }}
|
||||
{{ if .C.IsSyncOngoing }}
|
||||
<p class="metric-value">
|
||||
{{ .CountServiceRequests | bigNumber }}...?
|
||||
{{ .C.CountServiceRequests | bigNumber }}...?
|
||||
</p>
|
||||
{{ else }}
|
||||
<p class="metric-value">
|
||||
{{ .CountServiceRequests | bigNumber }}
|
||||
{{ .C.CountServiceRequests | bigNumber }}
|
||||
</p>
|
||||
{{ end }}
|
||||
<!--<p class="card-text text-muted">
|
||||
|
|
@ -97,13 +97,13 @@
|
|||
<i class="fas fa-bug"></i>
|
||||
</div>
|
||||
<h5 class="card-title">Mosquito Sources</h5>
|
||||
{{ if .IsSyncOngoing }}
|
||||
{{ if .C.IsSyncOngoing }}
|
||||
<p class="metric-value">
|
||||
{{ .CountMosquitoSources | bigNumber }}..?
|
||||
{{ .C.CountMosquitoSources | bigNumber }}..?
|
||||
</p>
|
||||
{{ else }}
|
||||
<p class="metric-value">
|
||||
{{ .CountMosquitoSources | bigNumber }}
|
||||
{{ .C.CountMosquitoSources | bigNumber }}
|
||||
</p>
|
||||
{{ end }}
|
||||
<!-- <p class="card-text text-muted">
|
||||
|
|
@ -123,10 +123,10 @@
|
|||
<i class="fas fa-clipboard-check"></i>
|
||||
</div>
|
||||
<h5 class="card-title">Traps</h5>
|
||||
{{ if .IsSyncOngoing }}
|
||||
<p class="metric-value">{{ .CountTraps | bigNumber }}...?</p>
|
||||
{{ if .C.IsSyncOngoing }}
|
||||
<p class="metric-value">{{ .C.CountTraps | bigNumber }}...?</p>
|
||||
{{ else }}
|
||||
<p class="metric-value">{{ .CountTraps | bigNumber }}</p>
|
||||
<p class="metric-value">{{ .C.CountTraps | bigNumber }}</p>
|
||||
{{ end }}
|
||||
<!-- <p class="card-text text-muted">
|
||||
<span class="text-success">
|
||||
|
|
@ -142,17 +142,21 @@
|
|||
<h3 class="section-title">Mosquito Activity Heatmap</h3>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<map-aggregate
|
||||
centroid="{{ if .Organization.ServiceAreaCentroidGeojson.IsValue }}
|
||||
{{ .Organization.ServiceAreaCentroidGeojson.MustGet|json }}
|
||||
{{ end }}"
|
||||
organization-id="{{ .Organization.ID }}"
|
||||
tegola="{{ .URL.Tegola }}"
|
||||
xmin="{{ .Organization.ServiceAreaXmin.GetOr 0 }}"
|
||||
ymin="{{ .Organization.ServiceAreaYmin.GetOr 0 }}"
|
||||
xmax="{{ .Organization.ServiceAreaXmax.GetOr 0 }}"
|
||||
ymax="{{ .Organization.ServiceAreaYmax.GetOr 0 }}"
|
||||
/>
|
||||
{{ if not (eq .Organization nil) }}
|
||||
{{ if not (eq .Organization.ServiceAreaCentroidGeojson nil) }}
|
||||
<map-aggregate
|
||||
centroid="{{ if .Organization.ServiceAreaCentroidGeojson.IsValue }}
|
||||
{{ .Organization.ServiceAreaCentroidGeojson.MustGet|json }}
|
||||
{{ end }}"
|
||||
organization-id="{{ .Organization.ID }}"
|
||||
tegola="{{ .URL.Tegola }}"
|
||||
xmin="{{ .Organization.ServiceAreaXmin.GetOr 0 }}"
|
||||
ymin="{{ .Organization.ServiceAreaYmin.GetOr 0 }}"
|
||||
xmax="{{ .Organization.ServiceAreaXmax.GetOr 0 }}"
|
||||
ymax="{{ .Organization.ServiceAreaYmax.GetOr 0 }}"
|
||||
/>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -174,7 +178,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ range $i, $sr := .RecentRequests }}
|
||||
{{ range $i, $sr := .C.RecentRequests }}
|
||||
<tr>
|
||||
<td>{{ $sr.Date | timeRelativePtr }}</td>
|
||||
<td>Service Request</td>
|
||||
|
|
|
|||
|
|
@ -48,6 +48,9 @@
|
|||
setTooltipsForSidebar();
|
||||
});
|
||||
</script>
|
||||
{{ if not .Config.IsProductionEnvironment }}
|
||||
<script src="/.flogo/injector.js"></script>
|
||||
{{ end }}
|
||||
</head>
|
||||
<body>
|
||||
{{ template "sync/component/icons.html" }}
|
||||
|
|
@ -60,6 +63,7 @@
|
|||
<div id="content">
|
||||
{{ template "content" . }}
|
||||
</div>
|
||||
<div id="flogo"></div>
|
||||
<script src="/static/vendor/js/bootstrap.bundle.min.js"></script>
|
||||
<script>
|
||||
document.getElementById("sidebarToggle").addEventListener("click", () => {
|
||||
|
|
|
|||
|
|
@ -11,9 +11,13 @@
|
|||
<!-- favicon -->
|
||||
<link rel="icon" href="/static/favicon-sync.ico" type="image/x-icon" />
|
||||
{{ block "extraheader" . }}{{ end }}
|
||||
{{ if not .Config.IsProductionEnvironment }}
|
||||
<script src="/.flogo/injector.js"></script>
|
||||
{{ end }}
|
||||
</head>
|
||||
<body>
|
||||
{{ template "content" . }}
|
||||
<div id="flogo"></div>
|
||||
<script src="/static/vendor/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue