Feature/standardize layout #325
@@ -20,8 +20,8 @@ COPY service/src/data/hierarchies/I62318514/hierarchy.json \
|
||||
COPY service/scripts/upload_orgminer_verified_persons_ude/ \
|
||||
./service/scripts/upload_orgminer_verified_persons_ude/
|
||||
|
||||
# Fail the image build if the service verification code is missing a dependency.
|
||||
RUN python -c "import inse.orgminer.logic"
|
||||
# Fail the image build if the service verification/author code is missing a dependency.
|
||||
RUN python -c "import inse.orgminer.logic, inse.authors.v2.service"
|
||||
|
||||
ENTRYPOINT ["python", "/app/service/scripts/upload_orgminer_verified_persons_ude/upload_orgminer_verified_persons_ude.py", \
|
||||
"--progress-file", "/state/orgminer_verified_persons_ude_progress.json"]
|
||||
|
||||
@@ -26,6 +26,28 @@ completed organization URI. On restart the scan resumes from that URI, skips
|
||||
completed organizations, and safely retries upserts if an interrupted request did
|
||||
not get checkpointed. Use `--progress-file PATH` to keep the checkpoint elsewhere.
|
||||
|
||||
Each document also exposes the organization context explicitly:
|
||||
|
||||
- `faculty`: root hierarchy node, for example `Chemie`
|
||||
- `organization_type`: immediate parent label, for example `Lehrstühle` or
|
||||
`Instituten`
|
||||
- `organization_level`: hierarchy node type code (`leaf`, `chairs`,
|
||||
`institutes`, `faculty`)
|
||||
|
||||
Each person document also carries the person's OpenAlex organizations, loaded
|
||||
from `openalex-authors`:
|
||||
|
||||
- `oa_organization_ids`: deduplicated short OpenAlex organization IDs
|
||||
(`I62318514`), used for filtering and joins
|
||||
- `oa_organization`: deduplicated OpenAlex organization objects with `id`,
|
||||
`openalex_url`, `display_name`, `ror`, `country_code`, `type`, `lineage`,
|
||||
`years`, and `last_known`
|
||||
|
||||
`last_known_institutions` and `affiliations` are merged by institution ID;
|
||||
affiliation years are unioned and institutions without an OpenAlex ID are
|
||||
skipped. Missing author documents do not drop the person; the document is written
|
||||
with empty institution fields and a warning is logged.
|
||||
|
||||
The script processes one organization at a time, so a run needs no concurrency
|
||||
flags.
|
||||
|
||||
@@ -54,3 +76,19 @@ When configured on a background-job task, `--fresh` applies on every run, so the
|
||||
task always restarts from the first source organization. If the checkpoint
|
||||
directory is not a mounted volume, a warning is logged because progress cannot
|
||||
survive the container.
|
||||
|
||||
## Rebuilding after a mapping change
|
||||
|
||||
The script creates the output index with its mapping only when the index does
|
||||
not exist. After changing the document fields, delete the old index first and
|
||||
then run a full upload:
|
||||
|
||||
```bash
|
||||
curl -X DELETE "$ELASTICSEARCH_INSE_URL/orgminer_verified_persons_ude" \
|
||||
-H "Authorization: ApiKey $ELASTICSEARCH_INSE_API_KEY"
|
||||
|
||||
python service/scripts/upload_orgminer_verified_persons_ude/upload_orgminer_verified_persons_ude.py --fresh
|
||||
```
|
||||
|
||||
`--fresh` also removes the checkpoint so every source organization is processed
|
||||
again.
|
||||
|
||||
+277
@@ -0,0 +1,277 @@
|
||||
"""Tests for the institution projection helpers in the upload script."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib.util
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from types import SimpleNamespace
|
||||
|
||||
from inse.models.openalex.author import Author
|
||||
from inse.models.openalex.author_affiliations_inner import AuthorAffiliationsInner
|
||||
from inse.models.openalex.dehydrated_institution import DehydratedInstitution
|
||||
|
||||
SCRIPT_PATH = Path(__file__).with_name("upload_orgminer_verified_persons_ude.py")
|
||||
_SPEC = importlib.util.spec_from_file_location(
|
||||
"upload_orgminer_verified_persons_ude", SCRIPT_PATH
|
||||
)
|
||||
assert _SPEC and _SPEC.loader
|
||||
upload = importlib.util.module_from_spec(_SPEC)
|
||||
sys.modules[_SPEC.name] = upload
|
||||
_SPEC.loader.exec_module(upload)
|
||||
|
||||
|
||||
def _institution(
|
||||
institution_id: str | None,
|
||||
display_name: str | None,
|
||||
*,
|
||||
ror: str | None = None,
|
||||
country_code: str | None = None,
|
||||
institution_type: str | None = None,
|
||||
lineage: list[str] | None = None,
|
||||
) -> DehydratedInstitution:
|
||||
return DehydratedInstitution(
|
||||
id=institution_id,
|
||||
display_name=display_name,
|
||||
ror=ror,
|
||||
country_code=country_code,
|
||||
type=institution_type,
|
||||
lineage=lineage,
|
||||
)
|
||||
|
||||
|
||||
def test_extract_merges_last_known_and_historical_institutions() -> None:
|
||||
ude_last_known = _institution(
|
||||
"https://openalex.org/I62318514",
|
||||
"University of Duisburg-Essen",
|
||||
country_code="DE",
|
||||
institution_type="education",
|
||||
lineage=["https://openalex.org/I1", "https://openalex.org/I62318514"],
|
||||
)
|
||||
ude_affiliation = _institution(
|
||||
"I62318514",
|
||||
"University of Duisburg-Essen",
|
||||
ror="https://ror.org/021ft7s37",
|
||||
)
|
||||
previous = _institution(
|
||||
"https://openalex.org/I999",
|
||||
"Previous University",
|
||||
country_code="NL",
|
||||
institution_type="education",
|
||||
)
|
||||
|
||||
author = Author(
|
||||
id="https://openalex.org/A1",
|
||||
last_known_institutions=[ude_last_known],
|
||||
affiliations=[
|
||||
AuthorAffiliationsInner(institution=ude_affiliation, years=[2020, 2021]),
|
||||
AuthorAffiliationsInner(institution=previous, years=[2017, 2018]),
|
||||
AuthorAffiliationsInner(institution=ude_affiliation, years=[2019]),
|
||||
],
|
||||
)
|
||||
|
||||
institutions = upload.extract_openalex_institutions(author)
|
||||
|
||||
assert [item["id"] for item in institutions] == ["I62318514", "I999"]
|
||||
assert institutions[0] == {
|
||||
"id": "I62318514",
|
||||
"openalex_url": "https://openalex.org/I62318514",
|
||||
"display_name": "University of Duisburg-Essen",
|
||||
"ror": "https://ror.org/021ft7s37",
|
||||
"country_code": "DE",
|
||||
"type": "education",
|
||||
"lineage": ["https://openalex.org/I1", "https://openalex.org/I62318514"],
|
||||
"years": [2019, 2020, 2021],
|
||||
"last_known": True,
|
||||
}
|
||||
assert institutions[1]["last_known"] is False
|
||||
assert institutions[1]["years"] == [2017, 2018]
|
||||
assert upload.openalex_institution_ids(institutions) == ["I62318514", "I999"]
|
||||
|
||||
|
||||
def test_extract_skips_institutions_without_an_openalex_id() -> None:
|
||||
author = Author(
|
||||
id="https://openalex.org/A1",
|
||||
last_known_institutions=[
|
||||
_institution(None, "Unknown Institute"),
|
||||
_institution("", "Empty Id Institute"),
|
||||
],
|
||||
affiliations=[
|
||||
AuthorAffiliationsInner(
|
||||
institution=_institution("I123", "Known Institute"),
|
||||
years=[2021],
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
institutions = upload.extract_openalex_institutions(author)
|
||||
|
||||
assert [item["id"] for item in institutions] == ["I123"]
|
||||
assert institutions[0]["last_known"] is False
|
||||
assert institutions[0]["years"] == [2021]
|
||||
|
||||
|
||||
def test_extract_handles_missing_author_and_empty_institutions() -> None:
|
||||
assert upload.extract_openalex_institutions(None) == []
|
||||
assert (
|
||||
upload.extract_openalex_institutions(Author(id="https://openalex.org/A1"))
|
||||
== []
|
||||
)
|
||||
assert upload.openalex_institution_ids([]) == []
|
||||
|
||||
|
||||
def _node(
|
||||
name: str,
|
||||
*,
|
||||
node_type: str,
|
||||
link: str | None = None,
|
||||
children: list[SimpleNamespace] | None = None,
|
||||
) -> SimpleNamespace:
|
||||
return SimpleNamespace(
|
||||
name_de=name,
|
||||
name_en=None,
|
||||
link_de=link,
|
||||
link_en=None,
|
||||
type=node_type,
|
||||
children=children or [],
|
||||
)
|
||||
|
||||
|
||||
def test_organization_details_splits_faculty_type_and_organization() -> None:
|
||||
hierarchy = [
|
||||
_node(
|
||||
"Chemie",
|
||||
node_type="faculty",
|
||||
link="https://example.org/chemie",
|
||||
children=[
|
||||
_node(
|
||||
"Lehrstühle",
|
||||
node_type="chairs",
|
||||
link="https://example.org/chemie/lehrstuehle",
|
||||
children=[
|
||||
_node(
|
||||
"Applied Analytical Chemistry",
|
||||
node_type="leaf",
|
||||
link="https://example.org/chemie/aac",
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
]
|
||||
lookup = upload.build_hierarchy_lookup(hierarchy)
|
||||
|
||||
details = upload.organization_details(
|
||||
{"uri": "https://example.org/chemie/aac"}, lookup
|
||||
)
|
||||
|
||||
assert details.faculty == "Chemie"
|
||||
assert details.organization_type == "Lehrstühle"
|
||||
assert details.name == "Applied Analytical Chemistry"
|
||||
assert details.organization_level == "leaf"
|
||||
assert details.hierarchy_path == [
|
||||
"Chemie",
|
||||
"Lehrstühle",
|
||||
"Applied Analytical Chemistry",
|
||||
]
|
||||
|
||||
|
||||
def test_organization_details_uses_immediate_parent_for_deep_paths() -> None:
|
||||
hierarchy = [
|
||||
_node(
|
||||
"Chemie",
|
||||
node_type="faculty",
|
||||
link="https://example.org/chemie",
|
||||
children=[
|
||||
_node(
|
||||
"Instituten",
|
||||
node_type="institutes",
|
||||
link="https://example.org/chemie/institute",
|
||||
children=[
|
||||
_node(
|
||||
"ACTIVE SITES",
|
||||
node_type="leaf",
|
||||
link="https://example.org/chemie/active-sites",
|
||||
children=[
|
||||
_node(
|
||||
"Lehrstühle",
|
||||
node_type="chairs",
|
||||
link="https://example.org/chemie/active-sites/chairs",
|
||||
children=[
|
||||
_node(
|
||||
"Applied Analytical Chemistry",
|
||||
node_type="leaf",
|
||||
link="https://example.org/chemie/active-sites/aac",
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
)
|
||||
]
|
||||
lookup = upload.build_hierarchy_lookup(hierarchy)
|
||||
|
||||
details = upload.organization_details(
|
||||
{"uri": "https://example.org/chemie/active-sites/aac"}, lookup
|
||||
)
|
||||
|
||||
assert details.faculty == "Chemie"
|
||||
assert details.organization_type == "Lehrstühle"
|
||||
assert details.name == "Applied Analytical Chemistry"
|
||||
|
||||
|
||||
def test_organization_details_describes_aggregator_nodes() -> None:
|
||||
hierarchy = [
|
||||
_node(
|
||||
"Chemie",
|
||||
node_type="faculty",
|
||||
link="https://example.org/chemie",
|
||||
children=[
|
||||
_node(
|
||||
"Lehrstühle",
|
||||
node_type="chairs",
|
||||
link="https://example.org/chemie/lehrstuehle",
|
||||
)
|
||||
],
|
||||
)
|
||||
]
|
||||
lookup = upload.build_hierarchy_lookup(hierarchy)
|
||||
|
||||
details = upload.organization_details(
|
||||
{"uri": "https://example.org/chemie/lehrstuehle"}, lookup
|
||||
)
|
||||
|
||||
assert details.faculty == "Chemie"
|
||||
assert details.organization_type == "Lehrstühle"
|
||||
assert details.name == "Lehrstühle"
|
||||
assert details.organization_level == "chairs"
|
||||
|
||||
|
||||
def test_extract_merges_lineage_and_metadata_from_multiple_sources() -> None:
|
||||
author = Author(
|
||||
id="https://openalex.org/A1",
|
||||
last_known_institutions=[
|
||||
_institution("I42", "Example University", lineage=["I1"])
|
||||
],
|
||||
affiliations=[
|
||||
AuthorAffiliationsInner(
|
||||
institution=_institution(
|
||||
"I42",
|
||||
"Example University",
|
||||
ror="https://ror.org/example",
|
||||
lineage=["I1", "I42"],
|
||||
),
|
||||
years=[2022],
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
institutions = upload.extract_openalex_institutions(author)
|
||||
|
||||
assert len(institutions) == 1
|
||||
assert institutions[0]["ror"] == "https://ror.org/example"
|
||||
assert institutions[0]["lineage"] == ["I1", "I42"]
|
||||
assert institutions[0]["years"] == [2022]
|
||||
+413
-20
@@ -6,9 +6,10 @@ For every organization in the UDE organization-content index (one at a time):
|
||||
|
||||
1. READ the organization and its staff list from Elasticsearch (INSE)
|
||||
2. VERIFY each staff member against the collaboration graph (OpenAlex)
|
||||
3. BUILD one document per (organization, OpenAlex person)
|
||||
4. UPLOAD the documents to ``orgminer_verified_persons_ude`` (bulk upsert)
|
||||
5. CHECKPOINT the organization as done in a small JSON progress file
|
||||
3. LOOK UP each verified person's OpenAlex institutions by author ID
|
||||
4. BUILD one document per (organization, OpenAlex person)
|
||||
5. UPLOAD the documents to ``orgminer_verified_persons_ude`` (bulk upsert)
|
||||
6. CHECKPOINT the organization as done in a small JSON progress file
|
||||
|
||||
Everything runs sequentially: one organization at a time, one graph query at a
|
||||
time.
|
||||
@@ -54,16 +55,34 @@ SERVICE_DIR = Path(__file__).resolve().parents[2]
|
||||
sys.path.insert(0, str(SERVICE_DIR / "src" / "main"))
|
||||
|
||||
from inse import config # noqa: E402
|
||||
from inse.authors.v2.service import get_author_by_id, search_authors # noqa: E402
|
||||
from inse.exceptions import NotFoundException # noqa: E402
|
||||
from inse.model import ESIndex # noqa: E402
|
||||
from inse.models.openalex.author import Author # noqa: E402
|
||||
from inse.orgminer import logic # noqa: E402
|
||||
from inse.orgminer.institutions_helper import ( # noqa: E402
|
||||
DEFAULT_INSTITUTION_ID,
|
||||
full_institution_url,
|
||||
normalize_org_uri,
|
||||
strip_openalex_prefix,
|
||||
)
|
||||
|
||||
T = TypeVar("T")
|
||||
Hit = dict[str, Any] # one Elasticsearch search hit
|
||||
HierarchyLookup = dict[str, tuple[str, list[str]]] # uri -> (name, path from root)
|
||||
# uri -> (display name, path from root, hierarchy node type)
|
||||
HierarchyLookup = dict[str, tuple[str, list[str], str | None]]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class OrganizationDetails:
|
||||
"""Explicit organization context for downstream predictions."""
|
||||
|
||||
name: str
|
||||
uri: str | None
|
||||
hierarchy_path: list[str]
|
||||
faculty: str | None
|
||||
organization_type: str | None
|
||||
organization_level: str | None
|
||||
|
||||
|
||||
# =============================================================================
|
||||
@@ -92,6 +111,17 @@ RETRYABLE_STATUS = {429, 502, 503, 504}
|
||||
# Collab-graph queries per organization. Kept at 1: fully sequential.
|
||||
GRAPH_QUERIES_AT_A_TIME = 1
|
||||
|
||||
# Author institution lookups. Batched by ID, with per-person fallbacks for
|
||||
# installations whose author documents use a different `_id` convention.
|
||||
AUTHOR_LOOKUP_BATCH_SIZE = 100
|
||||
AUTHOR_SOURCE_FIELDS = [
|
||||
"id",
|
||||
"display_name",
|
||||
"orcid",
|
||||
"last_known_institutions",
|
||||
"affiliations",
|
||||
]
|
||||
|
||||
PROGRESS_SAVE_INTERVAL_S = 5.0
|
||||
PROGRESS_LOG_INTERVAL_S = 30.0
|
||||
|
||||
@@ -99,10 +129,32 @@ INDEX_MAPPING = {
|
||||
"dynamic": "strict",
|
||||
"properties": {
|
||||
"name": {"type": "text", "fields": {"keyword": {"type": "keyword"}}},
|
||||
"org_name": {"type": "text", "fields": {"keyword": {"type": "keyword"}}},
|
||||
"organization": {"type": "text", "fields": {"keyword": {"type": "keyword"}}},
|
||||
"org_uri": {"type": "keyword"},
|
||||
"org_hierarchy_path": {"type": "keyword"},
|
||||
"faculty": {"type": "keyword"},
|
||||
"organization_type": {"type": "keyword"},
|
||||
"organization_level": {"type": "keyword"},
|
||||
"openalex_id": {"type": "keyword"},
|
||||
"oa_organization_ids": {"type": "keyword"},
|
||||
"oa_organization": {
|
||||
"type": "nested",
|
||||
"dynamic": False,
|
||||
"properties": {
|
||||
"id": {"type": "keyword"},
|
||||
"openalex_url": {"type": "keyword"},
|
||||
"display_name": {
|
||||
"type": "text",
|
||||
"fields": {"keyword": {"type": "keyword"}},
|
||||
},
|
||||
"ror": {"type": "keyword"},
|
||||
"country_code": {"type": "keyword"},
|
||||
"type": {"type": "keyword"},
|
||||
"lineage": {"type": "keyword"},
|
||||
"years": {"type": "integer"},
|
||||
"last_known": {"type": "boolean"},
|
||||
},
|
||||
},
|
||||
# Kept verbatim in _source; staff dicts vary, so don't index them.
|
||||
"staff": {"type": "object", "dynamic": False},
|
||||
"staff_entries": {"type": "object", "dynamic": False},
|
||||
@@ -218,6 +270,10 @@ class Stats:
|
||||
person_docs: int = 0
|
||||
uploaded: int = 0
|
||||
doc_errors: int = 0
|
||||
authors_requested: int = 0
|
||||
authors_found: int = 0
|
||||
authors_missing: int = 0
|
||||
persons_with_institutions: int = 0
|
||||
started: float = field(default_factory=time.monotonic)
|
||||
|
||||
@property
|
||||
@@ -229,6 +285,9 @@ class Stats:
|
||||
f"scanned={self.scanned} orgs_done={self.orgs_done} "
|
||||
f"orgs_failed={self.orgs_failed} person_docs={self.person_docs} "
|
||||
f"uploaded={self.uploaded} doc_errors={self.doc_errors} "
|
||||
f"author_lookups={self.authors_found}/{self.authors_requested} "
|
||||
f"authors_missing={self.authors_missing} "
|
||||
f"persons_with_institutions={self.persons_with_institutions} "
|
||||
f"elapsed={time.monotonic() - self.started:.0f}s"
|
||||
)
|
||||
|
||||
@@ -420,22 +479,128 @@ async def scan_organizations(
|
||||
)
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Step 2b: LOOK UP author documents for institution metadata
|
||||
# =============================================================================
|
||||
|
||||
|
||||
def normalize_author_id(value: str | None) -> str | None:
|
||||
"""Return the short OpenAlex author ID, accepting raw and URL forms."""
|
||||
if not value:
|
||||
return None
|
||||
normalized = strip_openalex_prefix(value.strip()).strip()
|
||||
return normalized or None
|
||||
|
||||
|
||||
async def _lookup_single_author(short_id: str) -> Author | None:
|
||||
"""Fetch one author, tolerating the different author-document ID schemes.
|
||||
|
||||
The batch lookup normally finds the document through the ``id`` field.
|
||||
This fallback handles documents that only expose the short ``_id`` (direct
|
||||
get) or that are reachable only through a search on ``_id``.
|
||||
"""
|
||||
try:
|
||||
author = await get_author_by_id(short_id)
|
||||
except NotFoundException:
|
||||
author = None
|
||||
if author is not None:
|
||||
return author
|
||||
|
||||
async def _search_by_id() -> Any:
|
||||
return await search_authors(
|
||||
page=0,
|
||||
size=1,
|
||||
query={
|
||||
"terms": {
|
||||
"_id": [
|
||||
short_id,
|
||||
f"https://openalex.org/{short_id}",
|
||||
]
|
||||
}
|
||||
},
|
||||
source=AUTHOR_SOURCE_FIELDS,
|
||||
)
|
||||
|
||||
page = await retry_async(
|
||||
_search_by_id,
|
||||
description=f"Author search for {short_id}",
|
||||
)
|
||||
return page.elements[0] if page.elements else None
|
||||
|
||||
|
||||
async def fetch_authors_by_ids(openalex_ids: Iterable[str]) -> dict[str, Author]:
|
||||
"""Return ``{short_author_id.casefold(): Author}`` for the requested IDs.
|
||||
|
||||
Uses one batched ``id``-terms query per chunk, then a per-person fallback
|
||||
for documents the batch query did not return. Missing authors are omitted
|
||||
so the caller can still write the person document with empty institutions.
|
||||
"""
|
||||
normalized = sorted(
|
||||
{
|
||||
short_id
|
||||
for value in openalex_ids
|
||||
if (short_id := normalize_author_id(value)) is not None
|
||||
}
|
||||
)
|
||||
if not normalized:
|
||||
return {}
|
||||
|
||||
authors: dict[str, Author] = {}
|
||||
for start in range(0, len(normalized), AUTHOR_LOOKUP_BATCH_SIZE):
|
||||
chunk = normalized[start : start + AUTHOR_LOOKUP_BATCH_SIZE]
|
||||
id_terms: list[str] = []
|
||||
for short_id in chunk:
|
||||
id_terms.extend([short_id, f"https://openalex.org/{short_id}"])
|
||||
|
||||
async def _search_batch() -> Any:
|
||||
return await search_authors(
|
||||
page=0,
|
||||
size=len(chunk),
|
||||
query={"terms": {"id": id_terms}},
|
||||
source=AUTHOR_SOURCE_FIELDS,
|
||||
)
|
||||
|
||||
page = await retry_async(
|
||||
_search_batch,
|
||||
description=f"Batch author lookup ({len(chunk)} ids)",
|
||||
)
|
||||
for author in page.elements:
|
||||
author_id = normalize_author_id(author.id)
|
||||
if author_id:
|
||||
authors[author_id.casefold()] = author
|
||||
|
||||
for short_id in chunk:
|
||||
key = short_id.casefold()
|
||||
if key in authors:
|
||||
continue
|
||||
author = await _lookup_single_author(short_id)
|
||||
if author is not None:
|
||||
authors[key] = author
|
||||
|
||||
return authors
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# Step 3: BUILD one document per (organization, OpenAlex person)
|
||||
# =============================================================================
|
||||
|
||||
|
||||
def build_hierarchy_lookup(hierarchy: Iterable[Any]) -> HierarchyLookup:
|
||||
"""Map normalized organization links to (display name, path from the root)."""
|
||||
"""Map normalized links to (display name, path, hierarchy node type)."""
|
||||
lookup: HierarchyLookup = {}
|
||||
|
||||
def visit(node: Any, ancestors: list[str]) -> None:
|
||||
name = getattr(node, "name_de", None) or getattr(node, "name_en", None)
|
||||
path = [*ancestors, name] if name else ancestors
|
||||
node_type = getattr(node, "type", None)
|
||||
if name:
|
||||
for link in (getattr(node, "link_de", None), getattr(node, "link_en", None)):
|
||||
if normalized := normalize_org_uri(link):
|
||||
lookup[normalized] = (name, path)
|
||||
lookup[normalized] = (
|
||||
name,
|
||||
path,
|
||||
node_type if isinstance(node_type, str) else None,
|
||||
)
|
||||
for child in getattr(node, "children", None) or []:
|
||||
visit(child, path)
|
||||
|
||||
@@ -446,11 +611,19 @@ def build_hierarchy_lookup(hierarchy: Iterable[Any]) -> HierarchyLookup:
|
||||
|
||||
def organization_details(
|
||||
source: dict[str, Any], hierarchy_lookup: HierarchyLookup
|
||||
) -> tuple[str, list[str], str | None]:
|
||||
"""Return (org name, hierarchy path, org URI), with fallbacks for the name."""
|
||||
) -> OrganizationDetails:
|
||||
"""Build explicit faculty / type / organization fields for a source org.
|
||||
|
||||
For a leaf such as ``Chemie > Lehrstühle > Applied Analytical Chemistry``
|
||||
this yields ``faculty=Chemie``, ``organization_type=Lehrstühle`` and
|
||||
``organization=Applied Analytical Chemistry``. Deeper paths still use the
|
||||
immediate parent as the type, so ``Chemie > Instituten > ACTIVE SITES >
|
||||
Lehrstühle > Applied Analytical Chemistry`` also yields
|
||||
``organization_type=Lehrstühle``.
|
||||
"""
|
||||
org_uri = source.get("uri")
|
||||
hierarchy_name, hierarchy_path = hierarchy_lookup.get(
|
||||
normalize_org_uri(org_uri) or "", ("", [])
|
||||
hierarchy_name, hierarchy_path, node_type = hierarchy_lookup.get(
|
||||
normalize_org_uri(org_uri) or "", ("", [], None)
|
||||
)
|
||||
org_name = (
|
||||
source.get("org_name")
|
||||
@@ -460,7 +633,35 @@ def organization_details(
|
||||
or org_uri
|
||||
or "Unknown organization"
|
||||
)
|
||||
return str(org_name), hierarchy_path, org_uri
|
||||
org_name = str(org_name)
|
||||
|
||||
organization_name = hierarchy_path[-1] if hierarchy_path else org_name
|
||||
if node_type in {"chairs", "institutes", "faculty"}:
|
||||
# Aggregator/faculty documents describe themselves rather than a child.
|
||||
organization_type = organization_name
|
||||
elif len(hierarchy_path) >= 2:
|
||||
organization_type = hierarchy_path[-2]
|
||||
else:
|
||||
organization_type = None
|
||||
|
||||
faculty = hierarchy_path[0] if hierarchy_path else None
|
||||
if not faculty:
|
||||
fallback_faculty = (
|
||||
source.get("faculty_de")
|
||||
or source.get("faculty_en")
|
||||
or source.get("faculty")
|
||||
)
|
||||
faculty = fallback_faculty.strip() if isinstance(fallback_faculty, str) else None
|
||||
faculty = faculty or None
|
||||
|
||||
return OrganizationDetails(
|
||||
name=org_name,
|
||||
uri=org_uri,
|
||||
hierarchy_path=hierarchy_path,
|
||||
faculty=faculty,
|
||||
organization_type=organization_type,
|
||||
organization_level=node_type,
|
||||
)
|
||||
|
||||
|
||||
def stable_document_id(org_uri: str | None, org_doc_id: str, openalex_id: str) -> str:
|
||||
@@ -473,19 +674,145 @@ def _canonical(value: Any) -> str:
|
||||
return json.dumps(value, sort_keys=True, ensure_ascii=False, default=str)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# OpenAlex institution projection
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
INSTITUTION_METADATA_FIELDS = ("display_name", "ror", "country_code", "type")
|
||||
|
||||
|
||||
def normalize_institution_id(value: Any) -> str | None:
|
||||
"""Return the raw OpenAlex institution ID, accepting short and URL forms."""
|
||||
if not isinstance(value, str):
|
||||
return None
|
||||
normalized = strip_openalex_prefix(value.strip()).strip()
|
||||
return normalized or None
|
||||
|
||||
|
||||
def _merge_text(record: dict[str, Any], key: str, value: Any) -> None:
|
||||
if not isinstance(value, str):
|
||||
return
|
||||
value = value.strip()
|
||||
if value and not record.get(key):
|
||||
record[key] = value
|
||||
|
||||
|
||||
def _merge_lineage(record: dict[str, Any], lineage: Any) -> None:
|
||||
if not isinstance(lineage, list):
|
||||
return
|
||||
merged: list[str] = list(record.get("lineage") or [])
|
||||
for item in lineage:
|
||||
if not isinstance(item, str):
|
||||
continue
|
||||
item = item.strip()
|
||||
if item and item not in merged:
|
||||
merged.append(item)
|
||||
if merged:
|
||||
record["lineage"] = merged
|
||||
|
||||
|
||||
def _merge_years(record: dict[str, Any], years: Any) -> None:
|
||||
if not isinstance(years, list):
|
||||
return
|
||||
merged = {int(year) for year in record.get("years") or []}
|
||||
for year in years:
|
||||
try:
|
||||
merged.add(int(year))
|
||||
except (TypeError, ValueError):
|
||||
continue
|
||||
record["years"] = sorted(merged)
|
||||
|
||||
|
||||
def extract_openalex_institutions(author: Author | None) -> list[dict[str, Any]]:
|
||||
"""Return deduplicated OpenAlex institutions for one author.
|
||||
|
||||
``last_known_institutions`` and ``affiliations[].institution`` are merged
|
||||
by OpenAlex institution ID. Affiliation years are unioned and institutions
|
||||
without an OpenAlex ID are skipped. Last-known institutions come first.
|
||||
"""
|
||||
if author is None:
|
||||
return []
|
||||
|
||||
by_id: dict[str, dict[str, Any]] = {}
|
||||
|
||||
def record_for(institution: Any) -> dict[str, Any] | None:
|
||||
if institution is None:
|
||||
return None
|
||||
short_id = normalize_institution_id(getattr(institution, "id", None))
|
||||
if not short_id:
|
||||
return None
|
||||
|
||||
key = short_id.casefold()
|
||||
record = by_id.get(key)
|
||||
if record is None:
|
||||
record = {
|
||||
"id": short_id,
|
||||
"openalex_url": full_institution_url(short_id),
|
||||
"display_name": None,
|
||||
"ror": None,
|
||||
"country_code": None,
|
||||
"type": None,
|
||||
"lineage": [],
|
||||
"years": [],
|
||||
"last_known": False,
|
||||
}
|
||||
by_id[key] = record
|
||||
|
||||
for field in INSTITUTION_METADATA_FIELDS:
|
||||
_merge_text(record, field, getattr(institution, field, None))
|
||||
_merge_lineage(record, getattr(institution, "lineage", None))
|
||||
return record
|
||||
|
||||
for institution in author.last_known_institutions or []:
|
||||
record = record_for(institution)
|
||||
if record is not None:
|
||||
record["last_known"] = True
|
||||
|
||||
for affiliation in author.affiliations or []:
|
||||
record = record_for(getattr(affiliation, "institution", None))
|
||||
if record is not None:
|
||||
_merge_years(record, getattr(affiliation, "years", None))
|
||||
|
||||
return sorted(
|
||||
by_id.values(),
|
||||
key=lambda item: (
|
||||
not item["last_known"],
|
||||
(item.get("display_name") or "").casefold(),
|
||||
item["id"].casefold(),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def openalex_institution_ids(institutions: Iterable[dict[str, Any]]) -> list[str]:
|
||||
"""Return the deduplicated short institution IDs in stable order."""
|
||||
seen: set[str] = set()
|
||||
ids: list[str] = []
|
||||
for institution in institutions:
|
||||
short_id = normalize_institution_id(institution.get("id"))
|
||||
if not short_id:
|
||||
continue
|
||||
key = short_id.casefold()
|
||||
if key in seen:
|
||||
continue
|
||||
seen.add(key)
|
||||
ids.append(short_id)
|
||||
return ids
|
||||
|
||||
|
||||
def make_person_documents(
|
||||
source: dict[str, Any],
|
||||
source_doc_id: str,
|
||||
verified_entries: list[dict[str, Any]],
|
||||
hierarchy_lookup: HierarchyLookup,
|
||||
verified_at: str,
|
||||
authors_by_id: dict[str, Author],
|
||||
) -> list[tuple[str, Hit]]:
|
||||
"""Turn verified staff entries into [(doc_id, document)], one per OpenAlex person.
|
||||
|
||||
A person may be matched by several staff entries and several collaborators,
|
||||
so entries and evidence are de-duplicated per person first.
|
||||
"""
|
||||
org_name, hierarchy_path, org_uri = organization_details(source, hierarchy_lookup)
|
||||
details = organization_details(source, hierarchy_lookup)
|
||||
|
||||
# openalex_id -> {canonical staff json -> staff dict}
|
||||
staff_by_person: dict[str, dict[str, dict[str, Any]]] = {}
|
||||
@@ -507,12 +834,20 @@ def make_person_documents(
|
||||
for openalex_id, staff_map in staff_by_person.items():
|
||||
staff_entries = list(staff_map.values())
|
||||
primary_staff = staff_entries[0]
|
||||
author_id = normalize_author_id(openalex_id)
|
||||
author = authors_by_id.get(author_id.casefold()) if author_id else None
|
||||
institutions = extract_openalex_institutions(author)
|
||||
document = {
|
||||
"name": primary_staff.get("name"),
|
||||
"org_name": org_name,
|
||||
"org_uri": org_uri,
|
||||
"org_hierarchy_path": hierarchy_path,
|
||||
"organization": details.name,
|
||||
"org_uri": details.uri,
|
||||
"org_hierarchy_path": details.hierarchy_path,
|
||||
"faculty": details.faculty,
|
||||
"organization_type": details.organization_type,
|
||||
"organization_level": details.organization_level,
|
||||
"openalex_id": openalex_id,
|
||||
"oa_organization_ids": openalex_institution_ids(institutions),
|
||||
"oa_organization": institutions,
|
||||
"staff": primary_staff,
|
||||
"staff_entries": staff_entries,
|
||||
"source_index": SOURCE_INDEX,
|
||||
@@ -521,7 +856,7 @@ def make_person_documents(
|
||||
"verification_evidence": list(evidence_by_person[openalex_id].values()),
|
||||
"verified_at": verified_at,
|
||||
}
|
||||
doc_id = stable_document_id(org_uri, source_doc_id, openalex_id)
|
||||
doc_id = stable_document_id(details.uri, source_doc_id, openalex_id)
|
||||
documents.append((doc_id, document))
|
||||
return documents
|
||||
|
||||
@@ -537,7 +872,28 @@ async def ensure_output_index(
|
||||
"""Create the output index with its mapping if it doesn't exist yet."""
|
||||
head = await client.head(f"{url}/{OUTPUT_INDEX}", headers=headers)
|
||||
if head.status_code == 200:
|
||||
logger.info("Output index %r already exists.", OUTPUT_INDEX)
|
||||
mapping_response = await client.get(
|
||||
f"{url}/{OUTPUT_INDEX}/_mapping", headers=headers
|
||||
)
|
||||
mapping_response.raise_for_status()
|
||||
properties = (
|
||||
mapping_response.json()
|
||||
.get(OUTPUT_INDEX, {})
|
||||
.get("mappings", {})
|
||||
.get("properties", {})
|
||||
)
|
||||
missing_fields = [
|
||||
field
|
||||
for field in ("oa_organization_ids", "oa_organization")
|
||||
if field not in properties
|
||||
]
|
||||
if missing_fields:
|
||||
raise SystemExit(
|
||||
f"Output index {OUTPUT_INDEX!r} already exists but is missing "
|
||||
f"{missing_fields}. Delete the index before uploading the new "
|
||||
"schema, or choose a different OUTPUT_INDEX."
|
||||
)
|
||||
logger.info("Output index %r already exists with the current schema.", OUTPUT_INDEX)
|
||||
return
|
||||
if head.status_code != 404:
|
||||
head.raise_for_status()
|
||||
@@ -696,18 +1052,55 @@ async def process_organization(hit: Hit, ctx: Context) -> bool:
|
||||
description=f"Collab-graph verification for {label}",
|
||||
)
|
||||
|
||||
# Step 2b: load OpenAlex author documents for institution metadata.
|
||||
requested_author_ids = {
|
||||
short_id
|
||||
for entry in verified_entries
|
||||
for openalex_id in entry["openalex_ids"]
|
||||
if (short_id := normalize_author_id(openalex_id)) is not None
|
||||
}
|
||||
authors_by_id = await fetch_authors_by_ids(requested_author_ids)
|
||||
found_author_ids = {
|
||||
short_id
|
||||
for short_id in requested_author_ids
|
||||
if short_id.casefold() in authors_by_id
|
||||
}
|
||||
missing_author_ids = requested_author_ids - found_author_ids
|
||||
ctx.stats.authors_requested += len(requested_author_ids)
|
||||
ctx.stats.authors_found += len(found_author_ids)
|
||||
ctx.stats.authors_missing += len(missing_author_ids)
|
||||
if missing_author_ids:
|
||||
logger.warning(
|
||||
"No OpenAlex author document for %d verified person(s) in %s: %s",
|
||||
len(missing_author_ids),
|
||||
label,
|
||||
", ".join(sorted(missing_author_ids)),
|
||||
)
|
||||
|
||||
# Step 3: build one document per OpenAlex person.
|
||||
documents = make_person_documents(
|
||||
source, doc_id, verified_entries, ctx.hierarchy_lookup, ctx.verified_at
|
||||
source,
|
||||
doc_id,
|
||||
verified_entries,
|
||||
ctx.hierarchy_lookup,
|
||||
ctx.verified_at,
|
||||
authors_by_id,
|
||||
)
|
||||
ctx.stats.person_docs += len(documents)
|
||||
ctx.stats.persons_with_institutions += sum(
|
||||
1 for _, document in documents if document.get("oa_organization")
|
||||
)
|
||||
|
||||
if ctx.dry_run:
|
||||
logger.info(
|
||||
"DRY RUN org=%s verified_staff=%d person_org_docs=%d",
|
||||
"DRY RUN org=%s verified_staff=%d person_org_docs=%d "
|
||||
"authors=%d/%d missing=%d",
|
||||
label,
|
||||
len(verified_entries),
|
||||
len(documents),
|
||||
len(found_author_ids),
|
||||
len(requested_author_ids),
|
||||
len(missing_author_ids),
|
||||
)
|
||||
return True
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ VERIFIED_PERSONS_INDEX = "orgminer_verified_persons_ude"
|
||||
VERIFIED_PERSONS_INSTITUTION_ID = DEFAULT_INSTITUTION_ID
|
||||
VERIFIED_PERSON_FIELDS = [
|
||||
"openalex_id",
|
||||
"organization",
|
||||
"org_name",
|
||||
"org_uri",
|
||||
"org_hierarchy_path",
|
||||
@@ -73,7 +74,7 @@ async def get_verified_organizations(author_id: str) -> list[VerifiedOrganizatio
|
||||
},
|
||||
"sort": [
|
||||
{"verified_at": {"order": "desc", "missing": "_last"}},
|
||||
{"org_name.keyword": {"order": "asc", "missing": "_last"}},
|
||||
{"organization.keyword": {"order": "asc", "missing": "_last"}},
|
||||
],
|
||||
}
|
||||
|
||||
@@ -91,7 +92,9 @@ async def get_verified_organizations(author_id: str) -> list[VerifiedOrganizatio
|
||||
for hit in data.get("hits", {}).get("hits", []):
|
||||
source = hit.get("_source") or {}
|
||||
org_uri = normalize_org_uri(source.get("org_uri"))
|
||||
org_name = (source.get("org_name") or "").strip()
|
||||
org_name = (
|
||||
source.get("organization") or source.get("org_name") or ""
|
||||
).strip()
|
||||
key = org_uri or org_name.casefold()
|
||||
if not key:
|
||||
continue
|
||||
|
||||
@@ -151,9 +151,9 @@ export const routes: Routes = [
|
||||
]),
|
||||
],
|
||||
loadComponent: () =>
|
||||
import(
|
||||
'./modules/founder-potential/multipliers-dashboard/multipliers-dashboard.component'
|
||||
).then((mod) => mod.MultipliersDashboardComponent),
|
||||
import('./modules/founder-potential/multipliers-dashboard/multipliers-dashboard.component').then(
|
||||
(mod) => mod.MultipliersDashboardComponent,
|
||||
),
|
||||
resolve: {
|
||||
researchers: multiplicatorResearchersResolver,
|
||||
},
|
||||
@@ -170,9 +170,9 @@ export const routes: Routes = [
|
||||
]),
|
||||
],
|
||||
loadComponent: () =>
|
||||
import(
|
||||
'./modules/founder-potential/founder-dashboard/founder-dashboard.component'
|
||||
).then((mod) => mod.FounderDashboardComponent),
|
||||
import('./modules/founder-potential/founder-dashboard/founder-dashboard.component').then(
|
||||
(mod) => mod.FounderDashboardComponent,
|
||||
),
|
||||
resolve: {
|
||||
statistics: founderStatisticsResolver,
|
||||
candidates: founderCandidatesResolver,
|
||||
@@ -180,7 +180,7 @@ export const routes: Routes = [
|
||||
runGuardsAndResolvers: 'paramsOrQueryParamsChange',
|
||||
},
|
||||
{
|
||||
path: 'founders/:authorId',
|
||||
path: 'collaboration-network/:authorId',
|
||||
canActivate: [
|
||||
roleGuard([
|
||||
UserRole.User,
|
||||
@@ -190,9 +190,9 @@ export const routes: Routes = [
|
||||
]),
|
||||
],
|
||||
loadComponent: () =>
|
||||
import(
|
||||
'./modules/founder-potential/researcher-network/researcher-network.component'
|
||||
).then((mod) => mod.ResearcherNetworkComponent),
|
||||
import('./modules/founder-potential/researcher-network/researcher-network.component').then(
|
||||
(mod) => mod.ResearcherNetworkComponent,
|
||||
),
|
||||
resolve: {
|
||||
page: multiplierResearcherPageResolver,
|
||||
},
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
effect,
|
||||
inject,
|
||||
} from '@angular/core';
|
||||
import { ResolverStateService } from '../../app/shared/services/resolver-state.service';
|
||||
import { NavigationStateService } from '../../app/shared/services/navigation-state.service';
|
||||
|
||||
@Directive({
|
||||
selector: 'span, [skText]',
|
||||
@@ -19,11 +19,11 @@ export class SkTextDirective implements OnChanges {
|
||||
|
||||
private readonly el = inject(ElementRef<HTMLElement>);
|
||||
private readonly renderer = inject(Renderer2);
|
||||
private readonly resolverStateService = inject(ResolverStateService);
|
||||
private readonly navigationState = inject(NavigationStateService);
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
const loading = this.skText || this.resolverStateService.isResolving();
|
||||
const loading = this.skText || this.navigationState.isResolving();
|
||||
|
||||
if (loading) {
|
||||
this.showSkeleton();
|
||||
@@ -38,7 +38,7 @@ export class SkTextDirective implements OnChanges {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.skText || this.resolverStateService.isResolving()) {
|
||||
if (this.skText || this.navigationState.isResolving()) {
|
||||
this.showSkeleton();
|
||||
} else {
|
||||
this.hideSkeleton();
|
||||
|
||||
@@ -44,10 +44,17 @@ export class DashboardComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.restoreTreemapNodeState();
|
||||
this.dashboard.initialize((institutionId) => {
|
||||
if (institutionId === this.selectedAnalyticalInstitutionId) return;
|
||||
this.dashboard.initialize((institutionId, source) => {
|
||||
const changed = institutionId !== this.selectedAnalyticalInstitutionId;
|
||||
this.selectedAnalyticalInstitutionId = institutionId;
|
||||
this.reloadAnalyticalData();
|
||||
// When the organization was auto-selected from the account (no explicit
|
||||
// URL parameter), persist it so the URL reflects the current state.
|
||||
if (source === 'default' && institutionId) {
|
||||
this.updateDashboardPeriodUrl();
|
||||
}
|
||||
if (changed) {
|
||||
this.reloadAnalyticalData();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@ import {
|
||||
TopAuthorStatistics,
|
||||
} from '../dashboard-statistics.service';
|
||||
import { mapProjectTopicsToTreemap } from './dashboard-topic-treemap.mapper';
|
||||
import { CredentialService } from '../../../shared/services/credential.service';
|
||||
|
||||
/** Where the initially selected institution came from. */
|
||||
export type InstitutionRestoreSource = 'url' | 'default';
|
||||
|
||||
@Injectable()
|
||||
export class DashboardFacade {
|
||||
@@ -88,9 +92,15 @@ export class DashboardFacade {
|
||||
constructor(
|
||||
private readonly statisticsService: DashboardStatisticsService,
|
||||
private readonly route: ActivatedRoute,
|
||||
private readonly credentials: CredentialService,
|
||||
) {}
|
||||
|
||||
initialize(onInstitutionRestored: (institutionId: string) => void): void {
|
||||
initialize(
|
||||
onInstitutionRestored: (
|
||||
institutionId: string,
|
||||
source: InstitutionRestoreSource,
|
||||
) => void,
|
||||
): void {
|
||||
this.restorePeriodState();
|
||||
this.loadStatistics();
|
||||
this.loadInstitutions(onInstitutionRestored);
|
||||
@@ -191,7 +201,10 @@ export class DashboardFacade {
|
||||
}
|
||||
|
||||
private loadInstitutions(
|
||||
onInstitutionRestored: (institutionId: string) => void,
|
||||
onInstitutionRestored: (
|
||||
institutionId: string,
|
||||
source: InstitutionRestoreSource,
|
||||
) => void,
|
||||
): void {
|
||||
this.institutionsLoading = true;
|
||||
this.institutionsError = false;
|
||||
@@ -202,18 +215,23 @@ export class DashboardFacade {
|
||||
next: (institutions) => {
|
||||
this.institutions = institutions;
|
||||
const requestedInstitution =
|
||||
this.route.snapshot.queryParamMap.get('institution') ?? 'all';
|
||||
const restoredInstitution = institutions.some(
|
||||
(institution) => institution.id === requestedInstitution,
|
||||
)
|
||||
? requestedInstitution
|
||||
: 'all';
|
||||
this.route.snapshot.queryParamMap.get('institution');
|
||||
// An explicit URL parameter wins; otherwise start with the logged-in
|
||||
// person's organization (the effective institution, which follows
|
||||
// impersonation) and fall back to all institutions.
|
||||
const restoredInstitution = requestedInstitution
|
||||
? this.findInstitution(institutions, requestedInstitution) ?? 'all'
|
||||
: this.findInstitution(
|
||||
institutions,
|
||||
this.credentials.effectiveInstitutionId(),
|
||||
) ?? 'all';
|
||||
if (restoredInstitution !== this.selectedInstitutionId) {
|
||||
this.selectedInstitutionId = restoredInstitution;
|
||||
this.loadStatistics();
|
||||
}
|
||||
onInstitutionRestored(
|
||||
restoredInstitution === 'all' ? '' : restoredInstitution,
|
||||
requestedInstitution ? 'url' : 'default',
|
||||
);
|
||||
},
|
||||
error: () => {
|
||||
@@ -223,6 +241,16 @@ export class DashboardFacade {
|
||||
});
|
||||
}
|
||||
|
||||
private findInstitution(
|
||||
institutions: DashboardInstitution[],
|
||||
institutionId: string | null | undefined,
|
||||
): string | undefined {
|
||||
if (!institutionId) return undefined;
|
||||
return institutions.some((institution) => institution.id === institutionId)
|
||||
? institutionId
|
||||
: undefined;
|
||||
}
|
||||
|
||||
private loadDfgProjectTopics(
|
||||
period: DashboardPeriodBounds,
|
||||
institutionId: string,
|
||||
|
||||
+4
-1
@@ -205,6 +205,9 @@ export class MultipliersDashboardComponent {
|
||||
};
|
||||
|
||||
openNetwork(row: MultiplierRow): void {
|
||||
void this.router.navigate(['/founders', row.researcher.author_id]);
|
||||
void this.router.navigate([
|
||||
'/collaboration-network',
|
||||
row.researcher.author_id,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-4
@@ -86,18 +86,19 @@
|
||||
<span class="legend__item">Knotengröße = aktive Jahre</span>
|
||||
</div>
|
||||
<p class="graph-hint">
|
||||
Personen anklicken, um ihr Profil zu öffnen · ziehen zum Verschieben ·
|
||||
scrollen zum Zoomen
|
||||
<span class="graph-hint__desktop">
|
||||
Personen anklicken, um ihr Profil zu öffnen · ziehen zum Verschieben ·
|
||||
scrollen zum Zoomen
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<div class="case-grid">
|
||||
<mat-card appearance="outlined" class="netbox">
|
||||
<mat-card-content>
|
||||
<mat-card-content class="netbox__content">
|
||||
@if (network(); as net) {
|
||||
@if ((net.nodes?.length ?? 0) > 0) {
|
||||
<app-multiplier-network-graph
|
||||
[network]="net"
|
||||
[height]="640"
|
||||
(nodeClick)="onNodeClick($event)" />
|
||||
} @else {
|
||||
<div class="netbox__empty">Kein Netzwerk verfügbar.</div>
|
||||
|
||||
+79
-2
@@ -44,6 +44,20 @@
|
||||
margin: 8px 0 0;
|
||||
color: var(--sg-text-soft);
|
||||
font-size: 12px;
|
||||
|
||||
&__touch {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (hover: none), (pointer: coarse) {
|
||||
.graph-hint__desktop {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.graph-hint__touch {
|
||||
display: inline;
|
||||
}
|
||||
}
|
||||
|
||||
.legend {
|
||||
@@ -101,22 +115,45 @@
|
||||
}
|
||||
|
||||
.netbox {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background: var(--sg-surface-muted);
|
||||
overflow: hidden;
|
||||
height: 100%;
|
||||
// Keep the chart usable even when the surrounding grid row has no
|
||||
// definite height (single-column phone layout).
|
||||
min-height: clamp(420px, 58vh, 760px);
|
||||
|
||||
.mat-mdc-card-content {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
&__empty {
|
||||
height: 640px;
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--sg-text-soft);
|
||||
}
|
||||
}
|
||||
|
||||
.netbox__content {
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
flex-direction: column;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
app-multiplier-network-graph {
|
||||
display: block;
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.detail-card {
|
||||
overflow: hidden;
|
||||
|
||||
@@ -288,9 +325,49 @@
|
||||
@media (max-width: 1000px) {
|
||||
.case-grid {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.netbox {
|
||||
// The grid row no longer gives the card a definite height here, so give
|
||||
// the chart an explicit viewport-based height instead of collapsing.
|
||||
height: auto;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
// The legend sits directly above the graph in the single-column layout, so
|
||||
// it does not need to stick, and the narrower column needs tighter wrapping.
|
||||
.legend {
|
||||
position: static;
|
||||
margin-top: 16px;
|
||||
padding: 6px 0;
|
||||
gap: 6px 12px;
|
||||
font-size: 11.5px;
|
||||
line-height: 1.35;
|
||||
}
|
||||
|
||||
app-multiplier-network-graph,
|
||||
.netbox__empty {
|
||||
height: 420px;
|
||||
flex: none;
|
||||
height: clamp(340px, 52vh, 500px);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 700px) {
|
||||
.case-grid {
|
||||
gap: 16px;
|
||||
margin-top: 18px;
|
||||
}
|
||||
|
||||
.detail-card .mat-mdc-card-content {
|
||||
padding: 14px;
|
||||
}
|
||||
|
||||
.network-footer {
|
||||
margin-top: 28px;
|
||||
}
|
||||
|
||||
.unavailable .mat-mdc-card-content {
|
||||
padding: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -604,9 +604,18 @@ export class HierarchyChartComponent implements OnInit {
|
||||
|
||||
if (hasChildren) {
|
||||
const newLevel = this.buildLevel(raw);
|
||||
// if the user clicks a different branch, drop any deeper levels first
|
||||
const truncated = this.levels().slice(0, levelIndex + 1);
|
||||
this.levels.set([...truncated, newLevel]);
|
||||
const currentLevels = this.levels();
|
||||
const existingIndex = currentLevels.findIndex(
|
||||
(level) => level.id === raw.id,
|
||||
);
|
||||
|
||||
if (existingIndex >= 0) {
|
||||
this.levels.set(currentLevels.slice(0, existingIndex + 1));
|
||||
} else {
|
||||
// If the user clicks a different branch, drop any deeper levels first.
|
||||
const truncated = currentLevels.slice(0, levelIndex + 1);
|
||||
this.levels.set([...truncated, newLevel]);
|
||||
}
|
||||
this.updateQueryParams();
|
||||
} else {
|
||||
this.onLeafSelect(raw);
|
||||
@@ -629,7 +638,7 @@ export class HierarchyChartComponent implements OnInit {
|
||||
const warning = this.chartTheme.colors().warning;
|
||||
return {
|
||||
borderColor: warning,
|
||||
borderWidth: 3,
|
||||
borderWidth: 1,
|
||||
shadowBlur: 10,
|
||||
shadowColor: warning,
|
||||
};
|
||||
@@ -696,9 +705,7 @@ export class HierarchyChartComponent implements OnInit {
|
||||
// Leaves inherit the icon of the group that contains them, including the
|
||||
// direct children of a group that is itself the root of this level.
|
||||
const parentType =
|
||||
raw.type === 'institutes' || raw.type === 'chairs'
|
||||
? raw.type
|
||||
: undefined;
|
||||
raw.type === 'institutes' || raw.type === 'chairs' ? raw.type : undefined;
|
||||
const children = (raw.children || []).map((c) =>
|
||||
this.toChartNode(c, true, parentType),
|
||||
);
|
||||
@@ -779,18 +786,27 @@ export class HierarchyChartComponent implements OnInit {
|
||||
fontSize: 11,
|
||||
color: 'black',
|
||||
formatter: (params: any) => {
|
||||
if (params.data.hasChildren) {
|
||||
return '{bold|' + params.name + '}';
|
||||
const isHighlighted = params.data.id === this.highlightedId();
|
||||
let style = 'normal';
|
||||
if (isHighlighted) {
|
||||
style = 'highlighted';
|
||||
} else if (params.data.hasChildren) {
|
||||
style = 'bold';
|
||||
}
|
||||
return '{normal|' + params.name + '}';
|
||||
|
||||
return `{${style}|${params.name}}`;
|
||||
},
|
||||
rich: {
|
||||
bold: {
|
||||
highlighted: {
|
||||
fontWeight: 'bold',
|
||||
color: colors.warning,
|
||||
},
|
||||
normal: {
|
||||
fontWeight: 'normal',
|
||||
},
|
||||
bold: {
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
},
|
||||
},
|
||||
leaves: {
|
||||
|
||||
@@ -14,7 +14,7 @@ import { FilterObserver } from '../../shared/ui/selected-filters/selected-filter
|
||||
import { AppInstitutionCardComponent } from '../../shared/ui/app-institution-card/app-institution-card.component';
|
||||
import { SEARCH_ICON } from '../../shared/ui/icons';
|
||||
import { PageContainerComponent } from '../../shared/ui/page-container/page-container.component';
|
||||
import { ResolverStateService } from '../../shared/services/resolver-state.service';
|
||||
import { NavigationStateService } from '../../shared/services/navigation-state.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-institutions',
|
||||
@@ -33,9 +33,9 @@ import { ResolverStateService } from '../../shared/services/resolver-state.servi
|
||||
export class InstitutionsComponent {
|
||||
institutionPage = input.required<InstitutionPage>();
|
||||
|
||||
private readonly resolverState = inject(ResolverStateService);
|
||||
private readonly navigationState = inject(NavigationStateService);
|
||||
readonly loading = computed(() =>
|
||||
this.resolverState.isResolvingInside('/institutions'),
|
||||
this.navigationState.isResolvingInside('/institutions'),
|
||||
);
|
||||
|
||||
observers: FilterObserver[] = [
|
||||
|
||||
@@ -114,6 +114,8 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
<app-live-region [text]="resultAnnouncement" />
|
||||
|
||||
<div class="toolbar">
|
||||
<span [skText]="loading" class="result-count">{{
|
||||
resultRange()
|
||||
@@ -151,11 +153,15 @@
|
||||
<!--><span>Sortiert nach Publikationen und Zitierungen</span>-->
|
||||
</div>
|
||||
|
||||
@if (getPersons().length) {
|
||||
@if (loading) {
|
||||
<app-page-skeleton
|
||||
variant="cards-plain"
|
||||
[compact]="true"
|
||||
[cardMinWidth]="280" />
|
||||
} @else if (getPersons().length) {
|
||||
<div class="person-grid">
|
||||
@for (person of getPersons(); track person.id) {
|
||||
<app-person-card
|
||||
[loading]="loading"
|
||||
[person]="person"
|
||||
[isBookmarked]="isBookmarked(person)"
|
||||
[selectedTopics]="selectedTopics()"
|
||||
|
||||
@@ -12,8 +12,7 @@ import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatRadioModule } from '@angular/material/radio';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { ResolverStateService } from '../../shared/services/resolver-state.service';
|
||||
|
||||
import { NavigationStateService } from '../../shared/services/navigation-state.service';
|
||||
import {
|
||||
CustomAuthor,
|
||||
DehydratedInstitution,
|
||||
@@ -48,6 +47,8 @@ import { BookmarkService } from '../../shared/services/bookmark.service';
|
||||
import { ComponentTooltipDirective } from '../../directives/component-tooltip.directive';
|
||||
import { AppTopicTooltipComponent } from '../../shared/ui/app-topic-tooltip/app-topic-tooltip.component';
|
||||
import { PageContainerComponent } from '../../shared/ui/page-container/page-container.component';
|
||||
import { LiveRegionComponent } from '../../shared/ui/live-region/live-region.component';
|
||||
import { PageSkeletonComponent } from '../../shared/ui/page-skeleton/page-skeleton.component';
|
||||
import {
|
||||
CLOSE_ICON,
|
||||
FILTER_ICON,
|
||||
@@ -81,6 +82,8 @@ type InstitutionYearFilterMode = 'in' | 'from' | 'between';
|
||||
SkTextDirective,
|
||||
ComponentTooltipDirective,
|
||||
PageContainerComponent,
|
||||
LiveRegionComponent,
|
||||
PageSkeletonComponent,
|
||||
],
|
||||
templateUrl: './person-list.component.html',
|
||||
styleUrl: './person-list.component.scss',
|
||||
@@ -105,9 +108,9 @@ export class PersonListComponent {
|
||||
private readonly bookmarkService = inject(BookmarkService);
|
||||
public readonly state = inject(SharedStateService);
|
||||
public readonly paginationService = inject(PaginationService);
|
||||
public readonly resolverStateService = inject(ResolverStateService);
|
||||
public readonly navigationState = inject(NavigationStateService);
|
||||
readonly loadingState = computed(() =>
|
||||
this.resolverStateService.isResolvingInside('/persons'),
|
||||
this.navigationState.isResolvingInside('/persons'),
|
||||
);
|
||||
persons: CustomAuthor[] = [];
|
||||
total = 0;
|
||||
@@ -600,6 +603,13 @@ export class PersonListComponent {
|
||||
return `${start}-${end} von ${this.total} Personen`;
|
||||
}
|
||||
|
||||
/** Announced to screen readers whenever a new result set is rendered. */
|
||||
get resultAnnouncement(): string {
|
||||
if (this.loading) return '';
|
||||
if (!this.total) return 'Keine Personen gefunden';
|
||||
return this.resultRange();
|
||||
}
|
||||
|
||||
// Bookmarks
|
||||
toggleBookmark(person: CustomAuthor): void {
|
||||
this.bookmarkService
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
|
||||
import { ResolverStateService } from '../../shared/services/resolver-state.service';
|
||||
import { NavigationStateService } from '../../shared/services/navigation-state.service';
|
||||
import { NewsArticle, NewsPage } from '../../resolvers/person-news.resolver';
|
||||
import {
|
||||
CardSearchComponent,
|
||||
@@ -27,7 +27,7 @@ import { SelectorOption } from '../../shared/ui/query-param-selector/query-param
|
||||
export class PersonNewsComponent implements OnInit {
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
private readonly resolverStateService = inject(ResolverStateService);
|
||||
private readonly navigationState = inject(NavigationStateService);
|
||||
|
||||
readonly sortingDirectionOptions: SelectorOption[] = [
|
||||
{ value: 'desc', display_name: 'Neueste zuerst' },
|
||||
@@ -40,7 +40,7 @@ export class PersonNewsComponent implements OnInit {
|
||||
private currentSize = 10;
|
||||
|
||||
get loading(): boolean {
|
||||
return this.resolverStateService.isResolving();
|
||||
return this.navigationState.isResolving();
|
||||
}
|
||||
|
||||
readonly page = computed<Page>(() => ({
|
||||
|
||||
@@ -1,217 +1,231 @@
|
||||
<app-page-container>
|
||||
@if (!isPersonLoading()) {
|
||||
<section class="person-hero">
|
||||
<div class="profile-card">
|
||||
<div class="profile-avatar">{{ initials() }}</div>
|
||||
<div class="profile-main">
|
||||
<div class="name-line">
|
||||
<span>Person</span>
|
||||
<h1>{{ displayName() }}</h1>
|
||||
<button
|
||||
type="button"
|
||||
class="profile-bookmark-button"
|
||||
[class.bookmarked]="bookmarkService.isBookmarked(person()?.id)"
|
||||
[attr.aria-label]="
|
||||
bookmarkService.isBookmarked(person()?.id)
|
||||
? 'Bookmark entfernen'
|
||||
: 'Person bookmarken'
|
||||
"
|
||||
[matTooltip]="
|
||||
bookmarkService.isBookmarked(person()?.id)
|
||||
? 'Bookmark entfernen'
|
||||
: 'Person bookmarken'
|
||||
"
|
||||
(click)="toggleBookmark()">
|
||||
<mat-icon>{{
|
||||
bookmarkService.isBookmarked(person()?.id)
|
||||
? BOOKMARK_ICON
|
||||
: BOOKMARK_BORDER_ICON
|
||||
}}</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
@if (resolvedInstitution() || verifiedOrganizations().length > 0) {
|
||||
<div class="institution-line">
|
||||
@if (resolvedInstitution(); as inst) {
|
||||
<app-institution-chip
|
||||
[institution]="inst"
|
||||
size="normal"
|
||||
[showIcon]="true"
|
||||
[isClickable]="false" />
|
||||
@if (secondaryInstitutions().length > 0) {
|
||||
<button
|
||||
type="button"
|
||||
class="more-institutions-btn"
|
||||
[appComponentTooltip]="PersonInstitutionTooltipListComponent"
|
||||
[tooltipInputs]="{ institutions: secondaryInstitutions() }"
|
||||
[attr.aria-label]="
|
||||
secondaryInstitutions().length + ' weitere Institutionen'
|
||||
">
|
||||
<mat-icon class="more-info-icon">{{ MORE_INFO_ICON }}</mat-icon>
|
||||
<span class="count-text"
|
||||
>+{{ secondaryInstitutions().length }}</span
|
||||
>
|
||||
</button>
|
||||
@if (!isPersonLoading()) {
|
||||
<section class="person-hero">
|
||||
<div class="profile-card">
|
||||
<div class="profile-avatar">{{ initials() }}</div>
|
||||
<div class="profile-main">
|
||||
<div class="name-line">
|
||||
<span>Person</span>
|
||||
<h1>{{ displayName() }}</h1>
|
||||
<button
|
||||
type="button"
|
||||
class="profile-bookmark-button"
|
||||
[class.bookmarked]="bookmarkService.isBookmarked(person()?.id)"
|
||||
[attr.aria-label]="
|
||||
bookmarkService.isBookmarked(person()?.id)
|
||||
? 'Bookmark entfernen'
|
||||
: 'Person bookmarken'
|
||||
"
|
||||
[matTooltip]="
|
||||
bookmarkService.isBookmarked(person()?.id)
|
||||
? 'Bookmark entfernen'
|
||||
: 'Person bookmarken'
|
||||
"
|
||||
(click)="toggleBookmark()">
|
||||
<mat-icon>{{
|
||||
bookmarkService.isBookmarked(person()?.id)
|
||||
? BOOKMARK_ICON
|
||||
: BOOKMARK_BORDER_ICON
|
||||
}}</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
@if (
|
||||
resolvedInstitution() ||
|
||||
(canOpenVerifiedOrganizationHierarchy() &&
|
||||
verifiedOrganizations().length > 0)
|
||||
) {
|
||||
<div class="institution-line">
|
||||
@if (resolvedInstitution(); as inst) {
|
||||
<app-institution-chip
|
||||
[institution]="inst"
|
||||
size="normal"
|
||||
[showIcon]="true"
|
||||
[isClickable]="false" />
|
||||
@if (secondaryInstitutions().length > 0) {
|
||||
<button
|
||||
type="button"
|
||||
class="more-institutions-btn"
|
||||
[appComponentTooltip]="
|
||||
PersonInstitutionTooltipListComponent
|
||||
"
|
||||
[tooltipInputs]="{ institutions: secondaryInstitutions() }"
|
||||
[attr.aria-label]="
|
||||
secondaryInstitutions().length + ' weitere Institutionen'
|
||||
">
|
||||
<mat-icon class="more-info-icon">{{
|
||||
MORE_INFO_ICON
|
||||
}}</mat-icon>
|
||||
<span class="count-text"
|
||||
>+{{ secondaryInstitutions().length }}</span
|
||||
>
|
||||
</button>
|
||||
}
|
||||
}
|
||||
}
|
||||
@for (org of verifiedOrganizations(); track $index) {
|
||||
@if (canOpenOrganizationHierarchy(org)) {
|
||||
<button
|
||||
type="button"
|
||||
class="verified-org-chip"
|
||||
@if (canOpenVerifiedOrganizationHierarchy()) {
|
||||
@for (org of verifiedOrganizations(); track $index) {
|
||||
@if (canOpenOrganizationHierarchy(org)) {
|
||||
<button
|
||||
type="button"
|
||||
class="verified-org-chip"
|
||||
[matTooltip]="
|
||||
'Verifizierte Organisation: ' +
|
||||
org.org_name +
|
||||
' – Hierarchie öffnen'
|
||||
"
|
||||
matTooltipPosition="right"
|
||||
[matTooltipShowDelay]="250"
|
||||
[attr.aria-label]="
|
||||
'Verifizierte Organisation: ' +
|
||||
org.org_name +
|
||||
'. Hierarchie öffnen.'
|
||||
"
|
||||
(click)="openOrganizationHierarchy(org)">
|
||||
<mat-icon>{{ VERIFIED_ICON }}</mat-icon>
|
||||
<span>{{ org.org_name }}</span>
|
||||
</button>
|
||||
} @else {
|
||||
<span
|
||||
class="verified-org-chip static"
|
||||
[matTooltip]="
|
||||
'Verifizierte Organisation: ' + org.org_name
|
||||
"
|
||||
matTooltipPosition="right"
|
||||
[matTooltipShowDelay]="250">
|
||||
<mat-icon>{{ VERIFIED_ICON }}</mat-icon>
|
||||
<span>{{ org.org_name }}</span>
|
||||
</span>
|
||||
}
|
||||
}
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@if (
|
||||
worksCount() !== null ||
|
||||
citedByCount() !== null ||
|
||||
h_index() !== null
|
||||
) {
|
||||
<span class="stats-line">
|
||||
@if (worksCount() !== null) {
|
||||
<span class="stat-item">
|
||||
<mat-icon class="stat-icon">{{ PUBLICATION_ICON }}</mat-icon>
|
||||
{{ worksCount() | number }} Publikationen
|
||||
</span>
|
||||
}
|
||||
@if (worksCount() !== null && citedByCount() !== null) {
|
||||
·
|
||||
}
|
||||
@if (citedByCount() !== null) {
|
||||
<span class="stat-item">
|
||||
<mat-icon class="stat-icon">{{ CITATION_ICON }}</mat-icon>
|
||||
{{ citedByCount() | number }} Zitationen
|
||||
</span>
|
||||
}
|
||||
@if (
|
||||
(worksCount() !== null || citedByCount() !== null) &&
|
||||
h_index() !== null
|
||||
) {
|
||||
·
|
||||
}
|
||||
@if (h_index() !== null) {
|
||||
<span
|
||||
class="stat-item has-tooltip"
|
||||
[matTooltip]="
|
||||
'Verifizierte Organisation: ' +
|
||||
org.org_name +
|
||||
' – Hierarchie öffnen'
|
||||
'Der h-Index beträgt ' +
|
||||
h_index() +
|
||||
': ' +
|
||||
h_index() +
|
||||
' Publikationen wurden jeweils mindestens ' +
|
||||
h_index() +
|
||||
'-mal zitiert.'
|
||||
"
|
||||
matTooltipPosition="right"
|
||||
[matTooltipShowDelay]="250"
|
||||
[attr.aria-label]="
|
||||
'Verifizierte Organisation: ' +
|
||||
org.org_name +
|
||||
'. Hierarchie öffnen.'
|
||||
"
|
||||
(click)="openOrganizationHierarchy(org)">
|
||||
<mat-icon>{{ VERIFIED_ICON }}</mat-icon>
|
||||
<span>{{ org.org_name }}</span>
|
||||
</button>
|
||||
} @else {
|
||||
<span
|
||||
class="verified-org-chip static"
|
||||
[matTooltip]="'Verifizierte Organisation: ' + org.org_name"
|
||||
[matTooltipShowDelay]="250">
|
||||
<mat-icon class="stat-icon">{{ TRENDING_UP_ICON }}</mat-icon>
|
||||
h-Index {{ h_index() }}
|
||||
</span>
|
||||
}
|
||||
</span>
|
||||
}
|
||||
@if (displayCareerStage() || orcid()) {
|
||||
<div class="meta-line">
|
||||
<app-career-stage-chip
|
||||
[careerStage]="displayCareerStage()"
|
||||
[activeYears]="person()?.career_metrics?.active_years" />
|
||||
@if (orcid(); as orcidId) {
|
||||
<a
|
||||
class="orcid-chip"
|
||||
[href]="orcidUrl()"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
matTooltip="ORCID-Profil öffnen"
|
||||
matTooltipPosition="right"
|
||||
[matTooltipShowDelay]="250">
|
||||
<mat-icon>{{ VERIFIED_ICON }}</mat-icon>
|
||||
<span>{{ org.org_name }}</span>
|
||||
</span>
|
||||
{{ orcidId }}
|
||||
</a>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@if (
|
||||
worksCount() !== null || citedByCount() !== null || h_index() !== null
|
||||
) {
|
||||
<span class="stats-line">
|
||||
@if (worksCount() !== null) {
|
||||
<span class="stat-item">
|
||||
<mat-icon class="stat-icon">{{ PUBLICATION_ICON }}</mat-icon>
|
||||
{{ worksCount() | number }} Publikationen
|
||||
</span>
|
||||
}
|
||||
@if (worksCount() !== null && citedByCount() !== null) {
|
||||
·
|
||||
}
|
||||
@if (citedByCount() !== null) {
|
||||
<span class="stat-item">
|
||||
<mat-icon class="stat-icon">{{ CITATION_ICON }}</mat-icon>
|
||||
{{ citedByCount() | number }} Zitationen
|
||||
</span>
|
||||
}
|
||||
@if (
|
||||
(worksCount() !== null || citedByCount() !== null) &&
|
||||
h_index() !== null
|
||||
) {
|
||||
·
|
||||
}
|
||||
@if (h_index() !== null) {
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<aside class="sidebar">
|
||||
<div class="bio-card">
|
||||
@if (isBioLoading()) {
|
||||
<app-loading
|
||||
text="Biografie wird geladen..."
|
||||
[icon]="DESCRIPTION_ICON"
|
||||
[size]="150"
|
||||
[diameter]="150"></app-loading>
|
||||
} @else if (personBio() != null) {
|
||||
<div class="bio-header">
|
||||
<h3>Biografie</h3>
|
||||
<span
|
||||
class="stat-item has-tooltip"
|
||||
[matTooltip]="
|
||||
'Der h-Index beträgt ' +
|
||||
h_index() +
|
||||
': ' +
|
||||
h_index() +
|
||||
' Publikationen wurden jeweils mindestens ' +
|
||||
h_index() +
|
||||
'-mal zitiert.'
|
||||
"
|
||||
matTooltipPosition="right"
|
||||
class="ai-badge"
|
||||
matTooltip="Diese Biografie wurde automatisch mit KI erstellt und kann Fehler enthalten."
|
||||
matTooltipPosition="above"
|
||||
[matTooltipShowDelay]="250">
|
||||
<mat-icon class="stat-icon">{{ TRENDING_UP_ICON }}</mat-icon>
|
||||
h-Index {{ h_index() }}
|
||||
<mat-icon>{{ AI_GENERATED_ICON }}</mat-icon>
|
||||
KI-generiert
|
||||
</span>
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
<p>{{ personBio() }}</p>
|
||||
}
|
||||
</div>
|
||||
</aside>
|
||||
<app-person-interesting
|
||||
[topics]="primaryTopicCounts()"
|
||||
[loading]="isTopicsLoading()"
|
||||
[personName]="personName()"
|
||||
[personPublicationsLink]="personPublicationsLink()"
|
||||
(tagClick)="onInterestingTagClick($event)"></app-person-interesting>
|
||||
</section>
|
||||
@if (this.links()) {
|
||||
<app-link-tab-nav-bar
|
||||
#navBar
|
||||
[links]="links()"
|
||||
[tabPanel]="tabPanel"></app-link-tab-nav-bar>
|
||||
}
|
||||
} @else {
|
||||
<app-loading
|
||||
text="Person wird geladen..."
|
||||
[icon]="PERSON_ICON"
|
||||
[size]="150"
|
||||
[diameter]="150"></app-loading>
|
||||
}
|
||||
<mat-tab-nav-panel #tabPanel class="person-panel">
|
||||
@let activeLink = this.activeLink();
|
||||
@if (activeLink) {
|
||||
<div class="description-container">
|
||||
@if (activeLink.label) {
|
||||
<h5>{{ activeLink.label }}</h5>
|
||||
}
|
||||
@if (displayCareerStage() || orcid()) {
|
||||
<div class="meta-line">
|
||||
<app-career-stage-chip
|
||||
[careerStage]="displayCareerStage()"
|
||||
[activeYears]="person()?.career_metrics?.active_years" />
|
||||
@if (orcid(); as orcidId) {
|
||||
<a
|
||||
class="orcid-chip"
|
||||
[href]="orcidUrl()"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
matTooltip="ORCID-Profil öffnen"
|
||||
matTooltipPosition="right"
|
||||
[matTooltipShowDelay]="250">
|
||||
<mat-icon>{{ VERIFIED_ICON }}</mat-icon>
|
||||
{{ orcidId }}
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
@if (activeLink.description) {
|
||||
<span class="description">{{ activeLink.description }}</span>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
<div class="content">
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
<aside class="sidebar">
|
||||
<div class="bio-card">
|
||||
@if (isBioLoading()) {
|
||||
<app-loading
|
||||
text="Biografie wird geladen..."
|
||||
[icon]="DESCRIPTION_ICON"
|
||||
[size]="150"
|
||||
[diameter]="150"></app-loading>
|
||||
} @else if (personBio() != null) {
|
||||
<div class="bio-header">
|
||||
<h3>Biografie</h3>
|
||||
<span
|
||||
class="ai-badge"
|
||||
matTooltip="Diese Biografie wurde automatisch mit KI erstellt und kann Fehler enthalten."
|
||||
matTooltipPosition="above"
|
||||
[matTooltipShowDelay]="250">
|
||||
<mat-icon>{{ AI_GENERATED_ICON }}</mat-icon>
|
||||
KI-generiert
|
||||
</span>
|
||||
</div>
|
||||
<p>{{ personBio() }}</p>
|
||||
}
|
||||
</div>
|
||||
</aside>
|
||||
<app-person-interesting
|
||||
[topics]="primaryTopicCounts()"
|
||||
[loading]="isTopicsLoading()"
|
||||
[personName]="personName()"
|
||||
[personPublicationsLink]="personPublicationsLink()"
|
||||
(tagClick)="onInterestingTagClick($event)"></app-person-interesting>
|
||||
</section>
|
||||
@if (this.links()) {
|
||||
<app-link-tab-nav-bar
|
||||
#navBar
|
||||
[links]="links()"
|
||||
[tabPanel]="tabPanel"></app-link-tab-nav-bar>
|
||||
}
|
||||
} @else {
|
||||
<app-loading
|
||||
text="Person wird geladen..."
|
||||
[icon]="PERSON_ICON"
|
||||
[size]="150"
|
||||
[diameter]="150"></app-loading>
|
||||
}
|
||||
<mat-tab-nav-panel #tabPanel class="person-panel">
|
||||
@let activeLink = this.activeLink();
|
||||
@if (activeLink) {
|
||||
<div class="description-container">
|
||||
@if (activeLink.label) {
|
||||
<h5>{{ activeLink.label }}</h5>
|
||||
}
|
||||
@if (activeLink.description) {
|
||||
<span class="description">{{ activeLink.description }}</span>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
<div class="content">
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
</mat-tab-nav-panel>
|
||||
</mat-tab-nav-panel>
|
||||
</app-page-container>
|
||||
|
||||
@@ -79,9 +79,7 @@ import {
|
||||
import { PageContainerComponent } from '../../shared/ui/page-container/page-container.component';
|
||||
|
||||
/** Accepts raw and full-URL OpenAlex IDs, e.g. `I123` or `.../I123`. */
|
||||
const normalizeInstitutionId = (
|
||||
value: string | null | undefined,
|
||||
): string =>
|
||||
const normalizeInstitutionId = (value: string | null | undefined): string =>
|
||||
(value ?? '')
|
||||
.trim()
|
||||
.replace(/^https:\/\/openalex\.org\//i, '')
|
||||
|
||||
@@ -16,7 +16,7 @@ import { FilterObserver } from '../../shared/ui/selected-filters/selected-filter
|
||||
import { FilterCardComponent } from '../../shared/ui/filter-card/filter-card.component';
|
||||
import { SEARCH_ICON } from '../../shared/ui/icons';
|
||||
import { PageContainerComponent } from '../../shared/ui/page-container/page-container.component';
|
||||
import { ResolverStateService } from '../../shared/services/resolver-state.service';
|
||||
import { NavigationStateService } from '../../shared/services/navigation-state.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-projects',
|
||||
@@ -37,9 +37,9 @@ import { ResolverStateService } from '../../shared/services/resolver-state.servi
|
||||
export class ProjectsComponent {
|
||||
fundingProjectPage = input.required<FundingProjectPage>();
|
||||
|
||||
private readonly resolverState = inject(ResolverStateService);
|
||||
private readonly navigationState = inject(NavigationStateService);
|
||||
readonly loading = computed(() =>
|
||||
this.resolverState.isResolvingInside('/projects'),
|
||||
this.navigationState.isResolvingInside('/projects'),
|
||||
);
|
||||
|
||||
page = computed<Page>(() => ({
|
||||
|
||||
@@ -19,7 +19,7 @@ import { PublicationFilterComponent } from '../../shared/ui/publication-filters/
|
||||
import { SelectorOption } from '../../shared/ui/query-param-selector/query-param-selector.component';
|
||||
import { workQueryParamKeys } from '../../resolvers/work-page.resolver';
|
||||
import { PageContainerComponent } from '../../shared/ui/page-container/page-container.component';
|
||||
import { ResolverStateService } from '../../shared/services/resolver-state.service';
|
||||
import { NavigationStateService } from '../../shared/services/navigation-state.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-publications',
|
||||
@@ -35,10 +35,10 @@ import { ResolverStateService } from '../../shared/services/resolver-state.servi
|
||||
export class PublicationsComponent {
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
private readonly router = inject(Router);
|
||||
private readonly resolverState = inject(ResolverStateService);
|
||||
private readonly navigationState = inject(NavigationStateService);
|
||||
|
||||
readonly loading = computed(() =>
|
||||
this.resolverState.isResolvingInside('/publications'),
|
||||
this.navigationState.isResolvingInside('/publications'),
|
||||
);
|
||||
|
||||
workPage = input.required<WorkPageV2>();
|
||||
|
||||
@@ -10,7 +10,7 @@ import { topicQueryParamKeys } from '../../resolvers/topic-page.resolver';
|
||||
import { SelectorOption } from '../../shared/ui/query-param-selector/query-param-selector.component';
|
||||
import { SEARCH_ICON } from '../../shared/ui/icons';
|
||||
import { PageContainerComponent } from '../../shared/ui/page-container/page-container.component';
|
||||
import { ResolverStateService } from '../../shared/services/resolver-state.service';
|
||||
import { NavigationStateService } from '../../shared/services/navigation-state.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-topics',
|
||||
@@ -21,9 +21,9 @@ import { ResolverStateService } from '../../shared/services/resolver-state.servi
|
||||
export class TopicsComponent {
|
||||
topicPage = input.required<TopicPageV2>();
|
||||
|
||||
private readonly resolverState = inject(ResolverStateService);
|
||||
private readonly navigationState = inject(NavigationStateService);
|
||||
readonly loading = computed(() =>
|
||||
this.resolverState.isResolvingInside('/topics'),
|
||||
this.navigationState.isResolvingInside('/topics'),
|
||||
);
|
||||
|
||||
observers: FilterObserver[] = [
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
import { inject, Injectable } from '@angular/core';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { NavigationEnd, Router } from '@angular/router';
|
||||
import { filter } from 'rxjs';
|
||||
import { navigationSectionFor, pathOf } from './navigation-sections';
|
||||
|
||||
/**
|
||||
* Moves keyboard and screen-reader focus to the new page heading after a
|
||||
* navigation between sections. In-section updates (tabs, filters, pagination)
|
||||
* keep the focus where the user left it.
|
||||
*/
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class NavigationFocusService {
|
||||
private readonly router = inject(Router);
|
||||
private lastPath: string | null = null;
|
||||
|
||||
constructor() {
|
||||
this.router.events
|
||||
.pipe(
|
||||
filter(
|
||||
(event): event is NavigationEnd => event instanceof NavigationEnd,
|
||||
),
|
||||
takeUntilDestroyed(),
|
||||
)
|
||||
.subscribe((event) => {
|
||||
const path = pathOf(event.urlAfterRedirects);
|
||||
const previousPath = this.lastPath;
|
||||
this.lastPath = path;
|
||||
|
||||
// Skip the initial load and in-section updates.
|
||||
if (previousPath === null) return;
|
||||
const fromSection = navigationSectionFor(previousPath);
|
||||
const toSection = navigationSectionFor(path);
|
||||
if (fromSection?.id === toSection?.id) return;
|
||||
|
||||
this.focusPageHeading();
|
||||
});
|
||||
}
|
||||
|
||||
private focusPageHeading(): void {
|
||||
// Wait for the activated component's view to be in the DOM.
|
||||
requestAnimationFrame(() => {
|
||||
const main = document.querySelector<HTMLElement>('main');
|
||||
const heading = main?.querySelector<HTMLElement>('h1') ?? null;
|
||||
const target = heading ?? main;
|
||||
if (!target) return;
|
||||
|
||||
if (!target.hasAttribute('tabindex')) {
|
||||
target.setAttribute('tabindex', '-1');
|
||||
}
|
||||
// The scroll service owns the scroll position; focusing must not move it.
|
||||
target.focus({ preventScroll: true });
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,331 @@
|
||||
import {
|
||||
ACCOUNT_CIRCLE_ICON,
|
||||
BOOKMARKS_ICON,
|
||||
DASHBOARD_ICON,
|
||||
FOUNDER_ICON,
|
||||
HIERARCHY_ICON,
|
||||
INSTITUTION_ICON,
|
||||
JOBS_ICON,
|
||||
KEYWORDS_ICON,
|
||||
NEWS_ICON,
|
||||
ORGANIZATIONS_ICON,
|
||||
PATENT_ICON,
|
||||
PERSONS_ICON,
|
||||
PERSON_ICON,
|
||||
PROJECT_ICON,
|
||||
PUBLICATION_ICON,
|
||||
TOPIC_ICON,
|
||||
} from '../ui/icons';
|
||||
|
||||
/**
|
||||
* Shape of the page skeleton for a navigation target. The variants mirror the
|
||||
* actual page layouts: card grids, data tables, master-detail pages, KPI
|
||||
* dashboards, tree charts, forms and graphs.
|
||||
*/
|
||||
export type PageSkeletonVariant =
|
||||
| 'cards'
|
||||
| 'cards-plain'
|
||||
| 'cards-sidebar'
|
||||
| 'table'
|
||||
| 'table-stats'
|
||||
| 'detail'
|
||||
| 'detail-table'
|
||||
| 'detail-chart'
|
||||
| 'dashboard'
|
||||
| 'comparison'
|
||||
| 'tree'
|
||||
| 'form'
|
||||
| 'graph';
|
||||
|
||||
export interface NavigationSection {
|
||||
/** Stable identifier, used to detect navigations that stay inside a section. */
|
||||
id: string;
|
||||
/**
|
||||
* URL prefix. A trailing slash means "any path below this prefix" and is
|
||||
* used for detail routes that share their list's prefix (e.g. `/news/:id`).
|
||||
*/
|
||||
prefix: string;
|
||||
label: string;
|
||||
/** Announced and shown while the section's resolvers run. */
|
||||
loadingText: string;
|
||||
icon: string;
|
||||
skeleton: PageSkeletonVariant;
|
||||
}
|
||||
|
||||
/**
|
||||
* Central map of the app's sections. Used for the navigation skeleton and to
|
||||
* tell "from outside" navigations (show a skeleton) apart from in-section
|
||||
* updates such as filters and pagination (keep the current content).
|
||||
*/
|
||||
export const NAVIGATION_SECTIONS: readonly NavigationSection[] = [
|
||||
{
|
||||
// Person list: card grid on the left, filter sidebar on the right.
|
||||
id: 'persons',
|
||||
prefix: '/persons',
|
||||
label: 'Personen',
|
||||
loadingText: 'Personen werden geladen …',
|
||||
icon: PERSONS_ICON,
|
||||
skeleton: 'cards-sidebar',
|
||||
},
|
||||
{
|
||||
// Person detail: hero, tabs, timeline/wordcloud on the overview tab.
|
||||
id: 'person',
|
||||
prefix: '/person',
|
||||
label: 'Person',
|
||||
loadingText: 'Personendaten werden geladen …',
|
||||
icon: PERSON_ICON,
|
||||
skeleton: 'detail-chart',
|
||||
},
|
||||
{
|
||||
id: 'publications',
|
||||
prefix: '/publications',
|
||||
label: 'Publikationen',
|
||||
loadingText: 'Publikationen werden geladen …',
|
||||
icon: PUBLICATION_ICON,
|
||||
skeleton: 'cards',
|
||||
},
|
||||
{
|
||||
id: 'publication',
|
||||
prefix: '/publication',
|
||||
label: 'Publikation',
|
||||
loadingText: 'Publikationsdaten werden geladen …',
|
||||
icon: PUBLICATION_ICON,
|
||||
skeleton: 'detail',
|
||||
},
|
||||
{
|
||||
id: 'project-detail',
|
||||
prefix: '/projects/dfg/',
|
||||
label: 'Projekt',
|
||||
loadingText: 'Projektdaten werden geladen …',
|
||||
icon: PROJECT_ICON,
|
||||
skeleton: 'detail',
|
||||
},
|
||||
{
|
||||
id: 'project-detail',
|
||||
prefix: '/projects/bund/',
|
||||
label: 'Projekt',
|
||||
loadingText: 'Projektdaten werden geladen …',
|
||||
icon: PROJECT_ICON,
|
||||
skeleton: 'detail',
|
||||
},
|
||||
{
|
||||
id: 'project-detail',
|
||||
prefix: '/projects/eu/',
|
||||
label: 'Projekt',
|
||||
loadingText: 'Projektdaten werden geladen …',
|
||||
icon: PROJECT_ICON,
|
||||
skeleton: 'detail',
|
||||
},
|
||||
{
|
||||
// Project list uses app-card-search, not a table.
|
||||
id: 'projects',
|
||||
prefix: '/projects',
|
||||
label: 'Projekte',
|
||||
loadingText: 'Projekte werden geladen …',
|
||||
icon: PROJECT_ICON,
|
||||
skeleton: 'cards',
|
||||
},
|
||||
{
|
||||
id: 'institutions',
|
||||
prefix: '/institutions',
|
||||
label: 'Institutionen',
|
||||
loadingText: 'Institutionen werden geladen …',
|
||||
icon: INSTITUTION_ICON,
|
||||
skeleton: 'cards',
|
||||
},
|
||||
{
|
||||
// Institution detail tabs default to a publication table.
|
||||
id: 'institution',
|
||||
prefix: '/institution',
|
||||
label: 'Institution',
|
||||
loadingText: 'Institutionsdaten werden geladen …',
|
||||
icon: INSTITUTION_ICON,
|
||||
skeleton: 'detail-table',
|
||||
},
|
||||
{
|
||||
// Patent list uses app-card-search; clicking a card opens a detail panel.
|
||||
id: 'patents',
|
||||
prefix: '/patents',
|
||||
label: 'Patente',
|
||||
loadingText: 'Patente werden geladen …',
|
||||
icon: PATENT_ICON,
|
||||
skeleton: 'cards',
|
||||
},
|
||||
{
|
||||
id: 'patent',
|
||||
prefix: '/patent',
|
||||
label: 'Patent',
|
||||
loadingText: 'Patentdaten werden geladen …',
|
||||
icon: PATENT_ICON,
|
||||
skeleton: 'detail',
|
||||
},
|
||||
{
|
||||
id: 'news-detail',
|
||||
prefix: '/news/',
|
||||
label: 'Nachricht',
|
||||
loadingText: 'Nachricht wird geladen …',
|
||||
icon: NEWS_ICON,
|
||||
skeleton: 'detail',
|
||||
},
|
||||
{
|
||||
id: 'news',
|
||||
prefix: '/news',
|
||||
label: 'Nachrichten',
|
||||
loadingText: 'Nachrichten werden geladen …',
|
||||
icon: NEWS_ICON,
|
||||
skeleton: 'cards',
|
||||
},
|
||||
{
|
||||
// Topic list uses app-card-search, not a table.
|
||||
id: 'topics',
|
||||
prefix: '/topics',
|
||||
label: 'Themen',
|
||||
loadingText: 'Themen werden geladen …',
|
||||
icon: TOPIC_ICON,
|
||||
skeleton: 'cards',
|
||||
},
|
||||
{
|
||||
// Topic detail tabs default to a publication table.
|
||||
id: 'topic',
|
||||
prefix: '/topic',
|
||||
label: 'Thema',
|
||||
loadingText: 'Themendaten werden geladen …',
|
||||
icon: TOPIC_ICON,
|
||||
skeleton: 'detail-table',
|
||||
},
|
||||
{
|
||||
id: 'hierarchy',
|
||||
prefix: '/hierarchy',
|
||||
label: 'Hierarchie',
|
||||
loadingText: 'Hierarchie wird geladen …',
|
||||
icon: HIERARCHY_ICON,
|
||||
skeleton: 'tree',
|
||||
},
|
||||
{
|
||||
// KPI tiles plus several ECharts panels.
|
||||
id: 'dashboard',
|
||||
prefix: '/dashboard',
|
||||
label: 'Dashboard',
|
||||
loadingText: 'Dashboard wird geladen …',
|
||||
icon: DASHBOARD_ICON,
|
||||
skeleton: 'dashboard',
|
||||
},
|
||||
{
|
||||
id: 'multipliers',
|
||||
prefix: '/multipliers',
|
||||
label: 'Multiplikatoren',
|
||||
loadingText: 'Multiplikatoren werden geladen …',
|
||||
icon: FOUNDER_ICON,
|
||||
skeleton: 'table',
|
||||
},
|
||||
{
|
||||
// KPI cards above a data table with expandable rows.
|
||||
id: 'founders',
|
||||
prefix: '/founders',
|
||||
label: 'Gründungspotenzial',
|
||||
loadingText: 'Gründungspotenzial wird geladen …',
|
||||
icon: FOUNDER_ICON,
|
||||
skeleton: 'table-stats',
|
||||
},
|
||||
{
|
||||
id: 'collaboration-network',
|
||||
prefix: '/collaboration-network',
|
||||
label: 'Forschungsnetzwerk',
|
||||
loadingText: 'Forschungsnetzwerk wird geladen …',
|
||||
icon: PERSON_ICON,
|
||||
skeleton: 'graph',
|
||||
},
|
||||
{
|
||||
// Bookmarks are just a card grid, without search/sort/pagination.
|
||||
id: 'bookmarks',
|
||||
prefix: '/bookmarks',
|
||||
label: 'Bookmarks',
|
||||
loadingText: 'Bookmarks werden geladen …',
|
||||
icon: BOOKMARKS_ICON,
|
||||
skeleton: 'cards-plain',
|
||||
},
|
||||
{
|
||||
// Two statistic tables, charts and a research-profile panel.
|
||||
id: 'compare',
|
||||
prefix: '/compare',
|
||||
label: 'Autorenvergleich',
|
||||
loadingText: 'Autorenvergleich wird geladen …',
|
||||
icon: PERSON_ICON,
|
||||
skeleton: 'comparison',
|
||||
},
|
||||
{
|
||||
// Keyword extraction form with a four-column chip matrix.
|
||||
id: 'keywords-results',
|
||||
prefix: '/keywords/search-results',
|
||||
label: 'Keyword-Suche',
|
||||
loadingText: 'Ergebnisse werden geladen …',
|
||||
icon: KEYWORDS_ICON,
|
||||
skeleton: 'table',
|
||||
},
|
||||
{
|
||||
id: 'keywords',
|
||||
prefix: '/keywords',
|
||||
label: 'Keywords',
|
||||
loadingText: 'Keywords werden geladen …',
|
||||
icon: KEYWORDS_ICON,
|
||||
skeleton: 'form',
|
||||
},
|
||||
{
|
||||
id: 'accounts',
|
||||
prefix: '/accounts',
|
||||
label: 'Accounts',
|
||||
loadingText: 'Accounts werden geladen …',
|
||||
icon: ACCOUNT_CIRCLE_ICON,
|
||||
skeleton: 'table',
|
||||
},
|
||||
{
|
||||
id: 'account',
|
||||
prefix: '/account',
|
||||
label: 'Mein Konto',
|
||||
loadingText: 'Kontodaten werden geladen …',
|
||||
icon: ACCOUNT_CIRCLE_ICON,
|
||||
skeleton: 'detail',
|
||||
},
|
||||
{
|
||||
id: 'organizations',
|
||||
prefix: '/organizations',
|
||||
label: 'Organisationen',
|
||||
loadingText: 'Organisationen werden geladen …',
|
||||
icon: ORGANIZATIONS_ICON,
|
||||
skeleton: 'table',
|
||||
},
|
||||
{
|
||||
// Health status cards above a data table.
|
||||
id: 'jobs',
|
||||
prefix: '/jobs',
|
||||
label: 'Jobs',
|
||||
loadingText: 'Jobs werden geladen …',
|
||||
icon: JOBS_ICON,
|
||||
skeleton: 'table-stats',
|
||||
},
|
||||
];
|
||||
|
||||
// Longest prefix first so `/persons` wins over `/person`.
|
||||
const SECTIONS_BY_LENGTH = [...NAVIGATION_SECTIONS].sort(
|
||||
(a, b) => b.prefix.length - a.prefix.length,
|
||||
);
|
||||
|
||||
/** Resolve the section for a router URL (query string and hash are ignored). */
|
||||
export function navigationSectionFor(
|
||||
url: string | null | undefined,
|
||||
): NavigationSection | null {
|
||||
if (!url) return null;
|
||||
const path = pathOf(url);
|
||||
return SECTIONS_BY_LENGTH.find((section) => matchesPrefix(path, section.prefix)) ?? null;
|
||||
}
|
||||
|
||||
function matchesPrefix(path: string, prefix: string): boolean {
|
||||
return prefix.endsWith('/')
|
||||
? path.startsWith(prefix)
|
||||
: path === prefix || path.startsWith(`${prefix}/`);
|
||||
}
|
||||
|
||||
/** Path part of a router URL. */
|
||||
export function pathOf(url: string): string {
|
||||
return url.split('?')[0].split('#')[0] || '/';
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
import { computed, inject, Injectable, signal } from '@angular/core';
|
||||
import {
|
||||
ActivatedRouteSnapshot,
|
||||
NavigationCancel,
|
||||
NavigationEnd,
|
||||
NavigationError,
|
||||
ResolveStart,
|
||||
Router,
|
||||
RouterStateSnapshot,
|
||||
} from '@angular/router';
|
||||
import {
|
||||
NavigationSection,
|
||||
navigationSectionFor,
|
||||
pathOf,
|
||||
} from './navigation-sections';
|
||||
|
||||
export interface NavigationTarget {
|
||||
/** URL the router is navigating to (including query string). */
|
||||
url: string;
|
||||
/** Section of the target URL, if it is one of the known sections. */
|
||||
section: NavigationSection | null;
|
||||
/** URL the user is coming from, captured when resolving starts. */
|
||||
fromUrl: string | null;
|
||||
/** Section of the origin URL. */
|
||||
fromSection: NavigationSection | null;
|
||||
/** True when the navigation switches to a different section. */
|
||||
external: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Central navigation state for the whole app.
|
||||
*
|
||||
* Resolvers run between `ResolveStart` and `NavigationEnd`; while they do, the
|
||||
* layout shows a section skeleton for navigations that come from outside a
|
||||
* section. In-section updates (filters, pagination, tabs) keep the current
|
||||
* content on screen and only clear when the navigation finishes.
|
||||
*/
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class NavigationStateService {
|
||||
private readonly router = inject(Router);
|
||||
private readonly currentTarget = signal<NavigationTarget | null>(null);
|
||||
|
||||
readonly target = this.currentTarget.asReadonly();
|
||||
readonly isResolving = computed(() => this.currentTarget() !== null);
|
||||
|
||||
/** Section whose skeleton should be shown, or null to keep the content. */
|
||||
readonly skeleton = computed<NavigationSection | null>(() => {
|
||||
const target = this.currentTarget();
|
||||
return target?.external ? target.section : null;
|
||||
});
|
||||
|
||||
constructor() {
|
||||
this.router.events.subscribe((event) => {
|
||||
if (event instanceof ResolveStart) {
|
||||
// Angular emits ResolveStart for every activation, even when no
|
||||
// resolver is configured. Without resolvers there is nothing to wait
|
||||
// for, so showing a skeleton would only cause a flash.
|
||||
if (!hasResolvers(event.state)) return;
|
||||
|
||||
const fromUrl = this.router.url;
|
||||
const section = navigationSectionFor(event.url);
|
||||
const fromSection = navigationSectionFor(fromUrl);
|
||||
this.currentTarget.set({
|
||||
url: event.url,
|
||||
section,
|
||||
fromUrl,
|
||||
fromSection,
|
||||
external: section?.id !== fromSection?.id,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
event instanceof NavigationEnd ||
|
||||
event instanceof NavigationCancel ||
|
||||
event instanceof NavigationError
|
||||
) {
|
||||
this.currentTarget.set(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** True while resolving a URL that starts with `path` from outside `path`. */
|
||||
isResolvingFromOutside(path: string): boolean {
|
||||
const target = this.currentTarget();
|
||||
if (!target || !matchesPath(target.url, path)) return false;
|
||||
return !matchesPath(target.fromUrl, path);
|
||||
}
|
||||
|
||||
/** True while resolving a URL that stays inside `path`. */
|
||||
isResolvingInside(path: string): boolean {
|
||||
const target = this.currentTarget();
|
||||
if (!target || !matchesPath(target.url, path)) return false;
|
||||
return matchesPath(target.fromUrl, path);
|
||||
}
|
||||
}
|
||||
|
||||
function matchesPath(url: string | null, prefix: string): boolean {
|
||||
if (!url) return false;
|
||||
const path = pathOf(url);
|
||||
return path === prefix || path.startsWith(`${prefix}/`);
|
||||
}
|
||||
|
||||
function hasResolvers(state: RouterStateSnapshot): boolean {
|
||||
let route: ActivatedRouteSnapshot | null = state.root;
|
||||
while (route) {
|
||||
if (Object.keys(route.routeConfig?.resolve ?? {}).length > 0) return true;
|
||||
route = route.firstChild;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
import { Injectable, signal, inject, computed } from '@angular/core';
|
||||
import { Router, RouterEvent, ActivatedRoute } from '@angular/router';
|
||||
import { toSignal } from '@angular/core/rxjs-interop';
|
||||
import { ResolveEnd, ResolveStart } from '@angular/router';
|
||||
import {
|
||||
NavigationEnd,
|
||||
NavigationError,
|
||||
NavigationCancel,
|
||||
} from '@angular/router';
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class ResolverStateService {
|
||||
private readonly router = inject(Router);
|
||||
|
||||
readonly resolvingUrl = signal<string | null>(null);
|
||||
readonly previousUrl = signal<string | null>(null);
|
||||
|
||||
readonly isResolving = computed(() => this.resolvingUrl() !== null);
|
||||
|
||||
constructor() {
|
||||
this.router.events.subscribe((event) => {
|
||||
if (event instanceof ResolveStart) {
|
||||
this.previousUrl.set(this.router.url); // capture current before it changes
|
||||
this.resolvingUrl.set(event.url);
|
||||
}
|
||||
|
||||
if (
|
||||
event instanceof NavigationEnd ||
|
||||
event instanceof NavigationCancel ||
|
||||
event instanceof NavigationError
|
||||
) {
|
||||
this.resolvingUrl.set(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
isResolvingFromOutside(path: string) {
|
||||
const from = this.previousUrl();
|
||||
const to = this.resolvingUrl();
|
||||
if (!to?.startsWith(path)) return false;
|
||||
return !from?.startsWith(path); // came from outside
|
||||
}
|
||||
|
||||
isResolvingInside(path: string) {
|
||||
const from = this.previousUrl();
|
||||
const to = this.resolvingUrl();
|
||||
if (to?.startsWith(path) && from?.startsWith(path)) return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -56,62 +56,13 @@
|
||||
</mat-toolbar>
|
||||
}
|
||||
|
||||
<main class="content" #contentScroller>
|
||||
<main class="content" #contentScroller tabindex="-1">
|
||||
<div class="main-content-body">
|
||||
@if (resolverState.isResolvingFromOutside('/persons')) {
|
||||
<app-loading
|
||||
text="Personenliste wird geladen..."
|
||||
[icon]="PERSONS_ICON"
|
||||
[size]="200"
|
||||
[diameter]="200" />
|
||||
} @else if (resolverState.isResolvingFromOutside('/person')) {
|
||||
<app-loading
|
||||
text="Personendaten werden geladen..."
|
||||
[icon]="PERSON_ICON"
|
||||
[size]="200"
|
||||
[diameter]="200" />
|
||||
} @else if (resolverState.isResolvingFromOutside('/publications')) {
|
||||
<app-loading
|
||||
text="Publikationsdaten werden geladen..."
|
||||
[icon]="PUBLICATION_ICON"
|
||||
[size]="200"
|
||||
[diameter]="200" />
|
||||
} @else if (resolverState.isResolvingFromOutside('/projects')) {
|
||||
<app-loading
|
||||
text="Projektdaten werden geladen..."
|
||||
[icon]="PROJECT_ICON"
|
||||
[size]="200"
|
||||
[diameter]="200" />
|
||||
} @else if (resolverState.isResolvingFromOutside('/institutions')) {
|
||||
<app-loading
|
||||
text="Institutionen werden geladen..."
|
||||
[icon]="INSTITUTION_ICON"
|
||||
[size]="200"
|
||||
[diameter]="200" />
|
||||
} @else if (resolverState.isResolvingFromOutside('/patents')) {
|
||||
<app-loading
|
||||
text="Patente werden geladen..."
|
||||
[icon]="PATENT_ICON"
|
||||
[size]="200"
|
||||
[diameter]="200" />
|
||||
} @else if (resolverState.isResolvingFromOutside('/news')) {
|
||||
<app-loading
|
||||
text="Nachrichten werden geladen..."
|
||||
[icon]="NEWS_ICON"
|
||||
[size]="200"
|
||||
[diameter]="200" />
|
||||
} @else if (resolverState.isResolvingFromOutside('/topics')) {
|
||||
<app-loading
|
||||
text="Themen werden geladen..."
|
||||
[icon]="TOPIC_ICON"
|
||||
[size]="200"
|
||||
[diameter]="200" />
|
||||
} @else if (resolverState.isResolvingFromOutside('/hierarchy')) {
|
||||
<app-loading
|
||||
text="Hierarchie werden geladen..."
|
||||
[icon]="HIERARCHY_ICON"
|
||||
[size]="200"
|
||||
[diameter]="200" />
|
||||
@if (navigationState.skeleton(); as skeleton) {
|
||||
<app-page-skeleton
|
||||
[label]="skeleton.loadingText"
|
||||
[icon]="skeleton.icon"
|
||||
[variant]="skeleton.skeleton" />
|
||||
} @else {
|
||||
<ng-content></ng-content>
|
||||
}
|
||||
|
||||
@@ -25,24 +25,16 @@ import { AppMenuComponent } from '../app-menu/app-menu.component';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { CredentialService } from '../../services/credential.service';
|
||||
import { AppSearchbarComponent } from '../app-searchbar/app-searchbar.component';
|
||||
import { ResolverStateService } from '../../services/resolver-state.service';
|
||||
import { NavigationStateService } from '../../services/navigation-state.service';
|
||||
import { NavigationFocusService } from '../../services/navigation-focus.service';
|
||||
import { BackNavigationService } from '../../services/back-navigation.service';
|
||||
import { PageTitleService } from '../../services/page-title.service';
|
||||
import { RouteScrollService } from '../../services/route-scroll.service';
|
||||
import { LoadingComponent } from '../loading/loading.component';
|
||||
import { PageSkeletonComponent } from '../page-skeleton/page-skeleton.component';
|
||||
import {
|
||||
ARROW_BACK_ICON,
|
||||
INSTITUTION_ICON,
|
||||
MENU_ICON,
|
||||
NEWS_ICON,
|
||||
PATENT_ICON,
|
||||
PERSONS_ICON,
|
||||
PERSON_ICON,
|
||||
PROJECT_ICON,
|
||||
PUBLICATION_ICON,
|
||||
SWITCH_ACCOUNT_ICON,
|
||||
TOPIC_ICON,
|
||||
HIERARCHY_ICON,
|
||||
} from '../icons';
|
||||
|
||||
@Component({
|
||||
@@ -56,7 +48,7 @@ import {
|
||||
AppMenuComponent,
|
||||
MatTooltipModule,
|
||||
AppSearchbarComponent,
|
||||
LoadingComponent,
|
||||
PageSkeletonComponent,
|
||||
],
|
||||
templateUrl: './app-layout.component.html',
|
||||
styleUrl: './app-layout.component.scss',
|
||||
@@ -66,28 +58,21 @@ export class AppLayoutComponent implements OnInit, OnDestroy {
|
||||
readonly SWITCH_ACCOUNT_ICON = SWITCH_ACCOUNT_ICON;
|
||||
readonly MENU_ICON = MENU_ICON;
|
||||
readonly ARROW_BACK_ICON = ARROW_BACK_ICON;
|
||||
readonly PERSONS_ICON = PERSONS_ICON;
|
||||
readonly PERSON_ICON = PERSON_ICON;
|
||||
readonly PUBLICATION_ICON = PUBLICATION_ICON;
|
||||
readonly PROJECT_ICON = PROJECT_ICON;
|
||||
readonly INSTITUTION_ICON = INSTITUTION_ICON;
|
||||
readonly PATENT_ICON = PATENT_ICON;
|
||||
readonly NEWS_ICON = NEWS_ICON;
|
||||
readonly HIERARCHY_ICON = HIERARCHY_ICON;
|
||||
readonly TOPIC_ICON = TOPIC_ICON;
|
||||
|
||||
@ViewChild(MatDrawer, { static: false })
|
||||
drawer?: MatDrawer;
|
||||
|
||||
mediaQuery: MediaQueryList;
|
||||
protected resolverState = inject(ResolverStateService);
|
||||
protected navigationState = inject(NavigationStateService);
|
||||
mediaQueryListener: () => void;
|
||||
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
private readonly backNavigation = inject(BackNavigationService);
|
||||
private readonly scrollService = inject(RouteScrollService);
|
||||
// Instantiated for its router subscription; keeps document.title in sync.
|
||||
// Instantiated for their router subscriptions; keeps document.title in sync
|
||||
// and moves focus to the new page heading after navigation.
|
||||
private readonly pageTitle = inject(PageTitleService);
|
||||
private readonly navigationFocus = inject(NavigationFocusService);
|
||||
private readonly contentScroller =
|
||||
viewChild<ElementRef<HTMLElement>>('contentScroller');
|
||||
private readonly currentPath = signal('/');
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
<mat-divider />
|
||||
@let pageValue = page();
|
||||
<div class="card-search-results" [attr.aria-busy]="loading()">
|
||||
<app-live-region [text]="resultAnnouncement()" />
|
||||
@if (loading()) {
|
||||
<div
|
||||
class="loading-overlay"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, input, TemplateRef } from '@angular/core';
|
||||
import { Component, computed, input, TemplateRef } from '@angular/core';
|
||||
import { QueryParamInputComponent } from '../query-param-input/query-param-input.component';
|
||||
import {
|
||||
QueryParamSelectorComponent,
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
FilterObserver,
|
||||
SelectedFiltersComponent,
|
||||
} from '../selected-filters/selected-filters.component';
|
||||
import { LiveRegionComponent } from '../live-region/live-region.component';
|
||||
|
||||
export type Page = {
|
||||
page: number;
|
||||
@@ -30,6 +31,7 @@ export type Page = {
|
||||
NgTemplateOutlet,
|
||||
MatProgressSpinnerModule,
|
||||
SelectedFiltersComponent,
|
||||
LiveRegionComponent,
|
||||
],
|
||||
templateUrl: './card-search.component.html',
|
||||
styleUrl: './card-search.component.scss',
|
||||
@@ -55,4 +57,12 @@ export class CardSearchComponent {
|
||||
sortingDirectionOptions = input<SelectorOption[]>();
|
||||
sortingDirectionQueryParamKey = input<string>('sorting_order');
|
||||
sortingDirectionLabel = input<string>('Sortierreihenfolge');
|
||||
|
||||
/** Announced to screen readers whenever a new result set is rendered. */
|
||||
readonly resultAnnouncement = computed(() => {
|
||||
if (this.loading()) return '';
|
||||
const total = this.page().total ?? 0;
|
||||
if (total === 0) return 'Keine Ergebnisse';
|
||||
return total === 1 ? '1 Ergebnis' : `${total} Ergebnisse`;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import { Component, effect, input, signal } from '@angular/core';
|
||||
|
||||
/**
|
||||
* Visually hidden live region. Screen readers announce text changes, while
|
||||
* sighted users see the normal result count elsewhere on the page.
|
||||
*
|
||||
* The text is applied in the next frame so that the region is already part of
|
||||
* the accessibility tree when its content changes. Screen readers then treat
|
||||
* it as an update and announce it, including on the first render.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-live-region',
|
||||
template: `<span
|
||||
class="visually-hidden"
|
||||
aria-live="polite"
|
||||
aria-atomic="true"
|
||||
>{{ announcement() }}</span
|
||||
>`,
|
||||
})
|
||||
export class LiveRegionComponent {
|
||||
readonly text = input('');
|
||||
|
||||
private readonly pending = signal('');
|
||||
readonly announcement = this.pending.asReadonly();
|
||||
|
||||
constructor() {
|
||||
effect((onCleanup) => {
|
||||
const text = this.text();
|
||||
const handle = requestAnimationFrame(() => this.pending.set(text));
|
||||
onCleanup(() => cancelAnimationFrame(handle));
|
||||
});
|
||||
}
|
||||
}
|
||||
+6
-1
@@ -1,4 +1,9 @@
|
||||
:host {
|
||||
display: block;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.multiplier-graph {
|
||||
width: 100%;
|
||||
height: 480px; // fallback; the component's `height` input overrides it
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
+96
-19
@@ -1,4 +1,15 @@
|
||||
import { Component, computed, inject, input, output } from '@angular/core';
|
||||
import {
|
||||
afterNextRender,
|
||||
Component,
|
||||
computed,
|
||||
DestroyRef,
|
||||
ElementRef,
|
||||
inject,
|
||||
input,
|
||||
NgZone,
|
||||
output,
|
||||
signal,
|
||||
} from '@angular/core';
|
||||
import { EgoNetwork, EgoNetworkEdge, EgoNetworkNode } from '../../../api';
|
||||
import { EChartsCoreOption } from 'echarts';
|
||||
import { NgxEchartsDirective } from 'ngx-echarts';
|
||||
@@ -63,11 +74,61 @@ export function multiplierRoleColor(role: string, dark: boolean): string {
|
||||
})
|
||||
export class MultiplierNetworkGraphComponent {
|
||||
readonly network = input.required<EgoNetwork>();
|
||||
/** Chart height in pixels. */
|
||||
readonly height = input<number>(480);
|
||||
/** Fixed chart height in pixels. Omit to fill the parent element. */
|
||||
readonly height = input<number>();
|
||||
readonly nodeClick = output<MultiplierNodeClickEvent>();
|
||||
|
||||
private readonly chartTheme = inject(ChartThemeService);
|
||||
private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
private readonly zone = inject(NgZone);
|
||||
|
||||
/** Rounded container width, used to adapt the force layout to small screens. */
|
||||
private readonly containerWidth = signal(0);
|
||||
/** Touch devices get pinch-zoom only, so one-finger swipes can scroll the page. */
|
||||
private readonly coarsePointer = signal(false);
|
||||
|
||||
private readonly compact = computed(() => {
|
||||
const width = this.containerWidth();
|
||||
return width > 0 && width < 560;
|
||||
});
|
||||
|
||||
private readonly medium = computed(() => {
|
||||
const width = this.containerWidth();
|
||||
return width >= 560 && width < 960;
|
||||
});
|
||||
|
||||
constructor() {
|
||||
if (typeof window !== 'undefined' && window.matchMedia) {
|
||||
const query = window.matchMedia('(pointer: coarse)');
|
||||
this.coarsePointer.set(query.matches);
|
||||
const onChange = (event: MediaQueryListEvent) =>
|
||||
this.coarsePointer.set(event.matches);
|
||||
query.addEventListener('change', onChange);
|
||||
this.destroyRef.onDestroy(() =>
|
||||
query.removeEventListener('change', onChange),
|
||||
);
|
||||
}
|
||||
|
||||
afterNextRender(() => {
|
||||
const host = this.host.nativeElement;
|
||||
const measure = () => {
|
||||
const width = Math.round(host.getBoundingClientRect().width);
|
||||
// Quantize so small resizes don't restart the force layout every frame.
|
||||
const bucket = Math.round(width / 40) * 40;
|
||||
if (bucket !== this.containerWidth()) {
|
||||
this.containerWidth.set(bucket);
|
||||
}
|
||||
};
|
||||
|
||||
this.zone.run(measure);
|
||||
|
||||
if (typeof ResizeObserver !== 'function') return;
|
||||
const observer = new ResizeObserver(() => this.zone.run(measure));
|
||||
observer.observe(host);
|
||||
this.destroyRef.onDestroy(() => observer.disconnect());
|
||||
});
|
||||
}
|
||||
|
||||
private roleColor(role: string): string {
|
||||
return multiplierRoleColor(role, this.chartTheme.isDark());
|
||||
@@ -79,8 +140,19 @@ export class MultiplierNetworkGraphComponent {
|
||||
if (!network) return {};
|
||||
|
||||
const textColor = colors.text;
|
||||
const nodes = this.buildNodes(network.nodes ?? []);
|
||||
const links = this.buildLinks(network.edges ?? []);
|
||||
const compact = this.compact();
|
||||
const medium = this.medium();
|
||||
const nodes = this.buildNodes(network.nodes ?? [], compact);
|
||||
const links = this.buildLinks(network.edges ?? [], compact);
|
||||
|
||||
// Force layouts spread nodes over a fixed pixel area, so a narrower
|
||||
// container needs a tighter layout or most of the network ends up
|
||||
// off-screen.
|
||||
const force = compact
|
||||
? { repulsion: 620, edgeLength: [38, 85], friction: 0.3, gravity: 0.2 }
|
||||
: medium
|
||||
? { repulsion: 1000, edgeLength: [55, 120], friction: 0.25, gravity: 0.14 }
|
||||
: { repulsion: 1400, edgeLength: [70, 150], friction: 0.25, gravity: 0.1 };
|
||||
|
||||
return {
|
||||
tooltip: {
|
||||
@@ -116,21 +188,18 @@ export class MultiplierNetworkGraphComponent {
|
||||
layout: 'force',
|
||||
data: nodes,
|
||||
links,
|
||||
roam: true,
|
||||
// On touch screens only pinch-zoom, so a one-finger swipe still
|
||||
// scrolls the page instead of panning the graph.
|
||||
roam: this.coarsePointer() ? 'scale' : true,
|
||||
roamTrigger: 'global',
|
||||
scaleLimit: { min: 0.4, max: 4 },
|
||||
label: {
|
||||
show: false,
|
||||
position: 'right',
|
||||
color: textColor,
|
||||
fontSize: 11,
|
||||
},
|
||||
force: {
|
||||
repulsion: 1400,
|
||||
edgeLength: [70, 150],
|
||||
friction: 0.25,
|
||||
gravity: 0.1,
|
||||
fontSize: compact ? 10 : 11,
|
||||
},
|
||||
force,
|
||||
emphasis: {
|
||||
focus: 'adjacency',
|
||||
label: { show: true, color: textColor, fontWeight: 'bold' },
|
||||
@@ -143,7 +212,7 @@ export class MultiplierNetworkGraphComponent {
|
||||
},
|
||||
lineStyle: {
|
||||
color: colors.mutedTextColor,
|
||||
opacity: 0.45,
|
||||
opacity: compact ? 0.32 : 0.45,
|
||||
curveness: 0,
|
||||
},
|
||||
},
|
||||
@@ -151,7 +220,7 @@ export class MultiplierNetworkGraphComponent {
|
||||
};
|
||||
});
|
||||
|
||||
private buildNodes(nodes: EgoNetworkNode[]): any[] {
|
||||
private buildNodes(nodes: EgoNetworkNode[], compact: boolean): any[] {
|
||||
const textColor = this.chartTheme.colors().text;
|
||||
const nWorks = this.network().n_works ?? undefined;
|
||||
return nodes.map((node) => {
|
||||
@@ -165,7 +234,13 @@ export class MultiplierNetworkGraphComponent {
|
||||
inst: node.inst ?? '',
|
||||
activeYears,
|
||||
nWorks: isEgo ? nWorks : undefined,
|
||||
symbolSize: isEgo ? 24 : clamp(8 + activeYears * 1.1, 8, 26),
|
||||
symbolSize: isEgo
|
||||
? compact
|
||||
? 22
|
||||
: 24
|
||||
: compact
|
||||
? clamp(9 + activeYears, 9, 22)
|
||||
: clamp(8 + activeYears * 1.1, 8, 26),
|
||||
itemStyle: {
|
||||
color: this.roleColor(role),
|
||||
borderColor: isEgo ? textColor : 'transparent',
|
||||
@@ -176,13 +251,13 @@ export class MultiplierNetworkGraphComponent {
|
||||
formatter: '{b}',
|
||||
position: 'right',
|
||||
color: textColor,
|
||||
fontSize: 12,
|
||||
fontSize: compact ? 11 : 12,
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
private buildLinks(edges: EgoNetworkEdge[]): any[] {
|
||||
private buildLinks(edges: EgoNetworkEdge[], compact: boolean): any[] {
|
||||
const names = new Map<string, string>();
|
||||
for (const node of this.network().nodes ?? []) {
|
||||
names.set(node.id, node.name ?? node.id);
|
||||
@@ -197,7 +272,9 @@ export class MultiplierNetworkGraphComponent {
|
||||
firstYear: edge.first_year,
|
||||
lastYear: edge.last_year,
|
||||
lineStyle: {
|
||||
width: clamp((edge.w ?? 0) * 2.5, 1, 7),
|
||||
width: compact
|
||||
? clamp((edge.w ?? 0) * 1.8, 1, 4.5)
|
||||
: clamp((edge.w ?? 0) * 2.5, 1, 7),
|
||||
type: edge.cross ? 'dashed' : 'solid',
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -0,0 +1,316 @@
|
||||
<div
|
||||
class="page-skeleton"
|
||||
[class.page-skeleton--compact]="compact()"
|
||||
role="status"
|
||||
[attr.aria-label]="compact() ? label() : null"
|
||||
aria-busy="true">
|
||||
@if (!compact()) {
|
||||
<div class="page-skeleton__status">
|
||||
<mat-icon aria-hidden="true">{{ icon() }}</mat-icon>
|
||||
<span>{{ label() }}</span>
|
||||
</div>
|
||||
|
||||
<div class="page-skeleton__header" aria-hidden="true">
|
||||
<span class="sk-bar sk-bar--eyebrow"></span>
|
||||
<span class="sk-bar sk-bar--title"></span>
|
||||
<span class="sk-bar sk-bar--subtitle"></span>
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="page-skeleton__body" aria-hidden="true">
|
||||
@switch (variant()) {
|
||||
@case ('cards') {
|
||||
<ng-container [ngTemplateOutlet]="filters" />
|
||||
<ng-container [ngTemplateOutlet]="cards" />
|
||||
}
|
||||
@case ('cards-plain') {
|
||||
<ng-container [ngTemplateOutlet]="cardsGrid" />
|
||||
}
|
||||
@case ('cards-sidebar') {
|
||||
<ng-container [ngTemplateOutlet]="filters" />
|
||||
<div class="sk-split">
|
||||
<div class="sk-split__main">
|
||||
<ng-container [ngTemplateOutlet]="cards" />
|
||||
</div>
|
||||
<div class="sk-panel sk-panel--sidebar">
|
||||
<span class="sk-bar sk-bar--section-title"></span>
|
||||
@for (row of [1, 2, 3, 4, 5, 6, 7]; track row) {
|
||||
<span class="sk-bar sk-bar--filter"></span>
|
||||
}
|
||||
<span class="sk-bar sk-bar--button"></span>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@case ('table') {
|
||||
<ng-container [ngTemplateOutlet]="filters" />
|
||||
<ng-container [ngTemplateOutlet]="table" />
|
||||
}
|
||||
@case ('table-stats') {
|
||||
<div class="sk-kpis">
|
||||
@for (tile of [1, 2, 3]; track tile) {
|
||||
<div class="sk-kpi">
|
||||
<span class="sk-bar sk-bar--kpi-label"></span>
|
||||
<span class="sk-bar sk-bar--kpi-value"></span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<ng-container [ngTemplateOutlet]="filters" />
|
||||
<ng-container [ngTemplateOutlet]="table" />
|
||||
}
|
||||
@case ('detail') {
|
||||
<ng-container [ngTemplateOutlet]="hero" />
|
||||
<ng-container [ngTemplateOutlet]="tabs" />
|
||||
<div class="sk-detail">
|
||||
<div class="sk-panel">
|
||||
<span class="sk-bar sk-bar--section-title"></span>
|
||||
@for (row of [1, 2, 3, 4, 5, 6]; track row) {
|
||||
<span class="sk-bar"></span>
|
||||
}
|
||||
</div>
|
||||
<div class="sk-panel">
|
||||
<span class="sk-bar sk-bar--section-title"></span>
|
||||
@for (row of [1, 2, 3, 4]; track row) {
|
||||
<span class="sk-bar sk-bar--short"></span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@case ('detail-table') {
|
||||
<ng-container [ngTemplateOutlet]="hero" />
|
||||
<ng-container [ngTemplateOutlet]="tabs" />
|
||||
<div class="sk-detail">
|
||||
<div class="sk-panel">
|
||||
<span class="sk-bar sk-bar--section-title"></span>
|
||||
<div class="sk-table sk-table--compact">
|
||||
<div class="sk-table__row sk-table__row--head">
|
||||
<span class="sk-bar"></span><span class="sk-bar"></span
|
||||
><span class="sk-bar"></span>
|
||||
</div>
|
||||
@for (row of [1, 2, 3, 4, 5]; track row) {
|
||||
<div class="sk-table__row">
|
||||
<span class="sk-bar"></span><span class="sk-bar"></span
|
||||
><span class="sk-bar"></span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="sk-panel">
|
||||
<span class="sk-bar sk-bar--section-title"></span>
|
||||
@for (row of [1, 2, 3]; track row) {
|
||||
<span class="sk-bar sk-bar--short"></span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@case ('detail-chart') {
|
||||
<ng-container [ngTemplateOutlet]="hero" />
|
||||
<ng-container [ngTemplateOutlet]="tabs" />
|
||||
<div class="sk-detail">
|
||||
<div class="sk-panel">
|
||||
<span class="sk-bar sk-bar--section-title"></span>
|
||||
<ng-container [ngTemplateOutlet]="chart" />
|
||||
@for (row of [1, 2]; track row) {
|
||||
<span class="sk-bar"></span>
|
||||
}
|
||||
</div>
|
||||
<div class="sk-panel">
|
||||
<span class="sk-bar sk-bar--section-title"></span>
|
||||
@for (row of [1, 2, 3]; track row) {
|
||||
<span class="sk-bar sk-bar--short"></span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@case ('comparison') {
|
||||
<div class="sk-chips">
|
||||
@for (chip of [1, 2, 3]; track chip) {
|
||||
<span class="sk-bar sk-bar--chip"></span>
|
||||
}
|
||||
</div>
|
||||
<div class="sk-compare-tables">
|
||||
@for (panel of [1, 2]; track panel) {
|
||||
<div class="sk-panel">
|
||||
<span class="sk-bar sk-bar--section-title"></span>
|
||||
<div class="sk-table sk-table--compact sk-table--two-col">
|
||||
<div class="sk-table__row sk-table__row--head">
|
||||
<span class="sk-bar"></span><span class="sk-bar"></span>
|
||||
</div>
|
||||
@for (row of [1, 2, 3, 4]; track row) {
|
||||
<div class="sk-table__row">
|
||||
<span class="sk-bar"></span><span class="sk-bar"></span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="sk-chart-grid">
|
||||
@for (panel of [1, 2]; track panel) {
|
||||
<div class="sk-panel">
|
||||
<span class="sk-bar sk-bar--section-title"></span>
|
||||
<ng-container [ngTemplateOutlet]="chart" />
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="sk-panel">
|
||||
<span class="sk-bar sk-bar--section-title"></span>
|
||||
@for (row of [1, 2, 3]; track row) {
|
||||
<span class="sk-bar"></span>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@case ('dashboard') {
|
||||
<div class="sk-chips">
|
||||
@for (chip of [1, 2, 3, 4]; track chip) {
|
||||
<span class="sk-bar sk-bar--chip"></span>
|
||||
}
|
||||
</div>
|
||||
<div class="sk-kpis sk-kpis--many">
|
||||
@for (tile of [1, 2, 3, 4, 5, 6, 7, 8]; track tile) {
|
||||
<div class="sk-kpi">
|
||||
<span class="sk-bar sk-bar--kpi-label"></span>
|
||||
<span class="sk-bar sk-bar--kpi-value"></span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="sk-chart-grid">
|
||||
@for (panel of [1, 2, 3, 4]; track panel) {
|
||||
<div class="sk-panel">
|
||||
<span class="sk-bar sk-bar--section-title"></span>
|
||||
<ng-container [ngTemplateOutlet]="chart" />
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@case ('tree') {
|
||||
<div class="sk-accordion">
|
||||
@for (panel of [1, 2, 3]; track panel) {
|
||||
<span class="sk-bar sk-bar--accordion"></span>
|
||||
}
|
||||
</div>
|
||||
<div class="sk-panel sk-tree">
|
||||
@for (node of [0, 1, 2, 3, 4, 5]; track node) {
|
||||
<span
|
||||
class="sk-tree__node"
|
||||
[style.margin-left.px]="node * 22"></span>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@case ('form') {
|
||||
<ng-container [ngTemplateOutlet]="tabs" />
|
||||
<div class="sk-form">
|
||||
@for (field of [1, 2, 3]; track field) {
|
||||
<span class="sk-bar sk-bar--field"></span>
|
||||
}
|
||||
<span class="sk-bar sk-bar--button"></span>
|
||||
</div>
|
||||
<div class="sk-matrix">
|
||||
@for (cell of [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; track cell) {
|
||||
<span class="sk-bar sk-bar--chip"></span>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@case ('graph') {
|
||||
<div class="sk-graph">
|
||||
<span class="sk-graph__node sk-graph__node--center"></span>
|
||||
@for (node of nodes; track node.x) {
|
||||
<span
|
||||
class="sk-graph__node"
|
||||
[style.left.%]="node.x"
|
||||
[style.top.%]="node.y"></span>
|
||||
}
|
||||
</div>
|
||||
<div class="sk-chips">
|
||||
@for (chip of [1, 2, 3]; track chip) {
|
||||
<span class="sk-bar sk-bar--chip"></span>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Shared blocks: these mirror the structure of the real page components. -->
|
||||
<ng-template #filters>
|
||||
<div class="sk-filters">
|
||||
<span class="sk-bar sk-bar--search"></span>
|
||||
<span class="sk-bar sk-bar--select"></span>
|
||||
<span class="sk-bar sk-bar--select"></span>
|
||||
</div>
|
||||
<div class="sk-toolbar">
|
||||
<span class="sk-bar sk-bar--toolbar"></span>
|
||||
<span class="sk-bar sk-bar--select"></span>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #cards>
|
||||
<ng-container [ngTemplateOutlet]="cardsGrid" />
|
||||
<div class="sk-pagination">
|
||||
<span class="sk-bar sk-bar--pagination"></span>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #cardsGrid>
|
||||
<div class="sk-cards" [style.--sk-card-min-width.px]="cardMinWidth()">
|
||||
@for (card of [1, 2, 3, 4, 5, 6]; track card) {
|
||||
<div class="sk-card">
|
||||
<span class="sk-bar sk-bar--card-title"></span>
|
||||
<span class="sk-bar"></span>
|
||||
<span class="sk-bar"></span>
|
||||
<span class="sk-bar sk-bar--short"></span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #table>
|
||||
<div class="sk-table">
|
||||
<div class="sk-table__row sk-table__row--head">
|
||||
<span class="sk-bar"></span><span class="sk-bar"></span
|
||||
><span class="sk-bar"></span><span class="sk-bar"></span>
|
||||
</div>
|
||||
@for (row of [1, 2, 3, 4, 5, 6, 7]; track row) {
|
||||
<div class="sk-table__row">
|
||||
<span class="sk-bar"></span><span class="sk-bar"></span
|
||||
><span class="sk-bar"></span><span class="sk-bar"></span>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="sk-pagination">
|
||||
<span class="sk-bar sk-bar--pagination"></span>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #hero>
|
||||
<div class="sk-hero">
|
||||
<span class="sk-avatar"></span>
|
||||
<div class="sk-hero__copy">
|
||||
<span class="sk-bar sk-bar--title"></span>
|
||||
<span class="sk-bar sk-bar--subtitle"></span>
|
||||
<div class="sk-chips">
|
||||
@for (chip of [1, 2, 3]; track chip) {
|
||||
<span class="sk-bar sk-bar--chip"></span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #tabs>
|
||||
<div class="sk-tabs">
|
||||
@for (tab of [1, 2, 3, 4]; track tab) {
|
||||
<span class="sk-bar sk-bar--tab"></span>
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
<ng-template #chart>
|
||||
<div class="sk-chart">
|
||||
<span class="sk-chart__axis"></span>
|
||||
<div class="sk-chart__bars">
|
||||
@for (height of [45, 68, 52, 88, 61, 76, 48, 70]; track $index) {
|
||||
<span class="sk-chart__bar" [style.height.%]="height"></span>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
@@ -0,0 +1,522 @@
|
||||
:host {
|
||||
display: block;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.page-skeleton {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
padding: clamp(8px, 1.4vw, 18px);
|
||||
|
||||
&--compact {
|
||||
gap: 0;
|
||||
padding: 0;
|
||||
|
||||
.page-skeleton__body {
|
||||
margin-top: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.page-skeleton__status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
color: var(--sg-text-soft);
|
||||
font-size: 13px;
|
||||
|
||||
mat-icon {
|
||||
flex: none;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
.page-skeleton__header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.page-skeleton__body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
/* Shimmer bars ------------------------------------------------------------ */
|
||||
.sk-bar {
|
||||
display: block;
|
||||
flex: none;
|
||||
height: 12px;
|
||||
border-radius: 6px;
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
var(--sg-skeleton-base) 25%,
|
||||
var(--sg-skeleton-highlight) 50%,
|
||||
var(--sg-skeleton-base) 75%
|
||||
);
|
||||
background-size: 600px 100%;
|
||||
animation: page-skeleton-shimmer 1.6s infinite linear;
|
||||
|
||||
&--eyebrow {
|
||||
width: 180px;
|
||||
max-width: 40%;
|
||||
height: 9px;
|
||||
}
|
||||
|
||||
&--title {
|
||||
width: 360px;
|
||||
max-width: 60%;
|
||||
height: 26px;
|
||||
}
|
||||
|
||||
&--subtitle {
|
||||
width: 520px;
|
||||
max-width: 80%;
|
||||
}
|
||||
|
||||
&--section-title {
|
||||
width: 220px;
|
||||
max-width: 50%;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
&--card-title {
|
||||
width: 60%;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
&--short {
|
||||
width: 45%;
|
||||
}
|
||||
|
||||
&--search {
|
||||
width: min(360px, 40%);
|
||||
height: 36px;
|
||||
border-radius: 18px;
|
||||
}
|
||||
|
||||
&--select,
|
||||
&--field {
|
||||
width: 180px;
|
||||
max-width: 30%;
|
||||
height: 36px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
&--toolbar {
|
||||
width: 220px;
|
||||
max-width: 35%;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
&--filter {
|
||||
width: 100%;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
&--button {
|
||||
width: 140px;
|
||||
height: 34px;
|
||||
border-radius: 8px;
|
||||
background: color-mix(in srgb, var(--sg-primary, #345) 25%, transparent);
|
||||
}
|
||||
|
||||
&--chip {
|
||||
width: 86px;
|
||||
height: 24px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
&--tab {
|
||||
width: 110px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
&--accordion {
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
&--kpi-label {
|
||||
width: 70%;
|
||||
height: 9px;
|
||||
}
|
||||
|
||||
&--kpi-value {
|
||||
width: 50%;
|
||||
height: 22px;
|
||||
}
|
||||
|
||||
&--pagination {
|
||||
width: 280px;
|
||||
max-width: 60%;
|
||||
height: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Search/filter/toolbar rows of list pages -------------------------------- */
|
||||
.sk-filters,
|
||||
.sk-toolbar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.sk-toolbar {
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.sk-chips {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.sk-pagination {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
/* Card grids -------------------------------------------------------------- */
|
||||
.sk-cards {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(
|
||||
auto-fill,
|
||||
minmax(var(--sk-card-min-width, 260px), 1fr)
|
||||
);
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.sk-card {
|
||||
display: flex;
|
||||
min-height: 130px;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
padding: 18px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 12px;
|
||||
background: var(--sg-surface-muted);
|
||||
}
|
||||
|
||||
/* Person list: grid plus filter sidebar ----------------------------------- */
|
||||
.sk-split {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
|
||||
gap: 20px;
|
||||
|
||||
&__main {
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Tables ------------------------------------------------------------------ */
|
||||
.sk-table {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 12px;
|
||||
background: var(--sg-surface-muted);
|
||||
|
||||
&--compact .sk-table__row {
|
||||
grid-template-columns: 2fr 1fr 0.6fr;
|
||||
padding: 10px 14px;
|
||||
}
|
||||
|
||||
&--two-col .sk-table__row {
|
||||
grid-template-columns: 1fr 2fr;
|
||||
}
|
||||
}
|
||||
|
||||
.sk-compare-tables {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.sk-table__row {
|
||||
display: grid;
|
||||
grid-template-columns: 2fr 1fr 1fr 0.6fr;
|
||||
gap: 16px;
|
||||
padding: 14px 18px;
|
||||
|
||||
& + & {
|
||||
border-top: 1px solid var(--sg-border);
|
||||
}
|
||||
|
||||
&--head {
|
||||
background: var(--sg-surface-soft);
|
||||
}
|
||||
}
|
||||
|
||||
/* Detail pages: hero, tabs, main + aside ---------------------------------- */
|
||||
.sk-hero {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 18px;
|
||||
padding: 18px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 12px;
|
||||
background: var(--sg-surface-muted);
|
||||
|
||||
&__copy {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.sk-avatar {
|
||||
flex: none;
|
||||
width: 64px;
|
||||
height: 64px;
|
||||
border-radius: 50%;
|
||||
background: var(--sg-skeleton-base);
|
||||
animation: page-skeleton-pulse 1.6s infinite ease-in-out;
|
||||
}
|
||||
|
||||
.sk-tabs {
|
||||
display: flex;
|
||||
gap: 18px;
|
||||
padding-bottom: 8px;
|
||||
border-bottom: 1px solid var(--sg-border);
|
||||
}
|
||||
|
||||
.sk-detail {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.sk-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
padding: 18px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 12px;
|
||||
background: var(--sg-surface-muted);
|
||||
|
||||
.sk-table {
|
||||
margin-top: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Dashboard: KPI tiles + chart panels ------------------------------------- */
|
||||
.sk-kpis {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
||||
gap: 12px;
|
||||
|
||||
&--many {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
.sk-kpi {
|
||||
display: flex;
|
||||
min-height: 78px;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
padding: 14px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 12px;
|
||||
background: var(--sg-surface-muted);
|
||||
}
|
||||
|
||||
.sk-chart-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.sk-chart {
|
||||
display: flex;
|
||||
height: 170px;
|
||||
align-items: flex-end;
|
||||
gap: 10px;
|
||||
padding: 12px 4px 0;
|
||||
|
||||
&__axis {
|
||||
align-self: stretch;
|
||||
width: 1px;
|
||||
background: var(--sg-border);
|
||||
}
|
||||
|
||||
&__bars {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
flex: 1;
|
||||
align-items: flex-end;
|
||||
justify-content: space-around;
|
||||
gap: 8px;
|
||||
border-bottom: 1px solid var(--sg-border);
|
||||
}
|
||||
|
||||
&__bar {
|
||||
width: min(32px, 8%);
|
||||
border-radius: 4px 4px 0 0;
|
||||
background: var(--sg-skeleton-base);
|
||||
animation: page-skeleton-pulse 1.6s infinite ease-in-out;
|
||||
}
|
||||
}
|
||||
|
||||
/* Hierarchy tree ---------------------------------------------------------- */
|
||||
.sk-accordion {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.sk-tree {
|
||||
gap: 14px;
|
||||
|
||||
&__node {
|
||||
display: block;
|
||||
width: min(320px, 70%);
|
||||
height: 16px;
|
||||
border-radius: 8px;
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
var(--sg-skeleton-base) 25%,
|
||||
var(--sg-skeleton-highlight) 50%,
|
||||
var(--sg-skeleton-base) 75%
|
||||
);
|
||||
background-size: 600px 100%;
|
||||
animation: page-skeleton-shimmer 1.6s infinite linear;
|
||||
|
||||
&::before {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
margin-right: 10px;
|
||||
border-radius: 2px;
|
||||
background: var(--sg-border-strong);
|
||||
content: '';
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Keyword form and chip matrix -------------------------------------------- */
|
||||
.sk-form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
padding: 18px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 12px;
|
||||
background: var(--sg-surface-muted);
|
||||
}
|
||||
|
||||
.sk-matrix {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 10px;
|
||||
padding: 18px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 12px;
|
||||
background: var(--sg-surface-muted);
|
||||
}
|
||||
|
||||
/* Collaboration network --------------------------------------------------- */
|
||||
.sk-graph {
|
||||
position: relative;
|
||||
height: min(52vh, 420px);
|
||||
min-height: 240px;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 12px;
|
||||
background: var(--sg-surface-muted);
|
||||
|
||||
&__node {
|
||||
position: absolute;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
margin: -9px 0 0 -9px;
|
||||
border-radius: 50%;
|
||||
background: var(--sg-skeleton-base);
|
||||
animation: page-skeleton-pulse 1.6s infinite ease-in-out;
|
||||
|
||||
&--center {
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
margin: -15px 0 0 -15px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes page-skeleton-shimmer {
|
||||
from {
|
||||
background-position: -600px 0;
|
||||
}
|
||||
|
||||
to {
|
||||
background-position: 600px 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes page-skeleton-pulse {
|
||||
0%,
|
||||
100% {
|
||||
opacity: 0.55;
|
||||
}
|
||||
|
||||
50% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.sk-detail,
|
||||
.sk-split {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.sk-kpis--many {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.sk-compare-tables {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.sk-matrix {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.sk-table:not(.sk-table--two-col) .sk-table__row {
|
||||
grid-template-columns: 2fr 1fr 0.6fr;
|
||||
|
||||
.sk-bar:last-child {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.sk-bar,
|
||||
.sk-tree__node {
|
||||
animation: none;
|
||||
background: var(--sg-skeleton-base);
|
||||
}
|
||||
|
||||
.sk-avatar,
|
||||
.sk-chart__bar,
|
||||
.sk-graph__node {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import { NgTemplateOutlet } from '@angular/common';
|
||||
import { Component, input } from '@angular/core';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { PageSkeletonVariant } from '../../services/navigation-sections';
|
||||
|
||||
/** Fixed node positions for the network graph placeholder. */
|
||||
const GRAPH_NODES = [
|
||||
{ x: 18, y: 26 },
|
||||
{ x: 38, y: 14 },
|
||||
{ x: 73, y: 20 },
|
||||
{ x: 85, y: 52 },
|
||||
{ x: 62, y: 78 },
|
||||
{ x: 26, y: 72 },
|
||||
{ x: 10, y: 52 },
|
||||
];
|
||||
|
||||
/**
|
||||
* Generic page placeholder shown while route resolvers run. Its variants
|
||||
* mirror the page layouts (card grids, tables, detail pages, dashboards,
|
||||
* trees, forms and graphs) so the loaded page does not shift the layout.
|
||||
*/
|
||||
@Component({
|
||||
selector: 'app-page-skeleton',
|
||||
imports: [MatIconModule, NgTemplateOutlet],
|
||||
templateUrl: './page-skeleton.component.html',
|
||||
styleUrl: './page-skeleton.component.scss',
|
||||
})
|
||||
export class PageSkeletonComponent {
|
||||
readonly label = input('Inhalte werden geladen …');
|
||||
readonly icon = input('hourglass_empty');
|
||||
readonly variant = input<PageSkeletonVariant>('table');
|
||||
/** Render only the body, e.g. inside an existing page's results panel. */
|
||||
readonly compact = input(false);
|
||||
/** Minimum card width, so the placeholder grid matches the real grid. */
|
||||
readonly cardMinWidth = input(260);
|
||||
|
||||
readonly nodes = GRAPH_NODES;
|
||||
}
|
||||
@@ -750,3 +750,24 @@ html.dark-theme {
|
||||
flex-shrink: 0;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
/* Screen-reader-only content (result announcements, see LiveRegionComponent). */
|
||||
.visually-hidden {
|
||||
position: absolute !important;
|
||||
width: 1px !important;
|
||||
height: 1px !important;
|
||||
margin: -1px !important;
|
||||
padding: 0 !important;
|
||||
overflow: hidden !important;
|
||||
clip: rect(0 0 0 0) !important;
|
||||
clip-path: inset(50%) !important;
|
||||
white-space: nowrap !important;
|
||||
border: 0 !important;
|
||||
}
|
||||
|
||||
/* Focus targets set by NavigationFocusService: no visible ring on the page
|
||||
frame itself, the heading is announced by screen readers instead. */
|
||||
main[tabindex='-1']:focus,
|
||||
main [tabindex='-1']:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user