Skip to content

Commit

Permalink
Merged in task/dspace-cris-2023_02_x/LM-46 (pull request DSpace#1917)
Browse files Browse the repository at this point in the history
Task/dspace cris 2023 02 x/LM-46

Approved-by: Francesco Molinaro
Approved-by: Stefano Maffei
  • Loading branch information
alisaismailati authored and steph-ieffam committed Aug 16, 2024
2 parents 640dc02 + f81e178 commit 13280ff
Show file tree
Hide file tree
Showing 32 changed files with 1,912 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[attr.aria-labelledby]="'sidebarName-' + section.id"
[title]="('menu.section.icon.' + section.id) | translate"
[routerLink]="itemModel.link"
[queryParams]="itemModel.queryParams"
(keyup.space)="navigate($event)"
(keyup.enter)="navigate($event)"
href="javascript:void(0);"
Expand All @@ -21,3 +22,4 @@
</div>
</a>
</div>

Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ export class AdminSidebarSectionComponent extends MenuSectionComponent implement
navigate(event: any): void {
event.preventDefault();
if (!this.isDisabled) {
this.router.navigate(this.itemModel.link);
const extras = {
queryParams: this.itemModel.queryParams
};
this.router.navigate(this.itemModel.link, extras);
}
}
}
6 changes: 6 additions & 0 deletions src/app/menu.resolver.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { createSuccessfulRemoteDataObject$ } from './shared/remote-data.utils';
import { createPaginatedList } from './shared/testing/utils.test';
import { SectionDataService } from './core/layout/section-data.service';
import createSpy = jasmine.createSpy;
import { ConfigurationDataService } from './core/data/configuration-data.service';

