Use chips for editing genres and authors metadata fields
This commit is contained in:
committed by
Aditya Chandel
parent
5faeaabd5a
commit
eaf207dc70
+50
-43
@@ -55,7 +55,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col flex-grow pl-2">
|
<div class="flex flex-col flex-grow pl-2">
|
||||||
<!-- Title and Subtitle -->
|
|
||||||
<div class="flex flex-row w-full gap-4 pb-1">
|
<div class="flex flex-row w-full gap-4 pb-1">
|
||||||
<div class="flex flex-col gap-1 w-2/3">
|
<div class="flex flex-col gap-1 w-2/3">
|
||||||
<label for="title">Title</label>
|
<label for="title">Title</label>
|
||||||
@@ -82,12 +82,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Authors and Publisher -->
|
|
||||||
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
|
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
|
||||||
<div class="flex flex-col gap-1 w-2/3">
|
<div class="flex flex-col gap-1 basis-[71%]">
|
||||||
<label for="authors">Authors</label>
|
<label for="authors">Authors</label>
|
||||||
<div class="flex justify-between items-center gap-2">
|
<div class="flex justify-between items-center gap-2">
|
||||||
<input pInputText id="authors" formControlName="authors" class="w-full"/>
|
<div class="w-full">
|
||||||
|
<p-chips formControlName="authors" addOnBlur="true"></p-chips>
|
||||||
|
</div>
|
||||||
@if (!book.metadata!['authorsLocked']) {
|
@if (!book.metadata!['authorsLocked']) {
|
||||||
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('authors')" severity="success"></p-button>
|
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('authors')" severity="success"></p-button>
|
||||||
}
|
}
|
||||||
@@ -96,7 +98,7 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col gap-1 w-1/3">
|
<div class="flex flex-col gap-1 basis-[20%]">
|
||||||
<label for="publisher">Publisher</label>
|
<label for="publisher">Publisher</label>
|
||||||
<div class="flex justify-between items-center gap-2">
|
<div class="flex justify-between items-center gap-2">
|
||||||
<input pInputText id="publisher" formControlName="publisher" class="w-full"/>
|
<input pInputText id="publisher" formControlName="publisher" class="w-full"/>
|
||||||
@@ -108,34 +110,7 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
<div class="flex flex-col gap-1 basis-[14%]">
|
||||||
<!-- Categories and Published Date -->
|
|
||||||
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
|
|
||||||
<div class="flex flex-col gap-1 w-3/4">
|
|
||||||
<label for="categories">Categories</label>
|
|
||||||
<div class="flex justify-between items-center gap-2">
|
|
||||||
<input pInputText id="categories" formControlName="categories" class="w-full"/>
|
|
||||||
@if (!book.metadata!['categoriesLocked']) {
|
|
||||||
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('categories')" severity="success"></p-button>
|
|
||||||
}
|
|
||||||
@if (book.metadata!['categoriesLocked']) {
|
|
||||||
<p-button icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('categories')" severity="warn"></p-button>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-1 w-1/8">
|
|
||||||
<label for="publishedDate">Publish Date</label>
|
|
||||||
<div class="flex justify-between items-center gap-2">
|
|
||||||
<input pInputText id="publishedDate" formControlName="publishedDate" class="w-full"/>
|
|
||||||
@if (!book.metadata!['publishedDateLocked']) {
|
|
||||||
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('publishedDate')" severity="success"></p-button>
|
|
||||||
}
|
|
||||||
@if (book.metadata!['publishedDateLocked']) {
|
|
||||||
<p-button icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('publishedDate')" severity="warn"></p-button>
|
|
||||||
}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="flex flex-col gap-1 w-1/8">
|
|
||||||
<label for="language">Language</label>
|
<label for="language">Language</label>
|
||||||
<div class="flex justify-between items-center gap-2">
|
<div class="flex justify-between items-center gap-2">
|
||||||
<input pInputText id="language" formControlName="language" class="w-full"/>
|
<input pInputText id="language" formControlName="language" class="w-full"/>
|
||||||
@@ -148,11 +123,28 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
|
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
|
||||||
<div class="flex flex-col gap-1 basis-3/4">
|
<div class="flex flex-col gap-1 w-full">
|
||||||
|
<label for="categories">Categories</label>
|
||||||
|
<div class="flex justify-between items-center gap-2">
|
||||||
|
<div class="w-full">
|
||||||
|
<p-chips formControlName="categories" addOnBlur="true"></p-chips>
|
||||||
|
</div>
|
||||||
|
@if (!book.metadata!['categoriesLocked']) {
|
||||||
|
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('categories')" severity="success"></p-button>
|
||||||
|
}
|
||||||
|
@if (book.metadata!['categoriesLocked']) {
|
||||||
|
<p-button icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('categories')" severity="warn"></p-button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
|
||||||
|
<div class="flex flex-col gap-1 basis-[75%]">
|
||||||
<label for="seriesName">Series Name</label>
|
<label for="seriesName">Series Name</label>
|
||||||
<div class="flex justify-between items-center gap-2">
|
<div class="flex justify-between items-center gap-2">
|
||||||
<input pInputText id="seriesName" formControlName="seriesName" class="w-full"/>
|
<input pInputText id="seriesName" formControlName="seriesName" class="w-full" />
|
||||||
@if (!book.metadata!['seriesNameLocked']) {
|
@if (!book.metadata!['seriesNameLocked']) {
|
||||||
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesName')" severity="success"></p-button>
|
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesName')" severity="success"></p-button>
|
||||||
}
|
}
|
||||||
@@ -161,10 +153,11 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col gap-1 basis-1/8">
|
|
||||||
<label for="seriesNumber">Book Number</label>
|
<div class="flex flex-col gap-1 basis-[10%]">
|
||||||
|
<label for="seriesNumber">Book #</label>
|
||||||
<div class="flex justify-between items-center gap-2">
|
<div class="flex justify-between items-center gap-2">
|
||||||
<input pInputText id="seriesNumber" formControlName="seriesNumber" class="w-full"/>
|
<input pInputText id="seriesNumber" formControlName="seriesNumber" class="w-full" />
|
||||||
@if (!book.metadata!['seriesNumberLocked']) {
|
@if (!book.metadata!['seriesNumberLocked']) {
|
||||||
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesNumber')" severity="success"></p-button>
|
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesNumber')" severity="success"></p-button>
|
||||||
}
|
}
|
||||||
@@ -173,10 +166,11 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col gap-1 basis-1/8">
|
|
||||||
<label for="seriesTotal">Books in Series</label>
|
<div class="flex flex-col gap-1 basis-[10%]">
|
||||||
|
<label for="seriesTotal">Total Books</label>
|
||||||
<div class="flex justify-between items-center gap-2">
|
<div class="flex justify-between items-center gap-2">
|
||||||
<input pInputText id="seriesTotal" formControlName="seriesTotal" class="w-full"/>
|
<input pInputText id="seriesTotal" formControlName="seriesTotal" class="w-full" />
|
||||||
@if (!book.metadata!['seriesTotalLocked']) {
|
@if (!book.metadata!['seriesTotalLocked']) {
|
||||||
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesTotal')" severity="success"></p-button>
|
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('seriesTotal')" severity="success"></p-button>
|
||||||
}
|
}
|
||||||
@@ -185,8 +179,21 @@
|
|||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="flex flex-col gap-1 basis-[15%]">
|
||||||
|
<label for="publishedDate">Publish Date</label>
|
||||||
|
<div class="flex justify-between items-center gap-2">
|
||||||
|
<input pInputText id="publishedDate" formControlName="publishedDate" class="w-full" />
|
||||||
|
@if (!book.metadata!['publishedDateLocked']) {
|
||||||
|
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock('publishedDate')" severity="success"></p-button>
|
||||||
|
}
|
||||||
|
@if (book.metadata!['publishedDateLocked']) {
|
||||||
|
<p-button icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock('publishedDate')" severity="warn"></p-button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- ISBN, ASIN, Language -->
|
|
||||||
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
|
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
|
||||||
<div class="flex flex-col gap-1 w-1/6">
|
<div class="flex flex-col gap-1 w-1/6">
|
||||||
<label for="isbn10">ISBN 10</label>
|
<label for="isbn10">ISBN 10</label>
|
||||||
@@ -261,7 +268,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Ratings and Reviews -->
|
|
||||||
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
|
<div class="flex flex-row w-full gap-4 mt-2 pb-1">
|
||||||
<div class="flex flex-col gap-1 w-1/6">
|
<div class="flex flex-col gap-1 w-1/6">
|
||||||
<label for="goodreadsId">Goodreads ID</label>
|
<label for="goodreadsId">Goodreads ID</label>
|
||||||
|
|||||||
+7
-5
@@ -21,6 +21,7 @@ import {DialogService} from 'primeng/dynamicdialog';
|
|||||||
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||||
import {MetadataRefreshRequest} from '../../model/request/metadata-refresh-request.model';
|
import {MetadataRefreshRequest} from '../../model/request/metadata-refresh-request.model';
|
||||||
import {MetadataRefreshType} from '../../model/request/metadata-refresh-type.enum';
|
import {MetadataRefreshType} from '../../model/request/metadata-refresh-type.enum';
|
||||||
|
import {Chips} from 'primeng/chips';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-metadata-editor',
|
selector: 'app-metadata-editor',
|
||||||
@@ -43,7 +44,8 @@ import {MetadataRefreshType} from '../../model/request/metadata-refresh-type.enu
|
|||||||
TabList,
|
TabList,
|
||||||
Tab,
|
Tab,
|
||||||
TabPanels,
|
TabPanels,
|
||||||
TabPanel
|
TabPanel,
|
||||||
|
Chips
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class MetadataEditorComponent implements OnInit {
|
export class MetadataEditorComponent implements OnInit {
|
||||||
@@ -167,8 +169,8 @@ export class MetadataEditorComponent implements OnInit {
|
|||||||
this.metadataForm.patchValue({
|
this.metadataForm.patchValue({
|
||||||
title: metadata.title ?? null,
|
title: metadata.title ?? null,
|
||||||
subtitle: metadata.subtitle ?? null,
|
subtitle: metadata.subtitle ?? null,
|
||||||
authors: (metadata.authors ?? []).sort().join(', '),
|
authors: [...(metadata.authors ?? [])].sort(),
|
||||||
categories: (metadata.categories ?? []).sort().join(', '),
|
categories: [...(metadata.categories ?? [])].sort(),
|
||||||
publisher: metadata.publisher ?? null,
|
publisher: metadata.publisher ?? null,
|
||||||
publishedDate: metadata.publishedDate ?? null,
|
publishedDate: metadata.publishedDate ?? null,
|
||||||
isbn10: metadata.isbn10 ?? null,
|
isbn10: metadata.isbn10 ?? null,
|
||||||
@@ -330,8 +332,8 @@ export class MetadataEditorComponent implements OnInit {
|
|||||||
bookId: this.currentBookId,
|
bookId: this.currentBookId,
|
||||||
title: this.metadataForm.get('title')?.value,
|
title: this.metadataForm.get('title')?.value,
|
||||||
subtitle: this.metadataForm.get('subtitle')?.value,
|
subtitle: this.metadataForm.get('subtitle')?.value,
|
||||||
authors: this.metadataForm.get('authors')?.value.split(',').map((author: string) => author.trim()),
|
authors: this.metadataForm.get('authors')?.value ?? [],
|
||||||
categories: this.metadataForm.get('categories')?.value.split(',').map((category: string) => category.trim()),
|
categories: this.metadataForm.get('categories')?.value ?? [],
|
||||||
publisher: this.metadataForm.get('publisher')?.value,
|
publisher: this.metadataForm.get('publisher')?.value,
|
||||||
publishedDate: this.metadataForm.get('publishedDate')?.value,
|
publishedDate: this.metadataForm.get('publishedDate')?.value,
|
||||||
isbn10: this.metadataForm.get('isbn10')?.value,
|
isbn10: this.metadataForm.get('isbn10')?.value,
|
||||||
|
|||||||
+65
-28
@@ -9,14 +9,14 @@
|
|||||||
[ngStyle]="{'padding-left': '2rem', 'padding-right': '0.5rem'}"
|
[ngStyle]="{'padding-left': '2rem', 'padding-right': '0.5rem'}"
|
||||||
[outlined]="true"
|
[outlined]="true"
|
||||||
pTooltip="Move all missing fields" tooltipPosition="bottom"
|
pTooltip="Move all missing fields" tooltipPosition="bottom"
|
||||||
(onClick)="copyMissing()"></p-button>
|
(onClick)="copyMissing()"></p-button>
|
||||||
<p-button
|
<p-button
|
||||||
severity="info"
|
severity="info"
|
||||||
icon='pi pi-angle-double-left'
|
icon='pi pi-angle-double-left'
|
||||||
[ngStyle]="{'padding-left': '0.5rem', 'padding-right': '2rem'}"
|
[ngStyle]="{'padding-left': '0.5rem', 'padding-right': '2rem'}"
|
||||||
[outlined]="true"
|
[outlined]="true"
|
||||||
pTooltip="Move all fields" tooltipPosition="bottom"
|
pTooltip="Move all fields" tooltipPosition="bottom"
|
||||||
(onClick)="copyAll()"></p-button>
|
(onClick)="copyAll()"></p-button>
|
||||||
<p class="text-lg">Fetched Metadata</p>
|
<p class="text-lg">Fetched Metadata</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
@@ -33,12 +33,12 @@
|
|||||||
<p-button
|
<p-button
|
||||||
[icon]="isValueSaved('thumbnailUrl') ? 'pi pi-check' : (hoveredFields['thumbnailUrl'] && isValueCopied('thumbnailUrl') ? 'pi pi-times' : 'pi pi-arrow-left')"
|
[icon]="isValueSaved('thumbnailUrl') ? 'pi pi-check' : (hoveredFields['thumbnailUrl'] && isValueCopied('thumbnailUrl') ? 'pi pi-times' : 'pi pi-arrow-left')"
|
||||||
[outlined]="true"
|
[outlined]="true"
|
||||||
[ngClass]="
|
[ngClass]="
|
||||||
{
|
{
|
||||||
'green-outlined-button': isValueSaved('thumbnailUrl'),
|
'green-outlined-button': isValueSaved('thumbnailUrl'),
|
||||||
'yellow-outlined-button': isValueCopied('thumbnailUrl') && !hoveredFields['thumbnailUrl'],
|
'yellow-outlined-button': isValueCopied('thumbnailUrl') && !hoveredFields['thumbnailUrl'],
|
||||||
'red-outlined-button': isValueCopied('thumbnailUrl') && hoveredFields['thumbnailUrl']
|
'red-outlined-button': isValueCopied('thumbnailUrl') && hoveredFields['thumbnailUrl']
|
||||||
}"
|
}"
|
||||||
class="arrow-button"
|
class="arrow-button"
|
||||||
(click)="hoveredFields['thumbnailUrl'] && isValueCopied('thumbnailUrl') ? resetField('thumbnailUrl') : copyFetchedToCurrent('thumbnailUrl')"
|
(click)="hoveredFields['thumbnailUrl'] && isValueCopied('thumbnailUrl') ? resetField('thumbnailUrl') : copyFetchedToCurrent('thumbnailUrl')"
|
||||||
(mouseenter)="onMouseEnter('thumbnailUrl')"
|
(mouseenter)="onMouseEnter('thumbnailUrl')"
|
||||||
@@ -61,12 +61,12 @@
|
|||||||
<p-button
|
<p-button
|
||||||
[icon]="isValueSaved(field.controlName) ? 'pi pi-check' : (hoveredFields[field.controlName] && isValueCopied(field.controlName) ? 'pi pi-times' : 'pi pi-arrow-left')"
|
[icon]="isValueSaved(field.controlName) ? 'pi pi-check' : (hoveredFields[field.controlName] && isValueCopied(field.controlName) ? 'pi pi-times' : 'pi pi-arrow-left')"
|
||||||
[outlined]="true"
|
[outlined]="true"
|
||||||
[ngClass]="
|
[ngClass]="
|
||||||
{
|
{
|
||||||
'green-outlined-button': isValueSaved(field.controlName),
|
'green-outlined-button': isValueSaved(field.controlName),
|
||||||
'yellow-outlined-button': isValueCopied(field.controlName) && !hoveredFields[field.controlName],
|
'yellow-outlined-button': isValueCopied(field.controlName) && !hoveredFields[field.controlName],
|
||||||
'red-outlined-button': isValueCopied(field.controlName) && hoveredFields[field.controlName]
|
'red-outlined-button': isValueCopied(field.controlName) && hoveredFields[field.controlName]
|
||||||
}"
|
}"
|
||||||
class="arrow-button"
|
class="arrow-button"
|
||||||
(click)="hoveredFields[field.controlName] && isValueCopied(field.controlName) ? resetField(field.controlName) : copyFetchedToCurrent(field.controlName)"
|
(click)="hoveredFields[field.controlName] && isValueCopied(field.controlName) ? resetField(field.controlName) : copyFetchedToCurrent(field.controlName)"
|
||||||
(mouseenter)="onMouseEnter(field.controlName)"
|
(mouseenter)="onMouseEnter(field.controlName)"
|
||||||
@@ -75,6 +75,43 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
@for (field of metadataChips; track field) {
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="{{field.controlName}}" class="label">{{ field.label }}</label>
|
||||||
|
<div class="input-container">
|
||||||
|
@if (!book.metadata![field.lockedKey]) {
|
||||||
|
<p-button icon="pi pi-lock-open" [outlined]="true" (onClick)="toggleLock(field.controlName)" severity="success"></p-button>
|
||||||
|
}
|
||||||
|
@if (book.metadata![field.lockedKey]) {
|
||||||
|
<p-button icon="pi pi-lock" [outlined]="true" (onClick)="toggleLock(field.controlName)" severity="warn"></p-button>
|
||||||
|
}
|
||||||
|
<div class="w-full px-2">
|
||||||
|
<p-chips formControlName="{{field.controlName}}" addOnBlur="true"></p-chips>
|
||||||
|
</div>
|
||||||
|
<p-button
|
||||||
|
[icon]="isValueSaved(field.controlName) ? 'pi pi-check' : (hoveredFields[field.controlName] && isValueCopied(field.controlName) ? 'pi pi-times' : 'pi pi-arrow-left')"
|
||||||
|
[outlined]="true"
|
||||||
|
[ngClass]="
|
||||||
|
{
|
||||||
|
'green-outlined-button': isValueSaved(field.controlName),
|
||||||
|
'yellow-outlined-button': isValueCopied(field.controlName) && !hoveredFields[field.controlName],
|
||||||
|
'red-outlined-button': isValueCopied(field.controlName) && hoveredFields[field.controlName]
|
||||||
|
}"
|
||||||
|
class="arrow-button"
|
||||||
|
(click)="hoveredFields[field.controlName] && isValueCopied(field.controlName) ? resetField(field.controlName) : copyFetchedToCurrent(field.controlName)"
|
||||||
|
(mouseenter)="onMouseEnter(field.controlName)"
|
||||||
|
(mouseleave)="onMouseLeave(field.controlName)"/>
|
||||||
|
|
||||||
|
<div class="w-full px-2">
|
||||||
|
<p-chips
|
||||||
|
[ngModel]="fetchedMetadata[field.fetchedKey] ?? []"
|
||||||
|
[ngModelOptions]="{ standalone: true }"
|
||||||
|
[disabled]="true">
|
||||||
|
</p-chips>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
@for (field of metadataDescription; track field) {
|
@for (field of metadataDescription; track field) {
|
||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<label for="{{field.controlName}}" class="label">{{ field.label }}</label>
|
<label for="{{field.controlName}}" class="label">{{ field.label }}</label>
|
||||||
@@ -89,12 +126,12 @@
|
|||||||
<p-button
|
<p-button
|
||||||
[icon]="isValueSaved(field.controlName) ? 'pi pi-check' : (hoveredFields[field.controlName] && isValueCopied(field.controlName) ? 'pi pi-times' : 'pi pi-arrow-left')"
|
[icon]="isValueSaved(field.controlName) ? 'pi pi-check' : (hoveredFields[field.controlName] && isValueCopied(field.controlName) ? 'pi pi-times' : 'pi pi-arrow-left')"
|
||||||
[outlined]="true"
|
[outlined]="true"
|
||||||
[ngClass]="
|
[ngClass]="
|
||||||
{
|
{
|
||||||
'green-outlined-button': isValueSaved(field.controlName),
|
'green-outlined-button': isValueSaved(field.controlName),
|
||||||
'yellow-outlined-button': isValueCopied(field.controlName) && !hoveredFields[field.controlName],
|
'yellow-outlined-button': isValueCopied(field.controlName) && !hoveredFields[field.controlName],
|
||||||
'red-outlined-button': isValueCopied(field.controlName) && hoveredFields[field.controlName]
|
'red-outlined-button': isValueCopied(field.controlName) && hoveredFields[field.controlName]
|
||||||
}"
|
}"
|
||||||
class="arrow-button"
|
class="arrow-button"
|
||||||
(click)="hoveredFields[field.controlName] && isValueCopied(field.controlName) ? resetField(field.controlName) : copyFetchedToCurrent(field.controlName)"
|
(click)="hoveredFields[field.controlName] && isValueCopied(field.controlName) ? resetField(field.controlName) : copyFetchedToCurrent(field.controlName)"
|
||||||
(mouseenter)="onMouseEnter(field.controlName)"
|
(mouseenter)="onMouseEnter(field.controlName)"
|
||||||
@@ -117,12 +154,12 @@
|
|||||||
<p-button
|
<p-button
|
||||||
[icon]="isValueSaved(field.controlName) ? 'pi pi-check' : (hoveredFields[field.controlName] && isValueCopied(field.controlName) ? 'pi pi-times' : 'pi pi-arrow-left')"
|
[icon]="isValueSaved(field.controlName) ? 'pi pi-check' : (hoveredFields[field.controlName] && isValueCopied(field.controlName) ? 'pi pi-times' : 'pi pi-arrow-left')"
|
||||||
[outlined]="true"
|
[outlined]="true"
|
||||||
[ngClass]="
|
[ngClass]="
|
||||||
{
|
{
|
||||||
'green-outlined-button': isValueSaved(field.controlName),
|
'green-outlined-button': isValueSaved(field.controlName),
|
||||||
'yellow-outlined-button': isValueCopied(field.controlName) && !hoveredFields[field.controlName],
|
'yellow-outlined-button': isValueCopied(field.controlName) && !hoveredFields[field.controlName],
|
||||||
'red-outlined-button': isValueCopied(field.controlName) && hoveredFields[field.controlName]
|
'red-outlined-button': isValueCopied(field.controlName) && hoveredFields[field.controlName]
|
||||||
}"
|
}"
|
||||||
class="arrow-button"
|
class="arrow-button"
|
||||||
(click)="hoveredFields[field.controlName] && isValueCopied(field.controlName) ? resetField(field.controlName) : copyFetchedToCurrent(field.controlName)"
|
(click)="hoveredFields[field.controlName] && isValueCopied(field.controlName) ? resetField(field.controlName) : copyFetchedToCurrent(field.controlName)"
|
||||||
(mouseenter)="onMouseEnter(field.controlName)"
|
(mouseenter)="onMouseEnter(field.controlName)"
|
||||||
@@ -139,14 +176,14 @@
|
|||||||
[ngStyle]="{'padding-left': '2rem', 'padding-right': '0.5rem'}"
|
[ngStyle]="{'padding-left': '2rem', 'padding-right': '0.5rem'}"
|
||||||
[outlined]="true"
|
[outlined]="true"
|
||||||
pTooltip="Move all missing fields" tooltipPosition="bottom"
|
pTooltip="Move all missing fields" tooltipPosition="bottom"
|
||||||
(onClick)="copyMissing()"></p-button>
|
(onClick)="copyMissing()"></p-button>
|
||||||
<p-button
|
<p-button
|
||||||
severity="info"
|
severity="info"
|
||||||
icon='pi pi-angle-double-left'
|
icon='pi pi-angle-double-left'
|
||||||
[ngStyle]="{'padding-left': '0.5rem', 'padding-right': '2rem'}"
|
[ngStyle]="{'padding-left': '0.5rem', 'padding-right': '2rem'}"
|
||||||
[outlined]="true"
|
[outlined]="true"
|
||||||
pTooltip="Move all fields" tooltipPosition="bottom"
|
pTooltip="Move all fields" tooltipPosition="bottom"
|
||||||
(onClick)="copyAll()"></p-button>
|
(onClick)="copyAll()"></p-button>
|
||||||
<p class="text-lg">Fetched Metadata</p>
|
<p class="text-lg">Fetched Metadata</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+14
-10
@@ -13,6 +13,7 @@ import {BookService} from '../../../service/book.service';
|
|||||||
import {Textarea} from 'primeng/textarea';
|
import {Textarea} from 'primeng/textarea';
|
||||||
import {filter, map} from 'rxjs/operators';
|
import {filter, map} from 'rxjs/operators';
|
||||||
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||||
|
import {Chips} from 'primeng/chips';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-metadata-picker',
|
selector: 'app-metadata-picker',
|
||||||
@@ -29,19 +30,21 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
|||||||
NgStyle,
|
NgStyle,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
AsyncPipe,
|
AsyncPipe,
|
||||||
Textarea
|
Textarea,
|
||||||
|
Chips
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class MetadataPickerComponent implements OnInit {
|
export class MetadataPickerComponent implements OnInit {
|
||||||
|
|
||||||
metadataFieldsTop = [
|
metadataFieldsTop = [
|
||||||
{label: 'Title', controlName: 'title', lockedKey: 'titleLocked', fetchedKey: 'title'},
|
{label: 'Title', controlName: 'title', lockedKey: 'titleLocked', fetchedKey: 'title'},
|
||||||
{label: 'Authors', controlName: 'authors', lockedKey: 'authorsLocked', fetchedKey: 'authors'},
|
|
||||||
{label: 'Categories', controlName: 'categories', lockedKey: 'categoriesLocked', fetchedKey: 'categories'},
|
|
||||||
{label: 'Publisher', controlName: 'publisher', lockedKey: 'publisherLocked', fetchedKey: 'publisher'},
|
{label: 'Publisher', controlName: 'publisher', lockedKey: 'publisherLocked', fetchedKey: 'publisher'},
|
||||||
{label: 'Published', controlName: 'publishedDate', lockedKey: 'publishedDateLocked', fetchedKey: 'publishedDate'},
|
{label: 'Published', controlName: 'publishedDate', lockedKey: 'publishedDateLocked', fetchedKey: 'publishedDate'}
|
||||||
{label: 'ISBN-10', controlName: 'isbn10', lockedKey: 'isbn10Locked', fetchedKey: 'isbn10'},
|
];
|
||||||
{label: 'Language', controlName: 'language', lockedKey: 'languageLocked', fetchedKey: 'language'}
|
|
||||||
|
metadataChips = [
|
||||||
|
{label: 'Authors', controlName: 'authors', lockedKey: 'authorsLocked', fetchedKey: 'authors'},
|
||||||
|
{label: 'Categories', controlName: 'categories', lockedKey: 'categoriesLocked', fetchedKey: 'categories'}
|
||||||
];
|
];
|
||||||
|
|
||||||
metadataDescription = [
|
metadataDescription = [
|
||||||
@@ -52,6 +55,8 @@ export class MetadataPickerComponent implements OnInit {
|
|||||||
{label: 'Series', controlName: 'seriesName', lockedKey: 'seriesNameLocked', fetchedKey: 'seriesName'},
|
{label: 'Series', controlName: 'seriesName', lockedKey: 'seriesNameLocked', fetchedKey: 'seriesName'},
|
||||||
{label: 'Book #', controlName: 'seriesNumber', lockedKey: 'seriesNumberLocked', fetchedKey: 'seriesNumber'},
|
{label: 'Book #', controlName: 'seriesNumber', lockedKey: 'seriesNumberLocked', fetchedKey: 'seriesNumber'},
|
||||||
{label: 'Total Books', controlName: 'seriesTotal', lockedKey: 'seriesTotalLocked', fetchedKey: 'seriesTotal'},
|
{label: 'Total Books', controlName: 'seriesTotal', lockedKey: 'seriesTotalLocked', fetchedKey: 'seriesTotal'},
|
||||||
|
{label: 'Language', controlName: 'language', lockedKey: 'languageLocked', fetchedKey: 'language'},
|
||||||
|
{label: 'ISBN-10', controlName: 'isbn10', lockedKey: 'isbn10Locked', fetchedKey: 'isbn10'},
|
||||||
{label: 'ISBN-13', controlName: 'isbn13', lockedKey: 'isbn13Locked', fetchedKey: 'isbn13'},
|
{label: 'ISBN-13', controlName: 'isbn13', lockedKey: 'isbn13Locked', fetchedKey: 'isbn13'},
|
||||||
{label: 'Amazon ID (ASIN)', controlName: 'asin', lockedKey: 'asinLocked', fetchedKey: 'asin'},
|
{label: 'Amazon ID (ASIN)', controlName: 'asin', lockedKey: 'asinLocked', fetchedKey: 'asin'},
|
||||||
{label: 'Amazon Reviews', controlName: 'amazonReviewCount', lockedKey: 'amazonReviewCountLocked', fetchedKey: 'amazonReviewCount'},
|
{label: 'Amazon Reviews', controlName: 'amazonReviewCount', lockedKey: 'amazonReviewCountLocked', fetchedKey: 'amazonReviewCount'},
|
||||||
@@ -144,8 +149,7 @@ export class MetadataPickerComponent implements OnInit {
|
|||||||
filter((book): book is Book => !!book && !!book.metadata),
|
filter((book): book is Book => !!book && !!book.metadata),
|
||||||
map(book => book.metadata),
|
map(book => book.metadata),
|
||||||
takeUntilDestroyed(this.destroyRef)
|
takeUntilDestroyed(this.destroyRef)
|
||||||
).
|
).subscribe((metadata) => {
|
||||||
subscribe((metadata) => {
|
|
||||||
if (metadata) {
|
if (metadata) {
|
||||||
this.originalMetadata = metadata;
|
this.originalMetadata = metadata;
|
||||||
this.originalMetadata.thumbnailUrl = this.urlHelper.getCoverUrl(metadata.bookId, metadata.coverUpdatedOn);
|
this.originalMetadata.thumbnailUrl = this.urlHelper.getCoverUrl(metadata.bookId, metadata.coverUpdatedOn);
|
||||||
@@ -153,8 +157,8 @@ export class MetadataPickerComponent implements OnInit {
|
|||||||
this.metadataForm.patchValue({
|
this.metadataForm.patchValue({
|
||||||
title: metadata.title || null,
|
title: metadata.title || null,
|
||||||
subtitle: metadata.subtitle || null,
|
subtitle: metadata.subtitle || null,
|
||||||
authors: (metadata.authors || []).sort().join(', '),
|
authors: [...(metadata.authors ?? [])].sort(),
|
||||||
categories: (metadata.categories || []).sort().join(', '),
|
categories: [...(metadata.categories ?? [])].sort(),
|
||||||
publisher: metadata.publisher || null,
|
publisher: metadata.publisher || null,
|
||||||
publishedDate: metadata.publishedDate || null,
|
publishedDate: metadata.publishedDate || null,
|
||||||
isbn10: metadata.isbn10 || null,
|
isbn10: metadata.isbn10 || null,
|
||||||
|
|||||||
+4
@@ -80,3 +80,7 @@
|
|||||||
z-index: 3;
|
z-index: 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::ng-deep .p-inputchips {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user