Skip to content

Commit 13280ff

Browse files
alisaismailatisteph-ieffam
authored andcommitted
Merged in task/dspace-cris-2023_02_x/LM-46 (pull request DSpace#1917)
Task/dspace cris 2023 02 x/LM-46 Approved-by: Francesco Molinaro Approved-by: Stefano Maffei
2 parents 640dc02 + f81e178 commit 13280ff

32 files changed

Lines changed: 1912 additions & 2 deletions

src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
[attr.aria-labelledby]="'sidebarName-' + section.id"
66
[title]="('menu.section.icon.' + section.id) | translate"
77
[routerLink]="itemModel.link"
8+
[queryParams]="itemModel.queryParams"
89
(keyup.space)="navigate($event)"
910
(keyup.enter)="navigate($event)"
1011
href="javascript:void(0);"
@@ -21,3 +22,4 @@
2122
</div>
2223
</a>
2324
</div>
25+

src/app/admin/admin-sidebar/admin-sidebar-section/admin-sidebar-section.component.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ export class AdminSidebarSectionComponent extends MenuSectionComponent implement
4949
navigate(event: any): void {
5050
event.preventDefault();
5151
if (!this.isDisabled) {
52-
this.router.navigate(this.itemModel.link);
52+
const extras = {
53+
queryParams: this.itemModel.queryParams
54+
};
55+
this.router.navigate(this.itemModel.link, extras);
5356
}
5457
}
5558
}

src/app/menu.resolver.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { createSuccessfulRemoteDataObject$ } from './shared/remote-data.utils';
1919
import { createPaginatedList } from './shared/testing/utils.test';
2020
import { SectionDataService } from './core/layout/section-data.service';
2121
import createSpy = jasmine.createSpy;
22+
import { ConfigurationDataService } from './core/data/configuration-data.service';
2223

