Skip to content

Comments

new project metadata representation component#2277

Merged
artlowel merged 19 commits intoDSpace:mainfrom
paulo-graca:bugfix/addressing-#2276
Jun 21, 2023
Merged

new project metadata representation component#2277
artlowel merged 19 commits intoDSpace:mainfrom
paulo-graca:bugfix/addressing-#2276

Conversation

@paulo-graca
Copy link
Contributor

@paulo-graca paulo-graca commented May 30, 2023

References

Add references/links to any related issues or PRs. These may include:

Description

This PR adds a new component to address issue #2276.

Instructions for Reviewers

You will find that when trying to create a relationship from a Project to a Publication, the project label is shown on the submission form (the dc:title field)
image

@paulo-graca paulo-graca added the 1 APPROVAL pull request only requires a single approval to merge label May 30, 2023
@paulo-graca paulo-graca self-assigned this May 30, 2023
@paulo-graca paulo-graca added the component: configurable entities related to configurable entities label May 30, 2023
@paulo-graca paulo-graca marked this pull request as ready for review May 30, 2023 14:51
@tdonohue tdonohue added this to the 7.6 milestone May 30, 2023
@tdonohue tdonohue requested a review from artlowel June 1, 2023 14:14
@artlowel
Copy link
Member

artlowel commented Jun 8, 2023

@paulo-graca The code looks sensible, but I don't seem to be able to reproduce the issue in the first place. If I create a relationship to a Project in the submission it already has a proper name:

            <row>
                <relation-field>
                    <relationship-type>isProjectOfPublication</relationship-type>
                    <search-configuration>project</search-configuration>
                    <label>Project</label>
                    <hint>import a project</hint>
                </relation-field>
            </row>

Perhaps you can send me the exact submission config I need to reproduce the issue?

@tdonohue tdonohue self-requested a review June 8, 2023 14:41
@paulo-graca
Copy link
Contributor Author

Thank you @artlowel for your feedback. I will try to gather more data.

@paulo-graca
Copy link
Contributor Author

paulo-graca commented Jun 10, 2023

@artlowel I'm using openAIREPublicationSubmission

With the field specification:

            <row>
                <relation-field>
                    <relationship-type>isProjectOfPublication</relationship-type>
                    <search-configuration>project</search-configuration>
                    <repeatable>true</repeatable>
                    <name-variants>false</name-variants>
                    <label>Funding</label>
                    <hint>Add a related Funding</hint>
                    <linked-metadata-field>
                        <dc-schema>dc</dc-schema>
                        <dc-element>relation</dc-element>
                        <input-type>onebox</input-type>
                    </linked-metadata-field>
                    <externalsources>openAIREFunding</externalsources>
                    <required></required>
                </relation-field>
            </row>

and the relationship type definition has the following:

	<type>
		<leftType>Publication</leftType>
		<rightType>Project</rightType>
		<leftwardType>isProjectOfPublication</leftwardType>
		<rightwardType>isPublicationOfProject</rightwardType>
		<leftCardinality>
			<min>0</min>
		</leftCardinality>
		<rightCardinality>
			<min>0</min>
		</rightCardinality>
	</type>

This is what is happening:

invisible-project

Copy link
Member

@artlowel artlowel left a comment

Choose a reason for hiding this comment

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

Thanks @paulo-graca!

The key was to use the openaire4 virtual metadata mapping. If I use that, I can reproduce the issue.

However your fix doesn't work for me in all cases, because you've created a new component with a decorator specific to dspace (i.e. @metadataRepresentationComponent). You need to add that component to the ENTRY_COMPONENTS array of its module. That way angular will know it exists and process that decorator when the app starts. Otherwise you just have to be lucky that it's already been processed by the time you need it

@paulo-graca
Copy link
Contributor Author

Thank you @artlowel for your feedback, I will address it soon as possible!

@paulo-graca paulo-graca requested a review from artlowel June 20, 2023 09:27
@paulo-graca
Copy link
Contributor Author

@artlowel I've just addressed your feedback. It's working for me.
image

I will just address the remaining styling issues.

Copy link
Member

@artlowel artlowel left a comment

Choose a reason for hiding this comment

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

Thanks @paulo-graca!

The changes look good, but the tests fail at the moment.

Looks like you still need to provide DSONameService in project-item-metadata-list-element.component.spec.ts

Meaning, add something like this to the beforeEach:

dsoNameService = jasmine.createSpyObj({
  getName: projectTitle
});

And then add that mock service to the providers list of the testbed:

declarations: [ProjectItemMetadataListElementComponent],
providers: [
  { provide: DSONameService, useValue: dsoNameService }
],
schemas: [NO_ERRORS_SCHEMA]

Once the tests are fixed, I'm a +1 for this PR

@paulo-graca
Copy link
Contributor Author

I don't have a test system setup on my remote host, I was trying to do that. But it will take me some time.
I didn't saw your feedback in time before my last push, but I think I was in the right track. Thank you! I will try to address it.

@artlowel artlowel merged commit 499bfe3 into DSpace:main Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1 APPROVAL pull request only requires a single approval to merge bug component: configurable entities related to configurable entities

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

Missing Project metadata representation component

3 participants