add scan full button

Release-As: 0.16.0
This commit is contained in:
sentriz
2023-09-10 14:51:55 +01:00
parent c909628e04
commit 07a7869836
2 changed files with 6 additions and 2 deletions

View File

@@ -57,7 +57,10 @@
<p class="col-span-full text-gray-500" title="{{ .LastScanTime }}">scanned {{ .LastScanTime | dateHuman }}</p> <p class="col-span-full text-gray-500" title="{{ .LastScanTime }}">scanned {{ .LastScanTime | dateHuman }}</p>
{{ end }} {{ end }}
<form class="col-span-full" action="{{ path "/admin/start_scan_inc_do" }}" method="post"> <form class="col-span-full" action="{{ path "/admin/start_scan_inc_do" }}" method="post">
<input type="submit" title="start a incremental scan" value="scan now"> <input type="submit" title="start a incremental scan. gonic will only scan files that have changed since the last scan. it is usually quite fast" value="scan (i)">
</form>
<form class="col-span-full" action="{{ path "/admin/start_scan_full_do" }}" method="post">
<input type="submit" title="start a slow scan. gonic will not check the timestamps of changed files. you generally shouldn't need this" value="scan slow (i)">
</form> </form>
{{ end }} {{ end }}
{{ if .IsScanning }}<p class="text-green-500 col-span-full">scan in progress...</p>{{ end }} {{ if .IsScanning }}<p class="text-green-500 col-span-full">scan in progress...</p>{{ end }}

View File

@@ -65,8 +65,9 @@ func (c *Controller) ServeHome(r *http.Request) *Response {
Order("created_at DESC"). Order("created_at DESC").
Limit(20). Limit(20).
Find(&data.RecentFolders) Find(&data.RecentFolders)
data.IsScanning = c.Scanner.IsScanning() data.IsScanning = c.Scanner.IsScanning()
if tStr, err := c.DB.GetSetting("last_scan_time"); err != nil { if tStr, _ := c.DB.GetSetting("last_scan_time"); tStr != "" {
i, _ := strconv.ParseInt(tStr, 10, 64) i, _ := strconv.ParseInt(tStr, 10, 64)
data.LastScanTime = time.Unix(i, 0) data.LastScanTime = time.Unix(i, 0)
} }