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 product entity #73

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,6 +120,8 @@ 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':
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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,20 @@ describe('OrcidSyncSettingsComponent test suite', () => {
it('should create cards properly', () => {
const modes = fixture.debugElement.query(By.css('[data-test="sync-mode"]'));
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(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');
});

Expand All @@ -189,6 +192,7 @@ describe('OrcidSyncSettingsComponent test suite', () => {
formGroup = new UntypedFormGroup({
syncMode: new UntypedFormControl('MANUAL'),
syncFundings: new UntypedFormControl('ALL'),
syncProducts: new UntypedFormControl('ALL'),
syncPublications: new UntypedFormControl('ALL'),
syncProfile_BIOGRAPHICAL: new UntypedFormControl(true),
syncProfile_IDENTIFIERS: new UntypedFormControl(true),
Expand All @@ -208,6 +212,10 @@ describe('OrcidSyncSettingsComponent test suite', () => {
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 @@ -40,6 +40,11 @@ export class OrcidSyncSettingsComponent implements OnInit {
*/
currentSyncPublications: string;

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

/**
* The current synchronization mode for funding
*/
Expand All @@ -55,6 +60,11 @@ export class OrcidSyncSettingsComponent implements OnInit {
*/
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 +108,14 @@ export class OrcidSyncSettingsComponent implements OnInit {
};
});

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

this.syncFundingOptions = ['DISABLED', 'ALL']
.map((value) => {
return {
Expand All @@ -119,6 +137,7 @@ export class OrcidSyncSettingsComponent implements OnInit {

this.currentSyncMode = this.getCurrentPreference('dspace.orcid.sync-mode', ['BATCH', 'MANUAL'], 'MANUAL');
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 @@ -131,6 +150,7 @@ export class OrcidSyncSettingsComponent implements OnInit {
const operations: Operation[] = [];
this.fillOperationsFor(operations, '/orcid/mode', form.value.syncMode);
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
14 changes: 14 additions & 0 deletions src/assets/i18n/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -6918,6 +6918,8 @@

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

"person.page.orcid.product-preferences": "Product 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 Down Expand Up @@ -6948,6 +6950,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 @@ -6986,6 +6996,8 @@

"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 @@ -7068,6 +7080,8 @@

"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