const BOOLEAN = { t: true, f: false };
const MENU_STATE = {
Expand Down Expand Up @@ -68,6 +69,7 @@ describe('MenuResolver', () => {
let sectionsService;
let authorizationService;
let scriptService;
let configService;

beforeEach(waitForAsync(() => {
menuService = new MenuServiceStub();
Expand All @@ -83,6 +85,9 @@ describe('MenuResolver', () => {
scriptService = jasmine.createSpyObj('scriptService', {
scriptWithNameExistsAndCanExecute: observableOf(true)
});
configService = jasmine.createSpyObj('ConfigurationDataService', {
findByPropertyName: observableOf({})
});

TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), NoopAnimationsModule, RouterTestingModule],
Expand All @@ -92,6 +97,7 @@ describe('MenuResolver', () => {
{ provide: SectionDataService, useValue: sectionsService },
{ provide: AuthorizationDataService, useValue: authorizationService },
{ provide: ScriptDataService, useValue: scriptService },
{ provide: ConfigurationDataService, useValue: configService },
{
provide: NgbModal, useValue: {
open: () => {/*comment*/
Expand Down
59 changes: 59 additions & 0 deletions src/app/menu.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ import { environment } from '../environments/environment';
import { SectionDataService } from './core/layout/section-data.service';
import { Section } from './core/layout/models/section.model';
import { NOTIFICATIONS_RECITER_SUGGESTION_PATH } from './admin/admin-notifications/admin-notifications-routing-paths';
import { ConfigurationDataService } from './core/data/configuration-data.service';
import { ConfigurationProperty } from './core/shared/configuration-property.model';

/**
* Creates all of the app's menus
Expand All @@ -70,6 +72,7 @@ export class MenuResolver implements Resolve<boolean> {
protected modalService: NgbModal,
protected scriptDataService: ScriptDataService,
protected sectionDataService: SectionDataService,
protected configService: ConfigurationDataService,
) {
}

Expand Down Expand Up @@ -254,6 +257,7 @@ export class MenuResolver implements Resolve<boolean> {
this.createExportMenuSections();
this.createImportMenuSections();
this.createAccessControlMenuSections();
this.createDLExporterMenuItem();

return this.waitForMenu$(MenuID.ADMIN);
}
Expand Down Expand Up @@ -609,6 +613,40 @@ export class MenuResolver implements Resolve<boolean> {
});
}

/**
* Add the DL Exporter menu item to the admin menu
*/
createDLExporterMenuItem() {
observableCombineLatest([
this.authorizationService.isAuthorized(FeatureID.AdministratorOf),
this.getDLExporterURL(),
this.getDLExporterAccessToken()
]).subscribe(([authorized, url, accesstoken]) => {
console.log(accesstoken);
const urlSegments = url.split('?');
const queryParamSegments = urlSegments[1].split('=');
this.menuService.addSection(MenuID.ADMIN,
{
id: 'loginmiur_dlexporter_url',
index: 15,
active: false,
visible: authorized && (hasValue(url) && url.length > 0) && (hasValue(accesstoken) && accesstoken.length > 0),
model: {
type: MenuItemType.LINK,
text: 'menu.section.loginmiur_dlexporter_url',
disabled: false,
link: urlSegments[0],
queryParams: {
[queryParamSegments[0]]: queryParamSegments[1]
}
} as LinkMenuItemModel,
icon: 'fa-solid fa-arrows-spin',
shouldPersistOnRouteChange: true
}
);
});
}

/**
* Create menu sections dependent on whether or not the current user is a site administrator and on whether or not
* the import scripts exist and the current user is allowed to execute them
Expand Down Expand Up @@ -974,4 +1012,25 @@ export class MenuResolver implements Resolve<boolean> {
const object = data.site ? data.site : data.dso?.payload;
return object?._links?.self?.href;
}

/**
* Get the DL Exporter URL from the configuration
*/
getDLExporterURL(): Observable<string> {
return this.configService.findByPropertyName('loginmiur.dlexporter.url').pipe(
getFirstCompletedRemoteData(),
map((res: RemoteData<ConfigurationProperty>) => {
return res?.payload?.values[0];
})
);
}

private getDLExporterAccessToken() {
return this.configService.findByPropertyName('loginmiur.dlexporter.accesstoken').pipe(
getFirstCompletedRemoteData(),
map((res: RemoteData<ConfigurationProperty>) => {
return res?.payload?.values[0];
})
);
}
}
68 changes: 68 additions & 0 deletions src/assets/i18n/ar.json5
Original file line number Diff line number Diff line change
Expand Up @@ -7997,6 +7997,14 @@
// TODO New key - Add a translation
"menu.section.workflow": "Administer Workflow",

// "menu.section.loginmiur_dlexporter_url": "DLExporter",
// TODO New key - Add a translation
"menu.section.loginmiur_dlexporter_url": "DLExporter",

// "menu.section.loginmiur_dlexporter": "DLExporter",
// TODO New key - Add a translation
"menu.section.loginmiur_dlexporter": "DLExporter",

// "metadata-export-search.tooltip": "Export search results as CSV",
// TODO New key - Add a translation
"metadata-export-search.tooltip": "Export search results as CSV",
Expand Down Expand Up @@ -11368,6 +11376,54 @@
// TODO New key - Add a translation
"statistics.reports.title": "Reports",

// "submission.dropdown.hint.open": "Open data means the data files you submit will be openly accessible and downloadable without any restrictions.",
// TODO New key - Add a translation
"submission.dropdown.hint.open": "Open data means the data files you submit will be openly accessible and downloadable without any restrictions.",

// "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).",
// TODO New key - Add a translation
"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).",

// "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.",
// TODO New key - Add a translation
"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.",

// "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”.",
// TODO New key - Add a translation
"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”.",

// "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).",
// TODO New key - Add a translation
"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).",

// "submission.dropdown.hint.DataCollector": "Person responsible for maintaining final dataset.",
// TODO New key - Add a translation
"submission.dropdown.hint.DataCollector": "Person responsible for maintaining final dataset.",

// "submission.dropdown.hint.DataCurator": "Person tasked with reviewing, enhancing, cleaning, or standardizing data.",
// TODO New key - Add a translation
"submission.dropdown.hint.DataCurator": "Person tasked with reviewing, enhancing, cleaning, or standardizing data.",

// "submission.dropdown.hint.DataManger": "Person responsible for maintaining final dataset.",
// TODO New key - Add a translation
"submission.dropdown.hint.DataManger": "Person responsible for maintaining final dataset.",

// "submission.dropdown.hint.ProjectLeader": "Leader of a research project, Principal Investigator (PI).",
// TODO New key - Add a translation
"submission.dropdown.hint.ProjectLeader": "Leader of a research project, Principal Investigator (PI).",

// "submission.dropdown.hint.ProjectManager": "Person who manages a research project",
// TODO New key - Add a translation
"submission.dropdown.hint.ProjectManager": "Person who manages a research project",

// "submission.dropdown.hint.ProjectMember": "Research fellow, collaborator or other person who works in a research project. ",
// TODO New key - Add a translation
"submission.dropdown.hint.ProjectMember": "Research fellow, collaborator or other person who works in a research project. ",

// "submission.dropdown.hint.Supervisor": "",
// TODO New key - Add a translation
"submission.dropdown.hint.Supervisor": "",

// "submission.edit.breadcrumbs": "Edit Submission",
// TODO New key - Add a translation
"submission.edit.breadcrumbs": "Edit Submission",
Expand Down Expand Up @@ -13166,6 +13222,18 @@
// TODO New key - Add a translation
"submission.workspace.generic.view-help": "Select this option to view the item's metadata",

// "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>",
// TODO New key - Add a translation
"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>",

// "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>",
// TODO New key - Add a translation
"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>",

// "submission.roles.modal.open": "Roles Info",
// TODO New key - Add a translation
"submission.roles.modal.open": "Roles Info",

// "submitter.empty": "N/A",
// TODO New key - Add a translation
"submitter.empty": "N/A",
Expand Down
Loading

0 comments on commit 13280ff

Please sign in to comment.