From 9ed3e9003d8560c167145599818699eb0ad72904 Mon Sep 17 00:00:00 2001 From: Harris Tzovanakis Date: Mon, 16 Dec 2024 13:32:52 +0100 Subject: [PATCH] ui: addition of literature links * ref: cern-sis/issues-inspire/issues/638 --- backend/data/records/data/2727274.json | 203 ++++++ backend/data/records/data/2727275.json | 583 ++++++++++++++++++ backend/data/records/literature/44707.json | 5 + .../common/literature_record.py | 0 .../inspirehep/records/marshmallow/data/ui.py | 7 +- .../records/marshmallow/seminars/ui.py | 4 +- .../records/serializers/json/test_data.py | 32 + .../components/LiteratureRecordsList.jsx | 8 +- .../__tests__/LiteratureRecordsList.test.jsx | 0 .../LiteratureRecordsList.test.jsx.snap | 0 ui/src/data/components/DataItem.jsx | 29 +- .../__snapshots__/DataItem.test.jsx.snap | 18 + .../DetailPageContainer.tsx | 31 +- ui/src/data/utils.ts | 2 +- .../containers/DetailPageContainer.jsx | 2 +- 15 files changed, 895 insertions(+), 29 deletions(-) create mode 100644 backend/data/records/data/2727274.json create mode 100644 backend/data/records/data/2727275.json rename backend/inspirehep/records/marshmallow/{seminars => }/common/literature_record.py (100%) rename ui/src/{seminars => common}/components/LiteratureRecordsList.jsx (79%) rename ui/src/{seminars => common}/components/__tests__/LiteratureRecordsList.test.jsx (100%) rename ui/src/{seminars => common}/components/__tests__/__snapshots__/LiteratureRecordsList.test.jsx.snap (100%) diff --git a/backend/data/records/data/2727274.json b/backend/data/records/data/2727274.json new file mode 100644 index 0000000000..710d0022f6 --- /dev/null +++ b/backend/data/records/data/2727274.json @@ -0,0 +1,203 @@ +{ + "dois": [ + { + "value": "10.17182/hepdata.153885", + "source": "hepdata", + "material": "data" + }, + { + "value": "10.17182/hepdata.153885.v1/t1", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t2", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t3", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t4", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t5", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t6", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t7", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t8", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t9", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t10", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t11", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t12", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t13", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t14", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t15", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t16", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t17", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t18", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t19", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t20", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t21", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t22", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t23", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t24", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t25", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t26", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t27", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t28", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t29", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885.v1/t30", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.153885", + "source": "hepdata", + "material": "version" + } + ], + "self": { + "$ref": "https://inspirebeta.net/api/data/2727274" + }, + "titles": [ + { + "title": "Energy Dependence of Polarized $\\mathbf{\\gamma\\gamma\\rightarrow e^{+}e^{-}}$ in Peripheral Au+Au Collisions at RHIC", + "source": "hepdata" + } + ], + "$schema": "https://inspirehep.net/schemas/records/data.json", + "keywords": [ + { + "value": "observables: $\\Delta\\phi$,$-2$,$p_{T}$,$\\sqrt{< p_{T}^{2} >} (MeV/c)$,$M_{ee}$,$p_{T}^{2}$,Excess Yield", + "source": "hepdata" + } + ], + "literature": [ + { + "record": { + "$ref": "https://inspirebeta.net/api/literature/2809899" + } + } + ], + "_collections": [ + "Data" + ], + "creation_date": "2024-12-13", + "collaborations": [ + { + "value": "STAR" + } + ], + "control_number": 2727274, + "acquisition_source": { + "method": "hepcrawl", + "source": "hepdata", + "datetime": "2024-12-13T00:02:15.023125+00:00", + "submission_number": "2809899" + } +} diff --git a/backend/data/records/data/2727275.json b/backend/data/records/data/2727275.json new file mode 100644 index 0000000000..beb01a0ed3 --- /dev/null +++ b/backend/data/records/data/2727275.json @@ -0,0 +1,583 @@ +{ + "dois": [ + { + "value": "10.17182/hepdata.151814", + "source": "hepdata", + "material": "data" + }, + { + "value": "10.17182/hepdata.151814.v1/t1", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t2", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t3", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t4", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t5", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t6", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t7", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t8", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t9", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t10", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t11", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t12", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t13", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t14", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t15", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t16", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t17", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t18", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t19", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t20", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t21", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t22", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t23", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t24", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t25", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t26", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t27", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t28", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t29", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t30", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t31", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t32", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t33", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t34", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t35", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t36", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t37", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t38", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t39", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t40", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t41", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t42", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t43", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t44", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t45", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t46", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t47", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t48", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t49", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t50", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t51", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t52", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t53", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t54", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t55", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t56", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t57", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t58", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t59", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t60", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t61", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t62", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t63", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t64", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t65", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t66", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t67", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t68", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t69", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t70", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t71", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t72", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t73", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t74", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t75", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t76", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t77", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t78", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t79", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t80", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t81", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t82", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t83", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t84", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t85", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t86", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t87", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t88", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t89", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t90", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t91", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t92", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t93", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t94", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t95", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t96", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t97", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/t98", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814.v1/r1", + "source": "hepdata", + "material": "part" + }, + { + "value": "10.17182/hepdata.151814", + "source": "hepdata", + "material": "version" + } + ], + "self": { + "$ref": "https://inspirebeta.net/api/data/2727275" + }, + "urls": [ + { + "value": "https://www.google.com", + "description": "web page with auxiliary material" + } + ], + "titles": [ + { + "title": "Measurement of jet substructure in boosted $t\\bar{t}$ events with the ATLAS detector using 140 fb$^{-1}$ of 13 TeV $pp$ collisions", + "source": "hepdata" + } + ], + "$schema": "https://inspirehep.net/schemas/records/data.json", + "keywords": [ + { + "value": "cmenergies: 13000.0-13000.0", + "source": "hepdata" + }, + { + "value": "observables: 1/SIG*D2SIG/DD_2/DMTOP,D2SIG/DTAU_32/DMTOP,1/SIG*DSIG/DTAU_32,1/SIG*DSIG/DECF2,DSIG/DTAU_3,DSIG/DTAU_32,1/SIG*D2SIG/DTAU_32/DPT_TOP,D2SIG/DTAU_32/DPT_TOP,DSIG/DD_2,DSIG/DC_3,1/SIG*D2SIG/DD_2/DPT_TOP,D2SIG/DD_2/DMTOP,1/SIG*DSIG/DC_3,1/SIG*DSIG/DDISPERSION,1/SIG*DSIG/DTAU_21,1/SIG*DSIG/DTAU_3,D2SIG/DD_2/DPT_TOP,DSIG/DDISPERSION,DSIG/DTAU_21,DSIG/DLHA,DSIG/DECF2,1/SIG*D2SIG/DTAU_32/DMTOP,1/SIG*DSIG/DD_2,1/SIG*DSIG/DLHA", + "source": "hepdata" + }, + { + "value": "Top", + "source": "hepdata" + }, + { + "value": "Differential Cross Section", + "source": "hepdata" + }, + { + "value": "Proton-Proton Scattering", + "source": "hepdata" + }, + { + "value": "P P --> TOP TOPBAR X", + "source": "hepdata" + } + ], + "abstracts": [ + { + "value": "Particle level differential cross-section measurements for top-pair production, in event with at least an hadronically decaying top-quark, as a function of substructure of the boosted top-quark. Only charged particles are used to build the substructure. Two topologies, $l$+jets and all-hadronic, are considered. The study was performed using data from pp collisions at centre-of-mass energy of 13 TeV collected in Run2 by the ATLAS detector at the CERN Large Hadron Collider (LHC), corresponding to an integrated luminosity of 140 fb$^{−1}$. Due to the large cross-section at the LHC, such measurements allow a detailed study of the properties top-quark substructure, enabling precision tests of several Monte Carlo generators. The Monte Carlo predictions for measures of the broadness, and also the two-body structure, of the top-quark jets are found to be in good agreement with the measurements, while variables sensitive to the three-body structure of the top-quark jets exhibit some tension with the measured distributions\n.", + "source": "hepdata" + } + ], + "literature": [ + { + "doi": { + "value": "10.1103/PhysRevD.109.112016" + }, + "record": { + "$ref": "https://inspirebeta.net/api/literature/2732688" + } + } + ], + "_collections": [ + "Data" + ], + "creation_date": "2024-12-13", + "collaborations": [ + { + "value": "ATLAS" + } + ], + "control_number": 2727275, + "acquisition_source": { + "method": "hepcrawl", + "source": "hepdata", + "datetime": "2024-12-13T00:02:25.488823+00:00", + "submission_number": "2732688" + } +} diff --git a/backend/data/records/literature/44707.json b/backend/data/records/literature/44707.json index d592604bb9..4b4a507109 100644 --- a/backend/data/records/literature/44707.json +++ b/backend/data/records/literature/44707.json @@ -80,6 +80,11 @@ "record": { "$ref": "http://XVxZ15mkm/api/data/777" } + }, + { + "record": { + "$ref": "https://inspirebeta.net/api/data/2727275" + } } ] } diff --git a/backend/inspirehep/records/marshmallow/seminars/common/literature_record.py b/backend/inspirehep/records/marshmallow/common/literature_record.py similarity index 100% rename from backend/inspirehep/records/marshmallow/seminars/common/literature_record.py rename to backend/inspirehep/records/marshmallow/common/literature_record.py diff --git a/backend/inspirehep/records/marshmallow/data/ui.py b/backend/inspirehep/records/marshmallow/data/ui.py index 1502528e60..899844a291 100644 --- a/backend/inspirehep/records/marshmallow/data/ui.py +++ b/backend/inspirehep/records/marshmallow/data/ui.py @@ -4,6 +4,11 @@ # inspirehep is free software; you can redistribute it and/or modify it under # the terms of the MIT License; see LICENSE file for more details. +from marshmallow import fields + +from inspirehep.records.marshmallow.common.literature_record import ( + LiteratureRecordSchemaV1, +) from inspirehep.records.marshmallow.data.base import DataPublicSchema @@ -12,7 +17,7 @@ class DataBaseSchema(DataPublicSchema): class DataDetailSchema(DataBaseSchema): - pass + literature = fields.Nested(LiteratureRecordSchemaV1, dump_only=True, many=True) class DataListSchema(DataBaseSchema): diff --git a/backend/inspirehep/records/marshmallow/seminars/ui.py b/backend/inspirehep/records/marshmallow/seminars/ui.py index 04c0e06f4b..833d15336a 100644 --- a/backend/inspirehep/records/marshmallow/seminars/ui.py +++ b/backend/inspirehep/records/marshmallow/seminars/ui.py @@ -7,10 +7,10 @@ from inspirehep.accounts.api import can_user_edit_record from inspirehep.records.marshmallow.common import ContactDetailsItemWithoutEmail -from inspirehep.records.marshmallow.seminars.base import SeminarsPublicSchema -from inspirehep.records.marshmallow.seminars.common.literature_record import ( +from inspirehep.records.marshmallow.common.literature_record import ( LiteratureRecordSchemaV1, ) +from inspirehep.records.marshmallow.seminars.base import SeminarsPublicSchema from inspirehep.records.marshmallow.seminars.common.speaker import SpeakerSchemaV1 from inspirehep.records.marshmallow.utils import get_acquisition_source_without_email diff --git a/backend/tests/integration/records/serializers/json/test_data.py b/backend/tests/integration/records/serializers/json/test_data.py index f2ba77d659..1d5b8f0a6a 100644 --- a/backend/tests/integration/records/serializers/json/test_data.py +++ b/backend/tests/integration/records/serializers/json/test_data.py @@ -79,3 +79,35 @@ def test_data_detail_json_format(inspire_app): response = client.get(f"/data/{record['control_number']}?format=json") assert response.status_code == expected_status_code assert response.content_type == expected_content_type + + +def test_data_detail_literature_records(inspire_app): + with inspire_app.test_client() as client: + headers = {"Accept": "application/vnd+inspire.record.ui+json"} + lit_record = create_record("lit", data={"titles": [{"title": "Lit title"}]}) + record = create_record( + "dat", + data={ + "literature": [ + { + "record": { + "$ref": f"http://localhost:5000/api/literature/{lit_record['control_number']}" + } + } + ] + }, + ) + + response = client.get(f"/data/{record['control_number']}", headers=headers) + + response_metadata = response.json["metadata"] + expected_literature_records = [ + { + "control_number": lit_record["control_number"], + "titles": [{"title": "Lit title"}], + "record": { + "$ref": f"http://localhost:5000/api/literature/{lit_record['control_number']}" + }, + } + ] + assert response_metadata["literature"] == expected_literature_records diff --git a/ui/src/seminars/components/LiteratureRecordsList.jsx b/ui/src/common/components/LiteratureRecordsList.jsx similarity index 79% rename from ui/src/seminars/components/LiteratureRecordsList.jsx rename to ui/src/common/components/LiteratureRecordsList.jsx index 26748353c7..d18fa0c941 100644 --- a/ui/src/seminars/components/LiteratureRecordsList.jsx +++ b/ui/src/common/components/LiteratureRecordsList.jsx @@ -4,10 +4,10 @@ import { List } from 'immutable'; import { Link } from 'react-router-dom'; -import { LITERATURE } from '../../common/routes'; -import { pluralizeUnlessSingle } from '../../common/utils'; -import InlineDataList from '../../common/components/InlineList'; -import LiteratureTitle from '../../common/components/LiteratureTitle'; +import { LITERATURE } from '../routes'; +import { pluralizeUnlessSingle } from '../utils'; +import InlineDataList from './InlineList'; +import LiteratureTitle from './LiteratureTitle'; function renderLiteratureRecord(literatureRecord) { const title = literatureRecord.getIn(['titles', 0]); diff --git a/ui/src/seminars/components/__tests__/LiteratureRecordsList.test.jsx b/ui/src/common/components/__tests__/LiteratureRecordsList.test.jsx similarity index 100% rename from ui/src/seminars/components/__tests__/LiteratureRecordsList.test.jsx rename to ui/src/common/components/__tests__/LiteratureRecordsList.test.jsx diff --git a/ui/src/seminars/components/__tests__/__snapshots__/LiteratureRecordsList.test.jsx.snap b/ui/src/common/components/__tests__/__snapshots__/LiteratureRecordsList.test.jsx.snap similarity index 100% rename from ui/src/seminars/components/__tests__/__snapshots__/LiteratureRecordsList.test.jsx.snap rename to ui/src/common/components/__tests__/__snapshots__/LiteratureRecordsList.test.jsx.snap diff --git a/ui/src/data/components/DataItem.jsx b/ui/src/data/components/DataItem.jsx index 8918108528..f9acbea90e 100644 --- a/ui/src/data/components/DataItem.jsx +++ b/ui/src/data/components/DataItem.jsx @@ -4,24 +4,21 @@ import { Link } from 'react-router-dom'; import PropTypes from 'prop-types'; import { Map } from 'immutable'; - import UrlsAction from '../../literature/components/UrlsAction'; import DOILinkAction from '../../literature/components/DOILinkAction'; import EditRecordAction from '../../common/components/EditRecordAction'; import ResultItem from '../../common/components/ResultItem'; -import { filterDoisByMaterial } from '../utils'; +import { filterDoisByMaterial, getPapersQueryString } from '../utils'; import { DATA } from '../../common/routes'; import LiteratureTitle from '../../common/components/LiteratureTitle'; import AuthorsAndCollaborations from '../../common/components/AuthorsAndCollaborations'; +import IncomingLiteratureReferencesLinkAction from '../../common/components/IncomingLiteratureReferencesLinkAction'; -function DataItem({ - metadata, - page, -}) { +function DataItem({ metadata, page }) { const title = metadata.getIn(['titles', 0]); const authors = metadata.get('authors'); - const authorCount = authors && authors.size || 0; + const authorCount = (authors && authors.size) || 0; const dois = filterDoisByMaterial(metadata.get('dois', [])); const recordId = metadata.get('control_number'); const urls = metadata.get('urls'); @@ -43,11 +40,23 @@ function DataItem({ {dois && } {canEdit && ( - + )} - } + rightActions={ + + } >
@@ -60,7 +69,6 @@ function DataItem({
-
- ); diff --git a/ui/src/data/components/__tests__/__snapshots__/DataItem.test.jsx.snap b/ui/src/data/components/__tests__/__snapshots__/DataItem.test.jsx.snap index e201ade7c4..9e1b0d2367 100644 --- a/ui/src/data/components/__tests__/__snapshots__/DataItem.test.jsx.snap +++ b/ui/src/data/components/__tests__/__snapshots__/DataItem.test.jsx.snap @@ -12,6 +12,15 @@ exports[`DataItem renders with all props set 1`] = ` /> } + rightActions={ + + } >
} + rightActions={ + + } >
- - {dois && } + {dois && ( + + - - - - -
- -
+ )} + {abstract && ( + + + + + + )} + {literatureRecords && ( + + + + + + )}
diff --git a/ui/src/data/utils.ts b/ui/src/data/utils.ts index aa9d3eb379..e56c5e3790 100644 --- a/ui/src/data/utils.ts +++ b/ui/src/data/utils.ts @@ -1,7 +1,7 @@ import { Map, List } from "immutable"; export function getPapersQueryString(recordId: number) { - return `refersto:recid:${recordId}`; + return `data.record.$ref:${recordId}`; } export function filterDoisByMaterial(dois: List>) { diff --git a/ui/src/seminars/containers/DetailPageContainer.jsx b/ui/src/seminars/containers/DetailPageContainer.jsx index 9507b7e1ee..dd68da5d9b 100644 --- a/ui/src/seminars/containers/DetailPageContainer.jsx +++ b/ui/src/seminars/containers/DetailPageContainer.jsx @@ -28,7 +28,7 @@ import SeminarDateTimes from '../components/SeminarDateTimes'; import { LOCAL_TIMEZONE, SEMINARS_PID_TYPE } from '../../common/constants'; import ExportToCalendarAction from '../components/ExportToCalendarAction/ExportToCalendarAction'; import UrlsAction from '../../literature/components/UrlsAction'; -import LiteratureRecordsList from '../components/LiteratureRecordsList'; +import LiteratureRecordsList from '../../common/components/LiteratureRecordsList'; import { isSuperUser } from '../../common/authorization'; import { APIButton } from '../../common/components/APIButton';