Don't merge categories on manual edit
This commit is contained in:
+5
-2
@@ -32,8 +32,11 @@ public class MetadataController {
|
||||
}
|
||||
|
||||
@PutMapping("/{bookId}/metadata")
|
||||
public ResponseEntity<BookMetadata> updateMetadata(@RequestBody BookMetadata setMetadataRequest, @PathVariable long bookId) {
|
||||
BookMetadata bookMetadata = bookMetadataMapper.toBookMetadata(bookMetadataUpdater.setBookMetadata(bookId, setMetadataRequest, true, true), true);
|
||||
public ResponseEntity<BookMetadata> updateMetadata(
|
||||
@RequestBody BookMetadata setMetadataRequest, @PathVariable long bookId,
|
||||
@RequestParam(defaultValue = "true") boolean mergeCategories) {
|
||||
BookMetadata bookMetadata = bookMetadataMapper.toBookMetadata(
|
||||
bookMetadataUpdater.setBookMetadata(bookId, setMetadataRequest, true, mergeCategories), true);
|
||||
return ResponseEntity.ok(bookMetadata);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: radial-gradient(circle, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.6) 100%);
|
||||
background: radial-gradient(circle, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0.6) 100%);
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s ease-in-out;
|
||||
pointer-events: none;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {inject, Injectable} from '@angular/core';
|
||||
import {BehaviorSubject, Observable, of} from 'rxjs';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import {HttpClient, HttpParams} from '@angular/common/http';
|
||||
import {catchError, map, tap} from 'rxjs/operators';
|
||||
import {Book, BookMetadata, BookSetting} from '../model/book.model';
|
||||
import {BookState} from '../model/state/book-state.model';
|
||||
@@ -196,8 +196,9 @@ export class BookService {
|
||||
return this.http.post<BookMetadata[]>(`${this.url}/${bookId}/metadata/prospective`, request);
|
||||
}
|
||||
|
||||
updateBookMetadata(bookId: number, bookMetadata: BookMetadata): Observable<BookMetadata> {
|
||||
return this.http.put<BookMetadata>(`${this.url}/${bookId}/metadata`, bookMetadata).pipe(
|
||||
updateBookMetadata(bookId: number, bookMetadata: BookMetadata, mergeCategories: boolean): Observable<BookMetadata> {
|
||||
const params = new HttpParams().set('mergeCategories', mergeCategories.toString());
|
||||
return this.http.put<BookMetadata>(`${this.url}/${bookId}/metadata`, bookMetadata, { params }).pipe(
|
||||
map(updatedMetadata => {
|
||||
this.handleBookMetadataUpdate(bookId, updatedMetadata);
|
||||
return updatedMetadata;
|
||||
|
||||
+2
-2
@@ -149,7 +149,7 @@ export class MetadataEditorComponent implements OnInit {
|
||||
}
|
||||
|
||||
onSave(): void {
|
||||
this.bookService.updateBookMetadata(this.currentBookId, this.buildMetadata()).subscribe({
|
||||
this.bookService.updateBookMetadata(this.currentBookId, this.buildMetadata(), false).subscribe({
|
||||
next: (response) => {
|
||||
this.messageService.add({severity: 'info', summary: 'Success', detail: 'Book metadata updated'});
|
||||
this.metadataCenterService.emit(response);
|
||||
@@ -236,7 +236,7 @@ export class MetadataEditorComponent implements OnInit {
|
||||
}
|
||||
|
||||
private updateMetadata(): void {
|
||||
this.bookService.updateBookMetadata(this.currentBookId, this.buildMetadata()).subscribe({
|
||||
this.bookService.updateBookMetadata(this.currentBookId, this.buildMetadata(), false).subscribe({
|
||||
next: (response) => {
|
||||
this.metadataCenterService.emit(response);
|
||||
},
|
||||
|
||||
+2
-2
@@ -170,7 +170,7 @@ export class MetadataPickerComponent implements OnInit {
|
||||
|
||||
onSave(): void {
|
||||
const updatedBookMetadata = this.buildMetadata();
|
||||
this.bookService.updateBookMetadata(this.currentBookId, updatedBookMetadata).subscribe({
|
||||
this.bookService.updateBookMetadata(this.currentBookId, updatedBookMetadata, false).subscribe({
|
||||
next: (bookMetadata) => {
|
||||
Object.keys(this.copiedFields).forEach((field) => {
|
||||
if (this.copiedFields[field]) {
|
||||
@@ -237,7 +237,7 @@ export class MetadataPickerComponent implements OnInit {
|
||||
}
|
||||
|
||||
private updateMetadata(): void {
|
||||
this.bookService.updateBookMetadata(this.currentBookId, this.buildMetadata()).subscribe({
|
||||
this.bookService.updateBookMetadata(this.currentBookId, this.buildMetadata(), false).subscribe({
|
||||
next: (response) => {
|
||||
this.metadataCenterService.emit(response);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user