diff --git a/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/deposit/DoiMint.js b/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/deposit/DoiMint.js deleted file mode 100644 index e665008..0000000 --- a/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/deposit/DoiMint.js +++ /dev/null @@ -1,203 +0,0 @@ -import React, { Component } from "react"; -import { - Button, - Card, - Icon, - Label, - Loader, - Dimmer, - Message, -} from "semantic-ui-react"; -import { FieldArray } from "formik"; - -import { FetchDoi, MapDatacite } from "datacite-rest"; - -export class DoiMint extends Component { - constructor(props) { - super(props); - this.record = props.record || {}; - this.configs = props.config || {}; - this.metadata = this.record.metadata; - this.is_doi = false; - this.id_doi = ""; - - // check for existing identifiers - if ( - typeof this.metadata.identifiers != "undefined" && - this.metadata.identifiers != null && - this.metadata.identifiers.length != null && - this.metadata.identifiers.length > 0 && - this.metadata.identifiers[0] != null - ) { - for(var identifier of this.metadata.identifiers){ - if (identifier.scheme == "doi"){ - this.is_doi = true; - this.id_doi = identifier.identifier; - } - } - } - - // add metadata to the state - this.state = { - identifiers: [], - showLoader: false, - doi_id: "", - errorMsg: "", - isError: false, - }; - } - - render() { - // this should fetch a new doi - var pushDoi = (form) => { - // activate the loader - this.setState({ - showLoader: true, - }); - - // get the prefix from backend - const prefix = this.configs.datacite_prefix; - const suffix = this.configs.datacite_suffix; - const host_url = this.configs.datacite_host_url - - if (prefix !== null && suffix !== null) { - // get mapped DOI - const mapped = MapDatacite(this.metadata, this.record.id, prefix, suffix, host_url); - - const _fetchdoi = new FetchDoi("/getdoi"); - - // Create a new DOI - _fetchdoi - .create(mapped) - .then((data) => { - // if there is an error - if (data.data.errors) { - this.setState({ - showLoader: false, - isError: true, - errorMsg: data.data.errors[0].title, - }); - } - // new doi is fetched - else { - // add new identifier - const _identifiers = [ - { - identifier: data.data.data.data.id, - scheme: "doi", - }, - ]; - // submit the value to the form - this.setState({ identifiers: _identifiers }); - form.setFieldValue( - "metadata.identifiers", - this.state.identifiers - ); - - this.is_doi = true; - // deactivate the loader - this.setState({ - showLoader: false, - doi_id: this.state.identifiers[0].identifier, - }); - } - }) - .catch((error) => { - console.log("error", error); - }); - } else { - this.setState({ - showLoader: false, - isError: true, - errorMsg: "Not configured!", - }); - } - }; - - // // get a link of dio - // var doiLink = (doiId) => { - // window.open(`https://doi.org/${doiId}`, "_blank"); - // }; - - return ( - - - - - Datacite DOI - - - - Record must be a published record to mint a DOI. - - - - {this.state.isError && ( - - {this.state.errorMsg} -

Please contact Repository supporters!

-
- )} - - {/* when the Component is rendered */} - {!this.is_doi && ( - - {(fieldArrayProps) => { - const { form } = fieldArrayProps; - return ( -
- - {this.state.showLoader && ( - - Loading... - - )} -
- ); - }} -
- )} - - {this.is_doi && ( -
- {this.state.doi_id && ( - - A DOI is registered! -

Please save the deposit.

-
- )} - -
- )} -
-
- ); - } -} diff --git a/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/deposit/PublisherField.js b/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/deposit/PublisherField.js deleted file mode 100644 index 048ae2e..0000000 --- a/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/deposit/PublisherField.js +++ /dev/null @@ -1,47 +0,0 @@ -// This file is part of React-Invenio-Deposit -// Copyright (C) 2020 CERN. -// Copyright (C) 2020 Northwestern University. -// Copyright (C) 2021 Graz University of Technology. -// -// React-Invenio-Deposit is free software; you can redistribute it and/or modify it -// under the terms of the MIT License; see LICENSE file for more details. - -import React, { Component } from 'react'; -import PropTypes from 'prop-types'; - -import { FieldLabel, TextField } from 'react-invenio-forms'; - -export class PublisherField extends Component { - render() { - const { fieldPath, label, labelIcon, placeholder, required } = this.props; - - return ( - - } - placeholder={placeholder} - required={required} - /> - ); - } -} - -PublisherField.propTypes = { - fieldPath: PropTypes.string.isRequired, - label: PropTypes.string, - labelIcon: PropTypes.string, - placeholder: PropTypes.string, - required: PropTypes.bool, -}; - -PublisherField.defaultProps = { - fieldPath: 'metadata.publisher', - label: 'Publisher', - labelIcon: 'building outline', - placeholder: 'Enter publisher name', -}; diff --git a/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/deposit/RDMDepositForm.js b/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/deposit/RDMDepositForm.js deleted file mode 100644 index 142640e..0000000 --- a/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/deposit/RDMDepositForm.js +++ /dev/null @@ -1,522 +0,0 @@ -// This file is part of InvenioRDM -// Copyright (C) 2020 CERN. -// Copyright (C) 2020 Northwestern University. -// Copyright (C) 2021 Graz University of Technology. -// -// Invenio App RDM is free software; you can redistribute it and/or modify it -// under the terms of the MIT License; see LICENSE file for more details. - -import _get from "lodash/get"; -import React, { Component, createRef } from "react"; -import { - Button, - Card, - Container, - Grid, - Icon, - Ref, - Sticky, -} from "semantic-ui-react"; -import { - AccessRightField, - ComingSoonField, - CreatibutorsField, - DatesField, - DepositFormApp, - FormFeedback, - DeleteButton, - DepositFormTitle, - DescriptionsField, - FileUploader, - FundingField, - IdentifiersField, - LanguagesField, - PublishButton, - PublicationDateField, - ResourceTypeField, - SaveButton, - SubjectsField, - TitlesField, - RelatedWorksField, - VersionField, - LicenseField, -} from "react-invenio-deposit"; -import { AccordionField } from "react-invenio-forms"; -import { DoiMint } from "./DoiMint"; -import { PublisherField } from "./PublisherField"; - -export class RDMDepositForm extends Component { - constructor(props) { - super(props); - this.config = props.config || {}; - // TODO: retrieve from backend - this.config["canHaveMetadataOnlyRecords"] = true; - - // TODO: Make ALL vocabulary be generated by backend. - // Currently, some vocabulary is generated by backend and some is - // generated by frontend here. Iteration is faster and abstractions can be - // discovered by generating vocabulary here. Once happy with vocabularies, - // then we can generate it in the backend. - this.vocabularies = { - metadata: { - ...this.config.vocabularies, - - titles: { - ...this.config.vocabularies.titles, - }, - - descriptions: { - type: [ - { text: "Abstract", value: "abstract" }, - { text: "Methods", value: "methods" }, - { text: "Series Information", value: "seriesinformation" }, - { text: "Table of Contents", value: "tableofcontents" }, - { text: "Technical Info", value: "technicalinfo" }, - { text: "Other", value: "other" }, - ], - }, - - creators: { - type: [ - { text: "Person", value: "personal" }, - { text: "Organization", value: "organizational" }, - ], - role: [ - { text: "Editor", value: "editor" }, - { text: "Data Curator", value: "datacurator" }, - { text: "Data Manager", value: "datamanager" }, - { text: "Project Manager", value: "projectmanager" }, - ], - }, - - contributors: { - type: [ - { text: "Person", value: "personal" }, - { text: "Organization", value: "organizational" }, - ], - role: [ - { text: "Editor", value: "editor" }, - { text: "Data Curator", value: "datacurator" }, - { text: "Data Manager", value: "datamanager" }, - { text: "Project Manager", value: "projectmanager" }, - ], - }, - - dates: { - type: [ - { text: "Accepted", value: "accepted" }, - { text: "Available", value: "available" }, - { text: "Copyrighted", value: "copyrighted" }, - { text: "Collected", value: "collected" }, - { text: "Created", value: "created" }, - { text: "Issued", value: "issued" }, - { text: "Submitted", value: "submitted" }, - { text: "Updated", value: "updated" }, - { text: "Valid", value: "valid" }, - { text: "Withdrawn", value: "withdrawn" }, - { text: "Other", value: "other" }, - ], - }, - - // TODO: Replace with an API backend - funding: { - funder: [ - { - name: "National Institutes of Health (US)", - identifier: "funder1", - scheme: "funderScheme1", - }, - { - name: "European Commission (EU)", - identifier: "funder2", - scheme: "funderScheme2", - }, - ], - award: [ - { - title: "CANCER &AIDS DRUGS--PRECLIN PHARMACOL/TOXICOLOGY", - number: "N01CM037835-016", - identifier: "awardA", - scheme: "awardSchemeA", - parentScheme: "funderScheme1", - parentIdentifier: "funder1", - }, - { - title: - "Beyond the Standard Model at the LHC and with Atom Interferometers.", - number: "228169", - identifier: "awardB1", - scheme: "awardSchemeB", - parentScheme: "funderScheme2", - parentIdentifier: "funder2", - }, - { - title: "ENvironmental COnditions in GLAucoma Patients", - number: "747441", - identifier: "awardB2", - scheme: "awardSchemeB", - parentScheme: "funderScheme2", - parentIdentifier: "funder2", - }, - ], - }, - - related_identifiers: { - resource_type: this.config.vocabularies.resource_type, - scheme: [ - { text: "ARK", value: "ark" }, - { text: "ARXIV", value: "arxiv" }, - { text: "BIBCODE", value: "bibcode" }, - { text: "DOI", value: "doi" }, - { text: "EAN13", value: "ean13" }, - { text: "EISSN", value: "eissn" }, - { text: "HANDLE", value: "handle" }, - { text: "IGSN", value: "igsn" }, - { text: "ISBN", value: "isbn" }, - { text: "ISSN", value: "issn" }, - { text: "ISTC", value: "istc" }, - { text: "LISSN", value: "lissn" }, - { text: "LSID", value: "lsid" }, - { text: "PMID", value: "pmid" }, - { text: "PURL", value: "purl" }, - { text: "UPC", value: "upc" }, - { text: "URL", value: "url" }, - { text: "URN", value: "urn" }, - { text: "W3ID", value: "w3id" }, - ], - relations: [ - { text: "Is cited by", value: "iscitedby" }, - { text: "Cites", value: "cites" }, - { text: "Is supplement to", value: "issupplementto" }, - { text: "Is supplemented by", value: "issupplementedby" }, - { text: "Is continued by", value: "iscontinuedby" }, - { text: "Continues", value: "continues" }, - { text: "Is described by", value: "isdescribedby" }, - { text: "Describes", value: "describes" }, - { text: "Has metadata", value: "hasmetadata" }, - { text: "Is metadata for", value: "ismetadatafor" }, - { text: "Has version", value: "hasversion" }, - { text: "Is version of", value: "isversionof" }, - { text: "Is new version of", value: "isnewversionof" }, - { text: "Is previous version of", value: "ispreviousversionof" }, - { text: "Is part of", value: "ispartof" }, - { text: "Has part", value: "haspart" }, - { text: "Is referenced by", value: "isreferencedby" }, - { text: "References", value: "references" }, - { text: "Is documented by", value: "isdocumentedby" }, - { text: "Documents", value: "documents" }, - { text: "Is compiled by", value: "iscompiledby" }, - { text: "Compiles", value: "compiles" }, - { text: "Is variant form of", value: "isvariantformof" }, - { text: "Is original form of", value: "isoriginalformof" }, - { text: "Is identical to", value: "isidenticalto" }, - { text: "Is reviewed by", value: "isreviewedby" }, - { text: "Reviews", value: "reviews" }, - { text: "Is derived from", value: "isderivedfrom" }, - { text: "Is source of", value: "issourceof" }, - { text: "Is required by", value: "isrequiredby" }, - { text: "Requires", value: "requires" }, - { text: "Is obsoleted by", value: "isobsoletedby" }, - { text: "Obsoletes", value: "obsoletes" }, - ], - }, - subjects: { - options: [ - { - text: "Deep Learning", - value: { - subject: "Deep Learning", - scheme: "user", - identifier: "U1", - }, - }, - { - text: "MeSH: Cognitive Neuroscience", - value: { - subject: "Cognitive Neuroscience", - scheme: "mesh", - identifier: "D000066494", - }, - }, - { - text: "FAST: Glucagonoma", - value: { - subject: "Glucagonoma", - scheme: "fast", - identifier: "943672", - }, - }, - ], - limitToOptions: [ - { text: "All", value: "all" }, - { text: "MeSH", value: "mesh" }, - { text: "FAST", value: "fast" }, - ], - }, - }, - }; - - // check if files are present - this.noFiles = false; - if ( - !Array.isArray(this.props.files.entries) || - (!this.props.files.entries.length && this.props.record.is_published) - ) { - this.noFiles = true; - } - } - - formFeedbackRef = createRef(); - sidebarRef = createRef(); - - accordionStyle = { - header: { className: "inverted brand", style: { cursor: "pointer" } }, - }; - - render() { - return ( - - - - - - - - - {this.noFiles && this.props.record.is_published && ( -

