diff --git a/service/src/main/inse/authors/v2/service.py b/service/src/main/inse/authors/v2/service.py
index 3118114a..8b73bb12 100644
--- a/service/src/main/inse/authors/v2/service.py
+++ b/service/src/main/inse/authors/v2/service.py
@@ -612,13 +612,59 @@ def get_collaboration_graph_status(
job.status,
)
- return CollaborationGraphStatusResponse(
- status=job.status,
- result=job.get_result()
- if job.status == CollaborationGraphStatus.COMPLETED
- else None,
- error_message=job.error_message,
+ status = job.status
+ result = (
+ job.get_result() if job.status == CollaborationGraphStatus.COMPLETED else None
)
+ error_message = job.error_message
+ if result and job.status == CollaborationGraphStatus.COMPLETED:
+ if _is_graph_empty(result):
+ status = CollaborationGraphStatus.FAILED
+ result = None
+ error_message = "Der generierte Kollaborationsgraph ist leer. Bitte versuchen Sie es mit anderen Filtereinstellungen."
+ logger.debug(
+ "Collaboration graph for graph ID: %s is empty, marking as failed.",
+ graph_id,
+ )
+ elif _is_graph_too_large(result):
+ status = CollaborationGraphStatus.FAILED
+ result = None
+ error_message = "Der generierte Kollaborationsgraph ist zu groß, um ihn anzuzeigen. Bitte versuchen Sie es mit anderen Filtereinstellungen."
+ logger.debug(
+ "Collaboration graph for graph ID: %s is too large, marking as failed.",
+ graph_id,
+ )
+
+ return CollaborationGraphStatusResponse(
+ status=status,
+ result=result,
+ error_message=error_message,
+ )
+
+
+def _is_graph_empty(graph: CollaborationGraph) -> bool:
+ """Returns True if the collaboration graph has no authors, works, or institutions.
+
+ Args:
+ graph (CollaborationGraph): The collaboration graph to check.
+
+ Returns:
+ bool: True if the graph is empty, False otherwise.
+ """
+ return not (graph.authors or graph.works or graph.institutions)
+
+
+def _is_graph_too_large(graph: CollaborationGraph, max_nodes: int = 1000) -> bool:
+ """Returns True if the total number of nodes (authors, works, and institutions) in the graph exceeds the specified max_nodes limit.
+
+ Args:
+ graph (CollaborationGraph): The collaboration graph to check.
+ max_nodes (int, optional): The maximum number of nodes allowed. Defaults to 1000.
+
+ Returns:
+ bool: True if the graph is too large, False otherwise.
+ """
+ return len(graph.authors + graph.works + graph.institutions) > max_nodes
def _prefix_id(raw_oa_id: str) -> str:
diff --git a/webapp/src/app/modules/person-network/person-network.component.html b/webapp/src/app/modules/person-network/person-network.component.html
index a8ab1ab3..b42f12ca 100644
--- a/webapp/src/app/modules/person-network/person-network.component.html
+++ b/webapp/src/app/modules/person-network/person-network.component.html
@@ -4,8 +4,27 @@
Zusammenarbeit und Verbindungen im wissenschaftlichen Netzwerk.
- @if (!collaborationGraph()) {
- Laden...
+ @if (this.isPending()) {
+
+ } @else if (this.isFailed()) {
+
+
error
+
{{
+ this.collaborationGraphError()
+ ? this.collaborationGraphError()
+ : 'Fehler beim Laden des Netzwerks. Bitte versuchen Sie es später erneut.'
+ }}
+
+
+
+ filter_alt
+ Filter
+
+
} @else {
@@ -22,15 +41,15 @@
class="mat-button-toggle-group"
aria-label="Select view"
(change)="onToggleChange($event)"
- [formField]="filterForm2.displayedTable"
+ [value]="displayedTable()"
style="width: 100%">
-
+
Kollaborierende
- Publikationen
-
+
Institutionen
@@ -53,21 +72,21 @@
- @if (this.displayedTable() === 'collaborators') {
+ @if (this.displayedTable() === 'collaborator') {
- } @else if (this.displayedTable() === 'publications') {
+ } @else if (this.displayedTable() === 'publication') {
- } @else if (this.displayedTable() === 'institutions') {
+ } @else if (this.displayedTable() === 'institution') {
();
+
collaborationGraph = signal(undefined);
+ collaborationGraphStatus = signal(
+ CollaborationGraphStatus.Pending,
+ );
+ collaborationGraphError = signal(undefined);
+
selectedTopics = input.required();
selectedInstitutions = input.required();
filterModel = signal({
- displayedTable: 'collaborators',
startYear: 2020,
endYear: new Date().getFullYear(),
minContributors: 2,
@@ -131,10 +137,23 @@ export class PersonNetworkComponent implements OnInit {
institutions: [],
});
- displayedTable = computed(() => this.filterForm2.displayedTable().value());
+ displayedTable = computed(
+ () => this.queryParamMap().get('table') || 'collaborator',
+ );
filterForm2 = form(this.filterModel);
+ isPending = computed(
+ () => this.collaborationGraphStatus() === CollaborationGraphStatus.Pending,
+ );
+ isCompleted = computed(
+ () =>
+ this.collaborationGraphStatus() === CollaborationGraphStatus.Completed,
+ );
+ isFailed = computed(
+ () => this.collaborationGraphStatus() === CollaborationGraphStatus.Failed,
+ );
+
observers: FilterObserver[] = [
{
id: 'searchTerm',
@@ -281,13 +300,13 @@ export class PersonNetworkComponent implements OnInit {
connections = computed(() => this.collaborationGraph()?.edges?.length ?? 0);
searchTermLabel = computed(() => {
- const displayedTable = this.filterForm2.displayedTable().value();
+ const displayedTable = this.displayedTable();
switch (displayedTable) {
- case 'collaborators':
+ case 'collaborator':
return 'Suche Kollaborierende nach Name';
- case 'publications':
+ case 'publication':
return 'Suche Publikationen nach Titel';
- case 'institutions':
+ case 'institution':
return 'Suche Institutionen nach Name';
default:
return 'Suchbegriff';
@@ -295,10 +314,10 @@ export class PersonNetworkComponent implements OnInit {
});
private readonly categoryTableMap: Record = {
- author: 'collaborators',
- collaborator: 'collaborators',
- work: 'publications',
- institution: 'institutions',
+ author: 'collaborator',
+ collaborator: 'collaborator',
+ work: 'publication',
+ institution: 'institution',
};
latestNodeId = signal(null);
@@ -357,6 +376,7 @@ export class PersonNetworkComponent implements OnInit {
}
handleNodeClick = ({ id, name, category }: NodeClickEvent): void => {
+ console.log('Node clicked:', { id, name, category });
if (this.latestNodeId() === id) {
this.clearSearch();
return;
@@ -371,7 +391,7 @@ export class PersonNetworkComponent implements OnInit {
relativeTo: this.activatedRoute,
queryParams: {
search_term: name,
- table: this.categoryTableMap[category] || 'collaborators',
+ table: this.categoryTableMap[category] || 'collaborator',
},
queryParamsHandling: 'merge',
});
@@ -439,9 +459,13 @@ export class PersonNetworkComponent implements OnInit {
),
),
tap((statusResponse) => {
+ this.collaborationGraphStatus.set(statusResponse.status);
+ this.collaborationGraphError.set(
+ statusResponse.error_message ?? undefined,
+ );
if (
- statusResponse.status === CollaborationGraphStatus.Completed &&
- statusResponse.result
+ statusResponse.result &&
+ statusResponse.status === CollaborationGraphStatus.Completed
) {
this.collaborationGraph.set(
this.rebuildCollaborationGraph(statusResponse.result),
@@ -449,9 +473,7 @@ export class PersonNetworkComponent implements OnInit {
}
}),
takeWhile((statusResponse) => {
- return (
- statusResponse.status !== CollaborationGraphStatus.Completed
- );
+ return statusResponse.status === CollaborationGraphStatus.Pending;
}, true),
),
),
@@ -464,7 +486,6 @@ export class PersonNetworkComponent implements OnInit {
this.router.navigate([], {
relativeTo: this.activatedRoute,
queryParams: {
- table: filters.displayedTable || null,
[collaborationGraphQueryParamKeys.yearFrom]:
filters.startYear || null,
[collaborationGraphQueryParamKeys.yearTo]: filters.endYear || null,
@@ -474,11 +495,11 @@ export class PersonNetworkComponent implements OnInit {
filters.maxContributors || null,
[collaborationGraphQueryParamKeys.topicId]:
filters.topics.length > 0
- ? filters.topics.map((topic) => topic.id).join(',')
+ ? filters.topics.map((topic) => topic.id)
: null,
[collaborationGraphQueryParamKeys.institutionId]:
filters.institutions.length > 0
- ? filters.institutions.map((inst) => inst.id).join(',')
+ ? filters.institutions.map((inst) => inst.id)
: null,
},
queryParamsHandling: 'merge',
@@ -503,7 +524,6 @@ export class PersonNetworkComponent implements OnInit {
dialogRef.afterClosed().subscribe((result) => {
if (result) {
this.filterModel.set({
- displayedTable: this.filterForm2.displayedTable().value(),
startYear: result.startYear,
endYear: result.endYear,
minContributors: result.minContributors,
@@ -518,7 +538,6 @@ export class PersonNetworkComponent implements OnInit {
ngOnInit(): void {
const queryParamMap = this.queryParamMap();
this.filterModel.set({
- displayedTable: queryParamMap.get('table') || 'collaborators',
startYear:
Number(queryParamMap.get(collaborationGraphQueryParamKeys.yearFrom)) ||
2020,
@@ -604,7 +623,13 @@ export class PersonNetworkComponent implements OnInit {
if (!value) {
return;
}
- this.filterForm2.displayedTable().value.set(value);
+ this.router.navigate([], {
+ relativeTo: this.activatedRoute,
+ queryParams: {
+ table: value,
+ },
+ queryParamsHandling: 'merge',
+ });
}
stripOpenAlexIdPrefix(id: string): string {
diff --git a/webapp/src/app/modules/person/person.component.html b/webapp/src/app/modules/person/person.component.html
index 37b613aa..6534c30d 100644
--- a/webapp/src/app/modules/person/person.component.html
+++ b/webapp/src/app/modules/person/person.component.html
@@ -163,20 +163,12 @@
}
} @else {
-
-
- Person wird geladen...
-
-
+
}
- @if (isNetworkResolving()) {
-
- } @else {
-
- }
+
diff --git a/webapp/src/app/modules/person/person.component.ts b/webapp/src/app/modules/person/person.component.ts
index b9d1dbc5..7db8c0e8 100644
--- a/webapp/src/app/modules/person/person.component.ts
+++ b/webapp/src/app/modules/person/person.component.ts
@@ -6,15 +6,11 @@ import {
takeUntilDestroyed,
} from '@angular/core/rxjs-interop';
import { MatIconModule } from '@angular/material/icon';
-import { MatProgressSpinner } from '@angular/material/progress-spinner';
import { MatTabsModule } from '@angular/material/tabs';
import { MatTooltipModule } from '@angular/material/tooltip';
import {
ActivatedRoute,
- ResolveEnd,
- ResolveStart,
Router,
- RouterEvent,
RouterModule,
RouterOutlet,
} from '@angular/router';
@@ -38,7 +34,6 @@ import { collaborationGraphQueryParamKeys } from '../../resolvers/collaboration-
PersonInterestingComponent,
RouterOutlet,
RouterModule,
- MatProgressSpinner,
LoadingComponent,
],
templateUrl: './person.component.html',
@@ -72,32 +67,6 @@ export class PersonComponent {
),
);
- readonly isNetworkResolving = computed(() => {
- const event = this.routerEvents();
-
- if (
- !(event instanceof RouterEvent) ||
- !this.isResolverEvent(event) ||
- !this.isNetworkRouterEvent(event)
- ) {
- return false;
- }
-
- if (event instanceof ResolveStart) {
- return true;
- }
-
- return false;
- });
-
- isResolverEvent(event: RouterEvent): boolean {
- return event instanceof ResolveStart || event instanceof ResolveEnd;
- }
-
- isNetworkRouterEvent(event: RouterEvent): boolean {
- return event.url.startsWith(`/person/${this.authorId()}/network`);
- }
-
readonly isPersonLoading = signal(false);
readonly isBioLoading = signal(false);
diff --git a/webapp/src/app/shared/ui/app-info-card/app-info-card.component.scss b/webapp/src/app/shared/ui/app-info-card/app-info-card.component.scss
index 13a84cc6..c357e093 100644
--- a/webapp/src/app/shared/ui/app-info-card/app-info-card.component.scss
+++ b/webapp/src/app/shared/ui/app-info-card/app-info-card.component.scss
@@ -1,13 +1,13 @@
.info-card {
--info-card-icon-size: 40px;
- background-color: var(--sg-background);
- padding: 10px 20px;
+ padding: 0.5rem 1rem;
+ text-wrap: break-word;
}
.info-card mat-card-content {
display: flex;
align-items: start;
- gap: 10px;
+ gap: 1rem;
}
.info-card mat-icon {
@@ -20,15 +20,15 @@
.info-card div {
display: flex;
flex-direction: column;
- gap: 4px;
+ gap: 0.25rem;
}
.info-card .number {
font-weight: var(--sg-default-bold-weight);
- font-size: 1.5em;
+ font-size: 1.5rem;
}
.info-card .description {
color: var(--sg-text-muted);
- font-size: 0.9em;
+ font-size: 0.9rem;
}
diff --git a/webapp/src/styles.scss b/webapp/src/styles.scss
index 71643900..a0be26ca 100644
--- a/webapp/src/styles.scss
+++ b/webapp/src/styles.scss
@@ -121,6 +121,46 @@ body {
--sg-blue-highlight: #3d7cff;
--sg-default-bold-weight: 900;
+
+ @include mat.button-toggle-overrides(
+ (
+ shape: var(--sg-radius-sm),
+ divider-color: var(--sg-border),
+ )
+ );
+
+ @include mat.form-field-overrides(
+ (
+ outlined-container-shape: var(--sg-radius-sm),
+ outlined-outline-color: var(--sg-border),
+ )
+ );
+
+ @include mat.card-overrides(
+ (
+ outlined-container-color: var(--sg-background),
+ outlined-outline-color: var(--sg-border),
+ )
+ );
+
+ @include mat.divider-overrides(
+ (
+ color: var(--sg-border),
+ )
+ );
+
+ @include mat.select-overrides(
+ (
+ panel-background-color: var(--sg-surface),
+ )
+ );
+
+ @include mat.button-overrides(
+ (
+ outlined-container-shape: var(--sg-radius-sm),
+ outlined-outline-color: var(--sg-border),
+ )
+ );
}
* {