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

Refresh Entity Import Infrastructure #1096

Merged
merged 81 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
de78f6b
feat(server/helpers): Add import search
shivam-tripathi Jul 12, 2018
acc103f
feat(helpers/utils): Add function to get import models
shivam-tripathi Jul 18, 2018
e60449e
feat(helpers/utils): Add function to get import model by name
shivam-tripathi Jul 18, 2018
56670ee
feat(helpers/utils): Add JSDocs for import functions
shivam-tripathi Jul 18, 2018
b272cc3
feat(server/helpers/search): Add import support in _fetchEntityModels…
shivam-tripathi Jul 18, 2018
c0b695e
feat(server/helpers/): Update licenses
shivam-tripathi Jul 18, 2018
870e0f0
feat(client/components/pages/search): Update search with message for …
shivam-tripathi Jul 18, 2018
cf4680e
feat(client/components/pages/parts/search-results): Update search res…
shivam-tripathi Jul 18, 2018
203dc05
feat(client/containers/layout): Add panel link to recent imports
shivam-tripathi Jul 12, 2018
90be205
feat(scripts): Update build-client-js and watch-client-js to track re…
shivam-tripathi Jul 31, 2018
0de46fa
feat(server/routes/imports/recent): Add routes to handle recent imports
shivam-tripathi Jul 31, 2018
3ad38bf
feat(client/controllers/recentImports): Add recentImports controller
shivam-tripathi Jul 31, 2018
8de2735
feat(client/components/pages/parts/recentImports): Add part to hold r…
shivam-tripathi Jul 31, 2018
53b0b6f
feat(client/components/pages/recentImports): Add base component to di…
shivam-tripathi Jul 31, 2018
61657de
feat(server/routes): Add imports route
shivam-tripathi Jul 31, 2018
0344296
feat(client/helpers/utils): Add function to extract imports url
shivam-tripathi Jul 31, 2018
4513011
feat(client/helpers/pagination-props): Add function to determine pagi…
shivam-tripathi Jul 31, 2018
08b4d0a
feat(scripts): Add build and watch command in client scripts for impo…
shivam-tripathi Aug 3, 2018
1426f1f
feat(client/helpers/props): Add function to extract import entity props
shivam-tripathi Aug 3, 2018
2854bff
feat(client/controllers/import-entity): Add import-entity controller
shivam-tripathi Aug 3, 2018
913c54b
feat(client/helpers/import-entity): Add import-entity helper functions
shivam-tripathi Aug 3, 2018
208fc7e
feat(client/components/pages/import-entities/footer): Add footer for …
shivam-tripathi Aug 3, 2018
49639b8
feat(src/client/components/pages/import-entities/title): Add title fr…
shivam-tripathi Aug 3, 2018
2f78a55
feat(src/client/components/pages/import-entities/footer): Remove unne…
shivam-tripathi Aug 3, 2018
21915cd
feat(client/components/pages/import-entities): Add import-entities pages
shivam-tripathi Aug 3, 2018
37ae6a2
feat(server/routes/import-entity): Refactor, add more routes
shivam-tripathi Aug 3, 2018
ae662d0
feat(recent-imports): Refactor code
shivam-tripathi Aug 10, 2018
06e8219
feat(scripts/client): Update client build and watch scripts
shivam-tripathi Aug 10, 2018
45fc92d
feat(package.json): Add uuid module
shivam-tripathi Aug 10, 2018
f5fba4b
feat(client/components/pages/entities): Make compulsory props of imag…
shivam-tripathi Aug 10, 2018
fdc8f17
refactor(client/components/pages/parts/recent-import-results)
shivam-tripathi Aug 10, 2018
48bd1b4
feat(client/discard-import-entity): Add confirm discard vote cast page
shivam-tripathi Aug 10, 2018
8d738f7
feat(client/controllers/recent-imports): Move recent-imports controll…
shivam-tripathi Aug 10, 2018
e563583
feat(client/controllers/import-entity): Add controller for import-ent…
shivam-tripathi Aug 10, 2018
2c25f13
refactor(client/helpers/utils): Remove unused function
shivam-tripathi Aug 10, 2018
b68bbab
feat(client/helpers/import-entity): Add import-entity helper function…
shivam-tripathi Aug 10, 2018
8ba3a82
feat(client/import-entities/footer): Add feature to prevent multiple …
shivam-tripathi Aug 10, 2018
560d24b
feat(client/components/pages/import-entities): Add import-entity pages
shivam-tripathi Aug 10, 2018
2598bdf
feat(client/entity-editor/submission-section): Add logic for redirect…
shivam-tripathi Aug 10, 2018
7c07651
feat(server/helpers/middleware): Add middleware to load imports into …
shivam-tripathi Aug 10, 2018
0374e40
feat(server/helpers/importEntityRouteUtils): Add logic to load edit p…
shivam-tripathi Aug 10, 2018
5fd6e9a
feat(server/helpers/utils): Add function to validate importId, could …
shivam-tripathi Aug 10, 2018
cab5b6a
feat(server/routes/import-entity/transform-form): Add module to trans…
shivam-tripathi Aug 10, 2018
b263307
feat(server/routes/import-entity/transform-import): Add module to tra…
shivam-tripathi Aug 10, 2018
a5b18db
feat(server/routes/import-entity/import-routes): Add import route hel…
shivam-tripathi Aug 10, 2018
0987520
feat(server/routes/import-entity): Add entity functions, update index
shivam-tripathi Aug 10, 2018
c8cb4d0
refactor(server/routes): Update routes to reflect import-entities
shivam-tripathi Aug 10, 2018
e450dec
feat(server/routes/import-entity): Add entity routes
shivam-tripathi Aug 18, 2018
762ccd9
feat(client/recent-imports): Add maximum button limit
shivam-tripathi Aug 18, 2018
26d82a7
feat(components/parts/search): Remove inline styles, add break before…
shivam-tripathi Aug 19, 2018
18fc335
feat(client/components/pages/entities): Export all attributes functions
shivam-tripathi Aug 19, 2018
29e3ada
feat(client/commit/pages/import-entities): Reuse attribute functions …
shivam-tripathi Aug 19, 2018
154f76c
feat(client/components/import-entities): Remove inline css
shivam-tripathi Aug 19, 2018
84989c7
feat(discard-import-entity): Remove token mechanism
shivam-tripathi Aug 19, 2018
18199d5
feat(client/import-entity/footer): Change name
shivam-tripathi Aug 19, 2018
35ea8b0
refactor: General refactor, remove redundant code, update credits
shivam-tripathi Aug 19, 2018
2afd166
feat(stylesheets/style.less): Add some style classes
shivam-tripathi Aug 19, 2018
b15a144
feat(client/helpers/import-entity): Add space after label, refactor
shivam-tripathi Aug 19, 2018
b61c993
feat(client/components/search-results): Use labels to denote imports
shivam-tripathi Aug 19, 2018
f8bb16c
feat(client/controllers/import-entity): Improve error handling when l…
shivam-tripathi Aug 19, 2018
d055486
Merge branch 'master' into imports-2018
kellnerd Jun 5, 2024
bbea14a
Merge branch 'master' into imports-2018
kellnerd Jun 12, 2024
6ced2dd
chore(deps): Install missing dependencies (uuid, moment) after merge
kellnerd Jun 12, 2024
e479fde
chore(deps): Drop unused uuid dependency
kellnerd Jun 12, 2024
7141fac
chore: Migrate from react-bootstrap v0.x to v1
kellnerd Jun 12, 2024
bcb51ac
chore: Fix broken module imports
kellnerd Jun 12, 2024
21cebf1
chore: Resolve linter errors
kellnerd Jun 12, 2024
b40e867
chore: Rename occurrences of entity types Creator and Publication
kellnerd Jun 12, 2024
b6d1379
chore: Update express render calls to use send instead
kellnerd Jun 12, 2024
566ec80
fix: Update file extension of modules containing TypeScript
kellnerd Jun 12, 2024
0cf2a66
chore: Update Font Awesome icon usages
kellnerd Jun 12, 2024
752f1f5
fix: Do not crash the server with a NotFoundError
kellnerd Jun 12, 2024
55b0695
chore: Migrate from react-bootstrap v0.x to v1, part 2
kellnerd Jun 12, 2024
d48833c
chore: Migrate entity icons for imports to the new syntax
kellnerd Jun 12, 2024
59188c0
fix(sql): Port renamed entity types from schema to the migration
kellnerd Jun 13, 2024
b67e023
feat(sql): Allow the import migration file to be run multiple times
kellnerd Jun 13, 2024
ee00d86
feat(sql): Add import tables for series to the existing migration
kellnerd Jun 13, 2024
aaa5534
refactor: Explicitly import lodash utilities if only few are used
kellnerd Jun 19, 2024
8a503fd
refactor: Use existing Bootstrap utility classes instead of our own
kellnerd Jun 19, 2024
d7b20c9
refactor(menu): Combine "Revisions" and "Recent imports" into a dropdown
kellnerd Jun 19, 2024
f6bc736
chore(sql): Update schema and `down` migration for imports as well
kellnerd Jun 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"browserslist": "> 0.25%, not dead",
"overrides": {
"react-select-fast-filter-options":{
"react-select-fast-filter-options": {
"react-select": "$react-select"
}
},
Expand Down Expand Up @@ -64,6 +64,7 @@
"log": "^6.0.0",
"log-node": "^8.0.3",
"mocha-chai-jest-snapshot": "^1.1.4",
"moment": "^2.30.1",
"morgan": "^1.10.0",
"nodemailer": "^6.9.9",
"passport": "^0.6.0",
Expand Down
11 changes: 7 additions & 4 deletions sql/migrations/import/down.sql
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
BEGIN;
DROP VIEW IF EXISTS bookbrainz.creator_import;

DROP VIEW IF EXISTS bookbrainz.author_import;
DROP VIEW IF EXISTS bookbrainz.edition_import;
DROP VIEW IF EXISTS bookbrainz.publication_import;
DROP VIEW IF EXISTS bookbrainz.edition_group_import;
DROP VIEW IF EXISTS bookbrainz.publisher_import;
DROP VIEW IF EXISTS bookbrainz.series_import;
DROP VIEW IF EXISTS bookbrainz.work_import;

DROP TABLE IF EXISTS bookbrainz.creator_import_header;
DROP TABLE IF EXISTS bookbrainz.author_import_header;
DROP TABLE IF EXISTS bookbrainz.edition_import_header;
DROP TABLE IF EXISTS bookbrainz.publication_import_header;
DROP TABLE IF EXISTS bookbrainz.edition_group_import_header;
DROP TABLE IF EXISTS bookbrainz.publisher_import_header;
DROP TABLE IF EXISTS bookbrainz.series_import_header;
DROP TABLE IF EXISTS bookbrainz.work_import_header;
DROP TABLE IF EXISTS bookbrainz.discard_votes;
DROP TABLE IF EXISTS bookbrainz.link_import;
Expand Down
128 changes: 76 additions & 52 deletions sql/migrations/import/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,44 @@ CREATE TABLE IF NOT EXISTS bookbrainz.import (
);

-- Tables linking import and relevant data in entitytype_data tables
CREATE TABLE IF NOT EXISTS bookbrainz.creator_import_header (
import_id INT PRIMARY KEY,
data_id INT NOT NULL
CREATE TABLE IF NOT EXISTS bookbrainz.author_import_header (
import_id INT PRIMARY KEY,
data_id INT NOT NULL
);
ALTER TABLE bookbrainz.creator_import_header ADD FOREIGN KEY (import_id) REFERENCES bookbrainz.import (id);
ALTER TABLE bookbrainz.creator_import_header ADD FOREIGN KEY (data_id) REFERENCES bookbrainz.creator_data (id);
ALTER TABLE bookbrainz.author_import_header ADD FOREIGN KEY (import_id) REFERENCES bookbrainz.import (id);
ALTER TABLE bookbrainz.author_import_header ADD FOREIGN KEY (data_id) REFERENCES bookbrainz.author_data (id);

CREATE TABLE IF NOT EXISTS bookbrainz.edition_import_header (
import_id INT PRIMARY KEY,
data_id INT NOT NULL
import_id INT PRIMARY KEY,
data_id INT NOT NULL
);
ALTER TABLE bookbrainz.edition_import_header ADD FOREIGN KEY (import_id) REFERENCES bookbrainz.import (id);
ALTER TABLE bookbrainz.edition_import_header ADD FOREIGN KEY (data_id) REFERENCES bookbrainz.edition_data (id);

CREATE TABLE IF NOT EXISTS bookbrainz.publication_import_header (
import_id INT PRIMARY KEY,
data_id INT NOT NULL
CREATE TABLE IF NOT EXISTS bookbrainz.edition_group_import_header (
import_id INT PRIMARY KEY,
data_id INT NOT NULL
);
ALTER TABLE bookbrainz.publication_import_header ADD FOREIGN KEY (import_id) REFERENCES bookbrainz.import (id);
ALTER TABLE bookbrainz.publication_import_header ADD FOREIGN KEY (data_id) REFERENCES bookbrainz.publication_data (id);
ALTER TABLE bookbrainz.edition_group_import_header ADD FOREIGN KEY (import_id) REFERENCES bookbrainz.import (id);
ALTER TABLE bookbrainz.edition_group_import_header ADD FOREIGN KEY (data_id) REFERENCES bookbrainz.edition_group_data (id);

CREATE TABLE IF NOT EXISTS bookbrainz.publisher_import_header (
import_id INT PRIMARY KEY,
data_id INT NOT NULL
import_id INT PRIMARY KEY,
data_id INT NOT NULL
);
ALTER TABLE bookbrainz.publisher_import_header ADD FOREIGN KEY (import_id) REFERENCES bookbrainz.import (id);
ALTER TABLE bookbrainz.publisher_import_header ADD FOREIGN KEY (data_id) REFERENCES bookbrainz.publisher_data (id);

CREATE TABLE IF NOT EXISTS bookbrainz.series_import_header (
import_id INT PRIMARY KEY,
data_id INT NOT NULL
);
ALTER TABLE bookbrainz.series_import_header ADD FOREIGN KEY (import_id) REFERENCES bookbrainz.import (id);
ALTER TABLE bookbrainz.series_import_header ADD FOREIGN KEY (data_id) REFERENCES bookbrainz.series_data (id);

CREATE TABLE IF NOT EXISTS bookbrainz.work_import_header (
import_id INT PRIMARY KEY,
data_id INT NOT NULL
import_id INT PRIMARY KEY,
data_id INT NOT NULL
);
ALTER TABLE bookbrainz.work_import_header ADD FOREIGN KEY (import_id) REFERENCES bookbrainz.import (id);
ALTER TABLE bookbrainz.work_import_header ADD FOREIGN KEY (data_id) REFERENCES bookbrainz.work_data (id);
Expand Down Expand Up @@ -81,37 +88,37 @@ ALTER TABLE bookbrainz.link_import ADD FOREIGN KEY (entity_id) REFERENCES bookbr
ALTER TABLE bookbrainz.link_import ADD FOREIGN KEY (import_id) REFERENCES bookbrainz.import (id);
ALTER TABLE bookbrainz.link_import ADD FOREIGN KEY (origin_source_id) REFERENCES bookbrainz.origin_source (id);

-- view --
CREATE VIEW bookbrainz.creator_import AS
-- Imported entities views --
CREATE OR REPLACE VIEW bookbrainz.author_import AS
SELECT
import.id AS import_id,
creator_data.id as data_id,
creator_data.annotation_id,
creator_data.disambiguation_id,
author_data.id as data_id,
author_data.annotation_id,
author_data.disambiguation_id,
alias_set.default_alias_id,
creator_data.begin_year,
creator_data.begin_month,
creator_data.begin_day,
creator_data.end_year,
creator_data.end_month,
creator_data.end_day,
creator_data.begin_area_id,
creator_data.end_area_id,
creator_data.ended,
creator_data.area_id,
creator_data.gender_id,
creator_data.type_id,
creator_data.alias_set_id,
creator_data.identifier_set_id,
author_data.begin_year,
author_data.begin_month,
author_data.begin_day,
author_data.end_year,
author_data.end_month,
author_data.end_day,
author_data.begin_area_id,
author_data.end_area_id,
author_data.ended,
author_data.area_id,
author_data.gender_id,
author_data.type_id,
author_data.alias_set_id,
author_data.identifier_set_id,
import.type
FROM bookbrainz.import import
LEFT JOIN bookbrainz.creator_import_header creator_import_header ON import.id = creator_import_header.import_id
LEFT JOIN bookbrainz.creator_data creator_data ON creator_import_header.data_id = creator_data.id
LEFT JOIN bookbrainz.alias_set alias_set ON creator_data.alias_set_id = alias_set.id
WHERE import.type = 'Creator';
LEFT JOIN bookbrainz.author_import_header author_import_header ON import.id = author_import_header.import_id
LEFT JOIN bookbrainz.author_data author_data ON author_import_header.data_id = author_data.id
LEFT JOIN bookbrainz.alias_set alias_set ON author_data.alias_set_id = alias_set.id
WHERE import.type = 'Author';


CREATE VIEW bookbrainz.edition_import AS
CREATE OR REPLACE VIEW bookbrainz.edition_import AS
SELECT
import.id AS import_id,
edition_data.id as data_id,
Expand All @@ -135,7 +142,7 @@ CREATE VIEW bookbrainz.edition_import AS
LEFT JOIN bookbrainz.alias_set alias_set ON edition_data.alias_set_id = alias_set.id
WHERE import.type = 'Edition';

CREATE VIEW bookbrainz.publisher_import AS
CREATE OR REPLACE VIEW bookbrainz.publisher_import AS
SELECT
import.id AS import_id,
publisher_data.id as data_id,
Expand All @@ -160,23 +167,40 @@ CREATE VIEW bookbrainz.publisher_import AS
LEFT JOIN bookbrainz.alias_set alias_set ON publisher_data.alias_set_id = alias_set.id
WHERE import.type = 'Publisher';

CREATE VIEW bookbrainz.publication_import AS
CREATE OR REPLACE VIEW bookbrainz.edition_group_import AS
SELECT
import.id AS import_id,
publication_data.id as data_id,
publication_data.disambiguation_id,
edition_group_data.id as data_id,
edition_group_data.disambiguation_id,
alias_set.default_alias_id,
edition_group_data.type_id,
edition_group_data.alias_set_id,
edition_group_data.identifier_set_id,
import.type
FROM bookbrainz.import import
LEFT JOIN bookbrainz.edition_group_import_header edition_group_import_header ON import.id = edition_group_import_header.import_id
LEFT JOIN bookbrainz.edition_group_data edition_group_data ON edition_group_import_header.data_id = edition_group_data.id
LEFT JOIN bookbrainz.alias_set alias_set ON edition_group_data.alias_set_id = alias_set.id
WHERE import.type = 'EditionGroup';

CREATE OR REPLACE VIEW bookbrainz.series_import AS
SELECT
import.id as import_id,
series_data.id AS data_id,
series_data.annotation_id,
series_data.disambiguation_id,
alias_set.default_alias_id,
publication_data.type_id,
publication_data.alias_set_id,
publication_data.identifier_set_id,
series_data.ordering_type_id,
series_data.alias_set_id,
series_data.identifier_set_id,
import.type
FROM bookbrainz.import import
LEFT JOIN bookbrainz.publication_import_header publication_import_header ON import.id = publication_import_header.import_id
LEFT JOIN bookbrainz.publication_data publication_data ON publication_import_header.data_id = publication_data.id
LEFT JOIN bookbrainz.alias_set alias_set ON publication_data.alias_set_id = alias_set.id
WHERE import.type = 'Publication';
LEFT JOIN bookbrainz.series_import_header series_import_header ON import.id = series_import_header.import_id
LEFT JOIN bookbrainz.series_data series_data ON series_import_header.data_id = series_data.id
LEFT JOIN bookbrainz.alias_set alias_set ON series_data.alias_set_id = alias_set.id
WHERE import.type = 'Series';

CREATE VIEW bookbrainz.work_import AS
CREATE OR REPLACE VIEW bookbrainz.work_import AS
SELECT
import.id as import_id,
work_data.id AS data_id,
Expand Down
24 changes: 24 additions & 0 deletions sql/schemas/bookbrainz.sql
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,13 @@ CREATE TABLE IF NOT EXISTS bookbrainz.publisher_import_header (
ALTER TABLE bookbrainz.publisher_import_header ADD FOREIGN KEY (import_id) REFERENCES bookbrainz.import (id);
ALTER TABLE bookbrainz.publisher_import_header ADD FOREIGN KEY (data_id) REFERENCES bookbrainz.publisher_data (id);

CREATE TABLE IF NOT EXISTS bookbrainz.series_import_header (
import_id INT PRIMARY KEY,
data_id INT NOT NULL
);
ALTER TABLE bookbrainz.series_import_header ADD FOREIGN KEY (import_id) REFERENCES bookbrainz.import (id);
ALTER TABLE bookbrainz.series_import_header ADD FOREIGN KEY (data_id) REFERENCES bookbrainz.series_data (id);

CREATE TABLE IF NOT EXISTS bookbrainz.work_import_header (
import_id INT PRIMARY KEY,
data_id INT NOT NULL
Expand Down Expand Up @@ -1037,6 +1044,23 @@ CREATE VIEW bookbrainz.edition_group_import AS
LEFT JOIN bookbrainz.alias_set alias_set ON edition_group_data.alias_set_id = alias_set.id
WHERE import.type = 'EditionGroup';

CREATE VIEW bookbrainz.series_import AS
SELECT
import.id as import_id,
series_data.id AS data_id,
series_data.annotation_id,
series_data.disambiguation_id,
alias_set.default_alias_id,
series_data.ordering_type_id,
series_data.alias_set_id,
series_data.identifier_set_id,
import.type
FROM bookbrainz.import import
LEFT JOIN bookbrainz.series_import_header series_import_header ON import.id = series_import_header.import_id
LEFT JOIN bookbrainz.series_data series_data ON series_import_header.data_id = series_data.id
LEFT JOIN bookbrainz.alias_set alias_set ON series_data.alias_set_id = alias_set.id
WHERE import.type = 'Series';

CREATE VIEW bookbrainz.work_import AS
SELECT
import.id as import_id,
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/pages/entities/author.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const {deletedEntityMessage, extractAttribute, getTypeAttribute, getEntityUrl,
ENTITY_TYPE_ICONS, getSortNameOfDefaultAlias, transformISODateForDisplay} = entityHelper;
const {Button, Col, Row} = bootstrap;

function AuthorAttributes({author}) {
export function AuthorAttributes({author}) {
if (author.deleted) {
return deletedEntityMessage;
}
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/pages/entities/edition-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import WikipediaExtract from './wikipedia-extract';
const {deletedEntityMessage, getTypeAttribute, getEntityUrl, ENTITY_TYPE_ICONS, getSortNameOfDefaultAlias} = entityHelper;
const {Col, Row} = bootstrap;

function EditionGroupAttributes({editionGroup}) {
export function EditionGroupAttributes({editionGroup}) {
if (editionGroup.deleted) {
return deletedEntityMessage;
}
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/pages/entities/edition.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const {
} = entityHelper;
const {Col, Row} = bootstrap;

function EditionAttributes({edition}) {
export function EditionAttributes({edition}) {
if (edition.deleted) {
return deletedEntityMessage;
}
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/pages/entities/publisher.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const {deletedEntityMessage, extractAttribute, getTypeAttribute, getEntityUrl,
ENTITY_TYPE_ICONS, getSortNameOfDefaultAlias, transformISODateForDisplay} = entityHelper;
const {Col, Row} = bootstrap;

function PublisherAttributes({publisher}) {
export function PublisherAttributes({publisher}) {
if (publisher.deleted) {
return deletedEntityMessage;
}
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/pages/entities/work.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const {deletedEntityMessage, getRelationshipSourceByTypeId, getLanguageAttribute
const {Col, Row} = bootstrap;


function WorkAttributes({work}) {
export function WorkAttributes({work}) {
if (work.deleted) {
return deletedEntityMessage;
}
Expand Down
86 changes: 86 additions & 0 deletions src/client/components/pages/import-entities/author.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
* Copyright (C) 2018 Shivam Tripathi
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

import * as bootstrap from 'react-bootstrap';
import * as importHelper from '../../../helpers/import-entity';

import {AuthorAttributes} from '../entities/author';
import {ENTITY_TYPE_ICONS} from '../../../helpers/entity';
import EntityImage from '../entities/image';
import EntityLinks from '../entities/links';
import ImportFooter from './footer';
import ImportTitle from './title';
import PropTypes from 'prop-types';
import React from 'react';
import {startCase} from 'lodash';


const {getImportUrl} = importHelper;
const {Alert, Col, Row} = bootstrap;


function ImportAuthorDisplayPage({importEntity, identifierTypes}) {
const urlPrefix = getImportUrl(importEntity);
return (
<div>
<Row className="entity-display-background">
<Col className="entity-display-image-box text-center" md={2}>
<EntityImage
backupIcon={ENTITY_TYPE_ICONS.Author}
imageUrl={importEntity.imageUrl}
/>
</Col>
<Col md={10}>
<ImportTitle importEntity={importEntity}/>
<AuthorAttributes author={importEntity}/>
</Col>
</Row>
<EntityLinks
entity={importEntity}
identifierTypes={identifierTypes}
urlPrefix={urlPrefix}
/>
<hr className="margin-top-d40"/>
<Row>
<Alert
className="text-center font-weight-bold"
variant="success"
>
This {startCase(importEntity.type.toLowerCase())} has been automatically added.{' '}
Kindly approve/discard it to help us improve our data.
</Alert>
</Row>
<ImportFooter
hasVoted={importEntity.hasVoted}
importUrl={urlPrefix}
importedAt={importEntity.importedAt}
source={importEntity.source}
/>
</div>
);
}
ImportAuthorDisplayPage.displayName = 'ImportAuthorDisplayPage';
ImportAuthorDisplayPage.propTypes = {
identifierTypes: PropTypes.array,
importEntity: PropTypes.object.isRequired
};
ImportAuthorDisplayPage.defaultProps = {
identifierTypes: []
};

export default ImportAuthorDisplayPage;
Loading
Loading