Skip to content

Commit

Permalink
add scan full button
Browse files Browse the repository at this point in the history
Release-As: v0.16.0
  • Loading branch information
sentriz committed Sep 10, 2023
1 parent 5b2ea75 commit 600f221
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion server/ctrladmin/adminui/pages/home.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@
<p class="col-span-full text-gray-500" title="{{ .LastScanTime }}">scanned {{ .LastScanTime | dateHuman }}</p>
{{ end }}
<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>
{{ end }}
{{ if .IsScanning }}<p class="text-green-500 col-span-full">scan in progress...</p>{{ end }}
Expand Down
3 changes: 2 additions & 1 deletion server/ctrladmin/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ func (c *Controller) ServeHome(r *http.Request) *Response {
Order("created_at DESC").
Limit(20).
Find(&data.RecentFolders)

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)
data.LastScanTime = time.Unix(i, 0)
}
Expand Down

0 comments on commit 600f221

Please sign in to comment.