Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

orcid sync-mode for patent entity #76

Closed
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,14 @@ export class OrcidQueueComponent implements OnInit, OnDestroy {
switch (orcidQueue.recordType.toLowerCase()) {
case 'publication':
return 'fas fa-book';
case 'product':
return 'fas fa-database';
case 'funding':
return 'fa fa-wallet';
case 'project':
return 'fas fa-wallet';
case 'patent':
return 'fas fa-file';
case 'education':
return 'fas fa-school';
case 'affiliation':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,29 @@ <h2>{{'person.orcid.sync.setting' | translate}}</h2>
</div>
</div>
</div>
<div class="col-md mb-3">
<div class="card h-100" data-test="sync-mode-product">
<div class="card-header">{{ 'person.page.orcid.products-references'| translate }}</div>
<div class="card-body">
<div class="container">
<div class="row">
<ds-alert [type]="'alert-info'">
{{ 'person.page.orcid.synchronization-mode-product-message' | translate}}
</ds-alert>
</div>
<div class="form-group">
<div *ngFor="let option of syncProductOptions" class="row form-check">
<input type="radio" [(ngModel)]="currentSyncProduct"
name="syncProducts" id="productOption_{{option.value}}" [value]="option.value"
required>
<label for="productOption_{{option.value}}"
class="ml-2">{{option.label | translate}}</label>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md mb-3">
<div class="card h-100" data-test="sync-mode-funding">
<div class="card-header">{{ 'person.page.orcid.funding-preferences'| translate }}</div>
Expand All @@ -71,6 +94,28 @@ <h2>{{'person.orcid.sync.setting' | translate}}</h2>
</div>
</div>
</div>
<div class="col-md mb-3">
<div class="card h-100" data-test="sync-mode-patent">
<div class="card-header">{{ 'person.page.orcid.patent-preferences'| translate }}</div>
<div class="card-body">
<div class="container">
<div class="row">
<ds-alert [type]="'alert-info'">
{{ 'person.page.orcid.synchronization-mode-patent-message' | translate}}
</ds-alert>
</div>
<div class="form-group">
<div *ngFor="let option of syncPatentOptions" class="row form-check">
<input type="radio" [(ngModel)]="currentSyncPatent"
name="syncPatents" id="patentOption_{{option.value}}" [value]="option.value"
required>
<label for="patentOption_{{option.value}}" class="ml-2">{{option.label | translate}}</label>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-md mb-3">
<div class="card h-100" data-test="profile-preferences">
<div class="card-header">{{ 'person.page.orcid.profile-preferences'| translate }}</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ describe('OrcidSyncSettingsComponent test suite', () => {
'confidence': -1,
'place': 0
}],
'dspace.orcid.sync-patents': [{
'value': 'DISABLED',
'language': null,
'authority': null,
'confidence': -1,
'place': 0
}],
'person.identifier.orcid': [{
'value': 'orcid-id',
'language': null,
Expand Down Expand Up @@ -167,19 +174,25 @@ describe('OrcidSyncSettingsComponent test suite', () => {

it('should create cards properly', () => {
const modes = fixture.debugElement.query(By.css('[data-test="sync-mode"]'));
const patent = fixture.debugElement.query(By.css('[data-test="sync-mode-patent"]'));
const publication = fixture.debugElement.query(By.css('[data-test="sync-mode-publication"]'));
const product = fixture.debugElement.query(By.css('[data-test="sync-mode-product"]'));
const funding = fixture.debugElement.query(By.css('[data-test="sync-mode-funding"]'));
const preferences = fixture.debugElement.query(By.css('[data-test="profile-preferences"]'));
expect(modes).toBeTruthy();
expect(publication).toBeTruthy();
expect(product).toBeTruthy();
expect(patent).toBeTruthy();
expect(funding).toBeTruthy();
expect(preferences).toBeTruthy();
});

it('should init sync modes properly', () => {
expect(comp.currentSyncMode).toBe('MANUAL');
expect(comp.currentSyncPublications).toBe('ALL');
expect(comp.currentSyncProduct).toBe('DISABLED');
expect(comp.currentSyncFunding).toBe('DISABLED');
expect(comp.currentSyncPatent).toBe('DISABLED');
});

describe('form submit', () => {
Expand All @@ -189,6 +202,8 @@ describe('OrcidSyncSettingsComponent test suite', () => {
formGroup = new UntypedFormGroup({
syncMode: new UntypedFormControl('MANUAL'),
syncFundings: new UntypedFormControl('ALL'),
syncProducts: new UntypedFormControl('ALL'),
syncPatents: new UntypedFormControl('ALL'),
syncPublications: new UntypedFormControl('ALL'),
syncProfile_BIOGRAPHICAL: new UntypedFormControl(true),
syncProfile_IDENTIFIERS: new UntypedFormControl(true),
Expand All @@ -204,10 +219,18 @@ describe('OrcidSyncSettingsComponent test suite', () => {
path: '/orcid/mode',
op: 'replace',
value: 'MANUAL'
}, {
path: '/orcid/patents',
op: 'replace',
value: 'ALL'
}, {
path: '/orcid/publications',
op: 'replace',
value: 'ALL'
}, {
path: '/orcid/products',
op: 'replace',
value: 'ALL'
}, {
path: '/orcid/fundings',
op: 'replace',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,21 @@ export class OrcidSyncSettingsComponent implements OnInit {
*/
currentSyncMode: string;

/**
* The current synchronization mode for patents
*/
currentSyncPatent: string;

/**
* The current synchronization mode for publications
*/
currentSyncPublications: string;

/**
* The current synchronization mode for product
*/
currentSyncProduct: string;

/**
* The current synchronization mode for funding
*/
Expand All @@ -50,11 +60,21 @@ export class OrcidSyncSettingsComponent implements OnInit {
*/
syncModes: { value: string, label: string }[];

/**
* The synchronization options for patents
*/
syncPatentOptions: { value: string, label: string }[];

/**
* The synchronization options for publications
*/
syncPublicationOptions: { value: string, label: string }[];

/**
* The synchronization options for products
*/
syncProductOptions: { value: string, label: string }[];

/**
* The synchronization options for funding
*/
Expand Down Expand Up @@ -98,6 +118,22 @@ export class OrcidSyncSettingsComponent implements OnInit {
};
});

this.syncProductOptions = ['DISABLED', 'ALL']
.map((value) => {
return {
label: this.messagePrefix + '.sync-products.' + value.toLowerCase(),
value: value,
};
});

this.syncPatentOptions = ['DISABLED', 'ALL']
.map((value) => {
return {
label: this.messagePrefix + '.sync-patents.' + value.toLowerCase(),
value: value,
};
});

this.syncFundingOptions = ['DISABLED', 'ALL']
.map((value) => {
return {
Expand All @@ -118,7 +154,9 @@ export class OrcidSyncSettingsComponent implements OnInit {
});

this.currentSyncMode = this.getCurrentPreference('dspace.orcid.sync-mode', ['BATCH', 'MANUAL'], 'MANUAL');
this.currentSyncPatent = this.getCurrentPreference('dspace.orcid.sync-patents', ['DISABLED', 'ALL'], 'DISABLED');
this.currentSyncPublications = this.getCurrentPreference('dspace.orcid.sync-publications', ['DISABLED', 'ALL'], 'DISABLED');
this.currentSyncProduct = this.getCurrentPreference('dspace.orcid.sync-products', ['DISABLED', 'ALL'], 'DISABLED');
this.currentSyncFunding = this.getCurrentPreference('dspace.orcid.sync-fundings', ['DISABLED', 'ALL'], 'DISABLED');
}

Expand All @@ -130,7 +168,9 @@ export class OrcidSyncSettingsComponent implements OnInit {
onSubmit(form: UntypedFormGroup): void {
const operations: Operation[] = [];
this.fillOperationsFor(operations, '/orcid/mode', form.value.syncMode);
this.fillOperationsFor(operations, '/orcid/patents', form.value.syncPatents);
this.fillOperationsFor(operations, '/orcid/publications', form.value.syncPublications);
this.fillOperationsFor(operations, '/orcid/products', form.value.syncProducts);
this.fillOperationsFor(operations, '/orcid/fundings', form.value.syncFundings);

const syncProfileValue = this.syncProfileOptions
Expand Down
28 changes: 28 additions & 0 deletions src/assets/i18n/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -6918,6 +6918,10 @@

"person.page.orcid.funding-preferences": "Funding preferences",

"person.page.orcid.product-preferences": "Product preferences",

"person.page.orcid.patent-preferences": "Patent preferences",

"person.page.orcid.publications-preferences": "Publication preferences",

"person.page.orcid.remove-orcid-message": "If you need to remove your ORCID, please contact the repository administrator",
Expand All @@ -6940,6 +6944,14 @@

"person.page.orcid.sync-fundings.disabled": "Disabled",

"person.page.orcid.sync-patents.all": "All patents",

"person.page.orcid.sync-patents.mine": "My patents",

"person.page.orcid.sync-patents.my_selected": "Selected patents",

"person.page.orcid.sync-patents.disabled": "Disabled",

"person.page.orcid.sync-publications.all": "All publications",

"person.page.orcid.sync-publications.mine": "My publications",
Expand All @@ -6948,6 +6960,14 @@

"person.page.orcid.sync-publications.disabled": "Disabled",

"person.page.orcid.sync-products.all": "All products",

"person.page.orcid.sync-products.mine": "My products",

"person.page.orcid.sync-products.my_selected": "Selected products",

"person.page.orcid.sync-products.disabled": "Disabled",

"person.page.orcid.sync-queue.discard": "Discard the change and do not synchronize with the ORCID registry",

"person.page.orcid.sync-queue.discard.error": "The discarding of the ORCID queue record failed",
Expand Down Expand Up @@ -6984,8 +7004,12 @@

"person.page.orcid.sync-queue.tooltip.delete": "Remove this entry from the ORCID registry",

"person.page.orcid.sync-queue.tooltip.patent": "Patent",

"person.page.orcid.sync-queue.tooltip.publication": "Publication",

"person.page.orcid.sync-queue.tooltip.product": "Product",

"person.page.orcid.sync-queue.tooltip.project": "Project",

"person.page.orcid.sync-queue.tooltip.affiliation": "Affiliation",
Expand Down Expand Up @@ -7066,8 +7090,12 @@

"person.page.orcid.synchronization-mode-funding-message": "Select whether to send your linked Project entities to your ORCID record's list of funding information.",

"person.page.orcid.synchronization-mode-patent-message": "Select whether to send your linked Patent entities to your ORCID record's list of works.",

"person.page.orcid.synchronization-mode-publication-message": "Select whether to send your linked Publication entities to your ORCID record's list of works.",

"person.page.orcid.synchronization-mode-product-message": "Select whether to send your linked Product entities to your ORCID record's list of works.",

"person.page.orcid.synchronization-mode-profile-message": "Select whether to send your biographical data or personal identifiers to your ORCID record.",

"person.page.orcid.synchronization-settings-update.success": "The synchronization settings have been updated successfully",
Expand Down