Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display and preserve annotation of imported entities #1107

Merged
merged 7 commits into from
Aug 6, 2024
2 changes: 2 additions & 0 deletions src/client/components/pages/import-entities/author.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import * as importHelper from '../../../helpers/import-entity';

import {AuthorAttributes} from '../entities/author';
import {ENTITY_TYPE_ICONS} from '../../../helpers/entity';
import EntityAnnotation from '../entities/annotation';
import EntityImage from '../entities/image';
import EntityLinks from '../entities/links';
import ImportFooter from './footer';
Expand Down Expand Up @@ -49,6 +50,7 @@ function ImportAuthorDisplayPage({importEntity, identifierTypes}) {
<AuthorAttributes author={importEntity}/>
</Col>
</Row>
<EntityAnnotation entity={importEntity}/>
<EntityLinks
entity={importEntity}
identifierTypes={identifierTypes}
Expand Down
2 changes: 2 additions & 0 deletions src/client/components/pages/import-entities/edition-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import * as importHelper from '../../../helpers/import-entity';

import {ENTITY_TYPE_ICONS} from '../../../helpers/entity';
import {EditionGroupAttributes} from '../entities/edition-group';
import EntityAnnotation from '../entities/annotation';
import EntityImage from '../entities/image';
import EntityLinks from '../entities/links';
import ImportFooter from './footer';
Expand Down Expand Up @@ -49,6 +50,7 @@ function ImportEditionGroupDisplayPage({importEntity, identifierTypes}) {
<EditionGroupAttributes editionGroup={importEntity}/>
</Col>
</Row>
<EntityAnnotation entity={importEntity}/>
<EntityLinks
entity={importEntity}
identifierTypes={identifierTypes}
Expand Down
2 changes: 2 additions & 0 deletions src/client/components/pages/import-entities/edition.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import * as importHelper from '../../../helpers/import-entity';

import {ENTITY_TYPE_ICONS} from '../../../helpers/entity';
import {EditionAttributes} from '../entities/edition';
import EntityAnnotation from '../entities/annotation';
import EntityImage from '../entities/image';
import EntityLinks from '../entities/links';
import ImportFooter from './footer';
Expand Down Expand Up @@ -50,6 +51,7 @@ function ImportEditionDisplayPage({importEntity, identifierTypes}) {
<EditionAttributes edition={importEntity}/>
</Col>
</Row>
<EntityAnnotation entity={importEntity}/>
<EntityLinks
entity={importEntity}
identifierTypes={identifierTypes}
Expand Down
2 changes: 2 additions & 0 deletions src/client/components/pages/import-entities/publisher.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import * as bootstrap from 'react-bootstrap';
import * as importHelper from '../../../helpers/import-entity';

import {ENTITY_TYPE_ICONS} from '../../../helpers/entity';
import EntityAnnotation from '../entities/annotation';
import EntityImage from '../entities/image';
import EntityLinks from '../entities/links';
import ImportFooter from './footer';
Expand Down Expand Up @@ -50,6 +51,7 @@ function ImportPublisherDisplayPage({importEntity, identifierTypes}) {
<PublisherAttributes publisher={importEntity}/>
</Col>
</Row>
<EntityAnnotation entity={importEntity}/>
<EntityLinks
entity={importEntity}
identifierTypes={identifierTypes}
Expand Down
2 changes: 2 additions & 0 deletions src/client/components/pages/import-entities/work.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import * as bootstrap from 'react-bootstrap';
import * as importHelper from '../../../helpers/import-entity';

import {ENTITY_TYPE_ICONS} from '../../../helpers/entity';
import EntityAnnotation from '../entities/annotation';
import EntityImage from '../entities/image';
import EntityLinks from '../entities/links';
import ImportFooter from './footer';
Expand Down Expand Up @@ -49,6 +50,7 @@ function ImportWorkDisplayPage({importEntity, identifierTypes}) {
<WorkAttributes work={importEntity}/>
</Col>
</Row>
<EntityAnnotation entity={importEntity}/>
<EntityLinks
entity={importEntity}
identifierTypes={identifierTypes}
Expand Down
1 change: 1 addition & 0 deletions src/server/helpers/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ export function makeEntityLoader(modelName: string, additionalRels: Array<string
export function makeImportLoader(modelName, additionalRels, errMessage) {
const relations = [
'aliasSet.aliases.language',
'annotation',
'defaultAlias',
'disambiguation',
'identifierSet.identifiers.type'
Expand Down
5 changes: 5 additions & 0 deletions src/server/routes/import-entity/transform-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function formToAuthorState(data) {

return {
aliases,
annotation: data.annotationSection.content,
beginAreaId: data.authorSection.beginArea &&
data.authorSection.beginArea.id,
beginDate: data.authorSection.beginDate,
Expand Down Expand Up @@ -55,6 +56,7 @@ export function formToEditionState(data) {

return {
aliases,
annotation: data.annotationSection.content,
depth: data.editionSection.depth &&
parseInt(data.editionSection.depth, 10),
disambiguation: data.nameSection.disambiguation,
Expand Down Expand Up @@ -88,6 +90,7 @@ export function formToEditionGroupState(data) {

return {
aliases,
annotation: data.annotationSection.content,
disambiguation: data.nameSection.disambiguation,
identifiers,
note: data.submissionSection.note,
Expand All @@ -102,6 +105,7 @@ export function formToPublisherState(data) {

return {
aliases,
annotation: data.annotationSection.content,
areaId: data.publisherSection.area && data.publisherSection.area.id,
beginDate: data.publisherSection.beginDate,
disambiguation: data.nameSection.disambiguation,
Expand All @@ -122,6 +126,7 @@ export function formToWorkState(data) {

return {
aliases,
annotation: data.annotationSection.content,
disambiguation: data.nameSection.disambiguation,
identifiers,
languages,
Expand Down
1 change: 1 addition & 0 deletions src/server/routes/import-entity/transform-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ export function entityToFormState(importEntity) {
const entitySection = `${importEntity.type.toLowerCase()}Section`;
return {
aliasEditor: getAliasEditor(importEntity),
annotationSection: importEntity.annotation ?? {},
buttonBar: getButtonBar(importEntity),
[entitySection]: entitySectionMap[importEntity.type](importEntity),
identifierEditor: getIdentifierEditor(importEntity),
Expand Down
Loading