From dd442ab9e90462d14e31fcc401577de826314879 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Sat, 30 May 2020 01:41:47 +0200 Subject: [PATCH] Add moments #154 Signed-off-by: Michael Mayer --- cmd/photoprism/photoprism.go | 1 + frontend/src/common/config.js | 17 +-- frontend/src/component/p-navigation.vue | 18 ++- frontend/src/dialog/p-photo-album-dialog.vue | 1 + frontend/src/pages/album/photos.vue | 2 + frontend/src/pages/albums.vue | 9 +- frontend/src/routes.js | 6 + go.mod | 1 + go.sum | 4 + internal/api/album.go | 95 +++++++++------ internal/api/album_test.go | 2 +- internal/api/folder.go | 31 +++-- internal/api/index.go | 6 + internal/api/label.go | 70 +++++++---- internal/api/photo_thumbnail.go | 23 +++- internal/commands/moments.go | 51 ++++++++ internal/config/client.go | 37 +++--- internal/config/config.go | 11 -- internal/entity/album.go | 84 ++++++++++++- internal/entity/const.go | 1 + internal/entity/photo_album.go | 5 + internal/entity/photo_maintain.go | 2 +- internal/form/photo_search.go | 13 +- internal/form/search.go | 96 +-------------- internal/form/serialize.go | 90 ++++++++++++++ internal/maps/places/cache.go | 14 ++- internal/maps/places/location.go | 22 +++- internal/photoprism/moments.go | 118 ++++++++++++++++++- internal/photoprism/moments_test.go | 18 +++ internal/query/albums.go | 24 +++- internal/query/albums_test.go | 4 +- internal/query/counts.go | 74 ++++++++++++ internal/query/moments.go | 16 +-- internal/query/moments_test.go | 6 +- internal/query/photo_search.go | 12 +- internal/service/cache.go | 12 +- internal/service/service.go | 6 +- 37 files changed, 755 insertions(+), 247 deletions(-) create mode 100644 internal/commands/moments.go create mode 100644 internal/photoprism/moments_test.go create mode 100644 internal/query/counts.go diff --git a/cmd/photoprism/photoprism.go b/cmd/photoprism/photoprism.go index 61616ccf4..9df659845 100644 --- a/cmd/photoprism/photoprism.go +++ b/cmd/photoprism/photoprism.go @@ -26,6 +26,7 @@ func main() { commands.StopCommand, commands.IndexCommand, commands.ImportCommand, + commands.MomentsCommand, commands.PurgeCommand, commands.CopyCommand, commands.ConvertCommand, diff --git a/frontend/src/common/config.js b/frontend/src/common/config.js index 84564f159..1e51a9e8a 100644 --- a/frontend/src/common/config.js +++ b/frontend/src/common/config.js @@ -86,14 +86,20 @@ class Config { case "videos": this.values.count.videos += data.count; break; - case "files": - this.values.count.files += data.count; + case "albums": + this.values.count.albums += data.count; + break; + case "moments": + this.values.count.moments += data.count; + break; + case "months": + this.values.count.months += data.count; break; case "folders": this.values.count.folders += data.count; break; - case "moments": - this.values.count.moments += data.count; + case "files": + this.values.count.files += data.count; break; case "favorites": this.values.count.favorites += data.count; @@ -104,9 +110,6 @@ class Config { case "private": this.values.count.private += data.count; break; - case "albums": - this.values.count.albums += data.count; - break; case "photos": this.values.count.photos += data.count; break; diff --git a/frontend/src/component/p-navigation.vue b/frontend/src/component/p-navigation.vue index dcd393f2d..1aef0ece4 100644 --- a/frontend/src/component/p-navigation.vue +++ b/frontend/src/component/p-navigation.vue @@ -142,7 +142,7 @@ - + @@ -152,6 +152,22 @@ + + + Folders + {{ config.count.folders }} + + + + + + Months + {{ config.count.months }} + + + diff --git a/frontend/src/dialog/p-photo-album-dialog.vue b/frontend/src/dialog/p-photo-album-dialog.vue index 97b454e09..e9d02fe07 100644 --- a/frontend/src/dialog/p-photo-album-dialog.vue +++ b/frontend/src/dialog/p-photo-album-dialog.vue @@ -90,6 +90,7 @@ q: q, count: 1000, offset: 0, + type: "album" }; Album.search(params).then(response => { diff --git a/frontend/src/pages/album/photos.vue b/frontend/src/pages/album/photos.vue index 0525217c4..f32a2c02f 100644 --- a/frontend/src/pages/album/photos.vue +++ b/frontend/src/pages/album/photos.vue @@ -171,6 +171,7 @@ count: count, offset: offset, album: this.uid, + filter: this.model.Filter ? this.model.Filter : "", merged: true, }; @@ -227,6 +228,7 @@ count: this.pageSize, offset: this.offset, album: this.uid, + filter: this.model.Filter ? this.model.Filter : "", merged: true, }; diff --git a/frontend/src/pages/albums.vue b/frontend/src/pages/albums.vue index c2e74c565..ec7d46c2e 100644 --- a/frontend/src/pages/albums.vue +++ b/frontend/src/pages/albums.vue @@ -76,7 +76,7 @@ @contextmenu="onContextMenu($event, index)" :dark="selection.includes(album.UID)" :class="selection.includes(album.UID) ? 'elevation-10 ma-0 accent darken-1 white--text' : 'elevation-0 ma-1 accent lighten-3'" - :to="{name: 'album', params: {uid: album.UID, slug: album.Slug}}" + :to="{name: albumRoute(), params: {uid: album.UID, slug: album.Slug}}" >