diff --git a/Gemfile b/Gemfile index 16f304a..03cb0fe 100644 --- a/Gemfile +++ b/Gemfile @@ -37,7 +37,8 @@ gem 'resource_api', git: 'https://github.com/performant-software/resource-api.gi gem 'jwt_auth', git: 'https://github.com/performant-software/jwt-auth.git', tag: 'v0.1.3' # Core data -gem 'core_data_connector', git: 'https://github.com/performant-software/core-data-connector.git', tag: 'v0.1.103' +#gem 'core_data_connector', git: 'https://github.com/performant-software/core-data-connector.git', tag: 'v0.1.104' +gem 'core_data_connector', path: '../core-data-connector' # IIIF gem 'triple_eye_effable', git: 'https://github.com/performant-software/triple-eye-effable.git', tag: 'v0.2.7' diff --git a/Gemfile.lock b/Gemfile.lock index a66f872..966201c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,25 +1,3 @@ -GIT - remote: https://github.com/performant-software/core-data-connector.git - revision: e16f738ed177b6a90943d523849839cd109c1dbb - tag: v0.1.103 - specs: - core_data_connector (0.1.0) - activerecord-postgis-adapter (~> 11.0) - faker - fuzzy_dates - jwt (~> 3.1.2) - jwt_auth - postmark-rails (~> 0.22.1) - rack-cors (~> 3.0.0) - rails (>= 8.0, < 9) - resource_api - rgeo-geojson (~> 2.2) - rubyzip (~> 2.3.2) - triple_eye_effable - typesense (~> 0.14) - typhoeus (~> 1.4) - user_defined_fields - GIT remote: https://github.com/performant-software/fuzzy-dates.git revision: 1572b9c3370922aace98e9e2db139a30c55fda48 @@ -66,6 +44,26 @@ GIT rails (>= 6.0.3.2, < 9) resource_api +PATH + remote: ../core-data-connector + specs: + core_data_connector (0.1.0) + activerecord-postgis-adapter (~> 11.0) + faker + fuzzy_dates + jwt (~> 3.1.2) + jwt_auth + postmark-rails (~> 0.22.1) + rack-cors (~> 3.0.0) + rails (>= 8.0, < 9) + resource_api + rgeo-geojson (~> 2.2) + rubyzip (~> 2.3.2) + triple_eye_effable + typesense (~> 0.14) + typhoeus (~> 1.4) + user_defined_fields + GEM remote: https://rubygems.org/ specs: @@ -189,8 +187,6 @@ GEM faker (3.5.2) i18n (>= 1.8.11, < 2) ffi (1.17.2-arm64-darwin) - ffi (1.17.2-x86_64-darwin) - ffi (1.17.2-x86_64-linux-gnu) globalid (1.1.0) activesupport (>= 5.0) httparty (0.20.0) diff --git a/client/src/components/ViafIdentifierForm.js b/client/src/components/ViafIdentifierForm.js index 78547e6..15fa4db 100644 --- a/client/src/components/ViafIdentifierForm.js +++ b/client/src/components/ViafIdentifierForm.js @@ -1,6 +1,6 @@ // @flow -import React, { useState } from 'react'; +import React, { useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Form, Header } from 'semantic-ui-react'; import WebIdentifierDropdown from './WebIdentifierDropdown'; @@ -13,10 +13,29 @@ type Props = { value: string | number }; +const PATH = [ + 'ns1:VIAFCluster', + 'ns1:mainHeadings', + 'ns1:data' +]; + +const NAME_ATTRIBUTE = 'ns1:text'; + const ViafIdentifierForm = (props: Props) => { const [selectedItem, setSelectedItem] = useState(); const { t } = useTranslation(); + /** + * Memo-izes the name of the item selected from the VIAF response. + */ + const text = useMemo(() => ( + _.chain(selectedItem) + .get(PATH) + .first() + .get(NAME_ATTRIBUTE) + .value() + ), [selectedItem]); + return (