diff --git a/.gitattributes b/.gitattributes index dfe0770424..406640bfcc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,16 @@ -# Auto detect text files and perform LF normalization +# By default, auto detect text files and perform LF normalization +# This ensures code is always checked in with LF line endings * text=auto + +# JS and TS files must always use LF for Angular tools to work +# Some Angular tools expect LF line endings, even on Windows. +# This ensures Windows always checks out these files with LF line endings +# We've copied many of these rules from https://github.com/angular/angular-cli/ +*.js eol=lf +*.ts eol=lf +*.json eol=lf +*.json5 eol=lf +*.css eol=lf +*.scss eol=lf +*.html eol=lf +*.svg eol=lf \ No newline at end of file diff --git a/config/config.example.yml b/config/config.example.yml index ae733e0be5..4814c826f1 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -258,3 +258,10 @@ mediaViewer: info: enableEndUserAgreement: true enablePrivacyStatement: true +# Home Page +homePage: + recentSubmissions: + # The number of item showing in recent submission components + pageSize: 5 + # Sort record of recent submission + sortField: 'dc.date.accessioned' diff --git a/cypress/.gitignore b/cypress/.gitignore index 99bd2a6312..645beff45f 100644 --- a/cypress/.gitignore +++ b/cypress/.gitignore @@ -1,2 +1,3 @@ screenshots/ videos/ +downloads/ diff --git a/scripts/serve.ts b/scripts/serve.ts index bf5506b8bd..09e517c3d4 100644 --- a/scripts/serve.ts +++ b/scripts/serve.ts @@ -7,8 +7,9 @@ const appConfig: AppConfig = buildAppConfig(); /** * Calls `ng serve` with the following arguments configured for the UI in the app config: host, port, nameSpace, ssl + * Any CLI arguments given to this script are patched through to `ng serve` as well. */ child.spawn( - `ng serve --host ${appConfig.ui.host} --port ${appConfig.ui.port} --serve-path ${appConfig.ui.nameSpace} --ssl ${appConfig.ui.ssl}`, + `ng serve --host ${appConfig.ui.host} --port ${appConfig.ui.port} --serve-path ${appConfig.ui.nameSpace} --ssl ${appConfig.ui.ssl} ${process.argv.slice(2).join(' ')}`, { stdio: 'inherit', shell: true } ); diff --git a/scripts/sync-i18n-files.ts b/scripts/sync-i18n-files.ts old mode 100755 new mode 100644 diff --git a/scripts/test-rest.ts b/scripts/test-rest.ts index b2a3ebd1af..51822cf939 100644 --- a/scripts/test-rest.ts +++ b/scripts/test-rest.ts @@ -22,7 +22,13 @@ console.log(`...Testing connection to REST API at ${restUrl}...\n`); if (appConfig.rest.ssl) { const req = https.request(restUrl, (res) => { console.log(`RESPONSE: ${res.statusCode} ${res.statusMessage} \n`); - res.on('data', (data) => { + // We will keep reading data until the 'end' event fires. + // This ensures we don't just read the first chunk. + let data = ''; + res.on('data', (chunk) => { + data += chunk; + }); + res.on('end', () => { checkJSONResponse(data); }); }); @@ -35,7 +41,13 @@ if (appConfig.rest.ssl) { } else { const req = http.request(restUrl, (res) => { console.log(`RESPONSE: ${res.statusCode} ${res.statusMessage} \n`); - res.on('data', (data) => { + // We will keep reading data until the 'end' event fires. + // This ensures we don't just read the first chunk. + let data = ''; + res.on('data', (chunk) => { + data += chunk; + }); + res.on('end', () => { checkJSONResponse(data); }); }); diff --git a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts index 4957958658..a96c238f93 100644 --- a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts +++ b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts @@ -177,7 +177,7 @@ describe('EPersonFormComponent', () => { }); groupsDataService = jasmine.createSpyObj('groupsDataService', { - findAllByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])), + findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])), getGroupRegistryRouterLink: '' }); diff --git a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts index 05fc3189d0..7d607647e3 100644 --- a/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts +++ b/src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts @@ -265,7 +265,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy { this.formGroup = this.formBuilderService.createFormGroup(this.formModel); this.subs.push(this.epersonService.getActiveEPerson().subscribe((eperson: EPerson) => { if (eperson != null) { - this.groups = this.groupsDataService.findAllByHref(eperson._links.groups.href, { + this.groups = this.groupsDataService.findListByHref(eperson._links.groups.href, { currentPage: 1, elementsPerPage: this.config.pageSize }); @@ -297,7 +297,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy { }), switchMap(([eperson, findListOptions]) => { if (eperson != null) { - return this.groupsDataService.findAllByHref(eperson._links.groups.href, findListOptions, true, true, followLink('object')); + return this.groupsDataService.findListByHref(eperson._links.groups.href, findListOptions, true, true, followLink('object')); } return observableOf(undefined); }) @@ -554,7 +554,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy { */ private updateGroups(options) { this.subs.push(this.epersonService.getActiveEPerson().subscribe((eperson: EPerson) => { - this.groups = this.groupsDataService.findAllByHref(eperson._links.groups.href, options); + this.groups = this.groupsDataService.findListByHref(eperson._links.groups.href, options); })); } } diff --git a/src/app/access-control/group-registry/group-form/members-list/members-list.component.spec.ts b/src/app/access-control/group-registry/group-form/members-list/members-list.component.spec.ts index 0b19b17100..8d0ddf0a85 100644 --- a/src/app/access-control/group-registry/group-form/members-list/members-list.component.spec.ts +++ b/src/app/access-control/group-registry/group-form/members-list/members-list.component.spec.ts @@ -53,7 +53,7 @@ describe('MembersListComponent', () => { activeGroup: activeGroup, epersonMembers: epersonMembers, subgroupMembers: subgroupMembers, - findAllByHref(href: string): Observable>> { + findListByHref(href: string): Observable>> { return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), groupsDataServiceStub.getEPersonMembers())); }, searchByScope(scope: string, query: string): Observable>> { diff --git a/src/app/access-control/group-registry/group-form/members-list/members-list.component.ts b/src/app/access-control/group-registry/group-form/members-list/members-list.component.ts index ad5d84544b..5c02e02d78 100644 --- a/src/app/access-control/group-registry/group-form/members-list/members-list.component.ts +++ b/src/app/access-control/group-registry/group-form/members-list/members-list.component.ts @@ -129,7 +129,7 @@ export class MembersListComponent implements OnInit, OnDestroy { this.subs.set(SubKey.MembersDTO, this.paginationService.getCurrentPagination(this.config.id, this.config).pipe( switchMap((currentPagination) => { - return this.ePersonDataService.findAllByHref(this.groupBeingEdited._links.epersons.href, { + return this.ePersonDataService.findListByHref(this.groupBeingEdited._links.epersons.href, { currentPage: currentPagination.currentPage, elementsPerPage: currentPagination.pageSize } @@ -171,7 +171,7 @@ export class MembersListComponent implements OnInit, OnDestroy { return this.groupDataService.getActiveGroup().pipe(take(1), mergeMap((group: Group) => { if (group != null) { - return this.ePersonDataService.findAllByHref(group._links.epersons.href, { + return this.ePersonDataService.findListByHref(group._links.epersons.href, { currentPage: 1, elementsPerPage: 9999 }) diff --git a/src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.spec.ts b/src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.spec.ts index bee5126e09..1ca6c88c5f 100644 --- a/src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.spec.ts +++ b/src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.spec.ts @@ -65,7 +65,7 @@ describe('SubgroupsListComponent', () => { getSubgroups(): Group { return this.activeGroup; }, - findAllByHref(href: string): Observable>> { + findListByHref(href: string): Observable>> { return this.subgroups$.pipe( map((currentGroups: Group[]) => { return createSuccessfulRemoteDataObject(buildPaginatedList(new PageInfo(), currentGroups)); diff --git a/src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.ts b/src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.ts index 9930dd61ea..5f1700e07d 100644 --- a/src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.ts +++ b/src/app/access-control/group-registry/group-form/subgroup-list/subgroups-list.component.ts @@ -115,7 +115,7 @@ export class SubgroupsListComponent implements OnInit, OnDestroy { this.subs.set( SubKey.Members, this.paginationService.getCurrentPagination(this.config.id, this.config).pipe( - switchMap((config) => this.groupDataService.findAllByHref(this.groupBeingEdited._links.subgroups.href, { + switchMap((config) => this.groupDataService.findListByHref(this.groupBeingEdited._links.subgroups.href, { currentPage: config.currentPage, elementsPerPage: config.pageSize }, @@ -139,7 +139,7 @@ export class SubgroupsListComponent implements OnInit, OnDestroy { if (activeGroup.uuid === possibleSubgroup.uuid) { return observableOf(false); } else { - return this.groupDataService.findAllByHref(activeGroup._links.subgroups.href, { + return this.groupDataService.findListByHref(activeGroup._links.subgroups.href, { currentPage: 1, elementsPerPage: 9999 }) diff --git a/src/app/access-control/group-registry/groups-registry.component.spec.ts b/src/app/access-control/group-registry/groups-registry.component.spec.ts index 99586ee5f0..239939e70d 100644 --- a/src/app/access-control/group-registry/groups-registry.component.spec.ts +++ b/src/app/access-control/group-registry/groups-registry.component.spec.ts @@ -69,7 +69,7 @@ describe('GroupRegistryComponent', () => { mockGroups = [GroupMock, GroupMock2]; mockEPeople = [EPersonMock, EPersonMock2]; ePersonDataServiceStub = { - findAllByHref(href: string): Observable>> { + findListByHref(href: string): Observable>> { switch (href) { case 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid2/epersons': return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ @@ -97,7 +97,7 @@ describe('GroupRegistryComponent', () => { }; groupsDataServiceStub = { allGroups: mockGroups, - findAllByHref(href: string): Observable>> { + findListByHref(href: string): Observable>> { switch (href) { case 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid2/groups': return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({ diff --git a/src/app/access-control/group-registry/groups-registry.component.ts b/src/app/access-control/group-registry/groups-registry.component.ts index 1770762a34..6ba501fcc4 100644 --- a/src/app/access-control/group-registry/groups-registry.component.ts +++ b/src/app/access-control/group-registry/groups-registry.component.ts @@ -213,7 +213,7 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy { * @param group */ getMembers(group: Group): Observable>> { - return this.ePersonDataService.findAllByHref(group._links.epersons.href).pipe(getFirstSucceededRemoteData()); + return this.ePersonDataService.findListByHref(group._links.epersons.href).pipe(getFirstSucceededRemoteData()); } /** @@ -221,7 +221,7 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy { * @param group */ getSubgroups(group: Group): Observable>> { - return this.groupService.findAllByHref(group._links.subgroups.href).pipe(getFirstSucceededRemoteData()); + return this.groupService.findListByHref(group._links.subgroups.href).pipe(getFirstSucceededRemoteData()); } /** diff --git a/src/app/admin/admin-sidebar/admin-sidebar.component.html b/src/app/admin/admin-sidebar/admin-sidebar.component.html index 84402c64e9..ef220b834b 100644 --- a/src/app/admin/admin-sidebar/admin-sidebar.component.html +++ b/src/app/admin/admin-sidebar/admin-sidebar.component.html @@ -1,4 +1,4 @@ -