diff options
-rw-r--r-- | main.go | 16 | ||||
-rw-r--r-- | public/gallery.js | 6 | ||||
-rw-r--r-- | public/style.css | 3 |
3 files changed, 15 insertions, 10 deletions
@@ -763,14 +763,16 @@ func getOrphanReplacement(webPath string) (*webOrphanImage, error) { var image webOrphanImage err = db.QueryRow(`SELECT i.sha1, - IFNULL(i.thumbw, 0), IFNULL(i.thumbh, 0), COUNT(*) AS tags + IFNULL(i.thumbw, 0), IFNULL(i.thumbh, 0), COUNT(ta.sha1) AS tags FROM node AS n JOIN image AS i ON n.sha1 = i.sha1 - JOIN tag_assignment AS ta ON n.sha1 = ta.sha1 + LEFT JOIN tag_assignment AS ta ON n.sha1 = ta.sha1 WHERE n.parent = ? AND n.name = ? - GROUP BY ta.sha1`, parent, path[len(path)-1]).Scan( + GROUP BY n.sha1`, parent, path[len(path)-1]).Scan( &image.SHA1, &image.ThumbW, &image.ThumbH, &image.Tags) - if err != nil { + if errors.Is(err, sql.ErrNoRows) { + return nil, nil + } else if err != nil { return nil, err } return &image, nil @@ -778,11 +780,11 @@ func getOrphanReplacement(webPath string) (*webOrphanImage, error) { func getOrphans() (result []webOrphan, err error) { rows, err := db.Query(`SELECT o.sha1, o.path, - IFNULL(i.thumbw, 0), IFNULL(i.thumbh, 0), COUNT(*) AS tags + IFNULL(i.thumbw, 0), IFNULL(i.thumbh, 0), COUNT(ta.sha1) AS tags FROM orphan AS o JOIN image AS i ON o.sha1 = i.sha1 - JOIN tag_assignment AS ta ON o.sha1 = ta.sha1 - GROUP BY ta.sha1`) + LEFT JOIN tag_assignment AS ta ON o.sha1 = ta.sha1 + GROUP BY o.sha1`) if err != nil { return nil, err } diff --git a/public/gallery.js b/public/gallery.js index 5df58e6..f97a162 100644 --- a/public/gallery.js +++ b/public/gallery.js @@ -416,7 +416,7 @@ let OrphansModel = { } let OrphansReplacement = { - view(node) { + view(vnode) { const info = vnode.attrs.info if (!info) return [] @@ -431,7 +431,7 @@ let OrphansReplacement = { } let OrphansRow = { - view(node) { + view(vnode) { const info = vnode.attrs.info return m('.row', [ // It might not load, but still allow tag viewing. @@ -451,7 +451,7 @@ let OrphansList = { let children = (OrphansModel.entries.length == 0) ? "No orphans" : OrphansModel.entries.map(info => [ - m("h3", info.lastPath), + m("h2", info.lastPath), m(OrphansRow, {info}), ]) return m('.orphans[tabindex=0]', {}, children) diff --git a/public/style.css b/public/style.css index 888fd6a..42d7a59 100644 --- a/public/style.css +++ b/public/style.css @@ -79,3 +79,6 @@ img.thumbnail, .thumbnail.missing { box-shadow: 0 0 3px rgba(0, 0, 0, 0.75); .orphans { padding: .5rem; flex-grow: 1; overflow: auto; } .duplicates .row, .orphans .row { display: flex; margin: .5rem 0; align-items: center; gap: 3px; } + +.orphans .row { margin-bottom: 1.25rem; } +.orphans h2 { margin: 0.25em 0; padding: 0; font-size: 1.1rem; } |