Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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 Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
44 changes: 20 additions & 24 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
23 changes: 21 additions & 2 deletions client/src/components/ViafIdentifierForm.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -13,10 +13,29 @@ type Props = {
value: string | number
};

const PATH = [
'ns1:VIAFCluster',
'ns1:mainHeadings',
'ns1:data'
];

const NAME_ATTRIBUTE = 'ns1:text';
Comment on lines +16 to +22
Copy link
Contributor

@blms blms Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it ns1 for every result in the response? I actually had to configure a Python VIAF API library to use the new API response and I found that it increased ns2, ns3 etc per each subsequent result. Though not 100% sure we're using the same endpoint (this one was for /search I believe). And since we're only doing this after selecting an entry maybe we only want the first result?

Just in case, here are all the changes I had to make in that library:

API reference

  • Changes to the search params and headers:

    • maximumRecords can only be a maximum of 10 (documented)
    • sortKeys has been renamed to sortKey, and only accepts holdingscount (documented)
    • httpAccept/Accept params no longer work, but passing an Accept header does (not documented)
  • Changes to search results (none documented):

    • Search results are now nested as records: { record: [] } or records: { record: {} }
    • Metadata is now nested under VIAFCluster inside of recordData
    • Most JSON keys are now "namespaced" using ns2:, ns3:, ns4: prefixes, which increase per result. For example, a result's recordData might look like
      {"ns2:VIAFCluster": {"ns2:mainHeadings": {"ns2:data": {"ns2:text": "My Name"}}}}
      and the following search result will have the same keys but with ns3: prefixed, etc. up to ns11.
    • Other small things, like numberOfRecords count being nested under content now, and @about renamed to about


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 (
<Form.Input
error={props.error}
Expand All @@ -35,7 +54,7 @@ const ViafIdentifierForm = (props: Props) => {
size='small'
/>
)}
text={_.first(selectedItem?.mainHeadings?.data)?.text}
text={text}
value={props.value}
/>
</Form.Input>
Expand Down
1 change: 1 addition & 0 deletions client/src/components/WebIdentifierDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ const WebIdentifierDropdown = (props: Props) => {
innerRef={inputRef}
>
<DropdownSearchInput
className={styles.input}
value={searchQuery}
/>
</Ref>
Expand Down
4 changes: 4 additions & 0 deletions client/src/components/WebIdentifierDropdown.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@

.webIdentifierDropdown.ui.dropdown.search.selection > .menu > .item > .optionContainer {
flex-grow: 1;
}

.webIdentifierDropdown.ui.dropdown.search.selection > .input {
width: 100%;
}