Merge branch 'dev' into researchers-to-projects
LocationBasedServices/smartguide/pipeline/head This commit looks good

This commit is contained in:
Mats Paul Tončik
2026-06-19 10:27:58 +02:00
44 changed files with 4364 additions and 382 deletions
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -111,4 +111,4 @@
"score": 4.721418
}
]
}
}
+21 -21
View File
@@ -1,22 +1,22 @@
{
"users": [
{
"username": "superadmin",
"password": "superadmin",
"email": "some_email@uni-due.de",
"account": 0,
"organization": 0,
"organization_name": "University of Duisburg-Essen",
"superadmin": true
},
{
"username": "user",
"password": "user",
"email": "user_email@uni-due.de",
"account": 1,
"organization": 1,
"organization_name": "University of Duisburg-Essen",
"superadmin": false
}
]
}
"users": [
{
"username": "superadmin",
"password": "superadmin",
"email": "some_email@uni-due.de",
"account": 0,
"organization": 0,
"organization_name": "University of Duisburg-Essen",
"superadmin": true
},
{
"username": "user",
"password": "user",
"email": "user_email@uni-due.de",
"account": 1,
"organization": 1,
"organization_name": "University of Duisburg-Essen",
"superadmin": false
}
]
}
@@ -0,0 +1,298 @@
import logging
from typing import Any
import httpx
from fastapi import HTTPException
from starlette.status import HTTP_502_BAD_GATEWAY, HTTP_503_SERVICE_UNAVAILABLE
from . import model
from .search_client import CompanyConnectionsSearchClient, MissingApiKeyError
logger = logging.getLogger(__name__)
UDE_OPENALEX_ID = "https://openalex.org/I62318514"
UDE_ROR = "https://ror.org/04mz5ra38"
UDE_DISPLAY_NAME = "University of Duisburg-Essen"
MATCHING_METHOD = "exact_openalex_display_name_to_handelsregister_officer_name"
async def get_company_connections_by_author_id(
author_id: str,
client: CompanyConnectionsSearchClient | None = None,
) -> model.CompanyConnectionsResponse:
search_client = client or CompanyConnectionsSearchClient()
try:
author_hit = await search_client.get_openalex_author(author_id)
except MissingApiKeyError as exc:
raise HTTPException(
status_code=HTTP_503_SERVICE_UNAVAILABLE,
detail="Elasticsearch is not configured.",
) from exc
except httpx.HTTPError as exc:
logger.exception("OpenAlex author lookup failed for %s.", author_id)
raise HTTPException(
status_code=HTTP_502_BAD_GATEWAY,
detail="OpenAlex author lookup failed.",
) from exc
if author_hit is None:
raise HTTPException(status_code=404, detail=f"Author {author_id} not found.")
source = author_hit.get("_source", {})
display_name = _clean(source.get("display_name"))
institution_scope, matching_institutions = _get_ude_institution_scope(source)
is_ude_author = institution_scope is not None
if not is_ude_author or not display_name:
return model.CompanyConnectionsResponse(
author_id=author_id,
display_name=display_name or None,
is_ude_author=is_ude_author,
institution_scope=institution_scope,
matching_institutions=matching_institutions,
matching_method=None,
company_count=0,
has_more_results=False,
common_name_warning=False,
connections=[],
)
try:
hr_response = await search_client.search_handelsregister_by_officer_name(
display_name
)
except MissingApiKeyError as exc:
raise HTTPException(
status_code=HTTP_503_SERVICE_UNAVAILABLE,
detail="Elasticsearch is not configured.",
) from exc
except httpx.HTTPError as exc:
logger.exception("Handelsregister lookup failed for %s.", display_name)
raise HTTPException(
status_code=HTTP_502_BAD_GATEWAY,
detail="Handelsregister lookup failed.",
) from exc
company_count, company_count_relation = _parse_total(hr_response)
connections = _parse_company_connections(
response=hr_response,
matched_person_name=display_name,
)
has_more_results = company_count_relation == "gte" or company_count > len(
connections
)
common_name_warning = has_more_results or company_count > 3
return model.CompanyConnectionsResponse(
author_id=author_id,
display_name=display_name,
is_ude_author=True,
institution_scope=institution_scope,
matching_institutions=matching_institutions,
matching_method=MATCHING_METHOD,
company_count=company_count,
has_more_results=has_more_results,
common_name_warning=common_name_warning,
connections=connections,
)
def _get_ude_institution_scope(source: dict[str, Any]) -> tuple[str | None, list[str]]:
institutions = source.get("last_known_institutions") or []
direct_matches: list[str] = []
child_matches: list[str] = []
for institution in institutions:
if not isinstance(institution, dict):
continue
institution_id = _clean(institution.get("id"))
ror = _clean(institution.get("ror"))
name = _clean(institution.get("display_name"))
lineage = institution.get("lineage") or []
label = name or institution_id or ror
is_direct = (
institution_id == UDE_OPENALEX_ID
or ror == UDE_ROR
or name == UDE_DISPLAY_NAME
)
is_child = UDE_OPENALEX_ID in lineage and not is_direct
if is_direct:
direct_matches.append(label)
elif is_child:
child_matches.append(label)
if direct_matches:
return "direct_ude", sorted(set(direct_matches))
if child_matches:
return "child_of_ude", sorted(set(child_matches))
return None, []
def _parse_total(response: dict[str, Any]) -> tuple[int, str]:
total = response.get("hits", {}).get("total", 0)
if isinstance(total, dict):
return int(total.get("value") or 0), total.get("relation") or "eq"
return int(total or 0), "eq"
def _parse_company_connections(
response: dict[str, Any],
matched_person_name: str,
) -> list[model.CompanyConnection]:
connections: list[model.CompanyConnection] = []
hits = response.get("hits", {}).get("hits", [])
for hit in hits:
source = hit.get("_source", {})
matched_officers = _parse_inner_hit_officers(hit)
officers = _parse_source_officers(
source=source,
matched_person_name=matched_person_name,
)
connections.append(
model.CompanyConnection(
company_number=source.get("company_number"),
company_name=source.get("name"),
company_status=source.get("current_status"),
register_art=source.get("register_art"),
register_nummer=source.get("register_nummer"),
native_company_number=source.get("native_company_number"),
registrar=source.get("registrar"),
registered_office=source.get("registered_office"),
registered_address=source.get("registered_address"),
retrieved_at=source.get("retrieved_at"),
matched_officers=matched_officers,
officers=officers,
)
)
return connections
def _parse_inner_hit_officers(hit: dict[str, Any]) -> list[model.MatchedOfficer]:
inner_hits = (
hit.get("inner_hits", {}).get("officers", {}).get("hits", {}).get("hits", [])
)
officers: list[model.MatchedOfficer] = []
for inner_hit in inner_hits:
source = inner_hit.get("_source", {})
officer_source = _normalize_officer_source(source)
officers.append(
_to_officer(
officer_source,
is_matched_person=True,
)
)
return _deduplicate_officers(officers)
def _parse_source_officers(
source: dict[str, Any],
matched_person_name: str,
) -> list[model.MatchedOfficer]:
raw_officers = source.get("officers") or []
if not isinstance(raw_officers, list):
return []
officers: list[model.MatchedOfficer] = []
for raw_officer in raw_officers:
if not isinstance(raw_officer, dict):
continue
if _clean(raw_officer.get("type")) != "person":
continue
officer_name = _clean(raw_officer.get("name"))
is_matched_person = officer_name == matched_person_name
officers.append(
_to_officer(
raw_officer,
is_matched_person=is_matched_person,
)
)
return _deduplicate_officers(officers)
def _to_officer(
source: dict[str, Any],
is_matched_person: bool,
) -> model.MatchedOfficer:
return model.MatchedOfficer(
name=_clean_or_none(source.get("name")),
firstname=_clean_or_none(source.get("firstname")),
lastname=_clean_or_none(source.get("lastname")),
city=_clean_or_none(source.get("city")),
position=_clean_or_none(source.get("position")),
start_date=_clean_or_none(source.get("start_date")),
type=_clean_or_none(source.get("type")),
flag=_clean_or_none(source.get("flag")),
is_matched_person=is_matched_person,
)
def _deduplicate_officers(
officers: list[model.MatchedOfficer],
) -> list[model.MatchedOfficer]:
seen: set[tuple[str, str, str, str]] = set()
deduplicated: list[model.MatchedOfficer] = []
for officer in officers:
key = (
officer.name or "",
officer.position or "",
officer.city or "",
officer.start_date or "",
)
if key in seen:
continue
seen.add(key)
deduplicated.append(officer)
return deduplicated
def _normalize_officer_source(source: dict[str, Any]) -> dict[str, Any]:
officers = source.get("officers")
if isinstance(officers, dict):
return officers
return source
def _clean_or_none(value: Any) -> str | None:
cleaned = _clean(value)
return cleaned or None
def _clean(value: Any) -> str:
if value is None:
return ""
return str(value).strip()
@@ -0,0 +1,44 @@
from pydantic import BaseModel, Field
class MatchedOfficer(BaseModel):
name: str | None = None
firstname: str | None = None
lastname: str | None = None
city: str | None = None
position: str | None = None
start_date: str | None = None
type: str | None = None
flag: str | None = None
is_matched_person: bool = False
class CompanyConnection(BaseModel):
company_number: str | None = None
company_name: str | None = None
company_status: str | None = None
register_art: str | None = None
register_nummer: str | None = None
native_company_number: str | None = None
registrar: str | None = None
registered_office: str | None = None
registered_address: str | None = None
retrieved_at: str | None = None
matched_officers: list[MatchedOfficer] = Field(default_factory=list)
officers: list[MatchedOfficer] = Field(default_factory=list)
class CompanyConnectionsResponse(BaseModel):
author_id: str
display_name: str | None = None
is_ude_author: bool
institution_scope: str | None = None
matching_institutions: list[str] = Field(default_factory=list)
matching_method: str | None = None
company_count: int
has_more_results: bool
common_name_warning: bool
connections: list[CompanyConnection] = Field(default_factory=list)
@@ -0,0 +1,141 @@
from typing import Any
import httpx
from .. import config
class MissingApiKeyError(Exception):
pass
class CompanyConnectionsSearchClient:
def __init__(
self,
base_url: str | None = None,
api_key: str | None = None,
openalex_index: str = "openalex-authors",
handelsregister_index: str = "handelsregister",
timeout: float = 30.0,
transport: httpx.AsyncBaseTransport | None = None,
):
self.base_url = (
base_url
or config.settings.elasticsearch_url
or config.settings.openalex_works_search_base_url
).rstrip("/")
self.api_key = (
api_key
if api_key is not None
else config.settings.elasticsearch_api_key
or config.settings.openalex_works_api_key
)
self.openalex_index = openalex_index
self.handelsregister_index = handelsregister_index
self.timeout = timeout
self.transport = transport
@staticmethod
def openalex_doc_id(author_id: str) -> str:
return author_id.strip().removeprefix("https://openalex.org/")
async def get_openalex_author(self, author_id: str) -> dict[str, Any] | None:
if not self.api_key:
raise MissingApiKeyError("Elasticsearch API key is not configured.")
doc_id = self.openalex_doc_id(author_id)
async with httpx.AsyncClient(
base_url=self.base_url,
timeout=self.timeout,
transport=self.transport,
) as client:
response = await client.get(
f"/{self.openalex_index}/_doc/{doc_id}",
headers={"Authorization": f"ApiKey {self.api_key}"},
)
if response.status_code == 404:
return None
response.raise_for_status()
return response.json()
async def search_handelsregister_by_officer_name(
self,
officer_name: str,
size: int = 10000,
track_total_hits: bool = True,
) -> dict[str, Any]:
if not self.api_key:
raise MissingApiKeyError("Elasticsearch API key is not configured.")
payload = self.handelsregister_officer_name_query(
officer_name=officer_name,
size=size,
track_total_hits=track_total_hits,
)
async with httpx.AsyncClient(
base_url=self.base_url,
timeout=self.timeout,
transport=self.transport,
) as client:
response = await client.post(
f"/{self.handelsregister_index}/_search",
headers={"Authorization": f"ApiKey {self.api_key}"},
json=payload,
)
response.raise_for_status()
return response.json()
@staticmethod
def handelsregister_officer_name_query(
officer_name: str,
size: int,
track_total_hits: bool,
) -> dict[str, Any]:
return {
"track_total_hits": track_total_hits,
"size": size,
"_source": [
"company_number",
"name",
"current_status",
"registered_address",
"registered_office",
"registrar",
"register_art",
"register_nummer",
"native_company_number",
"retrieved_at",
"officers",
],
"query": {
"nested": {
"path": "officers",
"query": {
"bool": {
"filter": [
{"term": {"officers.type": "person"}},
{"term": {"officers.name.keyword": officer_name}},
]
}
},
"inner_hits": {
"size": 10,
"_source": [
"officers.name",
"officers.firstname",
"officers.lastname",
"officers.city",
"officers.position",
"officers.start_date",
"officers.type",
"officers.flag",
],
},
}
},
"sort": [{"company_number": {"order": "asc"}}],
}
@@ -0,0 +1,25 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
REST API for possible company connections of OpenAlex authors.
"""
from fastapi import APIRouter
from . import logic, model
router = APIRouter(
prefix="/api/inse-service/authors",
tags=["Company Connections"],
)
@router.get(
"/{author_id}/company-connections",
operation_id="getCompanyConnectionsByAuthor",
response_model=model.CompanyConnectionsResponse,
response_model_exclude_none=True,
summary="Get possible company connections by OpenAlex author ID.",
)
async def get_company_connections_by_author(author_id: str):
return await logic.get_company_connections_by_author_id(author_id)
+13 -9
View File
@@ -7,23 +7,27 @@ webapp.
"""
import logging
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse, RedirectResponse
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import JSONResponse, RedirectResponse
from inse.collaboration_network.router import router as collaboration_network_router
from inse.institutions.router import router as institutions_router
from inse.topics.service import router as topics_service_router
from inse.works.service import router as works_service_router
from inse.persons.service import router as persons_service_router
from inse.company_connections.service import router as company_connections_router
from inse.exceptions import NotFoundException
from inse.funders.service import router as funders_service_router
from inse.projects.router import router as projects_router
from inse.institutions.router import router as institutions_router
# caching
from inse.middleware.etag_cache import ETagCacheMiddleware
from inse.exceptions import NotFoundException
from inse.persons.service import router as persons_service_router
from inse.projects.router import router as projects_router
from inse.topics.service import router as topics_service_router
from inse.works.service import router as works_service_router
from . import config
from .service import router as service_router
from .account.service import router as account_router
from .service import router as service_router
logger = logging.getLogger(__name__)
@@ -44,9 +48,9 @@ app.include_router(topics_service_router)
app.include_router(works_service_router)
app.include_router(persons_service_router)
app.include_router(funders_service_router)
app.include_router(company_connections_router)
app.include_router(service_router)
app.include_router(account_router)
app.include_router(projects_router)
app.add_middleware(
+324 -2
View File
@@ -6,7 +6,7 @@ Business logic for publication works.
import logging
from time import time
from typing import List
from typing import Any, List
import httpx
from fastapi import HTTPException
@@ -328,6 +328,30 @@ async def get_topics_by_time_by_author(
target_publications: int = 300,
include_all: bool = False,
client: OpenAlexWorksSearchClient | None = None,
) -> TopicsByTime:
if client is not None:
return await _get_topics_by_time_by_author_from_work_pages(
author_id,
max_topics_per_year=max_topics_per_year,
target_publications=target_publications,
include_all=include_all,
client=client,
)
return _get_topics_by_time_by_author_from_es(
author_id,
max_topics_per_year=max_topics_per_year,
target_publications=target_publications,
include_all=include_all,
)
async def _get_topics_by_time_by_author_from_work_pages(
author_id: str,
max_topics_per_year: int = 3,
target_publications: int = 300,
include_all: bool = False,
client: OpenAlexWorksSearchClient | None = None,
) -> TopicsByTime:
if include_all:
works = await get_all_author_works(author_id, client=client)
@@ -459,6 +483,304 @@ async def get_topics_by_time_by_author(
)
def _get_topics_by_time_by_author_from_es(
author_id: str,
max_topics_per_year: int = 3,
target_publications: int = 300,
include_all: bool = False,
) -> TopicsByTime:
year_buckets, total_publications = _get_publication_year_counts_from_es(author_id)
selected_years, is_limited = _select_complete_timeline_years(
year_buckets,
target_publications=target_publications,
include_all=include_all,
)
if not selected_years:
return TopicsByTime(
elements=[],
total=0,
is_limited=False,
used_publications=0,
total_publications=total_publications,
)
year_topic_buckets = _get_timeline_topic_counts_from_es(
author_id,
years=selected_years,
max_topics_per_year=max_topics_per_year,
)
topic_ids = _collect_topic_ids_from_year_buckets(year_topic_buckets)
topic_details = _get_topic_details(list(topic_ids))
elements = _build_timeline_elements_from_aggregations(
year_topic_buckets,
topic_details=topic_details,
max_topics_per_year=max_topics_per_year,
)
return TopicsByTime(
elements=elements,
total=len(elements),
is_limited=is_limited,
used_publications=sum(element.publication_count for element in elements),
total_publications=total_publications,
)
def _get_publication_year_counts_from_es(author_id: str) -> tuple[list[dict], int]:
body = {
"size": 0,
"track_total_hits": True,
"query": _author_works_query(author_id),
"aggs": {
"publication_years": {
"terms": {
"field": "publication_year",
"size": 300,
"order": {"_key": "desc"},
},
},
},
}
try:
response = elasticsearch.search(
index=config.settings.openalex_works_search_index,
body=body,
)
except httpx.HTTPError as exc:
logger.exception("OpenAlex publication year aggregation request failed.")
raise HTTPException(
status_code=HTTP_502_BAD_GATEWAY,
detail="OpenAlex works search request failed.",
) from exc
return _parse_year_count_buckets(response), _parse_total_hits(response)
def _get_timeline_topic_counts_from_es(
author_id: str,
years: list[int],
max_topics_per_year: int,
) -> list[dict]:
body = {
"size": 0,
"query": {
"bool": {
"must": [_author_works_query(author_id)],
"filter": [{"terms": {"publication_year": years}}],
},
},
"aggs": {
"by_year": {
"terms": {
"field": "publication_year",
"size": len(years),
"order": {"_key": "asc"},
},
"aggs": {
"primary_topics": {
"terms": {
"field": "primary_topic.id",
"size": max_topics_per_year,
"order": [
{"_count": "desc"},
{"_key": "asc"},
],
},
},
"topics_nested": {
"nested": {"path": "topics"},
"aggs": {
"topics": {
"terms": {
"field": "topics.id",
"size": max_topics_per_year,
"order": [
{"_count": "desc"},
{"_key": "asc"},
],
},
"aggs": {
"works": {
"reverse_nested": {},
},
},
},
},
},
},
},
},
}
try:
response = elasticsearch.search(
index=config.settings.openalex_works_search_index,
body=body,
)
except httpx.HTTPError as exc:
logger.exception("OpenAlex timeline topic aggregation request failed.")
raise HTTPException(
status_code=HTTP_502_BAD_GATEWAY,
detail="OpenAlex works search request failed.",
) from exc
return response.get("aggregations", {}).get("by_year", {}).get("buckets", [])
def _author_works_query(author_id: str) -> dict[str, Any]:
indexed_author_id = f"https://openalex.org/{author_id.strip()}"
return {
"nested": {
"path": "authorships",
"query": {
"bool": {
"filter": [
{"term": {"authorships.author.id": indexed_author_id}},
],
},
},
},
}
def _parse_year_count_buckets(response: dict) -> list[dict]:
return (
response.get("aggregations", {})
.get("publication_years", {})
.get("buckets", [])
)
def _parse_total_hits(response: dict) -> int:
total = response.get("hits", {}).get("total", 0)
if isinstance(total, dict):
return total.get("value", 0)
return total
def _select_complete_timeline_years(
year_buckets: list[dict],
target_publications: int,
include_all: bool,
) -> tuple[list[int], bool]:
if include_all:
return [bucket["key"] for bucket in year_buckets], False
selected_years: list[int] = []
selected_publications = 0
for bucket in year_buckets:
selected_years.append(bucket["key"])
selected_publications += bucket.get("doc_count", 0)
if selected_publications >= target_publications:
break
is_limited = len(selected_years) < len(year_buckets)
return selected_years, is_limited
def _collect_topic_ids_from_year_buckets(year_buckets: list[dict]) -> set[str]:
topic_ids: set[str] = set()
for year_bucket in year_buckets:
primary_buckets = (
year_bucket.get("primary_topics", {}).get("buckets", [])
)
topic_buckets = (
year_bucket.get("topics_nested", {})
.get("topics", {})
.get("buckets", [])
)
for bucket in primary_buckets + topic_buckets:
topic_id = bucket.get("key")
if topic_id:
topic_ids.add(topic_id)
return topic_ids
def _build_timeline_elements_from_aggregations(
year_buckets: list[dict],
topic_details: dict[str, dict],
max_topics_per_year: int,
) -> list[TopicsByYear]:
elements: list[TopicsByYear] = []
for year_bucket in year_buckets:
year = year_bucket.get("key")
if year is None:
continue
topics = _build_topic_counts_from_buckets(
year_bucket.get("topics_nested", {})
.get("topics", {})
.get("buckets", []),
topic_details=topic_details,
max_topics_per_year=max_topics_per_year,
use_reverse_nested_count=True,
)
primary_topics = _build_topic_counts_from_buckets(
year_bucket.get("primary_topics", {}).get("buckets", []),
topic_details=topic_details,
max_topics_per_year=max_topics_per_year,
use_reverse_nested_count=False,
)
elements.append(
TopicsByYear(
year=year,
publication_count=year_bucket.get("doc_count", 0),
topics=topics,
primary_topics=primary_topics,
)
)
return elements
def _build_topic_counts_from_buckets(
buckets: list[dict],
topic_details: dict[str, dict],
max_topics_per_year: int,
use_reverse_nested_count: bool,
) -> list[TopicCount]:
topics: list[TopicCount] = []
for bucket in buckets[:max_topics_per_year]:
topic_id = bucket.get("key")
if not topic_id:
continue
info = topic_details.get(topic_id, {})
display_name = info.get("display_name") or topic_id
count = bucket.get("doc_count", 0)
if use_reverse_nested_count:
count = bucket.get("works", {}).get("doc_count", count)
topics.append(
TopicCount(
id=topic_id,
name=display_name,
count=count,
description=info.get("description"),
)
)
return topics
async def _search_author_works_data(
search_client: OpenAlexWorksSearchClient,
author_id: str,
@@ -538,4 +860,4 @@ def _parse_full_work_search_response(data: dict) -> tuple[list[Work], int]:
detail="OpenAlex works search response could not be parsed.",
) from exc
return elements, total
return elements, total
@@ -4,6 +4,7 @@ README.md
api.base.service.ts
api.module.ts
api/api.ts
api/companyConnections.service.ts
api/funding.service.ts
api/iNSEAccountService.service.ts
api/iNSEService.service.ts
@@ -43,6 +44,8 @@ model/careerMetrics.ts
model/collaborationNetwork.ts
model/collaborationNetworkEdge.ts
model/collaborationNetworkNodeType.ts
model/companyConnection.ts
model/companyConnectionsResponse.ts
model/cordisEuProject.ts
model/cordisEuProjectPage.ts
model/costUsd.ts
@@ -77,6 +80,7 @@ model/keywords.ts
model/latitude.ts
model/location.ts
model/longitude.ts
model/matchedOfficer.ts
model/meta.ts
model/model2YrMeanCitedness.ts
model/models.ts
+3 -1
View File
@@ -1,3 +1,5 @@
export * from './companyConnections.service';
import { CompanyConnectionsService } from './companyConnections.service';
export * from './funding.service';
import { FundingService } from './funding.service';
export * from './iNSEAccountService.service';
@@ -18,4 +20,4 @@ export * from './topics.service';
import { TopicsService } from './topics.service';
export * from './works.service';
import { WorksService } from './works.service';
export const APIS = [FundingService, INSEAccountServiceService, INSEServiceService, InstitutionsService, ItemsService, PersonNetworkService, PersonsService, ProjectsService, TopicsService, WorksService];
export const APIS = [CompanyConnectionsService, FundingService, INSEAccountServiceService, INSEServiceService, InstitutionsService, ItemsService, PersonNetworkService, PersonsService, ProjectsService, TopicsService, WorksService];
@@ -0,0 +1,95 @@
/**
* Innovation Search Engine API
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */
import { Inject, Injectable, Optional } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams,
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
} from '@angular/common/http';
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
// @ts-ignore
import { CompanyConnectionsResponse } from '../model/companyConnectionsResponse';
// @ts-ignore
import { HTTPValidationError } from '../model/hTTPValidationError';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { BaseService } from '../api.base.service';
@Injectable({
providedIn: 'root'
})
export class CompanyConnectionsService extends BaseService {
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
super(basePath, configuration);
}
/**
* Get possible company connections by OpenAlex author ID.
* @endpoint get /api/inse-service/authors/{author_id}/company-connections
* @param authorId
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getCompanyConnectionsByAuthor(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<CompanyConnectionsResponse>;
public getCompanyConnectionsByAuthor(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<CompanyConnectionsResponse>>;
public getCompanyConnectionsByAuthor(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<CompanyConnectionsResponse>>;
public getCompanyConnectionsByAuthor(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
if (authorId === null || authorId === undefined) {
throw new Error('Required parameter authorId was null or undefined when calling getCompanyConnectionsByAuthor.');
}
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/company-connections`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<CompanyConnectionsResponse>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
}
@@ -0,0 +1,27 @@
/**
* Innovation Search Engine API
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { MatchedOfficer } from './matchedOfficer';
export interface CompanyConnection {
company_number?: string | null;
company_name?: string | null;
company_status?: string | null;
register_art?: string | null;
register_nummer?: string | null;
native_company_number?: string | null;
registrar?: string | null;
registered_office?: string | null;
registered_address?: string | null;
retrieved_at?: string | null;
matched_officers?: Array<MatchedOfficer>;
officers?: Array<MatchedOfficer>;
}
@@ -0,0 +1,25 @@
/**
* Innovation Search Engine API
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { CompanyConnection } from './companyConnection';
export interface CompanyConnectionsResponse {
author_id: string;
display_name?: string | null;
is_ude_author: boolean;
institution_scope?: string | null;
matching_institutions?: Array<string>;
matching_method?: string | null;
company_count: number;
has_more_results: boolean;
common_name_warning: boolean;
connections?: Array<CompanyConnection>;
}
@@ -0,0 +1,23 @@
/**
* Innovation Search Engine API
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export interface MatchedOfficer {
name?: string | null;
firstname?: string | null;
lastname?: string | null;
city?: string | null;
position?: string | null;
start_date?: string | null;
type?: string | null;
flag?: string | null;
is_matched_person?: boolean;
}
+3
View File
@@ -23,6 +23,8 @@ export * from './careerMetrics';
export * from './collaborationNetwork';
export * from './collaborationNetworkEdge';
export * from './collaborationNetworkNodeType';
export * from './companyConnection';
export * from './companyConnectionsResponse';
export * from './cordisEuProject';
export * from './cordisEuProjectPage';
export * from './costUsd';
@@ -57,6 +59,7 @@ export * from './keywords';
export * from './latitude';
export * from './location';
export * from './longitude';
export * from './matchedOfficer';
export * from './meta';
export * from './model2YrMeanCitedness';
export * from './openAccess';
-1
View File
@@ -40,7 +40,6 @@ export const appConfig: ApplicationConfig = {
const router = inject(Router);
const errorService = inject(ErrorService);
if (
router.url.includes('/error') ||
router.currentNavigation()?.extractedUrl.toString().includes('/error')
+7
View File
@@ -172,6 +172,13 @@ export const routes: Routes = [
(mod) => mod.PersonFundingComponent,
),
},
{
path: 'company-connections',
loadComponent: () =>
import('./modules/person-company-connections/person-company-connections.component').then(
(mod) => mod.PersonCompanyConnectionsComponent,
),
},
],
},
{
@@ -43,7 +43,7 @@
Anmelden
</button>
<div class="field" style="text-align: center; margin-top: -10px;">
<div class="field" style="text-align: center; margin-top: -10px">
<button mat-button type="button" routerLink="/register">
Noch kein Konto? <b>Registrieren</b>
</button>
@@ -1,9 +1,7 @@
<div class="container">
<form class="form" [formGroup]="registerForm">
<h3>Konto erstellen</h3>
<p class="field">
Bitte gib Deine Daten ein, um Dich zu registrieren.
</p>
<p class="field">Bitte gib Deine Daten ein, um Dich zu registrieren.</p>
<mat-form-field class="field">
<mat-label>Benutzername</mat-label>
@@ -49,43 +47,50 @@
<mat-label>Institution</mat-label>
<mat-icon matPrefix>apartment</mat-icon>
<input
type="text"
matInput
formControlName="institution"
[matAutocomplete]="auto"
placeholder="Institution suchen..."
/>
@if (registerForm.controls['institution'].hasError('required')) {
<input
type="text"
matInput
formControlName="institution"
[matAutocomplete]="auto"
placeholder="Institution suchen..." />
@if (registerForm.controls['institution'].hasError('required')) {
<mat-error>Fehler: <b>Institution</b> erforderlich.</mat-error>
}
<mat-autocomplete
#auto="matAutocomplete"
(optionSelected)="onInstitutionSelected($event)">
@for (institution of institutionOptions(); track institution.id) {
<mat-option [value]="institution.display_name" style="font-size: 16px;">
<div><span>{{ institution.display_name }}</span></div>
@if (institution.hint) {
<small>{{ institution.hint }}</small>
}
</mat-option>
<mat-autocomplete
#auto="matAutocomplete"
(optionSelected)="onInstitutionSelected($event)">
@for (institution of institutionOptions(); track institution.id) {
<mat-option
[value]="institution.display_name"
style="font-size: 16px">
<div>
<span>{{ institution.display_name }}</span>
</div>
@if (institution.hint) {
<small>{{ institution.hint }}</small>
}
</mat-autocomplete>
</mat-option>
}
</mat-autocomplete>
</mat-form-field>
<div class="field checkbox-container">
<mat-checkbox formControlName="superadmin">Superadmin Rechte</mat-checkbox>
<mat-checkbox formControlName="superadmin"
>Superadmin Rechte</mat-checkbox
>
</div>
<button
mat-raised-button
class="button"
(click)="submit()"
[disabled]="!registerForm.valid || (credentialService.validating | async)">
[disabled]="
!registerForm.valid || (credentialService.validating | async)
">
Registrieren
</button>
<div class="field" style="text-align: center; margin-top: -10px;">
<div class="field" style="text-align: center; margin-top: -10px">
<button mat-button type="button" routerLink="/login">
Bereits ein Konto? <b>Anmelden</b>
</button>
@@ -94,4 +99,4 @@
<p class="progress">
<!-- Statusanzeige analog zum Login-Formular -->
</p>
</div>
</div>
@@ -1,4 +1,11 @@
import { Component, inject, OnDestroy, signal, DestroyRef, OnInit } from '@angular/core';
import {
Component,
inject,
OnDestroy,
signal,
DestroyRef,
OnInit,
} from '@angular/core';
import { CommonModule } from '@angular/common';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { Router, RouterLink } from '@angular/router';
@@ -15,8 +22,19 @@ import { MatIconModule } from '@angular/material/icon';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { CredentialService } from '../../shared/services/credential.service';
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
import { Subscription, map, switchMap, debounceTime, distinctUntilChanged, catchError,of} from 'rxjs';
import { MatAutocompleteModule, MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
import {
Subscription,
map,
switchMap,
debounceTime,
distinctUntilChanged,
catchError,
of,
} from 'rxjs';
import {
MatAutocompleteModule,
MatAutocompleteSelectedEvent,
} from '@angular/material/autocomplete';
import { InstitutionsService } from '../../api';
@Component({
selector: 'app-register',
@@ -43,7 +61,7 @@ export class AppRegisterComponent implements OnDestroy, OnInit {
private readonly snackBar = inject(MatSnackBar);
private readonly destroyRef = inject(DestroyRef);
private subscription?: Subscription;
private institutionsService = inject(InstitutionsService)
private institutionsService = inject(InstitutionsService);
registerForm: FormGroup = this.fb.group({
username: ['', [Validators.required, Validators.minLength(4)]],
email: ['', [Validators.required, Validators.email]],
@@ -126,7 +144,10 @@ export class AppRegisterComponent implements OnDestroy, OnInit {
}
return this.searchInstitutions(query).pipe(
catchError((ev) => {console.log(ev);return of([])}),
catchError((ev) => {
console.log(ev);
return of([]);
}),
);
}),
takeUntilDestroyed(this.destroyRef),
@@ -144,7 +165,9 @@ export class AppRegisterComponent implements OnDestroy, OnInit {
onInstitutionSelected(event: MatAutocompleteSelectedEvent): void {
const val = event.option.value;
this.registerForm.controls['institution'].setValue(val, { emitEvent: false });
this.registerForm.controls['institution'].setValue(val, {
emitEvent: false,
});
this.institutionOptions.set([]);
}
}
@@ -75,9 +75,7 @@
undefined
" />
<app-person-network-info-card
[description]="
'Durchschnittliche jährliche Förderung durch die Europäische Union'
"
[description]="'Durchschnittliche jährliche Förderung durch die Europäische Union'"
[value]="
(euAverageAnnualFunding()
| currency: 'EUR' : 'symbol' : '1.0-0' : 'de') ?? undefined
@@ -6,6 +6,4 @@ import { Component } from '@angular/core';
templateUrl: './institution-publications.component.html',
styleUrl: './institution-publications.component.scss',
})
export class InstitutionPublicationsComponent {
}
export class InstitutionPublicationsComponent {}
@@ -0,0 +1,269 @@
@if (loading) {
<div class="state state-loading" aria-live="polite">
<mat-spinner diameter="36"></mat-spinner>
<span>Verbindungen zu Unternehmen werden geladen ...</span>
</div>
} @else if (error) {
<div class="state state-error">
Verbindungen zu Unternehmen konnten nicht geladen werden.
</div>
} @else if (data && !data.is_ude_author) {
<section class="empty-state">
<h2>Keine Unternehmenssuche verfügbar</h2>
<p>Für diese Person wird aktuell keine Suche nach Unternehmen angezeigt.</p>
</section>
} @else if (data && connections.length === 0) {
<section class="empty-state">
<h2>Keine Treffer im Handelsregister</h2>
<p>
Für diese Person wurden keine passenden Treffer im Handelsregister
gefunden.
</p>
</section>
} @else if (data) {
<section class="company-connections">
<header class="page-header">
<h2>Mögliche Verbindungen zu Unternehmen</h2>
<p>
{{ getResultCountLabel() }} für
<strong>{{ data.display_name }}</strong>
</p>
</header>
@if (data.common_name_warning) {
<div class="warning-box">
Für diesen Namen gibt es mehrere Treffer im Handelsregister. Die
Ergebnisse sollten besonders vorsichtig interpretiert werden.
</div>
}
<div class="main-layout">
<section class="graph-column">
@if (graphOptions) {
<mat-card appearance="outlined" class="graph-card">
<div class="graph-stage">
<button
mat-icon-button
type="button"
class="graph-related-persons-button"
#relatedPersonsTooltip="matTooltip"
(click)="toggleRelatedPersons(relatedPersonsTooltip)"
[matTooltip]="
showRelatedPersons
? 'Weitere Registerpersonen ausblenden'
: 'Weitere Registerpersonen anzeigen'
"
matTooltipPosition="left"
[attr.aria-label]="
showRelatedPersons
? 'Weitere Registerpersonen ausblenden'
: 'Weitere Registerpersonen anzeigen'
">
<mat-icon class="graph-related-persons-icon">
{{ showRelatedPersons ? 'no_accounts' : 'account_circle' }}
</mat-icon>
</button>
<div
class="graph"
echarts
[options]="graphOptions"
[autoResize]="true"
(wheel)="onGraphWheel($event)"
(chartClick)="onGraphClick($event)"></div>
</div>
@if (roleLegendItems.length > 0) {
<div class="role-legend" aria-label="Legende der Rollen">
@for (item of roleLegendItems; track item.role) {
<span class="role-legend-item">
<span
class="role-legend-line"
[style.background]="item.color"></span>
<span class="role-legend-text">{{ item.role }}</span>
</span>
}
</div>
}
@if (connections.length > 10) {
<p class="graph-note">
Der Graph zeigt die ersten 10 Unternehmen. Die vollständige
Liste ist rechts sichtbar.
</p>
}
</mat-card>
}
<p class="disclaimer">
{{ disclaimer }}
</p>
</section>
<section class="list-column">
<mat-card appearance="outlined" class="connection-list">
<div class="list-header">
<span>Unternehmen</span>
<span>Rolle</span>
</div>
<div class="list-scroll">
@for (connection of connections; track getCompanyKey(connection)) {
@let officer = getPrimaryOfficer(connection);
@let companyKey = getCompanyKey(connection);
@let relatedOfficers = getRelatedOfficers(connection);
<div class="connection-item">
<div
#connectionRow
class="connection-row"
[attr.data-company-key]="companyKey"
[class.selected]="companyKey === selectedCompanyKey"
[class.removed]="connection.company_status === 'removed'"
(click)="selectCompany(connection)">
<span
class="company-name"
[title]="connection.company_name || ''">
{{ connection.company_name || 'Unbekanntes Unternehmen' }}
</span>
<span
class="role-value"
[style.border-color]="getRoleColor(officer?.position)"
[title]="officer?.position || ''">
{{ officer?.position || '—' }}
</span>
</div>
@if (companyKey === selectedCompanyKey) {
<div
class="connection-detail"
(click)="$event.stopPropagation()">
<div class="detail-grid">
<div class="detail-field">
<span class="detail-label">Register</span>
<span class="detail-value">
{{ getCompanyRegisterLabel(connection) }}
</span>
</div>
<div class="detail-field">
<span class="detail-label">Amtsgericht</span>
<span class="detail-value">
{{ getRegistrarLabel(connection) }}
</span>
</div>
<div class="detail-field detail-field--address">
<span class="detail-label">Adresse</span>
<span class="detail-value">
{{ getCompanyAddressLabel(connection) }}
</span>
</div>
<div class="detail-field">
<span class="detail-label">Unternehmensstatus</span>
<span
class="detail-value detail-status"
[class.detail-status--active]="
connection.company_status === 'currently registered'
"
[class.detail-status--removed]="
connection.company_status === 'removed'
">
{{ getCompanyStatusLabel(connection.company_status) }}
</span>
</div>
<div class="detail-field detail-field--wide">
<span class="detail-label">Gegenstand</span>
<span class="detail-value">
{{ getGegenstandLabel() }}
</span>
</div>
</div>
@if (relatedOfficers.length > 0) {
<button
type="button"
class="officers-toggle"
(click)="toggleCompanyOfficers(connection, $event)">
<span>
Weitere Registerpersonen ({{
relatedOfficers.length
}})
</span>
<mat-icon>
{{
isCompanyOfficersExpanded(connection)
? 'expand_less'
: 'expand_more'
}}
</mat-icon>
</button>
@if (isCompanyOfficersExpanded(connection)) {
<div class="related-officers">
@for (
relatedOfficer of relatedOfficers;
track relatedOfficer.name
) {
<div class="related-officer">
<span
class="officer-name"
[title]="relatedOfficer.name || ''">
{{ relatedOfficer.name }}
</span>
<span
class="officer-role"
[style.border-color]="
getRoleColor(relatedOfficer.position)
"
[title]="relatedOfficer.position || ''">
{{ relatedOfficer.position || '—' }}
</span>
@if (relatedOfficer.name) {
<a
mat-icon-button
color="primary"
class="officer-open-link"
[routerLink]="['/persons']"
[queryParams]="
getPersonSearchQueryParams(
relatedOfficer.name
)
"
target="_blank"
rel="noopener noreferrer"
[attr.aria-label]="
'Suche nach ' +
relatedOfficer.name +
' öffnen'
"
[title]="
'Suche nach ' +
relatedOfficer.name +
' öffnen'
">
<mat-icon>open_in_new</mat-icon>
</a>
} @else {
<span class="officer-open-placeholder"></span>
}
</div>
}
</div>
}
}
</div>
}
</div>
}
</div>
</mat-card>
</section>
</div>
</section>
}
@@ -0,0 +1,505 @@
$marked-color: #5470c6;
$related-person-color: #4f8df5;
$timeline-purple: #7255d9;
$timeline-purple-bg: #f6f0ff;
$timeline-orange-bg: #fff7e8;
$timeline-orange-border: #ffd796;
$timeline-orange-text: #c67500;
$card-border: #dbe5f6;
$text-main: #07163d;
$text-muted: #64718f;
:host {
display: block;
}
.company-connections {
display: flex;
flex-direction: column;
gap: 16px;
padding: 20px 28px 32px;
}
.page-header {
h2 {
margin: 0 0 6px;
color: $text-main;
font-size: 20px;
font-weight: 700;
line-height: 1.25;
}
p {
margin: 0;
color: $text-muted;
font-size: 14px;
line-height: 1.4;
}
}
.state {
display: flex;
align-items: center;
justify-content: center;
gap: 14px;
min-height: 220px;
color: $text-muted;
font-size: 14px;
}
.state-error {
color: #b42318;
}
.empty-state {
margin: 14px 28px;
padding: 18px 22px;
border: 1px solid $card-border;
border-radius: 16px;
background: #ffffff;
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
h2 {
margin: 0 0 6px;
color: $text-main;
font-size: 18px;
font-weight: 700;
line-height: 1.3;
}
p {
margin: 0;
color: $text-muted;
font-size: 14px;
line-height: 1.4;
}
}
.warning-box {
padding: 12px 14px;
border: 1px solid $timeline-orange-border;
border-radius: 12px;
background: $timeline-orange-bg;
color: $timeline-orange-text;
font-size: 14px;
line-height: 1.45;
}
.main-layout {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
gap: 18px;
height: 680px;
align-items: stretch;
}
.graph-column,
.list-column {
min-width: 0;
min-height: 0;
display: flex;
flex-direction: column;
}
.graph-card,
.connection-list {
border-radius: 16px;
background: #ffffff;
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
overflow: hidden;
}
.graph-card {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
}
.graph-stage {
position: relative;
flex: 1 1 auto;
min-height: 0;
overflow: hidden;
}
.graph-related-persons-button {
position: absolute;
top: 12px;
right: 12px;
z-index: 2;
width: 50px;
height: 50px;
padding: 0;
background: transparent;
color: $related-person-color;
box-shadow: none;
}
.graph-related-persons-button:hover {
background: rgba(84, 112, 198, 0.08);
}
.graph-related-persons-icon {
width: 51px;
height: 51px;
font-size: 51px;
line-height: 51px;
font-variation-settings:
'FILL' 1,
'wght' 400,
'GRAD' 0,
'opsz' 48;
}
.graph {
width: 100%;
height: 100%;
min-height: 0;
overscroll-behavior: contain;
touch-action: none;
user-select: none;
cursor: grab;
}
.graph:active {
cursor: grabbing;
}
.role-legend {
flex: 0 0 auto;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
gap: 10px 18px;
padding: 10px 18px 6px;
}
.role-legend-item {
display: inline-flex;
align-items: center;
gap: 8px;
min-width: 0;
color: $text-muted;
font-size: 12px;
font-weight: 600;
}
.role-legend-line {
flex: 0 0 auto;
display: inline-block;
width: 24px;
height: 3px;
border-radius: 999px;
}
.role-legend-text {
min-width: 0;
max-width: 260px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.graph-note {
flex: 0 0 auto;
margin: 0;
padding: 4px 18px 16px;
color: $text-muted;
font-size: 13px;
line-height: 1.35;
text-align: left;
}
.disclaimer {
flex: 0 0 auto;
margin: 14px 0 0;
padding: 12px 14px;
border-left: 3px solid $timeline-purple;
border-radius: 8px;
background: $timeline-purple-bg;
color: $text-muted;
font-size: 13px;
line-height: 1.45;
}
.connection-list {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
}
.list-header,
.connection-row {
display: grid;
grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
gap: clamp(10px, 1vw, 18px);
align-items: center;
}
.list-header {
flex: 0 0 auto;
padding: 12px 16px;
border-bottom: 1px solid $card-border;
background: #fbfdff;
color: $text-muted;
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.02em;
line-height: 1.3;
}
.list-header span,
.connection-row span {
min-width: 0;
justify-self: start;
text-align: left;
}
.list-scroll {
flex: 1 1 auto;
min-height: 0;
overflow-y: auto;
}
.connection-item {
border-bottom: 1px solid #edf2fb;
}
.connection-row {
padding: 14px 16px;
color: $text-main;
font-size: 14px;
cursor: pointer;
&:hover {
background: #f8fbff;
}
&.selected {
background: #f0f6ff;
box-shadow: inset 3px 0 0 $marked-color;
}
&.removed {
color: $text-muted;
}
}
.company-name,
.role-value,
.detail-value,
.officer-name,
.officer-role {
display: block;
max-width: 100%;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.company-name {
font-weight: 700;
}
.role-value {
width: auto;
padding-left: 8px;
border-left: 3px solid;
color: $text-main;
}
.connection-detail {
padding: 0 16px 16px;
background: #f8fbff;
}
.detail-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 10px 18px;
padding: 14px 0 4px;
border-top: 1px solid #e5edf8;
}
.detail-field {
min-width: 0;
}
.detail-field--wide {
grid-column: 1 / -1;
}
.detail-field--address .detail-value,
.detail-field--wide .detail-value {
overflow: visible;
text-overflow: unset;
white-space: normal;
}
.detail-label {
display: block;
margin-bottom: 3px;
color: $text-muted;
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.02em;
}
.detail-value {
color: $text-main;
font-size: 13px;
line-height: 1.35;
}
.detail-value.detail-status {
display: block;
margin: 0;
padding: 0;
border: 0;
border-radius: 0;
background: transparent;
font-size: 13px;
font-weight: 700;
line-height: 1.35;
}
.detail-value.detail-status--active {
color: #218354;
}
.detail-value.detail-status--removed {
color: #6b7280;
}
.officers-toggle {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
margin-top: 14px;
padding: 12px 0 0;
border: 0;
border-top: 1px solid #e5edf8;
background: transparent;
color: $text-muted;
font-size: 11px;
font-weight: 700;
text-align: left;
text-transform: uppercase;
letter-spacing: 0.02em;
cursor: pointer;
}
.officers-toggle mat-icon {
color: $text-muted;
}
.related-officers {
display: flex;
flex-direction: column;
gap: 6px;
margin: 8px 0 0;
padding: 0;
}
.related-officer {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr) 40px;
gap: 12px;
align-items: center;
color: $text-main;
font-size: 13px;
}
.officer-name {
color: $text-main;
font-weight: 400;
}
.officer-role {
padding-left: 10px;
border-left: 4px solid #8a95b3;
color: $text-main;
font-weight: 600;
}
.officer-open-link {
justify-self: center;
color: $marked-color;
}
.officer-open-placeholder {
display: block;
width: 40px;
height: 40px;
}
@media (max-width: 1450px) {
.main-layout {
grid-template-columns: 1fr;
height: auto;
}
.graph-card {
height: 520px;
}
.connection-list {
height: 520px;
}
}
@media (max-width: 760px) {
.company-connections {
padding: 18px 16px 28px;
}
.empty-state {
margin: 14px 16px;
}
.graph-card {
height: 420px;
}
.list-header {
display: none;
}
.connection-row {
grid-template-columns: 1fr;
gap: 8px;
}
.detail-grid {
grid-template-columns: 1fr;
}
.related-officer {
grid-template-columns: minmax(0, 1fr) 40px;
gap: 6px 10px;
}
.officer-role {
grid-column: 1 / 2;
}
.officer-open-link,
.officer-open-placeholder {
grid-column: 2 / 3;
grid-row: 1 / 3;
align-self: center;
justify-self: center;
}
}
@@ -0,0 +1,702 @@
import { CommonModule, LocationStrategy } from '@angular/common';
import {
Component,
ElementRef,
OnInit,
QueryList,
ViewChildren,
inject,
} from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatIconModule } from '@angular/material/icon';
import { MatTooltip, MatTooltipModule } from '@angular/material/tooltip';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
import { EChartsOption } from 'echarts';
import { NgxEchartsDirective } from 'ngx-echarts';
import {
CompanyConnection,
CompanyConnectionsResponse,
CompanyConnectionsService,
MatchedOfficer,
} from '../../api';
interface RoleLegendItem {
role: string;
color: string;
}
@Component({
selector: 'app-person-company-connections',
imports: [
CommonModule,
MatProgressSpinnerModule,
NgxEchartsDirective,
MatButtonModule,
MatCardModule,
MatIconModule,
MatTooltipModule,
MatTooltip,
RouterModule,
],
templateUrl: './person-company-connections.component.html',
styleUrl: './person-company-connections.component.scss',
})
export class PersonCompanyConnectionsComponent implements OnInit {
private readonly route = inject(ActivatedRoute);
private readonly router = inject(Router);
private readonly locationStrategy = inject(LocationStrategy);
private readonly companyConnectionsApi = inject(CompanyConnectionsService);
private readonly graphCompanyLimit = 10;
private readonly personCategoryIndex = 0;
private readonly activeCompanyCategoryIndex = 1;
private readonly removedCompanyCategoryIndex = 2;
private readonly registerPersonCategoryIndex = 3;
private readonly personCategoryName = 'Person';
private readonly activeCompanyCategoryName = 'Aktives Unternehmen';
private readonly removedCompanyCategoryName = 'Gelöschtes Unternehmen';
private readonly registerPersonCategoryName = 'Registerperson';
private readonly authorColor = '#7255d9';
private readonly companyActiveColor = '#39a96b';
private readonly companyRemovedColor = '#8a95b3';
private readonly relatedPersonColor = '#4f8df5';
private readonly fallbackRoleColor = '#8a95b3';
private readonly personIconSymbol = this.createAccountCircleSymbol(
this.authorColor,
);
private readonly registerPersonIconSymbol = this.createAccountCircleSymbol(
this.relatedPersonColor,
);
private readonly activeCompanyIconSymbol = this.createApartmentSymbol(
this.companyActiveColor,
);
private readonly removedCompanyIconSymbol = this.createApartmentSymbol(
this.companyRemovedColor,
);
private readonly roleColors: Record<string, string> = {
Geschäftsführer: '#2678e8',
Prokurist: '#39a96b',
'Persönlich haftender Gesellschafter': '#7255d9',
Liquidator: '#f59e0b',
Inhaber: '#e0527c',
Vorstand: '#0f766e',
};
readonly disclaimer =
'Die angezeigten Verbindungen basieren nur auf einem Namensabgleich und können gleichnamige Personen enthalten.';
loading = true;
error = false;
data: CompanyConnectionsResponse | null = null;
graphOptions: EChartsOption | null = null;
roleLegendItems: RoleLegendItem[] = [];
selectedCompanyKey: string | null = null;
expandedOfficersCompanyKey: string | null = null;
showRelatedPersons = false;
@ViewChildren('connectionRow', { read: ElementRef })
private connectionRows!: QueryList<ElementRef<HTMLElement>>;
get connections(): CompanyConnection[] {
return this.data?.connections ?? [];
}
ngOnInit(): void {
this.route.parent?.paramMap.subscribe((params) => {
const authorId = params.get('id');
if (!authorId) {
this.loading = false;
this.error = true;
return;
}
this.loadCompanyConnections(authorId);
});
}
getPrimaryOfficer(connection: CompanyConnection): MatchedOfficer | null {
return connection.matched_officers?.[0] ?? null;
}
getRelatedOfficers(connection: CompanyConnection): MatchedOfficer[] {
const displayName = this.data?.display_name?.trim();
return (connection.officers ?? []).filter((officer) => {
const officerName = officer.name?.trim();
if (!officerName) {
return false;
}
if (officer.is_matched_person) {
return false;
}
return officerName !== displayName;
});
}
getCompanyStatusLabel(status?: string | null): string {
if (status === 'currently registered') {
return 'Aktiv';
}
if (status === 'removed') {
return 'Gelöscht';
}
return status || 'Unbekannt';
}
getCompanyKey(connection: CompanyConnection): string {
return (
connection.company_number ||
`${connection.company_name}-${connection.register_art}-${connection.register_nummer}`
);
}
getCompanyRegisterLabel(connection: CompanyConnection): string {
const parts = [connection.register_art, connection.register_nummer].filter(
Boolean,
);
return parts.length > 0 ? parts.join(' ') : '—';
}
getRegistrarLabel(connection: CompanyConnection): string {
return connection.registrar || '—';
}
getCompanyAddressLabel(connection: CompanyConnection): string {
return connection.registered_address || connection.registered_office || '—';
}
getGegenstandLabel(): string {
return 'Noch nicht verfügbar.';
}
getResultCountLabel(): string {
if (!this.data) {
return '';
}
const companyCount = this.data.company_count ?? this.connections.length;
if (companyCount === 1) {
return '1 Treffer';
}
return `${companyCount} Treffer`;
}
getRoleColor(role?: string | null): string {
if (!role) {
return this.fallbackRoleColor;
}
return this.roleColors[role] ?? this.fallbackRoleColor;
}
isCompanySelected(connection: CompanyConnection): boolean {
return this.selectedCompanyKey === this.getCompanyKey(connection);
}
isCompanyOfficersExpanded(connection: CompanyConnection): boolean {
return this.expandedOfficersCompanyKey === this.getCompanyKey(connection);
}
selectCompany(connection: CompanyConnection): void {
const companyKey = this.getCompanyKey(connection);
if (this.selectedCompanyKey === companyKey) {
this.selectedCompanyKey = null;
this.expandedOfficersCompanyKey = null;
return;
}
this.selectedCompanyKey = companyKey;
this.expandedOfficersCompanyKey = null;
}
toggleCompanyOfficers(connection: CompanyConnection, event: Event): void {
event.stopPropagation();
const companyKey = this.getCompanyKey(connection);
if (this.expandedOfficersCompanyKey === companyKey) {
this.expandedOfficersCompanyKey = null;
return;
}
this.expandedOfficersCompanyKey = companyKey;
}
onGraphClick(event: any): void {
if (event.dataType !== 'node') {
return;
}
if (event.data?.category === this.personCategoryIndex) {
return;
}
if (this.isCompanyNodeCategory(event.data?.category)) {
this.selectedCompanyKey = event.data.id;
this.expandedOfficersCompanyKey = null;
this.scrollSelectedCompanyIntoView();
return;
}
if (event.data?.category === this.registerPersonCategoryIndex) {
this.openPersonSearchInNewTab(event.data.searchName || event.data.name);
}
}
onGraphWheel(event: WheelEvent): void {
event.preventDefault();
}
private isCompanyNodeCategory(category: unknown): boolean {
return (
category === this.activeCompanyCategoryIndex ||
category === this.removedCompanyCategoryIndex
);
}
toggleRelatedPersons(tooltip?: MatTooltip): void {
this.showRelatedPersons = !this.showRelatedPersons;
this.refreshGraph();
tooltip?.hide(0);
window.setTimeout(() => {
tooltip?.show(0);
});
}
private loadCompanyConnections(authorId: string): void {
this.loading = true;
this.error = false;
this.data = null;
this.graphOptions = null;
this.roleLegendItems = [];
this.selectedCompanyKey = null;
this.expandedOfficersCompanyKey = null;
this.showRelatedPersons = false;
this.companyConnectionsApi
.getCompanyConnectionsByAuthor(authorId)
.subscribe({
next: (response) => {
this.data = response;
this.graphOptions = this.createGraphOptions(response);
this.loading = false;
},
error: (error) => {
console.error('Failed to load company connections:', error);
this.error = true;
this.loading = false;
},
});
}
private refreshGraph(): void {
if (!this.data) {
this.graphOptions = null;
this.roleLegendItems = [];
return;
}
this.graphOptions = this.createGraphOptions(this.data);
}
private createGraphOptions(
response: CompanyConnectionsResponse,
): EChartsOption | null {
const connections = response.connections ?? [];
if (!response.is_ude_author || connections.length === 0) {
return null;
}
const graphConnections = connections.slice(0, this.graphCompanyLimit);
this.roleLegendItems = this.createRoleLegendItems(graphConnections);
const personNodeId = `author-${response.author_id}`;
const nodes: any[] = [
{
id: personNodeId,
name: response.display_name || 'Person',
category: this.personCategoryIndex,
symbol: this.personIconSymbol,
symbolSize: 42,
symbolKeepAspect: true,
itemStyle: {
color: this.authorColor,
},
label: {
show: true,
position: 'bottom',
fontWeight: 700,
color: '#07163d',
},
},
];
const links: any[] = [];
for (const connection of graphConnections) {
const companyKey = this.getCompanyKey(connection);
const isRemoved = connection.company_status === 'removed';
nodes.push({
id: companyKey,
name: connection.company_name || 'Unbekanntes Unternehmen',
category: isRemoved
? this.removedCompanyCategoryIndex
: this.activeCompanyCategoryIndex,
symbol: isRemoved
? this.removedCompanyIconSymbol
: this.activeCompanyIconSymbol,
symbolSize: 44,
symbolKeepAspect: true,
itemStyle: {
color: isRemoved ? this.companyRemovedColor : this.companyActiveColor,
},
label: {
show: true,
position: 'bottom',
color: '#07163d',
width: 125,
overflow: 'truncate',
},
});
const officer = this.getPrimaryOfficer(connection);
const role = officer?.position || 'Unbekannte Rolle';
const color = this.getRoleColor(officer?.position);
links.push({
source: personNodeId,
target: companyKey,
value: role,
lineStyle: {
color,
width: 2.4,
opacity: 1,
},
});
if (this.showRelatedPersons) {
const relatedOfficers = this.getRelatedOfficers(connection);
relatedOfficers.forEach((relatedOfficer, index) => {
const relatedOfficerId = `officer-${companyKey}-${index}`;
const relatedRole = relatedOfficer.position || 'Unbekannte Rolle';
nodes.push({
id: relatedOfficerId,
name: relatedOfficer.name || 'Registerperson',
searchName: relatedOfficer.name,
role: relatedRole,
category: this.registerPersonCategoryIndex,
symbol: this.registerPersonIconSymbol,
symbolSize: 30,
symbolKeepAspect: true,
itemStyle: {
color: this.relatedPersonColor,
},
label: {
show: true,
position: 'bottom',
color: '#07163d',
width: 110,
overflow: 'truncate',
fontSize: 11,
},
});
links.push({
source: companyKey,
target: relatedOfficerId,
value: relatedRole,
lineStyle: {
color: this.getRoleColor(relatedOfficer.position),
width: 1.8,
opacity: 1,
},
});
});
}
}
const graphSeries: any = {
type: 'graph',
layout: 'force',
roam: true,
roamTrigger: 'global',
animation: false,
top: 34,
left: 20,
right: 20,
bottom: 64,
data: nodes,
links,
categories: this.createGraphCategories(),
force: {
repulsion: this.showRelatedPersons ? 760 : 620,
edgeLength: this.showRelatedPersons ? 145 : 170,
gravity: 0.08,
},
lineStyle: {
curveness: 0.05,
opacity: 1,
},
edgeSymbol: ['none', 'none'],
emphasis: {
focus: 'adjacency',
lineStyle: {
width: 3.5,
},
},
};
return {
legend: {
data: this.createNodeLegendData(graphConnections),
bottom: 8,
left: 'center',
orient: 'horizontal',
itemGap: 18,
itemWidth: 20,
itemHeight: 20,
selectedMode: false,
textStyle: {
color: '#3f4659',
fontSize: 13,
fontWeight: 500,
},
},
tooltip: {
trigger: 'item',
formatter: (params: any) => {
if (params.dataType === 'node') {
if (params.data?.category === this.registerPersonCategoryIndex) {
return params.data?.role
? `${params.data.name}<br/>Rolle: ${params.data.role}`
: params.data?.name;
}
return params.data?.name ?? '';
}
if (params.dataType === 'edge') {
return params.data?.value
? `Rolle: ${params.data.value}`
: 'Verbindung';
}
return '';
},
},
series: [graphSeries],
} as EChartsOption;
}
private createGraphCategories(): any[] {
return [
{
name: this.personCategoryName,
symbol: this.personIconSymbol,
},
{
name: this.activeCompanyCategoryName,
symbol: this.activeCompanyIconSymbol,
},
{
name: this.removedCompanyCategoryName,
symbol: this.removedCompanyIconSymbol,
},
{
name: this.registerPersonCategoryName,
symbol: this.registerPersonIconSymbol,
},
];
}
private createNodeLegendData(connections: CompanyConnection[]): any[] {
const hasActiveCompany = connections.some(
(connection) => connection.company_status !== 'removed',
);
const hasRemovedCompany = connections.some(
(connection) => connection.company_status === 'removed',
);
const legendData = [
{
name: this.personCategoryName,
icon: this.personIconSymbol,
},
];
if (hasActiveCompany) {
legendData.push({
name: this.activeCompanyCategoryName,
icon: this.activeCompanyIconSymbol,
});
}
if (hasRemovedCompany) {
legendData.push({
name: this.removedCompanyCategoryName,
icon: this.removedCompanyIconSymbol,
});
}
if (this.showRelatedPersons) {
legendData.push({
name: this.registerPersonCategoryName,
icon: this.registerPersonIconSymbol,
});
}
return legendData;
}
private createRoleLegendItems(
connections: CompanyConnection[],
): RoleLegendItem[] {
const usedRoles = new Set<string>();
for (const connection of connections) {
const role = this.getPrimaryOfficer(connection)?.position;
if (role) {
usedRoles.add(role);
}
if (this.showRelatedPersons) {
for (const officer of this.getRelatedOfficers(connection)) {
if (officer.position) {
usedRoles.add(officer.position);
}
}
}
}
return [...usedRoles]
.sort((a, b) => a.localeCompare(b))
.map((role) => ({
role,
color: this.getRoleColor(role),
}));
}
openPersonSearchInNewTab(name?: string | null): void {
const url = this.createPersonSearchUrl(name);
if (!url) {
return;
}
window.open(url, '_blank', 'noopener,noreferrer');
}
private createPersonSearchUrl(name?: string | null): string | null {
const query = name?.trim();
if (!query) {
return null;
}
const urlTree = this.router.createUrlTree(['/persons'], {
queryParams: this.getPersonSearchQueryParams(query),
});
const internalUrl = this.router.serializeUrl(urlTree);
return this.locationStrategy.prepareExternalUrl(internalUrl);
}
getPersonSearchQueryParams(name?: string | null): {
query: string;
page: number;
} {
return {
query: name?.trim() ?? '',
page: 1,
};
}
private scrollSelectedCompanyIntoView(): void {
window.setTimeout(() => {
if (!this.selectedCompanyKey) {
return;
}
const selectedRow = this.connectionRows.find((row) => {
return (
row.nativeElement.dataset['companyKey'] === this.selectedCompanyKey
);
});
selectedRow?.nativeElement.scrollIntoView({
block: 'nearest',
behavior: 'smooth',
});
});
}
private createAccountCircleSymbol(color: string): string {
const backgroundPath =
'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2z';
const foregroundPath =
'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z';
const svg = `
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="${backgroundPath}" fill="#fff"/>
<path d="${foregroundPath}" fill="${color}"/>
</svg>
`;
return this.toSvgImageSymbol(svg);
}
private createApartmentSymbol(color: string): string {
const backgroundPath = 'M17 11V3H7v4H3v14h18V11h-4z';
const foregroundPath =
'M17 11V3H7v4H3v14h18V11h-4zM7 19H5v-2h2v2zm0-4H5v-2h2v2zm0-4H5V9h2v2zm4 8H9v-2h2v2zm0-4H9v-2h2v2zm0-4H9V9h2v2zm0-4H9V5h2v2zm4 12h-2v-2h2v2zm0-4h-2v-2h2v2zm0-4h-2V9h2v2zm0-4h-2V5h2v2zm4 12h-2v-2h2v2zm0-4h-2v-2h2v2z';
const svg = `
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="${backgroundPath}" fill="#fff"/>
<path d="${foregroundPath}" fill="${color}"/>
</svg>
`;
return this.toSvgImageSymbol(svg);
}
private toSvgImageSymbol(svg: string): string {
return `image://data:image/svg+xml;utf8,${encodeURIComponent(svg.trim())}`;
}
}
@@ -313,32 +313,28 @@
type="button"
[class.active]="activeFilter === 'all'"
[attr.aria-pressed]="activeFilter === 'all'"
(click)="setFilter('all')"
>
(click)="setFilter('all')">
Alle
</button>
<button
type="button"
[class.active]="activeFilter === 'first'"
[attr.aria-pressed]="activeFilter === 'first'"
(click)="setFilter('first')"
>
(click)="setFilter('first')">
Erstautor
</button>
<button
type="button"
[class.active]="activeFilter === 'middle'"
[attr.aria-pressed]="activeFilter === 'middle'"
(click)="setFilter('middle')"
>
(click)="setFilter('middle')">
Mitautor
</button>
<button
type="button"
[class.active]="activeFilter === 'last'"
[attr.aria-pressed]="activeFilter === 'last'"
(click)="setFilter('last')"
>
(click)="setFilter('last')">
Letztautor
</button>
</div>
@@ -468,14 +464,14 @@
} @else {
<div class="funding-detail empty">
<div class="empty-overview">
@if (activeFilter !== "all") {
@if (activeFilter !== 'all') {
<span class="empty-overview__filter">
Filter: {{ getPositionLabel(activeFilter) }}
</span>
}
<h3 class="empty-overview__title">Förderübersicht</h3>
<p class="empty-overview__subtitle">
@if (activeFilter === "all") {
@if (activeFilter === 'all') {
Alle geförderten Publikationen dieser Person im Überblick.
} @else {
Nur Publikationen mit der gewählten Autorenposition.
@@ -40,25 +40,41 @@
button:nth-child(2) {
color: #3b82c4;
border-color: #c7dcfa;
&.active { color: #0b4f9e; background: #e8f2ff; border-color: #3b82c4; }
&.active {
color: #0b4f9e;
background: #e8f2ff;
border-color: #3b82c4;
}
}
button:nth-child(3) {
color: #3d9a66;
border-color: #b8e6cb;
&.active { color: #1a6b3f; background: #e8f7ee; border-color: #3d9a66; }
&.active {
color: #1a6b3f;
background: #e8f7ee;
border-color: #3d9a66;
}
}
button:nth-child(4) {
color: #7c65d9;
border-color: #d5c8f8;
&.active { color: #5b3fc9; background: #f0ebff; border-color: #7c65d9; }
&.active {
color: #5b3fc9;
background: #f0ebff;
border-color: #7c65d9;
}
}
button:nth-child(5) {
color: #d1435f;
border-color: #f8c4ce;
&.active { color: #a61e3a; background: #ffe8ec; border-color: #d1435f; }
&.active {
color: #a61e3a;
background: #ffe8ec;
border-color: #d1435f;
}
}
}
@@ -73,7 +89,9 @@
color: #333;
font-size: 14px;
span { color: #555; }
span {
color: #555;
}
select {
border: 0;
@@ -103,7 +121,9 @@
flex-wrap: wrap;
}
.sort-control { margin-left: auto; }
.sort-control {
margin-left: auto;
}
table {
width: 100%;
@@ -119,7 +139,9 @@
tr {
cursor: pointer;
&.selected { background: #f0f0f0; }
&.selected {
background: #f0f0f0;
}
}
td {
@@ -148,7 +170,11 @@
min-height: 280px;
padding: 24px;
background:
radial-gradient(circle at 100% 0%, rgba(200, 217, 255, 0.35), transparent 45%),
radial-gradient(
circle at 100% 0%,
rgba(200, 217, 255, 0.35),
transparent 45%
),
linear-gradient(160deg, #fff 0%, #f8faff 100%);
border-color: #dbe3f2;
}
@@ -203,7 +229,9 @@
background: #effaf3;
}
.stat-first { border-color: #bdebcf; }
.stat-first {
border-color: #bdebcf;
}
.position-badge--first {
color: #24834f;
@@ -363,7 +391,9 @@
}
}
.funding-publication-page { padding: 16px; }
.funding-publication-page {
padding: 16px;
}
.publication-detail-back,
.publication-more-info {
@@ -374,7 +404,9 @@
cursor: pointer;
}
.publication-detail-back { gap: 6px; }
.publication-detail-back {
gap: 6px;
}
.publication-more-info {
gap: 4px;
@@ -463,7 +495,9 @@
font-size: 0.875rem;
text-decoration: none;
.material-icons { font-size: 18px; }
.material-icons {
font-size: 18px;
}
}
}
@@ -622,7 +656,9 @@ $g: '.publication-detail-grid';
font-size: 0.875rem;
text-decoration: none;
.material-icons { font-size: 16px; }
.material-icons {
font-size: 16px;
}
}
#{$g} .warning-badge {
@@ -647,7 +683,9 @@ $g: '.publication-detail-grid';
}
.mehr-infos-label,
.publication-link-icon { color: #1976d2; }
.publication-link-icon {
color: #1976d2;
}
.mehr-infos-label {
font-size: 0.8rem;
@@ -658,7 +696,9 @@ $g: '.publication-detail-grid';
display: flex;
align-items: center;
.material-icons { font-size: 16px; }
.material-icons {
font-size: 16px;
}
}
@media (max-width: 720px) {
@@ -666,10 +706,14 @@ $g: '.publication-detail-grid';
flex-direction: column;
align-items: stretch;
&__action { justify-content: center; }
&__action {
justify-content: center;
}
}
}
@media (max-width: 960px) {
#{$g} { grid-template-columns: 1fr; }
#{$g} {
grid-template-columns: 1fr;
}
}
@@ -59,7 +59,7 @@
</div>
<div
*ngIf="timelineViewMode !== 'wordcloud' && hasYearRange"
*ngIf="hasYearRange"
class="year-filter"
aria-label="Zeitraum eingrenzen">
<div class="year-filter-top">
@@ -110,13 +110,6 @@
<span>{{ maxYear }}</span>
</div>
</div>
<div
*ngIf="timelineViewMode === 'wordcloud'"
class="year-filter"
aria-label="Anzahl angezeigter Themen">
<ng-content select="[timeline-wordcloud-controls]"></ng-content>
</div>
</div>
<ng-container *ngIf="timelineViewMode === 'wordcloud'; else timelineViews">
@@ -38,7 +38,7 @@
.timeline-header {
display: grid;
grid-template-columns: minmax(260px, 1fr) auto minmax(260px, 1fr);
grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
align-items: flex-start;
gap: 24px;
margin-bottom: 28px;
@@ -103,6 +103,7 @@
border: 1px solid #dbe5f6;
border-radius: 10px;
background: #fbfdff;
box-sizing: border-box;
}
.year-filter-top,
@@ -14,26 +14,6 @@
(topicSelect)="onTimelineTopicSelect($event)"
(yearSelect)="onTimelineYearSelect($event)"
(loadEarlierYears)="onTimelineLoadEarlierYears()">
<div timeline-wordcloud-controls class="word-cloud-slider-wrapper">
@if (loadingWordCloud) {
<span class="slider-label">Themen laden ...</span>
} @else if (wordCloudOptions && sliderMax > 5) {
<span class="slider-label">{{ topN }} Themen</span>
<div class="word-cloud-slider" [style.--range-value]="sliderPercent">
<div class="range-track"></div>
<input
type="range"
[min]="5"
[max]="sliderMax"
[value]="topN"
(input)="onTopNChange($event)"
aria-label="Anzahl der angezeigten Themen" />
</div>
} @else {
<span class="slider-label">Themen</span>
}
</div>
<div timeline-wordcloud-content class="word-cloud-view">
@if (loadingWordCloud) {
<div class="word-cloud-state">Forschungsthemen werden geladen ...</div>
@@ -5,91 +5,6 @@
box-sizing: border-box;
}
.word-cloud-slider-wrapper {
display: flex;
align-items: center;
justify-content: center;
gap: 0.75rem;
min-height: 86px;
}
.slider-label {
font-size: 13px;
color: var(--sg-text-muted);
white-space: nowrap;
min-width: 4.5rem;
text-align: right;
}
.word-cloud-slider {
--accent: #0057ff;
--range-value: 50%;
position: relative;
width: 160px;
height: 22px;
.range-track {
position: absolute;
top: 50%;
left: 0;
right: 0;
height: 5px;
transform: translateY(-50%);
border-radius: 999px;
background: linear-gradient(
to right,
var(--accent) 0%,
var(--accent) var(--range-value),
#d8e2f4 var(--range-value),
#d8e2f4 100%
);
}
input[type='range'] {
position: absolute;
inset: 0;
width: 100%;
height: 22px;
margin: 0;
appearance: none;
background: transparent;
&::-webkit-slider-runnable-track,
&::-moz-range-track {
height: 5px;
background: transparent;
border: none;
}
&::-webkit-slider-thumb {
appearance: none;
width: 15px;
height: 15px;
margin-top: -5px;
border: 2px solid #ffffff;
border-radius: 50%;
background: var(--accent);
box-shadow:
0 0 0 1px #9ab7ff,
0 2px 6px rgba(0, 87, 255, 0.22);
cursor: pointer;
}
&::-moz-range-thumb {
width: 15px;
height: 15px;
border: 2px solid #ffffff;
border-radius: 50%;
background: var(--accent);
box-shadow:
0 0 0 1px #9ab7ff,
0 2px 6px rgba(0, 87, 255, 0.22);
cursor: pointer;
}
}
}
.word-cloud-view {
min-height: 420px;
}
@@ -54,32 +54,10 @@ export class PersonOverviewComponent implements OnInit {
loadingWordCloud = false;
wordCloudEmpty = false;
topN = 30;
sliderMax = 50;
get sliderPercent(): string {
if (this.sliderMax <= 5) return '100%';
return `${(((this.topN - 5) / (this.sliderMax - 5)) * 100).toFixed(1)}%`;
}
onTopNChange(event: Event): void {
this.topN = Number((event.target as HTMLInputElement).value);
this.rebuildWordCloud();
}
private allTopicData: Array<{
private rawTopicOccurrences: Array<{
name: string;
value: number;
topicId: string | undefined;
textStyle: { color: string; fontSize: number };
emphasis: {
textStyle: {
fontSize: number;
color: string;
shadowBlur: number;
shadowColor: string;
};
};
topicId: string;
year: number | undefined;
}> = [];
ngOnInit(): void {
@@ -123,6 +101,7 @@ export class PersonOverviewComponent implements OnInit {
onTimelineYearRangeChange(range: TimelineYearRange): void {
this.timelineStartYear = range.startYear;
this.timelineEndYear = range.endYear;
this.rebuildWordCloud();
this.updateTimelineQueryParams(
{
@@ -308,30 +287,20 @@ export class PersonOverviewComponent implements OnInit {
this.timelineEarlierYearsLoadFailed = false;
}
private readonly blueShades = [
'#0057ff',
'#1a6fff',
'#2952d9',
'#3d7cff',
'#1240cc',
'#5a90ff',
'#0044cc',
'#4d85ff',
'#0b4fe0',
'#2563eb',
private readonly timelineColors = [
'#7255d9',
'#2678e8',
'#39a96b',
'#f59e0b',
'#e0527c',
];
private topicColor(name: string): string {
const hash = name.split('').reduce((acc, c) => acc + c.charCodeAt(0), 0);
return this.blueShades[hash % this.blueShades.length];
}
private loadWordCloud(authorId: string): void {
if (!authorId || authorId === '0') {
this.wordCloudOptions = null;
this.wordCloudEmpty = false;
this.loadingWordCloud = false;
this.allTopicData = [];
this.rawTopicOccurrences = [];
return;
}
@@ -344,64 +313,28 @@ export class PersonOverviewComponent implements OnInit {
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe({
next: (page) => {
const counts = new Map<string, number>();
const nameToId = new Map<string, string>();
this.rawTopicOccurrences = [];
page.elements?.forEach((work) => {
const year = work.publication_year ?? undefined;
work.topics?.forEach((topic) => {
if (topic.display_name && topic.id) {
counts.set(
topic.display_name,
(counts.get(topic.display_name) ?? 0) + 1,
);
if (!nameToId.has(topic.display_name)) {
nameToId.set(topic.display_name, topic.id);
}
this.rawTopicOccurrences.push({
name: topic.display_name,
topicId: topic.id,
year,
});
}
});
});
const allValues = Array.from(counts.values());
const minVal = Math.min(...allValues);
const maxVal = Math.max(...allValues);
const computeSize = (v: number): number =>
maxVal === minVal
? 22
: Math.round(12 + ((v - minVal) / (maxVal - minVal)) * (32 - 12));
this.allTopicData = Array.from(counts.entries())
.sort((a, b) => b[1] - a[1])
.map(([name, value]) => {
const fontSize = computeSize(value);
return {
name,
value,
topicId: nameToId.get(name),
textStyle: { color: this.topicColor(name), fontSize },
emphasis: {
textStyle: {
fontSize: Math.round(fontSize * 1.1),
color: '#101a3d',
shadowBlur: 16,
shadowColor: 'rgba(0, 87, 255, 0.35)',
},
},
};
});
this.loadingWordCloud = false;
if (this.allTopicData.length === 0) {
if (this.rawTopicOccurrences.length === 0) {
this.wordCloudEmpty = true;
return;
}
this.sliderMax = Math.min(50, this.allTopicData.length);
this.topN = Math.min(30, this.sliderMax);
setTimeout(() => {
this.rebuildWordCloud();
});
setTimeout(() => this.rebuildWordCloud());
},
error: (error) => {
console.error('Word cloud could not be loaded.', error);
@@ -412,8 +345,57 @@ export class PersonOverviewComponent implements OnInit {
}
private rebuildWordCloud(): void {
const data = this.allTopicData.slice(0, this.topN);
if (data.length === 0) return;
const start = this.timelineStartYear;
const end = this.timelineEndYear;
const counts = new Map<string, number>();
const nameToId = new Map<string, string>();
for (const occ of this.rawTopicOccurrences) {
if (start !== undefined && (occ.year === undefined || occ.year < start))
continue;
if (end !== undefined && (occ.year === undefined || occ.year > end))
continue;
counts.set(occ.name, (counts.get(occ.name) ?? 0) + 1);
if (!nameToId.has(occ.name)) nameToId.set(occ.name, occ.topicId);
}
if (counts.size === 0) {
this.wordCloudOptions = null;
this.wordCloudEmpty = true;
return;
}
this.wordCloudEmpty = false;
const allValues = Array.from(counts.values());
const minVal = Math.min(...allValues);
const maxVal = Math.max(...allValues);
const computeSize = (v: number): number =>
maxVal === minVal
? 22
: Math.round(12 + ((v - minVal) / (maxVal - minVal)) * (32 - 12));
const sorted = Array.from(counts.entries()).sort((a, b) => b[1] - a[1]);
const data = sorted.slice(0, 30).map(([name, value], i) => {
const fontSize = computeSize(value);
const color = this.timelineColors[i % this.timelineColors.length];
return {
name,
value,
topicId: nameToId.get(name),
textStyle: { color, fontSize },
emphasis: {
textStyle: {
fontSize: Math.round(fontSize * 1.1),
color,
shadowBlur: 16,
shadowColor: 'rgba(0, 87, 255, 0.35)',
},
},
};
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
this.wordCloudOptions = {
series: [
@@ -184,7 +184,7 @@ export class PersonComponent {
},
{ label: 'Publikationen', path: 'publications', disabled: false },
{ label: 'Netzwerk', path: 'network', disabled: false },
{ label: 'Gründungen', path: 'foundings', disabled: true },
{ label: 'Unternehmen', path: 'company-connections', disabled: false },
{ label: 'Förderungen', path: 'funding', disabled: false },
];
@@ -1,8 +1,12 @@
import { Injectable,inject } from '@angular/core';
import { Injectable, inject } from '@angular/core';
import { filter, take, map } from 'rxjs/operators'; //TODO: review by arman
import { Observable, of } from 'rxjs'; // review
import { BehaviorSubject } from 'rxjs'; //review
import { INSEAccountServiceService, IdentityGrant as ApiIdentityGrant, AccessGrant as ApiAccessGrant } from '../../api';
import {
INSEAccountServiceService,
IdentityGrant as ApiIdentityGrant,
AccessGrant as ApiAccessGrant,
} from '../../api';
export interface AuthAccount {
i: number;
@@ -113,26 +117,25 @@ export class CredentialService {
body.set('username', login);
body.set('password', password);
this.accountService.getIdentityGrant(login,password)
.subscribe({
next: (result) => {
if (this.request != request) return;
const token: TimedIdentityGrant = {
grant: result as any as IdentityGrant,
expiration: result.expires_in * 1000 + now,
};
this.identityToken.next(token);
localStorage.setItem(
CredentialService.KEY_GRANT,
JSON.stringify(token),
);
this.refreshAccessToken(token);
},
error: () => {
if (this.request != request) return;
this.validating.next(false);
},
});
this.accountService.getIdentityGrant(login, password).subscribe({
next: (result) => {
if (this.request != request) return;
const token: TimedIdentityGrant = {
grant: result as any as IdentityGrant,
expiration: result.expires_in * 1000 + now,
};
this.identityToken.next(token);
localStorage.setItem(
CredentialService.KEY_GRANT,
JSON.stringify(token),
);
this.refreshAccessToken(token);
},
error: () => {
if (this.request != request) return;
this.validating.next(false);
},
});
}
public refreshAccessToken(identityToken: TimedIdentityGrant) {
@@ -143,7 +146,8 @@ export class CredentialService {
const uid = identityToken.grant.scope.a!.i;
const org = identityToken.grant.scope.a!.o;
this.accountService.getAccessGrant(identityToken.grant.access_token, uid, org)
this.accountService
.getAccessGrant(identityToken.grant.access_token, uid, org)
.subscribe({
next: (result) => {
if (this.request != request) return;
@@ -178,11 +182,10 @@ export class CredentialService {
this.identityToken.next(undefined);
this.accessToken.next(undefined);
this.validating.next(false);
}
public registerAccount(data: any): Observable<any> {
return this.accountService.createUser(data)
return this.accountService.createUser(data);
}
//review: arman (generated fix)
@@ -1,6 +1,8 @@
<div class="app-shell">
<div class="container">
<mat-drawer-container class="drawer-container">
<mat-drawer-container
class="drawer-container"
[autosize]="!mediaQuery.matches">
@if (
(credentialService.authenticated | async) &&
((credentialService.superadmin | async) ||
@@ -8,10 +10,15 @@
) {
<mat-drawer
class="drawer"
[class.drawer--collapsed]="isSidebarCollapsed()"
#drawer
[mode]="mediaQuery.matches ? 'over' : 'side'"
[(opened)]="sideNavOpen">
<app-menu></app-menu>
<app-menu
[collapsed]="isSidebarCollapsed()"
[canCollapse]="!mediaQuery.matches"
(toggleCollapsed)="toggleSidebarCollapsed()">
</app-menu>
</mat-drawer>
}
<mat-drawer-content class="content-shell">
@@ -84,6 +84,10 @@ mat-toolbar.main {
box-shadow: none;
}
.drawer--collapsed {
width: 76px;
}
.content {
display: flex;
flex-direction: column;
@@ -45,7 +45,10 @@ export class AppLayoutComponent implements OnInit, OnDestroy {
protected resolverState = inject(ResolverStateService);
mediaQueryListener: () => void;
private readonly sidebarCollapsedStorageKey = 'inse.sidebar.collapsed';
sideNavOpen = false;
sideNavCollapsed = this.readSidebarCollapsedState();
constructor(
public credentialService: CredentialService,
public router: Router,
@@ -56,6 +59,11 @@ export class AppLayoutComponent implements OnInit, OnDestroy {
this.mediaQuery = media.matchMedia('(max-width: 600px)');
this.mediaQueryListener = () => {
this.sideNavOpen = !this.mediaQuery.matches;
if (this.mediaQuery.matches) {
this.sideNavCollapsed = false;
}
changeDetector.detectChanges();
};
}
@@ -66,6 +74,26 @@ export class AppLayoutComponent implements OnInit, OnDestroy {
}
}
private readSidebarCollapsedState(): boolean {
return localStorage.getItem(this.sidebarCollapsedStorageKey) === 'true';
}
isSidebarCollapsed(): boolean {
return this.sideNavCollapsed && !this.mediaQuery.matches;
}
toggleSidebarCollapsed(): void {
if (this.mediaQuery.matches) {
return;
}
this.sideNavCollapsed = !this.sideNavCollapsed;
localStorage.setItem(
this.sidebarCollapsedStorageKey,
String(this.sideNavCollapsed),
);
}
ngOnInit() {
this.sideNavOpen = !this.mediaQuery.matches;
this.mediaQuery.addEventListener('change', this.mediaQueryListener);
@@ -1,30 +1,71 @@
<aside class="sidebar">
<a class="brand" routerLink="/dashboard" aria-label="Smartguide Startseite">
<span class="brand-mark">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</span>
<span class="brand-text">
<strong>AIIS</strong>
<small>AI Innovation<br />Intelligence System</small>
</span>
</a>
<aside class="sidebar" [class.sidebar--collapsed]="collapsed()">
<div class="brand-row">
@if (!collapsed()) {
<a
class="brand"
routerLink="/dashboard"
aria-label="Smartguide Startseite">
<span class="brand-mark">
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</span>
<span class="brand-text">
<strong>AIIS</strong>
<small>AI Innovation<br />Intelligence System</small>
</span>
</a>
}
@if (canCollapse()) {
<button
mat-icon-button
class="sidebar-collapse-button"
type="button"
(click)="toggleCollapsed.emit()"
[attr.aria-label]="collapsed() ? 'Menü erweitern' : 'Menü einklappen'"
[matTooltip]="collapsed() ? 'Menü erweitern' : 'Menü einklappen'"
matTooltipPosition="right">
<mat-icon>
{{
collapsed()
? 'keyboard_double_arrow_right'
: 'keyboard_double_arrow_left'
}}
</mat-icon>
</button>
}
</div>
<mat-nav-list class="nav-list">
@for (item of navItems; track item.label) {
<a
mat-list-item
[routerLink]="item.disabled ? null : item.route"
[queryParams]="item.queryParams || null"
routerLinkActive="active"
[class.disabled]="item.disabled">
<mat-icon matListItemIcon>{{ item.icon }}</mat-icon>
<span matListItemTitle>{{ item.label }}</span>
</a>
@if (collapsed()) {
<a
mat-icon-button
class="nav-icon-button"
[routerLink]="item.disabled ? null : item.route"
[queryParams]="item.queryParams || null"
routerLinkActive="active"
[class.disabled]="item.disabled"
[matTooltip]="item.label"
matTooltipPosition="right"
[attr.aria-label]="item.label">
<mat-icon>{{ item.icon }}</mat-icon>
</a>
} @else {
<a
mat-list-item
[routerLink]="item.disabled ? null : item.route"
[queryParams]="item.queryParams || null"
routerLinkActive="active"
[class.disabled]="item.disabled">
<mat-icon matListItemIcon>{{ item.icon }}</mat-icon>
<span matListItemTitle>{{ item.label }}</span>
</a>
}
}
</mat-nav-list>
@@ -36,25 +77,52 @@
}
</div>
<div class="account-card">
<div class="avatar">{{ (credentialService.login | async)?.charAt(0) }}</div>
<div>
<strong>{{
(credentialService.login | async) || 'Max Mustermann'
}}</strong>
<strong>{{ credentialService.organizationName | async }}</strong>
<span>Startup Coach</span>
@if (collapsed()) {
<div
class="account-icon"
[matTooltip]="
((credentialService.login | async) || 'user') +
' · ' +
((credentialService.organizationName | async) || '')
"
matTooltipPosition="right">
<div class="avatar">
{{ (credentialService.login | async)?.charAt(0) }}
</div>
</div>
<mat-icon>expand_more</mat-icon>
</div>
} @else {
<div class="account-card">
<div class="avatar">
{{ (credentialService.login | async)?.charAt(0) }}
</div>
<div>
<strong>{{
(credentialService.login | async) || 'Max Mustermann'
}}</strong>
<strong>{{ credentialService.organizationName | async }}</strong>
<span>Startup Coach</span>
</div>
<mat-icon>expand_more</mat-icon>
</div>
}
<div class="sidebar-actions">
<button
class="utility-link"
type="button"
(click)="onLogout()">
<mat-icon>logout</mat-icon>
<span>Abmelden</span>
</button>
@if (collapsed()) {
<button
mat-icon-button
class="utility-icon-button"
type="button"
(click)="onLogout()"
matTooltip="Abmelden"
matTooltipPosition="right"
aria-label="Abmelden">
<mat-icon>logout</mat-icon>
</button>
} @else {
<button class="utility-link" type="button" (click)="onLogout()">
<mat-icon>logout</mat-icon>
<span>Abmelden</span>
</button>
}
</div>
</aside>
@@ -9,6 +9,27 @@
color: var(--sg-text);
}
.sidebar--collapsed {
align-items: center;
padding: 18px 10px 20px;
}
.brand-row {
display: flex;
align-items: center;
justify-content: space-between;
min-height: 58px;
}
.sidebar--collapsed .brand-row {
justify-content: center;
width: 100%;
}
.sidebar-collapse-button {
color: var(--sg-text-muted);
}
.brand {
display: flex;
align-items: center;
@@ -98,6 +119,13 @@
padding: 0;
}
.sidebar--collapsed .nav-list {
display: grid;
justify-items: center;
width: 100%;
margin-top: 28px;
}
.nav-list a {
height: 46px;
border-radius: var(--sg-radius-sm);
@@ -124,6 +152,23 @@
color: var(--sg-primary);
}
.nav-icon-button {
width: 48px;
height: 48px;
border-radius: var(--sg-radius-sm);
color: var(--sg-text-soft);
}
.nav-icon-button.active {
background: var(--sg-primary-soft);
color: var(--sg-primary);
}
.nav-icon-button.disabled {
opacity: 0.72;
pointer-events: none;
}
.sidebar-spacer {
flex: 1;
min-height: 28px;
@@ -141,7 +186,15 @@
background: var(--sg-surface);
}
.account-card .avatar {
.account-icon {
display: grid;
place-items: center;
width: 48px;
height: 48px;
}
.account-card .avatar,
.account-icon .avatar {
display: grid;
place-items: center;
width: 40px;
@@ -178,6 +231,12 @@
margin-top: 26px;
}
.sidebar--collapsed .sidebar-actions {
display: grid;
justify-items: center;
width: 100%;
}
.utility-link {
display: flex;
align-items: center;
@@ -199,6 +258,13 @@
background: var(--sg-surface-muted);
}
.utility-icon-button {
width: 48px;
height: 48px;
border-radius: var(--sg-radius-sm);
color: var(--sg-text-soft);
}
.loading-indicator {
margin-bottom: 16px;
}
@@ -1,8 +1,10 @@
import { Component, computed ,inject} from '@angular/core';
import { Component, computed, inject, input, output } from '@angular/core';
import { CommonModule } from '@angular/common';
import { Router, RouterLink, RouterLinkActive } from '@angular/router';
import { MatIconModule } from '@angular/material/icon';
import { MatListModule } from '@angular/material/list';
import { MatButtonModule } from '@angular/material/button';
import { MatTooltipModule } from '@angular/material/tooltip';
import { CredentialService } from '../../services/credential.service';
import { MatProgressBarModule } from '@angular/material/progress-bar';
import { MatDialog } from '@angular/material/dialog';
@@ -17,12 +19,17 @@ import { ConfirmationDialogComponent } from '../confirmation-dialog/confirmation
MatListModule,
RouterLinkActive,
MatProgressBarModule,
MatButtonModule,
MatTooltipModule,
],
templateUrl: './app-menu.component.html',
styleUrl: './app-menu.component.scss',
standalone: true,
})
export class AppMenuComponent {
collapsed = input(false);
canCollapse = input(false);
toggleCollapsed = output<void>();
navItems = [
{
label: 'Dashboard',
@@ -34,7 +41,9 @@ export class AppMenuComponent {
label: 'Personen',
icon: 'groups',
route: '/persons',
queryParams: { institutionName: this.credentialService.organizationName.value },
queryParams: {
institutionName: this.credentialService.organizationName.value,
},
disabled: false,
},
{
@@ -1,4 +1,10 @@
import { Component, EventEmitter, inject, Inject, Optional } from '@angular/core';
import {
Component,
EventEmitter,
inject,
Inject,
Optional,
} from '@angular/core';
import {
MatDialogRef,
MatDialogActions,
@@ -29,18 +35,18 @@ export interface ConfirmationData {
standalone: true,
})
export class ConfirmationDialogComponent {
confirmDelete = new EventEmitter<void>();
confirmDelete = new EventEmitter<void>();
constructor(
public dialogRef: MatDialogRef<ConfirmationDialogComponent>,
@Optional() @Inject(MAT_DIALOG_DATA) public data: ConfirmationData
@Optional() @Inject(MAT_DIALOG_DATA) public data: ConfirmationData,
) {
this.data = data || {
title: 'Daten löschen',
message: 'Bist Du sicher, dass Du die Daten löschen möchtest? Diesen Vorgang kannst Du nicht mehr rückgängig machen.',
message:
'Bist Du sicher, dass Du die Daten löschen möchtest? Diesen Vorgang kannst Du nicht mehr rückgängig machen.',
confirmText: 'Löschen',
cancelText: 'Abbrechen'
cancelText: 'Abbrechen',
};
}
+1
View File
@@ -3,6 +3,7 @@
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"rootDir": "./src",
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,