- The record has no files. -

- )} - -
- {/**TODO: uncomment to use IdentifiersField*/} - {/* - - -
-
*/} - - - - - - - - ({ - title: result.title_l10n, - description: result.description_l10n, - id: result.id, - link: result.props.url, - })} - /> -
-
- - - - {/**TODO: uncomment to use Subjects*/} - {/* - */} - {/**TODO- enable once issue is solved: - * https://github.com/inveniosoftware/invenio-app-rdm/issues/738 - */} - {/* lang !== null)} // needed because dumped empty record from backend gives [null] - serializeSuggestions={(suggestions) => - suggestions.map((item) => ({ - text: item.title_l10n, - value: item.id, - key: item.id, - })) - } - /> */} - - - -
-
- {/**TODO: uncomment to use FundingField*/} - {/* - - - -
-
*/} - - - -
-
-
- - - - - - - - - - - - - - - - - - {this.config.data_cite && ( - - )} - - - -
-
-
-
- ); - } -} diff --git a/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/deposit/index.js b/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/deposit/index.js deleted file mode 100644 index 869d72b..0000000 --- a/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/deposit/index.js +++ /dev/null @@ -1,23 +0,0 @@ -// This file is part of InvenioRDM -// Copyright (C) 2020 CERN. -// Copyright (C) 2020 Northwestern University. -// -// Invenio App RDM is free software; you can redistribute it and/or modify it -// under the terms of the MIT License; see LICENSE file for more details. - -import React from "react"; -import ReactDOM from "react-dom"; -import "semantic-ui-css/semantic.min.css"; - -import { getInputFromDOM } from "react-invenio-deposit"; -import { RDMDepositForm } from "./RDMDepositForm"; - -ReactDOM.render( - , - document.getElementById("deposit-form") -); diff --git a/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/search/components.js b/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/search/components.js deleted file mode 100644 index 5a35cde..0000000 --- a/invenio_theme_tugraz/assets/semantic-ui/js/invenio_theme_tugraz/search/components.js +++ /dev/null @@ -1,324 +0,0 @@ -/* - * Copyright (C) 2020 CERN. - * Copyright (C) 2020 Northwestern University. - * Copyright (C) 2020 Graz University of Technology - * - * invenio-theme-tugraz is free software; you can redistribute it - * and/or modify it under the terms of the MIT License; see LICENSE - * file for more details. - * - * origin: invenio_app_rdm/search/components.js - */ - -import React, { useState } from "react"; -import { Card, Item, Input, Label, Button, Grid, Checkbox, List, } from "semantic-ui-react"; -import { BucketAggregation, Toggle } from "react-searchkit"; -import _ from "lodash"; -import _truncate from "lodash/truncate"; -import Overridable from "react-overridable"; -import { SearchBar } from "@js/invenio_search_ui/components"; - -export const RDMRecordResultsListItem = ({ result, index }) => { - const description = _.get(result, "metadata.description", "No description"); - const version = _.get(result, "metadata.version", ""); - const creators = _.get(result, "metadata.creators", []); - const title = _.get(result, "metadata.title", "No title"); - const subjects = _.get(result, "metadata.subjects", null); - const rights = _.get(result, "metadata.rights", null) - - const publicationDate = _.get(result, "ui.publication_date_l10n_long", "No publication date found"); - const createdDate = _.get(result, "ui.created_date_l10n_long", "No creation date found."); - const resourceType = _.get(result, "ui.resource_type", "No resource type"); - const access = _.get(result, "ui.access_right.title", "No access rights"); - const accessRightCategory = _.get(result, "ui.access_right.category", "closed"); - const accessRightIcon = _.get(result, "ui.access_right.icon", "closed"); - const accessRight = {type: access, category: accessRightCategory, icon: accessRightIcon, rights}; - - const href = `/records/${result.id}`; - - return ( - - -
- - -
- {title} - - - {_truncate(description.replace(/(<([^>]+)>)/ig, ''), { length: 350 })} - -