2324
const BOOLEAN = { t: true, f: false };
2425
const MENU_STATE = {
@@ -68,6 +69,7 @@ describe('MenuResolver', () => {
6869
let sectionsService;
6970
let authorizationService;
7071
let scriptService;
72+
let configService;
7173

7274
beforeEach(waitForAsync(() => {
7375
menuService = new MenuServiceStub();
@@ -83,6 +85,9 @@ describe('MenuResolver', () => {
8385
scriptService = jasmine.createSpyObj('scriptService', {
8486
scriptWithNameExistsAndCanExecute: observableOf(true)
8587
});
88+
configService = jasmine.createSpyObj('ConfigurationDataService', {
89+
findByPropertyName: observableOf({})
90+
});
8691

8792
TestBed.configureTestingModule({
8893
imports: [TranslateModule.forRoot(), NoopAnimationsModule, RouterTestingModule],
@@ -92,6 +97,7 @@ describe('MenuResolver', () => {
9297
{ provide: SectionDataService, useValue: sectionsService },
9398
{ provide: AuthorizationDataService, useValue: authorizationService },
9499
{ provide: ScriptDataService, useValue: scriptService },
100+
{ provide: ConfigurationDataService, useValue: configService },
95101
{
96102
provide: NgbModal, useValue: {
97103
open: () => {/*comment*/

src/app/menu.resolver.ts

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ import { environment } from '../environments/environment';
5252
import { SectionDataService } from './core/layout/section-data.service';
5353
import { Section } from './core/layout/models/section.model';
5454
import { NOTIFICATIONS_RECITER_SUGGESTION_PATH } from './admin/admin-notifications/admin-notifications-routing-paths';
55+
import { ConfigurationDataService } from './core/data/configuration-data.service';
56+
import { ConfigurationProperty } from './core/shared/configuration-property.model';
5557

5658
/**
5759
* Creates all of the app's menus
@@ -70,6 +72,7 @@ export class MenuResolver implements Resolve<boolean> {
7072
protected modalService: NgbModal,
7173
protected scriptDataService: ScriptDataService,
7274
protected sectionDataService: SectionDataService,
75+
protected configService: ConfigurationDataService,
7376
) {
7477
}
7578

@@ -254,6 +257,7 @@ export class MenuResolver implements Resolve<boolean> {
254257
this.createExportMenuSections();
255258
this.createImportMenuSections();
256259
this.createAccessControlMenuSections();
260+
this.createDLExporterMenuItem();
257261

258262
return this.waitForMenu$(MenuID.ADMIN);
259263
}
@@ -609,6 +613,40 @@ export class MenuResolver implements Resolve<boolean> {
609613
});
610614
}
611615

616+
/**
617+
* Add the DL Exporter menu item to the admin menu
618+
*/
619+
createDLExporterMenuItem() {
620+
observableCombineLatest([
621+
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
622+
this.getDLExporterURL(),
623+
this.getDLExporterAccessToken()
624+
]).subscribe(([authorized, url, accesstoken]) => {
625+
console.log(accesstoken);
626+
const urlSegments = url.split('?');
627+
const queryParamSegments = urlSegments[1].split('=');
628+
this.menuService.addSection(MenuID.ADMIN,
629+
{
630+
id: 'loginmiur_dlexporter_url',
631+
index: 15,
632+
active: false,
633+
visible: authorized && (hasValue(url) && url.length > 0) && (hasValue(accesstoken) && accesstoken.length > 0),
634+
model: {
635+
type: MenuItemType.LINK,
636+
text: 'menu.section.loginmiur_dlexporter_url',
637+
disabled: false,
638+
link: urlSegments[0],
639+
queryParams: {
640+
[queryParamSegments[0]]: queryParamSegments[1]
641+
}
642+
} as LinkMenuItemModel,
643+
icon: 'fa-solid fa-arrows-spin',
644+
shouldPersistOnRouteChange: true
645+
}
646+
);
647+
});
648+
}
649+
612650
/**
613651
* Create menu sections dependent on whether or not the current user is a site administrator and on whether or not
614652
* the import scripts exist and the current user is allowed to execute them
@@ -974,4 +1012,25 @@ export class MenuResolver implements Resolve<boolean> {
9741012
const object = data.site ? data.site : data.dso?.payload;
9751013
return object?._links?.self?.href;
9761014
}
1015+
1016+
/**
1017+
* Get the DL Exporter URL from the configuration
1018+
*/
1019+
getDLExporterURL(): Observable<string> {
1020+
return this.configService.findByPropertyName('loginmiur.dlexporter.url').pipe(
1021+
getFirstCompletedRemoteData(),
1022+
map((res: RemoteData<ConfigurationProperty>) => {
1023+
return res?.payload?.values[0];
1024+
})
1025+
);
1026+
}
1027+
1028+
private getDLExporterAccessToken() {
1029+
return this.configService.findByPropertyName('loginmiur.dlexporter.accesstoken').pipe(
1030+
getFirstCompletedRemoteData(),
1031+
map((res: RemoteData<ConfigurationProperty>) => {
1032+
return res?.payload?.values[0];
1033+
})
1034+
);
1035+
}
9771036
}

src/assets/i18n/ar.json5

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7997,6 +7997,14 @@
79977997
// TODO New key - Add a translation
79987998
"menu.section.workflow": "Administer Workflow",
79997999

8000+
// "menu.section.loginmiur_dlexporter_url": "DLExporter",
8001+
// TODO New key - Add a translation
8002+
"menu.section.loginmiur_dlexporter_url": "DLExporter",
8003+
8004+
// "menu.section.loginmiur_dlexporter": "DLExporter",
8005+
// TODO New key - Add a translation
8006+
"menu.section.loginmiur_dlexporter": "DLExporter",
8007+
80008008
// "metadata-export-search.tooltip": "Export search results as CSV",
80018009
// TODO New key - Add a translation
80028010
"metadata-export-search.tooltip": "Export search results as CSV",
@@ -11368,6 +11376,54 @@
1136811376
// TODO New key - Add a translation
1136911377
"statistics.reports.title": "Reports",
1137011378

11379+
// "submission.dropdown.hint.open": "Open data means the data files you submit will be openly accessible and downloadable without any restrictions.",
11380+
// TODO New key - Add a translation
11381+
"submission.dropdown.hint.open": "Open data means the data files you submit will be openly accessible and downloadable without any restrictions.",
11382+
11383+
// "submission.dropdown.hint.embargoed": " Apply an Embargo if you have to hold your data back for a specific time period, e.g. due to a non-disclosure-agreement. Specify the embargo end date manually. If you want to permit individuals to request access before the embargo ends, you can include a Data Transfer Agreement (DTA).",
11384+
// TODO New key - Add a translation
11385+
"submission.dropdown.hint.embargoed": " Apply an Embargo if you have to hold your data back for a specific time period, e.g. due to a non-disclosure-agreement. Specify the embargo end date manually. If you want to permit individuals to request access before the embargo ends, you can include a Data Transfer Agreement (DTA).",
11386+
11387+
// "submission.dropdown.hint.restricted": "Restricted means that data are uploaded to the repository, but users cannot download data without your permission. They have to request access. Then please include a Data Transfer Agreement (DTA), specifying data sharing conditions, in the submission step “Upload” Select this option if you want to upload anonymized data that need special protection, e.g. in medical research. Be aware that your funder might request to publish your data openly (Data Availability type: Open) if it was fully anonymized. If you still would like to restrict your anonymised data and nonetheless permit individual users to gain access to it, you may upload a Data Transfer Agreement (DTA) under “Upload”, specifying your data sharing conditions. We also recommend to upload a supplemental material under “Supplement Upload” to document your data.",
11388+
// TODO New key - Add a translation
11389+
"submission.dropdown.hint.restricted": "Restricted means that data are uploaded to the repository, but users cannot download data without your permission. They have to request access. Then please include a Data Transfer Agreement (DTA), specifying data sharing conditions, in the submission step “Upload” Select this option if you want to upload anonymized data that need special protection, e.g. in medical research. Be aware that your funder might request to publish your data openly (Data Availability type: Open) if it was fully anonymized. If you still would like to restrict your anonymised data and nonetheless permit individual users to gain access to it, you may upload a Data Transfer Agreement (DTA) under “Upload”, specifying your data sharing conditions. We also recommend to upload a supplemental material under “Supplement Upload” to document your data.",
11390+
11391+
// "submission.dropdown.hint.closed": "Closed means that NO DATA will be uploaded. Metadata can be entered.Choose this option if your data cannot be shared via the repository.If you want to grant access to users, you can include a Data Transfer Agreement (DTA) in the submission step “Upload”.",
11392+
// TODO New key - Add a translation
11393+
"submission.dropdown.hint.closed": "Closed means that NO DATA will be uploaded. Metadata can be entered.Choose this option if your data cannot be shared via the repository.If you want to grant access to users, you can include a Data Transfer Agreement (DTA) in the submission step “Upload”.",
11394+
11395+
// "submission.dropdown.hint.metadataOnly": "Metadata Only means that no data will be uploaded, but metadata will be entered. Choose this option if your data has been shared elsewhere, and provide details about this location below (External Resource).",
11396+
// TODO New key - Add a translation
11397+
"submission.dropdown.hint.metadataOnly": "Metadata Only means that no data will be uploaded, but metadata will be entered. Choose this option if your data has been shared elsewhere, and provide details about this location below (External Resource).",
11398+
11399+
// "submission.dropdown.hint.DataCollector": "Person responsible for maintaining final dataset.",
11400+
// TODO New key - Add a translation
11401+
"submission.dropdown.hint.DataCollector": "Person responsible for maintaining final dataset.",
11402+
11403+
// "submission.dropdown.hint.DataCurator": "Person tasked with reviewing, enhancing, cleaning, or standardizing data.",
11404+
// TODO New key - Add a translation
11405+
"submission.dropdown.hint.DataCurator": "Person tasked with reviewing, enhancing, cleaning, or standardizing data.",
11406+
11407+
// "submission.dropdown.hint.DataManger": "Person responsible for maintaining final dataset.",
11408+
// TODO New key - Add a translation
11409+
"submission.dropdown.hint.DataManger": "Person responsible for maintaining final dataset.",
11410+
11411+
// "submission.dropdown.hint.ProjectLeader": "Leader of a research project, Principal Investigator (PI).",
11412+
// TODO New key - Add a translation
11413+
"submission.dropdown.hint.ProjectLeader": "Leader of a research project, Principal Investigator (PI).",
11414+
11415+
// "submission.dropdown.hint.ProjectManager": "Person who manages a research project",
11416+
// TODO New key - Add a translation
11417+
"submission.dropdown.hint.ProjectManager": "Person who manages a research project",
11418+
11419+
// "submission.dropdown.hint.ProjectMember": "Research fellow, collaborator or other person who works in a research project. ",
11420+
// TODO New key - Add a translation
11421+
"submission.dropdown.hint.ProjectMember": "Research fellow, collaborator or other person who works in a research project. ",
11422+
11423+
// "submission.dropdown.hint.Supervisor": "",
11424+
// TODO New key - Add a translation
11425+
"submission.dropdown.hint.Supervisor": "",
11426+
1137111427
// "submission.edit.breadcrumbs": "Edit Submission",
1137211428
// TODO New key - Add a translation
1137311429
"submission.edit.breadcrumbs": "Edit Submission",
@@ -13166,6 +13222,18 @@
1316613222
// TODO New key - Add a translation
1316713223
"submission.workspace.generic.view-help": "Select this option to view the item's metadata",
1316813224

13225+
// "submission.product.roles.info": "<div class='my-2'><b>1. Project Leader:</b><br/> Leader of a research project, Principal Investigator (PI).</div><br/><div class='my-2'><b>2. Project Member:</b><br/> Research fellow, collaborator or other person who works in a research project.</div><br/><div class='my-2'><b>3. Research Group Leader</b></div><br/><div class='my-2'><b>4. Project Manager:</b><br/> Person who manages a research project.</div><br/><div class='my-2'><b>5. Data Manager:</b><br/> Person responsible for maintaining final dataset.</div><br/><div class='my-2'><b>6. Data Collector:</b><br/> Person responsible for finding, gathering, collecting, or otherwise generating data.</div><br/><div class='my-2'><b>7. Data Curator:</b><br/> Person tasked with reviewing, enhancing, cleaning, or standardizing data.</div>",
13226+
// TODO New key - Add a translation
13227+
"submission.product.roles.info": "<div class='my-2'><b>1. Project Leader:</b><br/> Leader of a research project, Principal Investigator (PI).</div><br/><div class='my-2'><b>2. Project Member:</b><br/> Research fellow, collaborator or other person who works in a research project.</div><br/><div class='my-2'><b>3. Research Group Leader</b></div><br/><div class='my-2'><b>4. Project Manager:</b><br/> Person who manages a research project.</div><br/><div class='my-2'><b>5. Data Manager:</b><br/> Person responsible for maintaining final dataset.</div><br/><div class='my-2'><b>6. Data Collector:</b><br/> Person responsible for finding, gathering, collecting, or otherwise generating data.</div><br/><div class='my-2'><b>7. Data Curator:</b><br/> Person tasked with reviewing, enhancing, cleaning, or standardizing data.</div>",
13228+
13229+
// "submission.product.dataavailability.info": "<div class='my-2'><b>Open</b><br/> - Open data means the data files you submit will be openly accessible and downloadable without any restrictions.</div> <br/><div class='my-2'><b>Embargoed</b><br/> - Apply an Embargo if you have to hold your data back for a specific time period, e.g. due to a non-disclosure-agreement. Specify the embargo end date manually. If you want to permit individuals to request access before the embargo ends, you can include a Data Transfer Agreement (DTA).</div><br/><div class='my-2'><b>Restricted</b><br/> - Restricted means that data are uploaded to the repository, but users cannot download data without your permission. They have to request access. Then please include a Data Transfer Agreement (DTA), specifying data sharing conditions, in the submission step “Upload” Select this option if you want to upload anonymized data that need special protection, e.g. in medical research.<br/>Be aware that your funder might request to publish your data openly (Data Availability type: Open) if it was fully anonymized. If you still would like to restrict your anonymised data and nonetheless permit individual users to gain access to it, you may upload a Data Transfer Agreement (DTA) under “Upload”, specifying your data sharing conditions. We also recommend to upload a supplemental material under “Supplement Upload” to document your data.</div><br/><div class='my-2'><b>Closed</b><br/> - Closed means that NO DATA will be uploaded. Metadata can be entered.Choose this option if your data cannot be shared via the repository.If you want to grant access to users, you can include a Data Transfer Agreement (DTA) in the submission step “Upload”</div>.<br/><div class='my-2'><b>Metadata Only</b><br/> - Metadata Only means that no data will be uploaded, but metadata will be entered. Choose this option if your data has been shared elsewhere, and provide details about this location below (External Resource).</div>",
13230+
// TODO New key - Add a translation
13231+
"submission.product.dataavailability.info": "<div class='my-2'><b>Open</b><br/> - Open data means the data files you submit will be openly accessible and downloadable without any restrictions.</div> <br/><div class='my-2'><b>Embargoed</b><br/> - Apply an Embargo if you have to hold your data back for a specific time period, e.g. due to a non-disclosure-agreement. Specify the embargo end date manually. If you want to permit individuals to request access before the embargo ends, you can include a Data Transfer Agreement (DTA).</div><br/><div class='my-2'><b>Restricted</b><br/> - Restricted means that data are uploaded to the repository, but users cannot download data without your permission. They have to request access. Then please include a Data Transfer Agreement (DTA), specifying data sharing conditions, in the submission step “Upload” Select this option if you want to upload anonymized data that need special protection, e.g. in medical research.<br/>Be aware that your funder might request to publish your data openly (Data Availability type: Open) if it was fully anonymized. If you still would like to restrict your anonymised data and nonetheless permit individual users to gain access to it, you may upload a Data Transfer Agreement (DTA) under “Upload”, specifying your data sharing conditions. We also recommend to upload a supplemental material under “Supplement Upload” to document your data.</div><br/><div class='my-2'><b>Closed</b><br/> - Closed means that NO DATA will be uploaded. Metadata can be entered.Choose this option if your data cannot be shared via the repository.If you want to grant access to users, you can include a Data Transfer Agreement (DTA) in the submission step “Upload”</div>.<br/><div class='my-2'><b>Metadata Only</b><br/> - Metadata Only means that no data will be uploaded, but metadata will be entered. Choose this option if your data has been shared elsewhere, and provide details about this location below (External Resource).</div>",
13232+
13233+
// "submission.roles.modal.open": "Roles Info",
13234+
// TODO New key - Add a translation
13235+
"submission.roles.modal.open": "Roles Info",
13236+
1316913237
// "submitter.empty": "N/A",
1317013238
// TODO New key - Add a translation
1317113239
"submitter.empty": "N/A",

0 commit comments

Comments
 (0)