Merge branch 'dev' of https://project.nes.uni-due.de/gitea/lbs/smartguide into refactor/trend_visual
This commit is contained in:
@@ -127,21 +127,12 @@
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@if (hasPagination()) {
|
||||
<div class="pagination">
|
||||
<button
|
||||
[disabled]="selectedPage === 1"
|
||||
(click)="setPage(selectedPage - 1)">
|
||||
Zurück
|
||||
</button>
|
||||
<span>Seite {{ selectedPage }} von {{ getPageCount() }}</span>
|
||||
<button
|
||||
[disabled]="selectedPage === getPageCount()"
|
||||
(click)="setPage(selectedPage + 1)">
|
||||
Weiter
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
<app-query-param-paginator
|
||||
[total]="totalPatents"
|
||||
queryParamPageKey="page"
|
||||
queryParamSizeKey="size"
|
||||
[pageSizeOptions]="[10, 20, 50]"
|
||||
(handlePageChange)="onPatentPageChange($event)" />
|
||||
</div>
|
||||
|
||||
@if (selectedPatent) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -11,6 +11,8 @@ import {
|
||||
getPublicationStageLabel,
|
||||
} from '../patent-detail/patent-detail.utils';
|
||||
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
|
||||
import { PageEvent } from '@angular/material/paginator';
|
||||
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||
|
||||
type SortMode = 'date' | 'title';
|
||||
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
||||
@@ -25,6 +27,7 @@ type OrgPatentMatchTypeFilter = 'all' | 'institution' | 'name' | 'both';
|
||||
MatFormFieldModule,
|
||||
MatSelectModule,
|
||||
MatIconModule,
|
||||
QueryParamPaginatorComponent,
|
||||
],
|
||||
templateUrl: './institution-patents.component.html',
|
||||
styleUrl: './institution-patents.component.scss',
|
||||
@@ -47,8 +50,8 @@ export class InstitutionPatentsComponent implements OnInit {
|
||||
activeMatchType: OrgPatentMatchTypeFilter = 'all';
|
||||
sortMode: SortMode = 'date';
|
||||
|
||||
selectedPage = 1;
|
||||
readonly pageSize = 20;
|
||||
pageIndex = 0;
|
||||
pageSize = 20;
|
||||
totalPatents = 0;
|
||||
|
||||
ngOnInit(): void {
|
||||
@@ -59,6 +62,12 @@ export class InstitutionPatentsComponent implements OnInit {
|
||||
const sortFromUrl = this.route.snapshot.queryParamMap.get('sortBy');
|
||||
const matchTypeFromUrl =
|
||||
this.route.snapshot.queryParamMap.get('matchType');
|
||||
this.pageIndex = this.parsePageIndexParam(
|
||||
this.route.snapshot.queryParamMap.get('page'),
|
||||
);
|
||||
this.pageSize = this.parsePageSizeParam(
|
||||
this.route.snapshot.queryParamMap.get('size'),
|
||||
);
|
||||
|
||||
if (this.isValidFilter(filterFromUrl)) {
|
||||
this.activeFilter = filterFromUrl;
|
||||
@@ -79,7 +88,7 @@ export class InstitutionPatentsComponent implements OnInit {
|
||||
|
||||
setFilter(filter: SourceFilter): void {
|
||||
this.activeFilter = filter;
|
||||
this.selectedPage = 1;
|
||||
this.pageIndex = 0;
|
||||
this.selectedPatent = null;
|
||||
this.reloadPatents();
|
||||
}
|
||||
@@ -87,7 +96,7 @@ export class InstitutionPatentsComponent implements OnInit {
|
||||
setMatchType(matchType: OrgPatentMatchTypeFilter): void {
|
||||
if (this.activeMatchType === matchType) return;
|
||||
this.activeMatchType = matchType;
|
||||
this.selectedPage = 1;
|
||||
this.pageIndex = 0;
|
||||
this.selectedPatent = null;
|
||||
this.reloadPatents();
|
||||
}
|
||||
@@ -108,8 +117,9 @@ export class InstitutionPatentsComponent implements OnInit {
|
||||
this.router.navigate(['/patent', this.selectedPatent.patent_id]);
|
||||
}
|
||||
|
||||
setPage(page: number): void {
|
||||
this.selectedPage = Math.min(Math.max(page, 1), this.getPageCount());
|
||||
onPatentPageChange(event: PageEvent): void {
|
||||
this.pageIndex = event.pageIndex;
|
||||
this.pageSize = event.pageSize;
|
||||
this.selectedPatent = null;
|
||||
this.reloadPatents();
|
||||
}
|
||||
@@ -118,14 +128,6 @@ export class InstitutionPatentsComponent implements OnInit {
|
||||
return this.filteredPatents;
|
||||
}
|
||||
|
||||
getPageCount(): number {
|
||||
return Math.max(1, Math.ceil(this.totalPatents / this.pageSize));
|
||||
}
|
||||
|
||||
hasPagination(): boolean {
|
||||
return this.totalPatents > this.pageSize;
|
||||
}
|
||||
|
||||
private reloadPatents(): void {
|
||||
const institutionId =
|
||||
this.institutionId ??
|
||||
@@ -145,7 +147,7 @@ export class InstitutionPatentsComponent implements OnInit {
|
||||
institutionId,
|
||||
|
||||
this.activeMatchType !== 'all' ? this.activeMatchType : undefined,
|
||||
this.selectedPage - 1,
|
||||
this.pageIndex,
|
||||
this.pageSize,
|
||||
this.activeFilter !== 'all' ? this.activeFilter : undefined,
|
||||
)
|
||||
@@ -183,13 +185,24 @@ export class InstitutionPatentsComponent implements OnInit {
|
||||
filter: this.activeFilter,
|
||||
sortBy: this.sortMode,
|
||||
matchType: this.activeMatchType,
|
||||
page: this.selectedPage,
|
||||
page: this.pageIndex,
|
||||
size: this.pageSize,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
replaceUrl: true,
|
||||
});
|
||||
}
|
||||
|
||||
private parsePageIndexParam(value: string | null): number {
|
||||
const parsed = Number(value);
|
||||
return Number.isInteger(parsed) && parsed >= 0 ? parsed : 0;
|
||||
}
|
||||
|
||||
private parsePageSizeParam(value: string | null): number {
|
||||
const parsed = Number(value);
|
||||
return Number.isInteger(parsed) && parsed > 0 ? parsed : 20;
|
||||
}
|
||||
|
||||
private isValidFilter(value: string | null): value is SourceFilter {
|
||||
return value === 'all' || value === 'EPO' || value === 'USPTO';
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
@if (loading) {
|
||||
<p class="message">Lade Förderungen...</p>
|
||||
<app-loading
|
||||
text="Förderdaten werden geladen..."
|
||||
icon="volunteer_activism"
|
||||
[size]="150"
|
||||
[diameter]="150" />
|
||||
} @else if (error) {
|
||||
<p class="message">Fehler beim Laden der Förderungen.</p>
|
||||
} @else if (funders.length === 0) {
|
||||
@@ -41,7 +45,10 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Förderer</th>
|
||||
<th>Publikationen</th>
|
||||
<th class="text-center">Publikationen</th>
|
||||
<th class="text-center">Erstautor</th>
|
||||
<th class="text-center">Mitautor</th>
|
||||
<th class="text-center">Letztautor</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -50,29 +57,35 @@
|
||||
[class.selected]="selectedFunder === funder"
|
||||
(click)="selectFunder(funder)">
|
||||
<td class="funder-name">{{ funder.funder_name }}</td>
|
||||
<td>{{ getPublicationCount(funder) }}</td>
|
||||
<td class="text-center">{{ getPublicationCount(funder) }}</td>
|
||||
<td class="text-center">
|
||||
<span
|
||||
class="position-count-badge position-count-badge--first"
|
||||
>{{ funder.author_position_count.first || 0 }}</span
|
||||
>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span
|
||||
class="position-count-badge position-count-badge--middle"
|
||||
>{{ funder.author_position_count.middle || 0 }}</span
|
||||
>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<span
|
||||
class="position-count-badge position-count-badge--last"
|
||||
>{{ funder.author_position_count.last || 0 }}</span
|
||||
>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
@if (hasFunderListPagination()) {
|
||||
<div class="publication-pagination">
|
||||
<button
|
||||
[disabled]="selectedFunderListPage === 1"
|
||||
(click)="setFunderListPage(selectedFunderListPage - 1)">
|
||||
Zurück
|
||||
</button>
|
||||
<span
|
||||
>Seite {{ selectedFunderListPage }} von
|
||||
{{ getFunderListPageCount() }}</span
|
||||
>
|
||||
<button
|
||||
[disabled]="selectedFunderListPage === getFunderListPageCount()"
|
||||
(click)="setFunderListPage(selectedFunderListPage + 1)">
|
||||
Weiter
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
<app-query-param-paginator
|
||||
[total]="filteredFunders.length"
|
||||
queryParamPageKey="funderPage"
|
||||
queryParamSizeKey="funderSize"
|
||||
[pageSizeOptions]="[10, 25, 50]"
|
||||
(handlePageChange)="onFunderPageChange($event)" />
|
||||
</div>
|
||||
|
||||
<!-- Rechte Seite: Details -->
|
||||
@@ -129,26 +142,12 @@
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
@if (hasPublicationPagination()) {
|
||||
<div class="publication-pagination">
|
||||
<button
|
||||
[disabled]="selectedPublicationPage === 1"
|
||||
(click)="setPublicationPage(selectedPublicationPage - 1)">
|
||||
Zurück
|
||||
</button>
|
||||
<span
|
||||
>Seite {{ selectedPublicationPage }} von
|
||||
{{ getSelectedPublicationPageCount() }}</span
|
||||
>
|
||||
<button
|
||||
[disabled]="
|
||||
selectedPublicationPage === getSelectedPublicationPageCount()
|
||||
"
|
||||
(click)="setPublicationPage(selectedPublicationPage + 1)">
|
||||
Weiter
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
<app-query-param-paginator
|
||||
[total]="getSelectedPublicationTotal()"
|
||||
queryParamPageKey="pubPage"
|
||||
queryParamSizeKey="pubSize"
|
||||
[pageSizeOptions]="[10, 25, 50]"
|
||||
(handlePageChange)="onPublicationPageChange($event)" />
|
||||
</div>
|
||||
} @else {
|
||||
<div class="funding-detail empty">
|
||||
|
||||
@@ -3,8 +3,12 @@
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
|
||||
app-query-param-paginator {
|
||||
display: block;
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.funding-container {
|
||||
padding: 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
@@ -35,51 +39,107 @@
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
overflow: hidden;
|
||||
|
||||
th {
|
||||
text-align: left;
|
||||
padding: 10px 12px;
|
||||
border-bottom: 2px solid var(--sg-border);
|
||||
font-weight: 600;
|
||||
color: var(--sg-text);
|
||||
padding: 12px 16px;
|
||||
background: var(--sg-surface-muted);
|
||||
border-bottom: 1px solid var(--sg-border);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.02em;
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
|
||||
tr {
|
||||
cursor: pointer;
|
||||
&.selected {
|
||||
transition: background-color 0.15s ease;
|
||||
|
||||
&:hover td {
|
||||
background: rgba(16, 26, 61, 0.04);
|
||||
}
|
||||
|
||||
&.selected td {
|
||||
background: var(--sg-primary-soft);
|
||||
}
|
||||
|
||||
&:last-child td {
|
||||
border-bottom: 0;
|
||||
}
|
||||
}
|
||||
|
||||
td {
|
||||
padding: 10px 12px;
|
||||
padding: 12px 16px;
|
||||
border-bottom: 1px solid var(--sg-border);
|
||||
color: var(--sg-text);
|
||||
font-size: 13px;
|
||||
transition: background-color 0.15s ease;
|
||||
}
|
||||
|
||||
.funder-name {
|
||||
color: var(--sg-text);
|
||||
font-weight: 500;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.text-center {
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.position-count-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 26px;
|
||||
padding: 2px 8px;
|
||||
border-radius: 999px;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
|
||||
&--first {
|
||||
background: #effaf3;
|
||||
color: #24834f;
|
||||
}
|
||||
|
||||
&--middle {
|
||||
background: #f6f0ff;
|
||||
color: #7255d9;
|
||||
}
|
||||
|
||||
&--last {
|
||||
background: #fff1f2;
|
||||
color: #be123c;
|
||||
}
|
||||
}
|
||||
|
||||
.funding-detail {
|
||||
width: 440px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
background: var(--sg-surface-muted);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
padding: 24px;
|
||||
background: var(--sg-surface);
|
||||
box-shadow: var(--sg-shadow-sm);
|
||||
|
||||
h3 {
|
||||
margin: 0 0 16px;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: var(--sg-text);
|
||||
}
|
||||
|
||||
h4 {
|
||||
margin: 16px 0 8px;
|
||||
font-size: 14px;
|
||||
margin: 20px 0 10px;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.02em;
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
}
|
||||
@@ -95,7 +155,7 @@
|
||||
text-align: center;
|
||||
background: var(--sg-surface);
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 8px;
|
||||
border-radius: var(--sg-radius-sm);
|
||||
padding: 10px;
|
||||
|
||||
.stat-label {
|
||||
@@ -173,7 +233,7 @@
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
max-height: 300px;
|
||||
max-height: 320px;
|
||||
overflow-y: auto;
|
||||
|
||||
li {
|
||||
@@ -208,6 +268,9 @@
|
||||
font-size: 12px;
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
}
|
||||
|
||||
.empty-overview {
|
||||
@@ -268,7 +331,7 @@
|
||||
text-align: center;
|
||||
padding: 12px 8px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 8px;
|
||||
border-radius: var(--sg-radius-sm);
|
||||
background: var(--sg-surface);
|
||||
}
|
||||
|
||||
@@ -312,19 +375,37 @@
|
||||
.publication-more-info {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
gap: 4px;
|
||||
margin-top: 6px;
|
||||
padding: 0;
|
||||
margin-top: 8px;
|
||||
padding: 4px 10px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 999px;
|
||||
background: var(--sg-surface);
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
transition: all 0.15s ease;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
border-color: #1976d2;
|
||||
background: rgba(16, 26, 61, 0.04);
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
.publication-item {
|
||||
padding: 8px 0;
|
||||
border-bottom: 2px solid var(--sg-border);
|
||||
padding: 10px 14px;
|
||||
border-bottom: 1px solid var(--sg-border);
|
||||
cursor: pointer;
|
||||
transition: background-color 0.15s ease;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: rgba(16, 26, 61, 0.04);
|
||||
}
|
||||
}
|
||||
|
||||
.publication-title {
|
||||
@@ -342,7 +423,7 @@
|
||||
|
||||
.mehr-infos-label {
|
||||
font-size: 0.8rem;
|
||||
font-weight: 500;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.publication-link-icon {
|
||||
|
||||
@@ -5,7 +5,10 @@ import { Router } from '@angular/router';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { PageEvent } from '@angular/material/paginator';
|
||||
import { FundingService } from '../../api';
|
||||
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
|
||||
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||
|
||||
type SortMode = 'name' | 'top';
|
||||
type AuthorPosition = 'first' | 'middle' | 'last' | 'unknown';
|
||||
@@ -26,6 +29,8 @@ type FundingPublicationDetail = {
|
||||
MatFormFieldModule,
|
||||
MatSelectModule,
|
||||
MatIconModule,
|
||||
LoadingComponent,
|
||||
QueryParamPaginatorComponent,
|
||||
],
|
||||
templateUrl: './person-funding.component.html',
|
||||
styleUrl: './person-funding.component.scss',
|
||||
@@ -35,16 +40,18 @@ export class PersonFundingComponent implements OnInit {
|
||||
private router = inject(Router);
|
||||
private fundingApi = inject(FundingService);
|
||||
private initialSelectedFunderKey: string | null = null;
|
||||
private initialPublicationPage = 1;
|
||||
private initialFunderListPage = 1;
|
||||
private initialFunderPageIndex = 0;
|
||||
private initialFunderPageSize = 10;
|
||||
private initialPublicationPageIndex = 0;
|
||||
private initialPublicationPageSize = 10;
|
||||
|
||||
funders: any[] = [];
|
||||
filteredFunders: any[] = [];
|
||||
selectedFunder: any = null;
|
||||
selectedFunderListPage = 1;
|
||||
selectedPublicationPage = 1;
|
||||
readonly funderListPageSize = 10;
|
||||
readonly publicationPageSize = 10;
|
||||
funderPageIndex = 0;
|
||||
funderPageSize = 10;
|
||||
publicationPageIndex = 0;
|
||||
publicationPageSize = 10;
|
||||
activeFilter: 'all' | 'first' | 'middle' | 'last' = 'all';
|
||||
sortMode: SortMode = 'name';
|
||||
loading = true;
|
||||
@@ -58,13 +65,18 @@ export class PersonFundingComponent implements OnInit {
|
||||
const sortFromUrl = this.route.snapshot.queryParamMap.get('sortBy');
|
||||
this.initialSelectedFunderKey =
|
||||
this.route.snapshot.queryParamMap.get('funder');
|
||||
this.initialPublicationPage = this.parsePageParam(
|
||||
this.route.snapshot.queryParamMap.get('publicationPage') ??
|
||||
this.route.snapshot.queryParamMap.get('page'),
|
||||
);
|
||||
this.initialFunderListPage = this.parsePageParam(
|
||||
this.initialFunderPageIndex = this.parsePageIndexParam(
|
||||
this.route.snapshot.queryParamMap.get('funderPage'),
|
||||
);
|
||||
this.initialFunderPageSize = this.parsePageSizeParam(
|
||||
this.route.snapshot.queryParamMap.get('funderSize'),
|
||||
);
|
||||
this.initialPublicationPageIndex = this.parsePageIndexParam(
|
||||
this.route.snapshot.queryParamMap.get('pubPage'),
|
||||
);
|
||||
this.initialPublicationPageSize = this.parsePageSizeParam(
|
||||
this.route.snapshot.queryParamMap.get('pubSize'),
|
||||
);
|
||||
if (this.isValidFilter(filterFromUrl)) {
|
||||
this.activeFilter = filterFromUrl;
|
||||
}
|
||||
@@ -77,9 +89,11 @@ export class PersonFundingComponent implements OnInit {
|
||||
next: (result: any) => {
|
||||
this.funders = result.funders ?? [];
|
||||
this.applyFilter();
|
||||
this.selectedFunderListPage = this.clampPage(
|
||||
this.initialFunderListPage,
|
||||
this.getFunderListPageCount(),
|
||||
this.funderPageSize = this.initialFunderPageSize;
|
||||
this.funderPageIndex = this.clampPageIndex(
|
||||
this.initialFunderPageIndex,
|
||||
this.funderPageSize,
|
||||
this.filteredFunders.length,
|
||||
);
|
||||
this.restoreSelectedFunderFromUrl();
|
||||
this.loading = false;
|
||||
@@ -95,7 +109,7 @@ export class PersonFundingComponent implements OnInit {
|
||||
|
||||
selectFunder(funder: any): void {
|
||||
this.selectedFunder = funder;
|
||||
this.selectedPublicationPage = 1;
|
||||
this.publicationPageIndex = 0;
|
||||
this.updateQueryParams();
|
||||
}
|
||||
|
||||
@@ -111,10 +125,20 @@ export class PersonFundingComponent implements OnInit {
|
||||
this.updateQueryParams();
|
||||
}
|
||||
|
||||
onFunderPageChange(event: PageEvent): void {
|
||||
this.funderPageIndex = event.pageIndex;
|
||||
this.funderPageSize = event.pageSize;
|
||||
}
|
||||
|
||||
onPublicationPageChange(event: PageEvent): void {
|
||||
this.publicationPageIndex = event.pageIndex;
|
||||
this.publicationPageSize = event.pageSize;
|
||||
}
|
||||
|
||||
private applyFilter(): void {
|
||||
this.selectedFunder = null;
|
||||
this.selectedFunderListPage = 1;
|
||||
this.selectedPublicationPage = 1;
|
||||
this.funderPageIndex = 0;
|
||||
this.publicationPageIndex = 0;
|
||||
let funders: any[];
|
||||
if (this.activeFilter === 'all') {
|
||||
funders = this.funders;
|
||||
@@ -143,12 +167,13 @@ export class PersonFundingComponent implements OnInit {
|
||||
this.getFunderKey(funder) === this.getFunderKey(matchedFunder),
|
||||
);
|
||||
if (matchedIndex >= 0) {
|
||||
this.selectedFunderListPage =
|
||||
Math.floor(matchedIndex / this.funderListPageSize) + 1;
|
||||
this.funderPageIndex = Math.floor(matchedIndex / this.funderPageSize);
|
||||
}
|
||||
this.selectedPublicationPage = this.clampPublicationPage(
|
||||
this.initialPublicationPage,
|
||||
this.getPublicationPageCountForFunder(matchedFunder),
|
||||
this.publicationPageSize = this.initialPublicationPageSize;
|
||||
this.publicationPageIndex = this.clampPageIndex(
|
||||
this.initialPublicationPageIndex,
|
||||
this.publicationPageSize,
|
||||
this.getPublicationIds(matchedFunder).length,
|
||||
);
|
||||
this.updateQueryParams();
|
||||
} else {
|
||||
@@ -165,10 +190,10 @@ export class PersonFundingComponent implements OnInit {
|
||||
funder: this.selectedFunder
|
||||
? this.getFunderKey(this.selectedFunder)
|
||||
: null,
|
||||
publicationPage: this.selectedFunder
|
||||
? this.selectedPublicationPage
|
||||
: null,
|
||||
funderPage: this.selectedFunderListPage,
|
||||
funderPage: this.funderPageIndex,
|
||||
funderSize: this.funderPageSize,
|
||||
pubPage: this.selectedFunder ? this.publicationPageIndex : null,
|
||||
pubSize: this.selectedFunder ? this.publicationPageSize : null,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
replaceUrl: true,
|
||||
@@ -214,61 +239,29 @@ export class PersonFundingComponent implements OnInit {
|
||||
}
|
||||
|
||||
getPagedFunders(): any[] {
|
||||
const startIndex =
|
||||
(this.selectedFunderListPage - 1) * this.funderListPageSize;
|
||||
const startIndex = this.funderPageIndex * this.funderPageSize;
|
||||
return this.filteredFunders.slice(
|
||||
startIndex,
|
||||
startIndex + this.funderListPageSize,
|
||||
startIndex + this.funderPageSize,
|
||||
);
|
||||
}
|
||||
|
||||
hasFunderListPagination(): boolean {
|
||||
return this.getFunderListPageCount() > 1;
|
||||
}
|
||||
|
||||
getFunderListPageCount(): number {
|
||||
return Math.max(
|
||||
1,
|
||||
Math.ceil(this.filteredFunders.length / this.funderListPageSize),
|
||||
);
|
||||
}
|
||||
|
||||
setFunderListPage(page: number): void {
|
||||
this.selectedFunderListPage = this.clampPage(
|
||||
page,
|
||||
this.getFunderListPageCount(),
|
||||
);
|
||||
this.updateQueryParams();
|
||||
}
|
||||
|
||||
getSelectedPublicationIdsPage(): string[] {
|
||||
if (!this.selectedFunder) {
|
||||
return [];
|
||||
}
|
||||
const allPublicationIds = this.getPublicationIds(this.selectedFunder);
|
||||
const startIndex =
|
||||
(this.selectedPublicationPage - 1) * this.publicationPageSize;
|
||||
const startIndex = this.publicationPageIndex * this.publicationPageSize;
|
||||
return allPublicationIds.slice(
|
||||
startIndex,
|
||||
startIndex + this.publicationPageSize,
|
||||
);
|
||||
}
|
||||
|
||||
hasPublicationPagination(): boolean {
|
||||
return this.getSelectedPublicationPageCount() > 1;
|
||||
}
|
||||
|
||||
getSelectedPublicationPageCount(): number {
|
||||
if (!this.selectedFunder) {
|
||||
return 1;
|
||||
}
|
||||
return this.getPublicationPageCountForFunder(this.selectedFunder);
|
||||
}
|
||||
|
||||
setPublicationPage(page: number): void {
|
||||
const totalPages = this.getSelectedPublicationPageCount();
|
||||
this.selectedPublicationPage = this.clampPublicationPage(page, totalPages);
|
||||
this.updateQueryParams();
|
||||
getSelectedPublicationTotal(): number {
|
||||
return this.selectedFunder
|
||||
? this.getPublicationIds(this.selectedFunder).length
|
||||
: 0;
|
||||
}
|
||||
|
||||
getPositionLabel(position: string): string {
|
||||
@@ -301,11 +294,6 @@ export class PersonFundingComponent implements OnInit {
|
||||
return allIds.size;
|
||||
}
|
||||
|
||||
private getPublicationPageCountForFunder(funder: any): number {
|
||||
const publicationCount = this.getPublicationIds(funder).length;
|
||||
return Math.max(1, Math.ceil(publicationCount / this.publicationPageSize));
|
||||
}
|
||||
|
||||
private sortFunders(funders: any[]): any[] {
|
||||
const sortedFunders = [...funders];
|
||||
return sortedFunders.sort((first, second) => {
|
||||
@@ -329,21 +317,25 @@ export class PersonFundingComponent implements OnInit {
|
||||
return funder.funder_name ?? '';
|
||||
}
|
||||
|
||||
private clampPublicationPage(page: number, totalPages: number): number {
|
||||
return this.clampPage(page, totalPages);
|
||||
private clampPageIndex(
|
||||
pageIndex: number,
|
||||
pageSize: number,
|
||||
total: number,
|
||||
): number {
|
||||
const maxIndex = Math.max(0, Math.ceil(total / pageSize) - 1);
|
||||
return Math.min(Math.max(pageIndex, 0), maxIndex);
|
||||
}
|
||||
|
||||
private clampPage(page: number, totalPages: number): number {
|
||||
return Math.min(Math.max(page, 1), totalPages);
|
||||
}
|
||||
|
||||
private parsePageParam(value: string | null): number {
|
||||
private parsePageIndexParam(value: string | null): number {
|
||||
const parsed = Number(value);
|
||||
if (!Number.isInteger(parsed) || parsed < 1) {
|
||||
return 1;
|
||||
}
|
||||
return parsed;
|
||||
return Number.isInteger(parsed) && parsed >= 0 ? parsed : 0;
|
||||
}
|
||||
|
||||
private parsePageSizeParam(value: string | null): number {
|
||||
const parsed = Number(value);
|
||||
return Number.isInteger(parsed) && parsed > 0 ? parsed : 10;
|
||||
}
|
||||
|
||||
getPublicationTitle(publicationId: string): string {
|
||||
const detailTitle = this.getPublicationDetail(publicationId)?.title;
|
||||
if (detailTitle) return detailTitle;
|
||||
|
||||
@@ -46,6 +46,8 @@
|
||||
<th>Patent</th>
|
||||
<th>Quelle</th>
|
||||
<th>Jahr</th>
|
||||
<th>Erfinder</th>
|
||||
<th>Anmelder</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -68,26 +70,23 @@
|
||||
</span>
|
||||
</td>
|
||||
<td>{{ patent.publication_year ?? '-' }}</td>
|
||||
<td class="patent-people" [title]="getInventorsLabel(patent)">
|
||||
{{ getInventorsLabel(patent) }}
|
||||
</td>
|
||||
<td class="patent-people" [title]="getAssigneesLabel(patent)">
|
||||
{{ getAssigneesLabel(patent) }}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@if (hasPagination()) {
|
||||
<div class="pagination">
|
||||
<button
|
||||
[disabled]="selectedPage === 1"
|
||||
(click)="setPage(selectedPage - 1)">
|
||||
Zurück
|
||||
</button>
|
||||
<span>Seite {{ selectedPage }} von {{ getPageCount() }}</span>
|
||||
<button
|
||||
[disabled]="selectedPage === getPageCount()"
|
||||
(click)="setPage(selectedPage + 1)">
|
||||
Weiter
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
<app-query-param-paginator
|
||||
[total]="filteredPatents.length"
|
||||
queryParamPageKey="page"
|
||||
queryParamSizeKey="size"
|
||||
[pageSizeOptions]="[10, 25, 50]"
|
||||
(handlePageChange)="onPatentPageChange($event)" />
|
||||
</div>
|
||||
|
||||
@if (selectedPatent) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -13,6 +13,8 @@ import {
|
||||
getPublicationStageLabel,
|
||||
} from '../patent-detail/patent-detail.utils';
|
||||
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
|
||||
import { PageEvent } from '@angular/material/paginator';
|
||||
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||
|
||||
type SortMode = 'date' | 'title';
|
||||
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
||||
@@ -25,6 +27,7 @@ type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
||||
MatFormFieldModule,
|
||||
MatSelectModule,
|
||||
MatIconModule,
|
||||
QueryParamPaginatorComponent,
|
||||
],
|
||||
templateUrl: './person-patents.component.html',
|
||||
styleUrl: './person-patents.component.scss',
|
||||
@@ -45,12 +48,18 @@ export class PersonPatentsComponent {
|
||||
activeFilter: SourceFilter = 'all';
|
||||
sortMode: SortMode = 'date';
|
||||
|
||||
selectedPage = 1;
|
||||
readonly pageSize = 10;
|
||||
pageIndex = 0;
|
||||
pageSize = 10;
|
||||
|
||||
constructor() {
|
||||
const filterFromUrl = this.route.snapshot.queryParamMap.get('filter');
|
||||
const sortFromUrl = this.route.snapshot.queryParamMap.get('sortBy');
|
||||
this.pageIndex = this.parsePageIndexParam(
|
||||
this.route.snapshot.queryParamMap.get('page'),
|
||||
);
|
||||
this.pageSize = this.parsePageSizeParam(
|
||||
this.route.snapshot.queryParamMap.get('size'),
|
||||
);
|
||||
|
||||
if (this.isValidFilter(filterFromUrl)) {
|
||||
this.activeFilter = filterFromUrl;
|
||||
@@ -93,12 +102,17 @@ export class PersonPatentsComponent {
|
||||
|
||||
setFilter(filter: SourceFilter): void {
|
||||
this.activeFilter = filter;
|
||||
this.selectedPage = 1;
|
||||
this.pageIndex = 0;
|
||||
this.selectedPatent = null;
|
||||
this.applyFilter();
|
||||
this.updateQueryParams();
|
||||
}
|
||||
|
||||
onPatentPageChange(event: PageEvent): void {
|
||||
this.pageIndex = event.pageIndex;
|
||||
this.pageSize = event.pageSize;
|
||||
}
|
||||
|
||||
setSortMode(sortMode: SortMode): void {
|
||||
this.sortMode = sortMode;
|
||||
this.applyFilter();
|
||||
@@ -144,12 +158,24 @@ export class PersonPatentsComponent {
|
||||
queryParams: {
|
||||
filter: this.activeFilter,
|
||||
sortBy: this.sortMode,
|
||||
page: this.pageIndex,
|
||||
size: this.pageSize,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
replaceUrl: true,
|
||||
});
|
||||
}
|
||||
|
||||
private parsePageIndexParam(value: string | null): number {
|
||||
const parsed = Number(value);
|
||||
return Number.isInteger(parsed) && parsed >= 0 ? parsed : 0;
|
||||
}
|
||||
|
||||
private parsePageSizeParam(value: string | null): number {
|
||||
const parsed = Number(value);
|
||||
return Number.isInteger(parsed) && parsed > 0 ? parsed : 10;
|
||||
}
|
||||
|
||||
private isValidFilter(value: string | null): value is SourceFilter {
|
||||
return value === 'all' || value === 'EPO' || value === 'USPTO';
|
||||
}
|
||||
@@ -159,21 +185,16 @@ export class PersonPatentsComponent {
|
||||
}
|
||||
|
||||
getPagedPatents(): PatentEntry[] {
|
||||
const start = (this.selectedPage - 1) * this.pageSize;
|
||||
const start = this.pageIndex * this.pageSize;
|
||||
return this.filteredPatents.slice(start, start + this.pageSize);
|
||||
}
|
||||
|
||||
getPageCount(): number {
|
||||
return Math.max(1, Math.ceil(this.filteredPatents.length / this.pageSize));
|
||||
getInventorsLabel(patent: PatentEntry): string {
|
||||
return patent.inventors?.length ? patent.inventors.join(', ') : '-';
|
||||
}
|
||||
|
||||
hasPagination(): boolean {
|
||||
return this.getPageCount() > 1;
|
||||
}
|
||||
|
||||
setPage(page: number): void {
|
||||
this.selectedPage = Math.min(Math.max(page, 1), this.getPageCount());
|
||||
this.updateQueryParams();
|
||||
getAssigneesLabel(patent: PatentEntry): string {
|
||||
return patent.assignees?.length ? patent.assignees.join(', ') : '-';
|
||||
}
|
||||
|
||||
formatDate(date: string | null | undefined): string {
|
||||
|
||||
@@ -77,6 +77,20 @@
|
||||
<mat-icon>work</mat-icon>
|
||||
Projekte
|
||||
</a>
|
||||
@if (hasPatents()) {
|
||||
<a
|
||||
class="card-action"
|
||||
[routerLink]="[
|
||||
'/institution',
|
||||
stripOpenAlexId(institution().id),
|
||||
'patents',
|
||||
]"
|
||||
matButton="outlined"
|
||||
(click)="$event.stopPropagation()">
|
||||
<mat-icon>verified</mat-icon>
|
||||
Patente
|
||||
</a>
|
||||
}
|
||||
</mat-card-actions>
|
||||
</mat-card-footer>
|
||||
</mat-card>
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
import { Component, computed, input } from '@angular/core';
|
||||
import {
|
||||
Component,
|
||||
computed,
|
||||
effect,
|
||||
inject,
|
||||
input,
|
||||
signal,
|
||||
} from '@angular/core';
|
||||
import { Institution } from '../../../api';
|
||||
import { PatentsService } from '../../../api/api/patents.service';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
@@ -15,12 +23,14 @@ import { DecimalPipe } from '@angular/common';
|
||||
MatDividerModule,
|
||||
MatIconModule,
|
||||
MatButtonModule,
|
||||
DecimalPipe
|
||||
DecimalPipe,
|
||||
],
|
||||
templateUrl: './app-institution-card.component.html',
|
||||
styleUrl: './app-institution-card.component.scss',
|
||||
})
|
||||
export class AppInstitutionCardComponent {
|
||||
private readonly patentsApi = inject(PatentsService);
|
||||
|
||||
institution = input.required<Institution>();
|
||||
|
||||
displayName = computed(() => {
|
||||
@@ -33,6 +43,29 @@ export class AppInstitutionCardComponent {
|
||||
return 'Unbekannte Institution';
|
||||
});
|
||||
|
||||
// The "Patente" action only makes sense once org_patents has been indexed
|
||||
// for this institution (currently a manual, per-institution process), so
|
||||
// it's hidden by default and only shown once a cheap count check confirms
|
||||
// there is actually data behind it.
|
||||
private readonly hasPatentsSignal = signal(false);
|
||||
hasPatents = this.hasPatentsSignal.asReadonly();
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
const id = this.stripOpenAlexId(this.institution().id);
|
||||
this.hasPatentsSignal.set(false);
|
||||
if (!id) return;
|
||||
|
||||
this.patentsApi
|
||||
.getOrgPatentsByInstitution(id, undefined, 0, 0)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
this.hasPatentsSignal.set((result.patent_count ?? 0) > 0);
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
stripOpenAlexId(id: string | null | undefined): string | undefined {
|
||||
if (!id) {
|
||||
return undefined;
|
||||
|
||||
Reference in New Issue
Block a user