From 09ee9ec3579c24c885758ea2c23e3170249cbda7 Mon Sep 17 00:00:00 2001 From: adityachandelgit <> Date: Wed, 30 Apr 2025 21:50:58 -0600 Subject: [PATCH 1/3] Suppress noisy Spring boot logs, Hikari warnings, and clean Quartz/Hibernate startup output --- booklore-api/build.gradle | 2 +- booklore-api/src/main/resources/application.yaml | 15 +++++++++++---- .../user-management/user-management.component.ts | 4 +--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/booklore-api/build.gradle b/booklore-api/build.gradle index b127a947b..cf98ed330 100644 --- a/booklore-api/build.gradle +++ b/booklore-api/build.gradle @@ -38,7 +38,7 @@ dependencies { // --- Database & Migration --- implementation 'org.mariadb.jdbc:mariadb-java-client:3.5.3' - implementation 'org.flywaydb:flyway-mysql:11.7.1' + implementation 'org.flywaydb:flyway-mysql:11.8.0' // --- Security & Authentication --- implementation 'io.jsonwebtoken:jjwt-api:0.12.6' diff --git a/booklore-api/src/main/resources/application.yaml b/booklore-api/src/main/resources/application.yaml index 40ad35724..0066b0a05 100644 --- a/booklore-api/src/main/resources/application.yaml +++ b/booklore-api/src/main/resources/application.yaml @@ -27,10 +27,11 @@ spring: username: ${DATABASE_USERNAME:root} password: ${DATABASE_PASSWORD:${MYSQL_ROOT_PASSWORD}} hikari: - max-lifetime: 580000 # 580 seconds + max-lifetime: 580000 # 9.6 minutes (avoid DB-side connection cuts) connection-test-query: SELECT 1 - maximum-pool-size: 10 - idle-timeout: 300000 # 5 minutes + maximum-pool-size: 10 # Allows bursts + minimum-idle: 1 # Shrinks when idle + idle-timeout: 300000 # 5 minutes before idle connections are closed jpa: hibernate: naming: @@ -42,6 +43,7 @@ spring: batch_size: 500 order_inserts: true order_updates: true + open-in-view: false flyway: enabled: true locations: classpath:db/migration @@ -51,4 +53,9 @@ logging: root: ${ROOT_LOG_LEVEL:INFO} com.adityachandel.booklore: ${LOG_LEVEL:INFO} org.apache.fontbox: ERROR - org.apache.pdfbox: ERROR \ No newline at end of file + org.apache.pdfbox: ERROR + org.quartz.core.QuartzScheduler: WARN + org.quartz.simpl.SimpleThreadPool: WARN + org.quartz.simpl.RAMJobStore: WARN + org.hibernate.orm.connections.pooling: WARN + org.springframework.security.config.annotation.authentication.configuration.InitializeUserDetailsBeanManagerConfigurer: ERROR \ No newline at end of file diff --git a/booklore-ui/src/app/settings/user-management/user-management.component.ts b/booklore-ui/src/app/settings/user-management/user-management.component.ts index 7adbaa0de..07ca5e445 100644 --- a/booklore-ui/src/app/settings/user-management/user-management.component.ts +++ b/booklore-ui/src/app/settings/user-management/user-management.component.ts @@ -13,7 +13,6 @@ import {Library} from '../../book/model/library.model'; import {LibraryService} from '../../book/service/library.service'; import {Dialog} from 'primeng/dialog'; import {Password} from 'primeng/password'; -import {Tooltip} from 'primeng/tooltip'; @Component({ selector: 'app-user-management', @@ -26,8 +25,7 @@ import {Tooltip} from 'primeng/tooltip'; NgStyle, MultiSelect, Dialog, - Password, - Tooltip, + Password ], templateUrl: './user-management.component.html', styleUrls: ['./user-management.component.scss'], From d7e65466966aff230792aab395306e5e4a4c86a5 Mon Sep 17 00:00:00 2001 From: adityachandelgit <> Date: Sun, 11 May 2025 23:27:37 -0600 Subject: [PATCH 2/3] Implement multi-select AND filter with count in UI --- .../src/main/resources/application.yaml | 1 - .../book-browser/book-browser.component.ts | 70 +++++++++---------- .../book-filter/book-filter.component.html | 14 +++- .../book-filter/book-filter.component.ts | 31 +++++--- 4 files changed, 65 insertions(+), 51 deletions(-) diff --git a/booklore-api/src/main/resources/application.yaml b/booklore-api/src/main/resources/application.yaml index 0066b0a05..1a4ae64c9 100644 --- a/booklore-api/src/main/resources/application.yaml +++ b/booklore-api/src/main/resources/application.yaml @@ -43,7 +43,6 @@ spring: batch_size: 500 order_inserts: true order_updates: true - open-in-view: false flyway: enabled: true locations: classpath:db/migration diff --git a/booklore-ui/src/app/book/components/book-browser/book-browser.component.ts b/booklore-ui/src/app/book/components/book-browser/book-browser.component.ts index baf0182bc..543353c85 100644 --- a/booklore-ui/src/app/book/components/book-browser/book-browser.component.ts +++ b/booklore-ui/src/app/book/components/book-browser/book-browser.component.ts @@ -97,7 +97,7 @@ export class BookBrowserComponent implements OnInit, AfterViewInit { @ViewChild(BookTableComponent) bookTableComponent!: BookTableComponent; @ViewChild(BookFilterComponent) bookFilterComponent!: BookFilterComponent; - selectedFilter = new BehaviorSubject<{ type: string; value: any } | null>(null); + selectedFilter = new BehaviorSubject | null>(null); protected resetFilterSubject = new Subject(); protected userService = inject(UserService); @@ -257,43 +257,37 @@ export class BookBrowserComponent implements OnInit, AfterViewInit { private sideBarFilter(bookState: BookState): Observable { return this.selectedFilter.pipe( - map(selectedFilter => { - if (!selectedFilter) { + map((activeFilters: Record | null) => { + if (!activeFilters) { return bookState; } - let filteredBooks = bookState.books || []; - switch (selectedFilter.type) { - case 'author': - filteredBooks = filteredBooks.filter(book => - book.metadata?.authors?.some(author => author === selectedFilter.value) - ); - break; - case 'category': - filteredBooks = filteredBooks.filter(book => - book.metadata?.categories?.some(category => category === selectedFilter.value) - ); - break; - case 'publisher': - filteredBooks = filteredBooks.filter(book => - book.metadata?.publisher === selectedFilter.value - ); - break; - case 'award': - filteredBooks = filteredBooks.filter(book => - book.metadata?.awards?.some( - award => award.name === selectedFilter.value.name && award.designation === 'WINNER' - ) - ); - break; - case 'series': - filteredBooks = filteredBooks.filter(book => - book.metadata?.seriesName === selectedFilter.value - ); - break; - default: - break; - } - return {...bookState, books: filteredBooks}; + + const filteredBooks = (bookState.books || []).filter(book => { + return Object.entries(activeFilters).every(([filterType, filterValues]) => { + if (!Array.isArray(filterValues) || filterValues.length === 0) return true; + + switch (filterType) { + case 'author': + return filterValues.every(val => book.metadata?.authors?.includes(val)); + case 'category': + return filterValues.every(val => book.metadata?.categories?.includes(val)); + case 'publisher': + return filterValues.every(val => book.metadata?.publisher === val); + case 'award': + return filterValues.every(val => + book.metadata?.awards?.some( + award => award.name === val.name && award.designation === 'WINNER' + ) + ); + case 'series': + return filterValues.every(val => book.metadata?.seriesName === val); + default: + return true; + } + }); + }); + + return { ...bookState, books: filteredBooks }; }) ); } @@ -523,8 +517,8 @@ export class BookBrowserComponent implements OnInit, AfterViewInit { } ngAfterViewInit() { - this.bookFilterComponent.filterSelected.subscribe((item) => { - this.selectedFilter.next(item); + this.bookFilterComponent.filterSelected.subscribe((filters: Record | null) => { + this.selectedFilter.next(filters); }); this.activatedRoute.queryParamMap.subscribe(paramMap => { diff --git a/booklore-ui/src/app/book/components/book-browser/book-filter/book-filter.component.html b/booklore-ui/src/app/book/components/book-browser/book-filter/book-filter.component.html index abf2d915e..642b5c985 100644 --- a/booklore-ui/src/app/book/components/book-browser/book-filter/book-filter.component.html +++ b/booklore-ui/src/app/book/components/book-browser/book-filter/book-filter.component.html @@ -1,13 +1,23 @@
- {{ filterType | titlecase }} + + + {{ filterType | titlecase }} + + ({{ activeFilters[filterType].length }}) + + +

{{ filter.value.name || filter.value }} diff --git a/booklore-ui/src/app/book/components/book-browser/book-filter/book-filter.component.ts b/booklore-ui/src/app/book/components/book-browser/book-filter/book-filter.component.ts index 27c5ebfff..89bed169d 100644 --- a/booklore-ui/src/app/book/components/book-browser/book-filter/book-filter.component.ts +++ b/booklore-ui/src/app/book/components/book-browser/book-filter/book-filter.component.ts @@ -32,14 +32,14 @@ type Filter = { value: T; bookCount: number }; ] }) export class BookFilterComponent implements OnInit { - @Output() filterSelected = new EventEmitter<{ type: string; value: any } | null>(); + @Output() filterSelected = new EventEmitter | null>(); @Input() showFilters: boolean = true; @Input() entity$!: Observable | undefined; @Input() entityType$!: Observable | undefined; @Input() resetFilter$!: Subject; - activeFilter: { type: string; value: any | null } = {type: '', value: null}; + activeFilters: Record = {}; filterStreams: Record[]>> = {}; filterTypes: string[] = []; @@ -91,18 +91,29 @@ export class BookFilterComponent implements OnInit { return books; } - handleFilterClick(filterType: string, value: any) { - if (this.activeFilter.type === filterType && this.activeFilter.value === value) { - this.activeFilter = {type: '', value: null}; - this.filterSelected.emit(null); - } else { - this.activeFilter = {type: filterType, value}; - this.filterSelected.emit({type: filterType, value}); + handleFilterClick(filterType: string, value: any): void { + if (!this.activeFilters[filterType]) { + this.activeFilters[filterType] = []; } + + const index = this.activeFilters[filterType].indexOf(value); + if (index > -1) { + // Deselect + this.activeFilters[filterType].splice(index, 1); + if (this.activeFilters[filterType].length === 0) { + delete this.activeFilters[filterType]; + } + } else { + // Select + this.activeFilters[filterType].push(value); + } + + // Emit updated filter state + this.filterSelected.emit({ ...this.activeFilters }); } clearActiveFilter() { - this.activeFilter = { type: '', value: null }; + this.activeFilters = {}; this.filterSelected.emit(null); } } From 548e09ae2c6e6218185f6a282dfbf52f6320f889 Mon Sep 17 00:00:00 2001 From: adityachandelgit <> Date: Sun, 11 May 2025 23:43:46 -0600 Subject: [PATCH 3/3] Make main dashboard vertically scrollable --- .../main-dashboard.component.html | 83 +++++++++---------- .../main-dashboard.component.scss | 5 ++ 2 files changed, 46 insertions(+), 42 deletions(-) diff --git a/booklore-ui/src/app/dashboard/components/main-dashboard/main-dashboard.component.html b/booklore-ui/src/app/dashboard/components/main-dashboard/main-dashboard.component.html index 647966cc7..e3d14e9e8 100644 --- a/booklore-ui/src/app/dashboard/components/main-dashboard/main-dashboard.component.html +++ b/booklore-ui/src/app/dashboard/components/main-dashboard/main-dashboard.component.html @@ -1,47 +1,46 @@ - - -

-
-
-
-
-

Looks like you haven't added a library yet. Let's add one!

- - +
+ +
+
+
+
+
+

Looks like you haven't added a library yet. Let's add one!

+ + +
+ + + + + +
+ +
+ + + + +
+ +
+ + + +
- - - - - -
- -
- - - - -
- -
- - - - - -
diff --git a/booklore-ui/src/app/dashboard/components/main-dashboard/main-dashboard.component.scss b/booklore-ui/src/app/dashboard/components/main-dashboard/main-dashboard.component.scss index 932cbbb8e..0ca370597 100644 --- a/booklore-ui/src/app/dashboard/components/main-dashboard/main-dashboard.component.scss +++ b/booklore-ui/src/app/dashboard/components/main-dashboard/main-dashboard.component.scss @@ -1,3 +1,8 @@ +.dashboard-container { + height: calc(100vh - 6.7rem); + overflow-y: auto; +} + .dashboard { flex-direction: column; align-items: center;