mirror of
https://git.cyberia.club/cyberia/matrix-synapse-diskspace-janitor
synced 2024-05-20 01:16:33 +02:00
add refresh data button
This commit is contained in:
parent
225e7fae8b
commit
7bd1bd87a0
12
frontend.go
12
frontend.go
|
@ -95,6 +95,15 @@ func initFrontend(config *Config, db *DBModel) FrontendApp {
|
|||
}
|
||||
|
||||
if request.Method == "POST" {
|
||||
|
||||
refresh := request.PostFormValue("refresh")
|
||||
if refresh == "true" {
|
||||
go runScheduledTask(db, config)
|
||||
|
||||
http.Redirect(responseWriter, request, "/", http.StatusFound)
|
||||
return
|
||||
}
|
||||
|
||||
toDelete := []MatrixRoom{}
|
||||
for i := 0; i < 20; i++ {
|
||||
roomId := request.PostFormValue(fmt.Sprintf("id_%d", i))
|
||||
|
@ -180,7 +189,8 @@ func initFrontend(config *Config, db *DBModel) FrontendApp {
|
|||
DBTableSizes template.JS
|
||||
BigRooms template.JS
|
||||
BigRoomsSlice []MatrixRoom
|
||||
}{template.JS(diskUsage), template.JS(dbTableSizes), template.JS(bigRoomsBytes), biggestRooms}
|
||||
Updating bool
|
||||
}{template.JS(diskUsage), template.JS(dbTableSizes), template.JS(bigRoomsBytes), biggestRooms, isRunningScheduledTask}
|
||||
|
||||
app.buildPageFromTemplate(responseWriter, request, session, "panel.html", panelTemplateData)
|
||||
} else {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<p>
|
||||
<em>This page will automatically refresh every 10 seconds while the deletion process is happening...</em>
|
||||
</p>
|
||||
|
||||
<script>
|
||||
setTimeout(function(){ window.location.reload(); }, 1000 * 10);
|
||||
</script>
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
<div class="vertical align-center">
|
||||
{{ if .Updating }}
|
||||
<p>
|
||||
<span class="bold-red">
|
||||
NOTE: The data on this page is currently being updated... This can take a few minutes. Stand by.
|
||||
</span>
|
||||
</p>
|
||||
{{ else }}
|
||||
<p>
|
||||
<span class="bold-red">
|
||||
NOTE: The data on this page is generated by a scheduled task that runs every 24 hours.
|
||||
</span>
|
||||
</p>
|
||||
|
||||
|
||||
<form action="/" method="POST" class="box vertical">
|
||||
<input type="hidden" name="refresh" value="true"></input>
|
||||
<input type="submit" value="Re-run data gathering task now"></input>
|
||||
</form>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
<div class="horizontal justify-center wrap">
|
||||
|
||||
|
|
|
@ -144,6 +144,11 @@ header .session-status {
|
|||
padding: 5px;
|
||||
}
|
||||
|
||||
.bold-red {
|
||||
font-style: italic;
|
||||
font-weight: bold;
|
||||
color: #a5048a;
|
||||
}
|
||||
|
||||
code {
|
||||
padding: 2px 4px;
|
||||
|
|
Loading…
Reference in a new issue