From c31e7b8e3a1d03ddbee9ab56828fa8630f594356 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Fri, 28 May 2021 22:02:49 +0200 Subject: [PATCH] Adding save album button to search query builder #45 --- .../app/ui/albums/album/album.component.css | 25 +-------- .../app/ui/albums/album/album.component.html | 2 +- .../app/ui/albums/album/album.component.ts | 6 +- src/frontend/app/ui/albums/albums.service.ts | 6 ++ .../app/ui/faces/face/face.component.css | 5 -- .../search/search.gallery.component.html | 55 ++++++++++++++++--- .../search/search.gallery.component.ts | 30 ++++++++-- 7 files changed, 83 insertions(+), 46 deletions(-) diff --git a/src/frontend/app/ui/albums/album/album.component.css b/src/frontend/app/ui/albums/album/album.component.css index e01f51f3..56d40552 100644 --- a/src/frontend/app/ui/albums/album/album.component.css +++ b/src/frontend/app/ui/albums/album/album.component.css @@ -1,21 +1,15 @@ -.star { +.delete { margin: 2px; - color: #888; cursor: default; - } -.star.favourite { - color: white; -} - -.star.clickable { +.delete { cursor: pointer; transition: all .05s ease-in-out; transform: scale(1.0, 1.0); } -.star.clickable:hover { +.delete:hover { transform: scale(1.4, 1.4); } @@ -46,13 +40,6 @@ a { background-position: center; } -.button { - border: 0; - padding: 0; - text-align: left; - -} - .info { background-color: rgba(0, 0, 0, 0.6); color: white; @@ -71,9 +58,3 @@ a:hover .info { a:hover .photo-container { border-color: #000; } - -.person-name { - display: inline-block; - width: 180px; - white-space: normal; -} diff --git a/src/frontend/app/ui/albums/album/album.component.html b/src/frontend/app/ui/albums/album/album.component.html index 10496b84..c0692e80 100644 --- a/src/frontend/app/ui/albums/album/album.component.html +++ b/src/frontend/app/ui/albums/album/album.component.html @@ -21,7 +21,7 @@ {{album.name}} + class="delete oi oi-trash float-right"> diff --git a/src/frontend/app/ui/albums/album/album.component.ts b/src/frontend/app/ui/albums/album/album.component.ts index e3a6f9c0..2ca850cf 100644 --- a/src/frontend/app/ui/albums/album/album.component.ts +++ b/src/frontend/app/ui/albums/album/album.component.ts @@ -37,14 +37,14 @@ export class AlbumComponent implements OnInit, OnDestroy { } get CanUpdate(): boolean { - return this.authenticationService.user.getValue().role >= UserRoles.Admin; + return this.authenticationService.user.getValue().role >= UserRoles.Admin; } get RouterLink(): any[] { if (this.IsSavedSearch) { - return ['/search', this.AsSavedSearch.searchQuery]; + return ['/search', JSON.stringify(this.AsSavedSearch.searchQuery)]; } - // TODO: add nomral albums here once they are ready + // TODO: add "normal" albums here once they are ready, see: https://github.com/bpatrik/pigallery2/issues/301 return null; } diff --git a/src/frontend/app/ui/albums/albums.service.ts b/src/frontend/app/ui/albums/albums.service.ts index 9acbee04..ff6f75e1 100644 --- a/src/frontend/app/ui/albums/albums.service.ts +++ b/src/frontend/app/ui/albums/albums.service.ts @@ -2,6 +2,7 @@ import {Injectable} from '@angular/core'; import {NetworkService} from '../../model/network/network.service'; import {BehaviorSubject} from 'rxjs'; import {AlbumBaseDTO} from '../../../../common/entities/album/AlbumBaseDTO'; +import {SearchQueryDTO} from '../../../../common/entities/SearchQueryDTO'; @Injectable() @@ -22,4 +23,9 @@ export class AlbumsService { await this.networkService.deleteJson('/albums/' + album.id); await this.getAlbums(); } + + async addSavedSearch(name: string, searchQuery: SearchQueryDTO): Promise { + await this.networkService.putJson('/albums/saved-searches', {name, searchQuery}); + await this.getAlbums(); + } } diff --git a/src/frontend/app/ui/faces/face/face.component.css b/src/frontend/app/ui/faces/face/face.component.css index e01f51f3..a5192162 100644 --- a/src/frontend/app/ui/faces/face/face.component.css +++ b/src/frontend/app/ui/faces/face/face.component.css @@ -72,8 +72,3 @@ a:hover .photo-container { border-color: #000; } -.person-name { - display: inline-block; - width: 180px; - white-space: normal; -} diff --git a/src/frontend/app/ui/gallery/search/search.gallery.component.html b/src/frontend/app/ui/gallery/search/search.gallery.component.html index 0abfb650..7643a825 100644 --- a/src/frontend/app/ui/gallery/search/search.gallery.component.html +++ b/src/frontend/app/ui/gallery/search/search.gallery.component.html @@ -1,11 +1,11 @@