Skip to content

Commit 3f95fd6

Browse files
committed
bugfix
1 parent e5bb0cd commit 3f95fd6

File tree

4 files changed

+52
-19
lines changed

4 files changed

+52
-19
lines changed

src/components/pid-component/pid-component.stories.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,3 +419,19 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor i
419419
},
420420
},
421421
};
422+
423+
export const TypedPIDMakerExampleText: Story = {
424+
args: {
425+
value: '21.T11981/be908bd1-e049-4d35-975e-8e27d40117e6',
426+
},
427+
decorators: [
428+
(story: () => unknown) => html`
429+
<p class="align-middle items-center w-1/3">
430+
The Typed PID Maker is an entry point to integrate digital resources into the FAIR Digital Object (FAIR DO) ecosystem. It allows creating PIDs for resources and to provide
431+
them with the necessary metadata to ensure that the resources can be found and understood. <br />
432+
As a result, a machine-readable representation of all kinds of research artifacts allows act on such FAIR Digital Objects which present themselves as PID, e.g., ${story()},
433+
but carry much more than just a pointer to a landing page.
434+
</p>
435+
`,
436+
],
437+
};

src/rendererModules/LocaleType.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class LocaleType extends GenericIdentifierType {
1111
}
1212

1313
hasCorrectFormat(): boolean {
14-
const regex = /^[a-z]{2}(-[A-Z]{2})?$/;
14+
const regex = /^([a-zA-Z]{2})(-[A-Z]{2})?$/;
1515
return regex.test(this.value);
1616
}
1717

src/rendererModules/ORCiD/ORCIDInfo.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,22 @@ export class ORCIDInfo {
296296
});
297297
// .then(response => response.json());
298298

299-
// Parse family name and given names
300-
const familyName = rawOrcidJSON['person']['name']['family-name']['value'];
301-
const givenNames = rawOrcidJSON['person']['name']['given-names']['value'];
299+
let familyName = '';
300+
let givenNames = [];
301+
302+
try {
303+
familyName = rawOrcidJSON['person']['name']['family-name']['value'];
304+
} catch (e) {
305+
console.debug(e);
306+
}
307+
308+
try {
309+
givenNames = rawOrcidJSON['person']['name']['given-names']['value'];
310+
} catch (e) {
311+
console.debug(e);
312+
}
313+
// const familyName = rawOrcidJSON['person']['name']['family-name']['value'] ? rawOrcidJSON['person']['name']['family-name']['value'] : '';
314+
// const givenNames = rawOrcidJSON['person']['name']['given-names']['value'] ? rawOrcidJSON['person']['name']['given-names']['value'] : '';
302315

303316
// Parse employments, if available
304317
const affiliations = rawOrcidJSON['activities-summary']['employments']['affiliation-group'];

src/rendererModules/ORCiD/ORCIDType.tsx

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,26 @@ export class ORCIDType extends GenericIdentifierType {
6565

6666
// Generate items and actions
6767
this.items.push(
68-
...[
69-
new FoldableItem(
70-
0,
71-
'ORCiD',
72-
this._orcidInfo.orcid,
73-
'ORCiD is a free service for researchers to distinguish themselves by creating a unique personal identifier.',
74-
'https://orcid.org',
75-
undefined,
76-
true,
77-
),
78-
new FoldableItem(1, 'Family Name', this._orcidInfo.familyName, 'The family name of the person.'),
79-
],
68+
new FoldableItem(
69+
0,
70+
'ORCiD',
71+
this._orcidInfo.orcid,
72+
'ORCiD is a free service for researchers to distinguish themselves by creating a unique personal identifier.',
73+
'https://orcid.org',
74+
undefined,
75+
true,
76+
),
8077
);
8178

79+
try {
80+
const familyName = this._orcidInfo.familyName;
81+
if (familyName) {
82+
new FoldableItem(1, 'Family Name', this._orcidInfo.familyName, 'The family name of the person.');
83+
}
84+
} catch (e) {
85+
console.log('Failed to obtain family name from ORCiD record.', e);
86+
}
87+
8288
try {
8389
const givenNames = this._orcidInfo.givenNames;
8490
if (givenNames) {
@@ -139,9 +145,7 @@ export class ORCIDType extends GenericIdentifierType {
139145

140146
// If there are other e-mail addresses, generate an item with a list of them
141147
if (other.length > 0)
142-
this.items.push(
143-
new FoldableItem(70, 'Other E-Mail addresses', other.map(email => email.email).join(', '), 'All other e-mail addresses of the person.', undefined, undefined, false),
144-
);
148+
this.items.push(new FoldableItem(70, 'Other E-Mail addresses', other.map(email => email.email).join(', '), 'All other e-mail addresses of the person.'));
145149

146150
if (this._orcidInfo.preferredLocale)
147151
this.items.push(new FoldableItem(25, 'Preferred Language', this._orcidInfo.preferredLocale, 'The preferred locale/language of the person.'));

0 commit comments

Comments
 (0)