mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
ESLint: fix dangling commas
This commit is contained in:
@@ -7,10 +7,10 @@ import { GROUP_EDIT_PATH } from './access-control-routing-paths';
|
||||
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
|
||||
import { GroupPageGuard } from './group-registry/group-page.guard';
|
||||
import {
|
||||
GroupAdministratorGuard
|
||||
GroupAdministratorGuard,
|
||||
} from '../core/data/feature-authorization/feature-authorization-guard/group-administrator.guard';
|
||||
import {
|
||||
SiteAdministratorGuard
|
||||
SiteAdministratorGuard,
|
||||
} from '../core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
|
||||
import { BulkAccessComponent } from './bulk-access/bulk-access.component';
|
||||
|
||||
@@ -21,49 +21,49 @@ import { BulkAccessComponent } from './bulk-access/bulk-access.component';
|
||||
path: 'epeople',
|
||||
component: EPeopleRegistryComponent,
|
||||
resolve: {
|
||||
breadcrumb: I18nBreadcrumbResolver
|
||||
breadcrumb: I18nBreadcrumbResolver,
|
||||
},
|
||||
data: { title: 'admin.access-control.epeople.title', breadcrumbKey: 'admin.access-control.epeople' },
|
||||
canActivate: [SiteAdministratorGuard]
|
||||
canActivate: [SiteAdministratorGuard],
|
||||
},
|
||||
{
|
||||
path: GROUP_EDIT_PATH,
|
||||
component: GroupsRegistryComponent,
|
||||
resolve: {
|
||||
breadcrumb: I18nBreadcrumbResolver
|
||||
breadcrumb: I18nBreadcrumbResolver,
|
||||
},
|
||||
data: { title: 'admin.access-control.groups.title', breadcrumbKey: 'admin.access-control.groups' },
|
||||
canActivate: [GroupAdministratorGuard]
|
||||
canActivate: [GroupAdministratorGuard],
|
||||
},
|
||||
{
|
||||
path: `${GROUP_EDIT_PATH}/newGroup`,
|
||||
component: GroupFormComponent,
|
||||
resolve: {
|
||||
breadcrumb: I18nBreadcrumbResolver
|
||||
breadcrumb: I18nBreadcrumbResolver,
|
||||
},
|
||||
data: { title: 'admin.access-control.groups.title.addGroup', breadcrumbKey: 'admin.access-control.groups.addGroup' },
|
||||
canActivate: [GroupAdministratorGuard]
|
||||
canActivate: [GroupAdministratorGuard],
|
||||
},
|
||||
{
|
||||
path: `${GROUP_EDIT_PATH}/:groupId`,
|
||||
component: GroupFormComponent,
|
||||
resolve: {
|
||||
breadcrumb: I18nBreadcrumbResolver
|
||||
breadcrumb: I18nBreadcrumbResolver,
|
||||
},
|
||||
data: { title: 'admin.access-control.groups.title.singleGroup', breadcrumbKey: 'admin.access-control.groups.singleGroup' },
|
||||
canActivate: [GroupPageGuard]
|
||||
canActivate: [GroupPageGuard],
|
||||
},
|
||||
{
|
||||
path: 'bulk-access',
|
||||
component: BulkAccessComponent,
|
||||
resolve: {
|
||||
breadcrumb: I18nBreadcrumbResolver
|
||||
breadcrumb: I18nBreadcrumbResolver,
|
||||
},
|
||||
data: { title: 'admin.access-control.bulk-access.title', breadcrumbKey: 'admin.access-control.bulk-access' },
|
||||
canActivate: [SiteAdministratorGuard]
|
||||
canActivate: [SiteAdministratorGuard],
|
||||
},
|
||||
])
|
||||
]
|
||||
]),
|
||||
],
|
||||
})
|
||||
/**
|
||||
* Routing module for the AccessControl section of the admin sidebar
|
||||
|
@@ -55,9 +55,9 @@ export const ValidateEmailErrorStateMatcher: DynamicErrorMessagesMatcher =
|
||||
providers: [
|
||||
{
|
||||
provide: DYNAMIC_ERROR_MESSAGES_MATCHER,
|
||||
useValue: ValidateEmailErrorStateMatcher
|
||||
useValue: ValidateEmailErrorStateMatcher,
|
||||
},
|
||||
]
|
||||
],
|
||||
})
|
||||
/**
|
||||
* This module handles all components related to the access control pages
|
||||
|
@@ -31,13 +31,13 @@ describe('BulkAccessBrowseComponent', () => {
|
||||
imports: [
|
||||
NgbAccordionModule,
|
||||
NgbNavModule,
|
||||
TranslateModule.forRoot()
|
||||
TranslateModule.forRoot(),
|
||||
],
|
||||
declarations: [BulkAccessBrowseComponent],
|
||||
providers: [ { provide: SelectableListService, useValue: selectableListService }, ],
|
||||
providers: [ { provide: SelectableListService, useValue: selectableListService } ],
|
||||
schemas: [
|
||||
NO_ERRORS_SCHEMA
|
||||
]
|
||||
NO_ERRORS_SCHEMA,
|
||||
],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
@@ -72,7 +72,7 @@ describe('BulkAccessBrowseComponent', () => {
|
||||
'elementsPerPage': 5,
|
||||
'totalElements': 2,
|
||||
'totalPages': 1,
|
||||
'currentPage': 1
|
||||
'currentPage': 1,
|
||||
}), [selected1, selected2]) ;
|
||||
const rd = createSuccessfulRemoteDataObject(list);
|
||||
|
||||
|
@@ -22,9 +22,9 @@ import { hasValue } from '../../../shared/empty.util';
|
||||
providers: [
|
||||
{
|
||||
provide: SEARCH_CONFIG_SERVICE,
|
||||
useClass: SearchConfigurationService
|
||||
}
|
||||
]
|
||||
useClass: SearchConfigurationService,
|
||||
},
|
||||
],
|
||||
})
|
||||
export class BulkAccessBrowseComponent implements OnInit, OnDestroy {
|
||||
|
||||
@@ -49,7 +49,7 @@ export class BulkAccessBrowseComponent implements OnInit, OnDestroy {
|
||||
paginationOptions$: BehaviorSubject<PaginationComponentOptions> = new BehaviorSubject<PaginationComponentOptions>(Object.assign(new PaginationComponentOptions(), {
|
||||
id: 'bas',
|
||||
pageSize: 5,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
}));
|
||||
|
||||
/**
|
||||
@@ -67,20 +67,20 @@ export class BulkAccessBrowseComponent implements OnInit, OnDestroy {
|
||||
this.subs.push(
|
||||
this.selectableListService.getSelectableList(this.listId).pipe(
|
||||
distinctUntilChanged(),
|
||||
map((list: SelectableListState) => this.generatePaginatedListBySelectedElements(list))
|
||||
).subscribe(this.objectsSelected$)
|
||||
map((list: SelectableListState) => this.generatePaginatedListBySelectedElements(list)),
|
||||
).subscribe(this.objectsSelected$),
|
||||
);
|
||||
}
|
||||
|
||||
pageNext() {
|
||||
this.paginationOptions$.next(Object.assign(new PaginationComponentOptions(), this.paginationOptions$.value, {
|
||||
currentPage: this.paginationOptions$.value.currentPage + 1
|
||||
currentPage: this.paginationOptions$.value.currentPage + 1,
|
||||
}));
|
||||
}
|
||||
|
||||
pagePrev() {
|
||||
this.paginationOptions$.next(Object.assign(new PaginationComponentOptions(), this.paginationOptions$.value, {
|
||||
currentPage: this.paginationOptions$.value.currentPage - 1
|
||||
currentPage: this.paginationOptions$.value.currentPage - 1,
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -99,12 +99,12 @@ export class BulkAccessBrowseComponent implements OnInit, OnDestroy {
|
||||
elementsPerPage: this.paginationOptions$.value.pageSize,
|
||||
totalElements: list?.selection.length,
|
||||
totalPages: this.calculatePageCount(this.paginationOptions$.value.pageSize, list?.selection.length),
|
||||
currentPage: this.paginationOptions$.value.currentPage
|
||||
currentPage: this.paginationOptions$.value.currentPage,
|
||||
});
|
||||
if (pageInfo.currentPage > pageInfo.totalPages) {
|
||||
pageInfo.currentPage = pageInfo.totalPages;
|
||||
this.paginationOptions$.next(Object.assign(new PaginationComponentOptions(), this.paginationOptions$.value, {
|
||||
currentPage: pageInfo.currentPage
|
||||
currentPage: pageInfo.currentPage,
|
||||
}));
|
||||
}
|
||||
return createSuccessfulRemoteDataObject(buildPaginatedList(pageInfo, list?.selection || []));
|
||||
|
@@ -31,35 +31,35 @@ describe('BulkAccessComponent', () => {
|
||||
'startDate': {
|
||||
'year': 2026,
|
||||
'month': 5,
|
||||
'day': 31
|
||||
'day': 31,
|
||||
},
|
||||
'endDate': null,
|
||||
},
|
||||
'endDate': null
|
||||
}
|
||||
],
|
||||
'state': {
|
||||
'item': {
|
||||
'toggleStatus': true,
|
||||
'accessMode': 'replace'
|
||||
'accessMode': 'replace',
|
||||
},
|
||||
'bitstream': {
|
||||
'toggleStatus': false,
|
||||
'accessMode': '',
|
||||
'changesLimit': '',
|
||||
'selectedBitstreams': []
|
||||
}
|
||||
}
|
||||
'selectedBitstreams': [],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const mockFile = {
|
||||
'uuids': [
|
||||
'1234', '5678'
|
||||
'1234', '5678',
|
||||
],
|
||||
'file': { }
|
||||
'file': { },
|
||||
};
|
||||
|
||||
const mockSettings: any = jasmine.createSpyObj('AccessControlFormContainerComponent', {
|
||||
getValue: jasmine.createSpy('getValue'),
|
||||
reset: jasmine.createSpy('reset')
|
||||
reset: jasmine.createSpy('reset'),
|
||||
});
|
||||
const selection: any[] = [{ indexableObject: { uuid: '1234' } }, { indexableObject: { uuid: '5678' } }];
|
||||
const selectableListState: SelectableListState = { id: 'test', selection };
|
||||
@@ -71,15 +71,15 @@ describe('BulkAccessComponent', () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [
|
||||
RouterTestingModule,
|
||||
TranslateModule.forRoot()
|
||||
TranslateModule.forRoot(),
|
||||
],
|
||||
declarations: [ BulkAccessComponent ],
|
||||
providers: [
|
||||
{ provide: BulkAccessControlService, useValue: bulkAccessControlServiceMock },
|
||||
{ provide: NotificationsService, useValue: NotificationsServiceStub },
|
||||
{ provide: SelectableListService, useValue: selectableListServiceMock }
|
||||
{ provide: SelectableListService, useValue: selectableListServiceMock },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
@@ -11,7 +11,7 @@ import { SelectableListService } from '../../shared/object-list/selectable-list/
|
||||
@Component({
|
||||
selector: 'ds-bulk-access',
|
||||
templateUrl: './bulk-access.component.html',
|
||||
styleUrls: ['./bulk-access.component.scss']
|
||||
styleUrls: ['./bulk-access.component.scss'],
|
||||
})
|
||||
export class BulkAccessComponent implements OnInit {
|
||||
|
||||
@@ -37,7 +37,7 @@ export class BulkAccessComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private bulkAccessControlService: BulkAccessControlService,
|
||||
private selectableListService: SelectableListService
|
||||
private selectableListService: SelectableListService,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ export class BulkAccessComponent implements OnInit {
|
||||
this.subs.push(
|
||||
this.selectableListService.getSelectableList(this.listId).pipe(
|
||||
distinctUntilChanged(),
|
||||
map((list: SelectableListState) => this.generateIdListBySelectedElements(list))
|
||||
).subscribe(this.objectsSelected$)
|
||||
map((list: SelectableListState) => this.generateIdListBySelectedElements(list)),
|
||||
).subscribe(this.objectsSelected$),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -74,12 +74,12 @@ export class BulkAccessComponent implements OnInit {
|
||||
const { file } = this.bulkAccessControlService.createPayloadFile({
|
||||
bitstreamAccess,
|
||||
itemAccess,
|
||||
state: settings.state
|
||||
state: settings.state,
|
||||
});
|
||||
|
||||
this.bulkAccessControlService.executeScript(
|
||||
this.objectsSelected$.value || [],
|
||||
file
|
||||
file,
|
||||
).subscribe();
|
||||
}
|
||||
|
||||
|
@@ -15,35 +15,35 @@ describe('BulkAccessSettingsComponent', () => {
|
||||
'startDate': {
|
||||
'year': 2026,
|
||||
'month': 5,
|
||||
'day': 31
|
||||
'day': 31,
|
||||
},
|
||||
'endDate': null,
|
||||
},
|
||||
'endDate': null
|
||||
}
|
||||
],
|
||||
'state': {
|
||||
'item': {
|
||||
'toggleStatus': true,
|
||||
'accessMode': 'replace'
|
||||
'accessMode': 'replace',
|
||||
},
|
||||
'bitstream': {
|
||||
'toggleStatus': false,
|
||||
'accessMode': '',
|
||||
'changesLimit': '',
|
||||
'selectedBitstreams': []
|
||||
}
|
||||
}
|
||||
'selectedBitstreams': [],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const mockControl: any = jasmine.createSpyObj('AccessControlFormContainerComponent', {
|
||||
getFormValue: jasmine.createSpy('getFormValue'),
|
||||
reset: jasmine.createSpy('reset')
|
||||
reset: jasmine.createSpy('reset'),
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [NgbAccordionModule, TranslateModule.forRoot()],
|
||||
declarations: [BulkAccessSettingsComponent],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
|
@@ -1,13 +1,13 @@
|
||||
import { Component, ViewChild } from '@angular/core';
|
||||
import {
|
||||
AccessControlFormContainerComponent
|
||||
AccessControlFormContainerComponent,
|
||||
} from '../../../shared/access-control-form-container/access-control-form-container.component';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-bulk-access-settings',
|
||||
templateUrl: 'bulk-access-settings.component.html',
|
||||
styleUrls: ['./bulk-access-settings.component.scss'],
|
||||
exportAs: 'dsBulkSettings'
|
||||
exportAs: 'dsBulkSettings',
|
||||
})
|
||||
export class BulkAccessSettingsComponent {
|
||||
|
||||
|
@@ -52,7 +52,7 @@ describe('EPeopleRegistryComponent', () => {
|
||||
elementsPerPage: this.allEpeople.length,
|
||||
totalElements: this.allEpeople.length,
|
||||
totalPages: 1,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
}), this.allEpeople));
|
||||
},
|
||||
getActiveEPerson(): Observable<EPerson> {
|
||||
@@ -67,7 +67,7 @@ describe('EPeopleRegistryComponent', () => {
|
||||
elementsPerPage: [result].length,
|
||||
totalElements: [result].length,
|
||||
totalPages: 1,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
}), [result]));
|
||||
}
|
||||
if (scope === 'metadata') {
|
||||
@@ -76,7 +76,7 @@ describe('EPeopleRegistryComponent', () => {
|
||||
elementsPerPage: this.allEpeople.length,
|
||||
totalElements: this.allEpeople.length,
|
||||
totalPages: 1,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
}), this.allEpeople));
|
||||
}
|
||||
const result = this.allEpeople.find((ePerson: EPerson) => {
|
||||
@@ -86,14 +86,14 @@ describe('EPeopleRegistryComponent', () => {
|
||||
elementsPerPage: [result].length,
|
||||
totalElements: [result].length,
|
||||
totalPages: 1,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
}), [result]));
|
||||
}
|
||||
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({
|
||||
elementsPerPage: this.allEpeople.length,
|
||||
totalElements: this.allEpeople.length,
|
||||
totalPages: 1,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
}), this.allEpeople));
|
||||
},
|
||||
deleteEPerson(ePerson: EPerson): Observable<boolean> {
|
||||
@@ -113,10 +113,10 @@ describe('EPeopleRegistryComponent', () => {
|
||||
},
|
||||
getEPeoplePageRouterLink(): string {
|
||||
return '/access-control/epeople';
|
||||
}
|
||||
},
|
||||
};
|
||||
authorizationService = jasmine.createSpyObj('authorizationService', {
|
||||
isAuthorized: observableOf(true)
|
||||
isAuthorized: observableOf(true),
|
||||
});
|
||||
builderService = getMockFormBuilderService();
|
||||
translateService = getMockTranslateService();
|
||||
@@ -127,8 +127,8 @@ describe('EPeopleRegistryComponent', () => {
|
||||
TranslateModule.forRoot({
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
useClass: TranslateLoaderMock
|
||||
}
|
||||
useClass: TranslateLoaderMock,
|
||||
},
|
||||
}),
|
||||
],
|
||||
declarations: [EPeopleRegistryComponent],
|
||||
@@ -139,9 +139,9 @@ describe('EPeopleRegistryComponent', () => {
|
||||
{ provide: FormBuilderService, useValue: builderService },
|
||||
{ provide: Router, useValue: new RouterStub() },
|
||||
{ provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) },
|
||||
{ provide: PaginationService, useValue: paginationService }
|
||||
{ provide: PaginationService, useValue: paginationService },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
@@ -209,7 +209,7 @@ describe('EPeopleRegistryComponent', () => {
|
||||
const editButtons = fixture.debugElement.queryAll(By.css('.access-control-editEPersonButton'));
|
||||
editButtons[0].triggerEventHandler('click', {
|
||||
preventDefault: () => {/**/
|
||||
}
|
||||
},
|
||||
});
|
||||
tick();
|
||||
fixture.detectChanges();
|
||||
@@ -242,7 +242,7 @@ describe('EPeopleRegistryComponent', () => {
|
||||
const deleteButtons = fixture.debugElement.queryAll(By.css('.access-control-deleteEPersonButton'));
|
||||
deleteButtons[0].triggerEventHandler('click', {
|
||||
preventDefault: () => {/**/
|
||||
}
|
||||
},
|
||||
});
|
||||
tick();
|
||||
fixture.detectChanges();
|
||||
|
@@ -61,7 +61,7 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
|
||||
config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||
id: 'elp',
|
||||
pageSize: 5,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -131,7 +131,7 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
|
||||
epersonDtoModel.ableToDelete = authorized;
|
||||
epersonDtoModel.eperson = eperson;
|
||||
return epersonDtoModel;
|
||||
})
|
||||
}),
|
||||
);
|
||||
})]).pipe(map((dtos: EpersonDtoModel[]) => {
|
||||
return buildPaginatedList(epeople.pageInfo, dtos);
|
||||
@@ -161,14 +161,14 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
|
||||
const scope: string = data.scope;
|
||||
if (query != null && this.currentSearchQuery !== query) {
|
||||
this.router.navigate([this.epersonService.getEPeoplePageRouterLink()], {
|
||||
queryParamsHandling: 'merge'
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
this.currentSearchQuery = query;
|
||||
this.paginationService.resetPage(this.config.id);
|
||||
}
|
||||
if (scope != null && this.currentSearchScope !== scope) {
|
||||
this.router.navigate([this.epersonService.getEPeoplePageRouterLink()], {
|
||||
queryParamsHandling: 'merge'
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
this.currentSearchScope = scope;
|
||||
this.paginationService.resetPage(this.config.id);
|
||||
@@ -176,15 +176,15 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
return this.epersonService.searchByScope(this.currentSearchScope, this.currentSearchQuery, {
|
||||
currentPage: findListOptions.currentPage,
|
||||
elementsPerPage: findListOptions.pageSize
|
||||
elementsPerPage: findListOptions.pageSize,
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
getAllSucceededRemoteData(),
|
||||
).subscribe((peopleRD) => {
|
||||
this.ePeople$.next(peopleRD.payload);
|
||||
this.pageInfoState$.next(peopleRD.payload.pageInfo);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
|
||||
*/
|
||||
isActive(eperson: EPerson): Observable<boolean> {
|
||||
return this.getActiveEPerson().pipe(
|
||||
map((activeEPerson) => eperson === activeEPerson)
|
||||
map((activeEPerson) => eperson === activeEPerson),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
|
||||
return this.requestService.setStaleByHrefSubstring(href).pipe(
|
||||
take(1),
|
||||
);
|
||||
})
|
||||
}),
|
||||
).subscribe(()=>{
|
||||
this.epersonService.cancelEditEPerson();
|
||||
this.isEPersonFormShown = false;
|
||||
|
@@ -2,7 +2,7 @@ import { EPerson } from '../../core/eperson/models/eperson.model';
|
||||
import {
|
||||
EPeopleRegistryAction,
|
||||
EPeopleRegistryActionTypes,
|
||||
EPeopleRegistryEditEPersonAction
|
||||
EPeopleRegistryEditEPersonAction,
|
||||
} from './epeople-registry.actions';
|
||||
|
||||
/**
|
||||
@@ -30,13 +30,13 @@ export function ePeopleRegistryReducer(state = initialState, action: EPeopleRegi
|
||||
|
||||
case EPeopleRegistryActionTypes.EDIT_EPERSON: {
|
||||
return Object.assign({}, state, {
|
||||
editEPerson: (action as EPeopleRegistryEditEPersonAction).eperson
|
||||
editEPerson: (action as EPeopleRegistryEditEPersonAction).eperson,
|
||||
});
|
||||
}
|
||||
|
||||
case EPeopleRegistryActionTypes.CANCEL_EDIT_EPERSON: {
|
||||
return Object.assign({}, state, {
|
||||
editEPerson: null
|
||||
editEPerson: null,
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -106,7 +106,7 @@ describe('EPersonFormComponent', () => {
|
||||
},
|
||||
getEPersonByEmail(email): Observable<RemoteData<EPerson>> {
|
||||
return createSuccessfulRemoteDataObject$(null);
|
||||
}
|
||||
},
|
||||
};
|
||||
builderService = Object.assign(getMockFormBuilderService(),{
|
||||
createFormGroup(formModel, options = null) {
|
||||
@@ -169,7 +169,7 @@ describe('EPersonFormComponent', () => {
|
||||
},
|
||||
isObject(value) {
|
||||
return typeof value === 'object' && value !== null;
|
||||
}
|
||||
},
|
||||
});
|
||||
authService = new AuthServiceStub();
|
||||
authorizationService = jasmine.createSpyObj('authorizationService', {
|
||||
@@ -178,7 +178,7 @@ describe('EPersonFormComponent', () => {
|
||||
});
|
||||
groupsDataService = jasmine.createSpyObj('groupsDataService', {
|
||||
findListByHref: createSuccessfulRemoteDataObject$(createPaginatedList([])),
|
||||
getGroupRegistryRouterLink: ''
|
||||
getGroupRegistryRouterLink: '',
|
||||
});
|
||||
|
||||
paginationService = new PaginationServiceStub();
|
||||
@@ -187,8 +187,8 @@ describe('EPersonFormComponent', () => {
|
||||
TranslateModule.forRoot({
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
useClass: TranslateLoaderMock
|
||||
}
|
||||
useClass: TranslateLoaderMock,
|
||||
},
|
||||
}),
|
||||
],
|
||||
declarations: [EPersonFormComponent],
|
||||
@@ -202,14 +202,14 @@ describe('EPersonFormComponent', () => {
|
||||
{ provide: PaginationService, useValue: paginationService },
|
||||
{ provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring'])},
|
||||
{ provide: EpersonRegistrationService, useValue: epersonRegistrationService },
|
||||
EPeopleRegistryComponent
|
||||
EPeopleRegistryComponent,
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
epersonRegistrationService = jasmine.createSpyObj('epersonRegistrationService', {
|
||||
registerEmail: createSuccessfulRemoteDataObject$(null)
|
||||
registerEmail: createSuccessfulRemoteDataObject$(null),
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -241,12 +241,12 @@ describe('EPersonFormComponent', () => {
|
||||
metadata: {
|
||||
'eperson.firstname': [
|
||||
{
|
||||
value: firstName
|
||||
}
|
||||
value: firstName,
|
||||
},
|
||||
],
|
||||
'eperson.lastname': [
|
||||
{
|
||||
value: lastName
|
||||
value: lastName,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -329,7 +329,7 @@ describe('EPersonFormComponent', () => {
|
||||
const ePersonServiceWithEperson = Object.assign(ePersonDataServiceStub,{
|
||||
getEPersonByEmail(): Observable<RemoteData<EPerson>> {
|
||||
return createSuccessfulRemoteDataObject$(EPersonMock);
|
||||
}
|
||||
},
|
||||
});
|
||||
component.formGroup.controls.email.setValue('test@test.com');
|
||||
component.formGroup.controls.email.setAsyncValidators(ValidateEmailNotTaken.createValidator(ePersonServiceWithEperson));
|
||||
@@ -366,12 +366,12 @@ describe('EPersonFormComponent', () => {
|
||||
metadata: {
|
||||
'eperson.firstname': [
|
||||
{
|
||||
value: firstName
|
||||
}
|
||||
value: firstName,
|
||||
},
|
||||
],
|
||||
'eperson.lastname': [
|
||||
{
|
||||
value: lastName
|
||||
value: lastName,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -409,19 +409,19 @@ describe('EPersonFormComponent', () => {
|
||||
metadata: {
|
||||
'eperson.firstname': [
|
||||
{
|
||||
value: firstName
|
||||
}
|
||||
value: firstName,
|
||||
},
|
||||
],
|
||||
'eperson.lastname': [
|
||||
{
|
||||
value: lastName
|
||||
value: lastName,
|
||||
},
|
||||
],
|
||||
},
|
||||
email: email,
|
||||
canLogIn: canLogIn,
|
||||
requireCertificate: requireCertificate,
|
||||
_links: undefined
|
||||
_links: undefined,
|
||||
});
|
||||
spyOn(ePersonDataServiceStub, 'getActiveEPerson').and.returnValue(observableOf(expectedWithId));
|
||||
component.onSubmit();
|
||||
@@ -443,7 +443,7 @@ describe('EPersonFormComponent', () => {
|
||||
spyOn(authService, 'impersonate').and.callThrough();
|
||||
ePersonId = 'testEPersonId';
|
||||
component.epersonInitial = Object.assign(new EPerson(), {
|
||||
id: ePersonId
|
||||
id: ePersonId,
|
||||
});
|
||||
component.impersonate();
|
||||
});
|
||||
@@ -531,7 +531,7 @@ describe('EPersonFormComponent', () => {
|
||||
ePersonEmail = 'person.email@4science.it';
|
||||
component.epersonInitial = Object.assign(new EPerson(), {
|
||||
id: ePersonId,
|
||||
email: ePersonEmail
|
||||
email: ePersonEmail,
|
||||
});
|
||||
component.resetPassword();
|
||||
});
|
||||
|
@@ -4,7 +4,7 @@ import {
|
||||
DynamicCheckboxModel,
|
||||
DynamicFormControlModel,
|
||||
DynamicFormLayout,
|
||||
DynamicInputModel
|
||||
DynamicInputModel,
|
||||
} from '@ng-dynamic-forms/core';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { combineLatest as observableCombineLatest, Observable, of as observableOf, Subscription } from 'rxjs';
|
||||
@@ -18,7 +18,7 @@ import { Group } from '../../../core/eperson/models/group.model';
|
||||
import {
|
||||
getFirstCompletedRemoteData,
|
||||
getFirstSucceededRemoteData,
|
||||
getRemoteDataPayload
|
||||
getRemoteDataPayload,
|
||||
} from '../../../core/shared/operators';
|
||||
import { hasValue } from '../../../shared/empty.util';
|
||||
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
|
||||
@@ -82,28 +82,28 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
||||
formLayout: DynamicFormLayout = {
|
||||
firstName: {
|
||||
grid: {
|
||||
host: 'row'
|
||||
}
|
||||
host: 'row',
|
||||
},
|
||||
},
|
||||
lastName: {
|
||||
grid: {
|
||||
host: 'row'
|
||||
}
|
||||
host: 'row',
|
||||
},
|
||||
},
|
||||
email: {
|
||||
grid: {
|
||||
host: 'row'
|
||||
}
|
||||
host: 'row',
|
||||
},
|
||||
},
|
||||
canLogIn: {
|
||||
grid: {
|
||||
host: 'col col-sm-6 d-inline-block'
|
||||
}
|
||||
host: 'col col-sm-6 d-inline-block',
|
||||
},
|
||||
},
|
||||
requireCertificate: {
|
||||
grid: {
|
||||
host: 'col col-sm-6 d-inline-block'
|
||||
}
|
||||
host: 'col col-sm-6 d-inline-block',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -159,7 +159,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
||||
config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||
id: 'gem',
|
||||
pageSize: 5,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -257,23 +257,23 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
||||
required: true,
|
||||
errorMessages: {
|
||||
emailTaken: 'error.validation.emailTaken',
|
||||
pattern: 'error.validation.NotValidEmail'
|
||||
pattern: 'error.validation.NotValidEmail',
|
||||
},
|
||||
hint: emailHint
|
||||
hint: emailHint,
|
||||
});
|
||||
this.canLogIn = new DynamicCheckboxModel(
|
||||
{
|
||||
id: 'canLogIn',
|
||||
label: canLogIn,
|
||||
name: 'canLogIn',
|
||||
value: (this.epersonInitial != null ? this.epersonInitial.canLogIn : true)
|
||||
value: (this.epersonInitial != null ? this.epersonInitial.canLogIn : true),
|
||||
});
|
||||
this.requireCertificate = new DynamicCheckboxModel(
|
||||
{
|
||||
id: 'requireCertificate',
|
||||
label: requireCertificate,
|
||||
name: 'requireCertificate',
|
||||
value: (this.epersonInitial != null ? this.epersonInitial.requireCertificate : false)
|
||||
value: (this.epersonInitial != null ? this.epersonInitial.requireCertificate : false),
|
||||
});
|
||||
this.formModel = [
|
||||
this.firstName,
|
||||
@@ -287,7 +287,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
||||
if (eperson != null) {
|
||||
this.groups$ = this.groupsDataService.findListByHref(eperson._links.groups.href, {
|
||||
currentPage: 1,
|
||||
elementsPerPage: this.config.pageSize
|
||||
elementsPerPage: this.config.pageSize,
|
||||
});
|
||||
}
|
||||
this.formGroup.patchValue({
|
||||
@@ -295,7 +295,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
||||
lastName: eperson != null ? eperson.firstMetadataValue('eperson.lastname') : '',
|
||||
email: eperson != null ? eperson.email : '',
|
||||
canLogIn: eperson != null ? eperson.canLogIn : true,
|
||||
requireCertificate: eperson != null ? eperson.requireCertificate : false
|
||||
requireCertificate: eperson != null ? eperson.requireCertificate : false,
|
||||
});
|
||||
|
||||
if (eperson === null && !!this.formGroup.controls.email) {
|
||||
@@ -312,7 +312,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
||||
switchMap((eperson) => {
|
||||
return observableCombineLatest([observableOf(eperson), this.paginationService.getFindListOptions(this.config.id, {
|
||||
currentPage: 1,
|
||||
elementsPerPage: this.config.pageSize
|
||||
elementsPerPage: this.config.pageSize,
|
||||
})]);
|
||||
}),
|
||||
switchMap(([eperson, findListOptions]) => {
|
||||
@@ -320,7 +320,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
||||
return this.groupsDataService.findListByHref(eperson._links.groups.href, findListOptions, true, true, followLink('object'));
|
||||
}
|
||||
return observableOf(undefined);
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
this.groupsPageInfoState$ = this.groups$.pipe(
|
||||
@@ -334,10 +334,10 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
||||
} else {
|
||||
return observableOf(false);
|
||||
}
|
||||
})
|
||||
}),
|
||||
);
|
||||
this.canDelete$ = activeEPerson$.pipe(
|
||||
switchMap((eperson) => this.authorizationService.isAuthorized(FeatureID.CanDelete, hasValue(eperson) ? eperson.self : undefined))
|
||||
switchMap((eperson) => this.authorizationService.isAuthorized(FeatureID.CanDelete, hasValue(eperson) ? eperson.self : undefined)),
|
||||
);
|
||||
this.canReset$ = observableOf(true);
|
||||
});
|
||||
@@ -364,12 +364,12 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
||||
metadata: {
|
||||
'eperson.firstname': [
|
||||
{
|
||||
value: this.firstName.value
|
||||
}
|
||||
value: this.firstName.value,
|
||||
},
|
||||
],
|
||||
'eperson.lastname': [
|
||||
{
|
||||
value: this.lastName.value
|
||||
value: this.lastName.value,
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -382,7 +382,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
||||
} else {
|
||||
this.editEPerson(ePerson, values);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -395,7 +395,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
||||
|
||||
const response = this.epersonService.create(ePersonToCreate);
|
||||
response.pipe(
|
||||
getFirstCompletedRemoteData()
|
||||
getFirstCompletedRemoteData(),
|
||||
).subscribe((rd: RemoteData<EPerson>) => {
|
||||
if (rd.hasSucceeded) {
|
||||
this.notificationsService.success(this.translateService.get(this.labelPrefix + 'notification.created.success', { name: this.dsoNameService.getName(ePersonToCreate) }));
|
||||
@@ -419,12 +419,12 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
||||
metadata: {
|
||||
'eperson.firstname': [
|
||||
{
|
||||
value: (this.firstName.value ? this.firstName.value : ePerson.firstMetadataValue('eperson.firstname'))
|
||||
}
|
||||
value: (this.firstName.value ? this.firstName.value : ePerson.firstMetadataValue('eperson.firstname')),
|
||||
},
|
||||
],
|
||||
'eperson.lastname': [
|
||||
{
|
||||
value: (this.lastName.value ? this.lastName.value : ePerson.firstMetadataValue('eperson.lastname'))
|
||||
value: (this.lastName.value ? this.lastName.value : ePerson.firstMetadataValue('eperson.lastname')),
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -457,7 +457,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
||||
onPageChange(event) {
|
||||
this.updateGroups({
|
||||
currentPage: event,
|
||||
elementsPerPage: this.config.pageSize
|
||||
elementsPerPage: this.config.pageSize,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -493,15 +493,15 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
||||
this.canDelete$ = observableOf(false);
|
||||
return this.epersonService.deleteEPerson(eperson).pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
map((restResponse: RemoteData<NoContent>) => ({ restResponse, eperson }))
|
||||
map((restResponse: RemoteData<NoContent>) => ({ restResponse, eperson })),
|
||||
);
|
||||
} else {
|
||||
return observableOf(null);
|
||||
}
|
||||
}),
|
||||
finalize(() => this.canDelete$ = observableOf(true))
|
||||
finalize(() => this.canDelete$ = observableOf(true)),
|
||||
);
|
||||
})
|
||||
}),
|
||||
).subscribe(({ restResponse, eperson }: { restResponse: RemoteData<NoContent> | null, eperson: EPerson }) => {
|
||||
if (restResponse?.hasSucceeded) {
|
||||
this.notificationsService.success(this.translateService.get(this.labelPrefix + 'notification.deleted.success', { name: this.dsoNameService.getName(eperson) }));
|
||||
@@ -535,7 +535,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
||||
this.notificationsService.error(this.translateService.get('forgot-email.form.error.head'),
|
||||
this.translateService.get('forgot-email.form.error.content', {email: this.epersonInitial.email}));
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -571,13 +571,13 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
|
||||
// Relevant message for email in use
|
||||
this.subs.push(this.epersonService.searchByScope('email', ePerson.email, {
|
||||
currentPage: 1,
|
||||
elementsPerPage: 0
|
||||
elementsPerPage: 0,
|
||||
}).pipe(getFirstSucceededRemoteData(), getRemoteDataPayload())
|
||||
.subscribe((list: PaginatedList<EPerson>) => {
|
||||
if (list.totalElements > 0) {
|
||||
this.notificationsService.error(this.translateService.get(this.labelPrefix + 'notification.' + notificationSection + '.failure.emailInUse', {
|
||||
name: this.dsoNameService.getName(ePerson),
|
||||
email: ePerson.email
|
||||
email: ePerson.email,
|
||||
}));
|
||||
}
|
||||
}));
|
||||
|
@@ -3,7 +3,7 @@ import { Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
import { EPersonDataService } from '../../../../core/eperson/eperson-data.service';
|
||||
import { getFirstSucceededRemoteData, } from '../../../../core/shared/operators';
|
||||
import { getFirstSucceededRemoteData } from '../../../../core/shared/operators';
|
||||
|
||||
export class ValidateEmailNotTaken {
|
||||
|
||||
@@ -18,7 +18,7 @@ export class ValidateEmailNotTaken {
|
||||
getFirstSucceededRemoteData(),
|
||||
map(res => {
|
||||
return res.payload ? { emailTaken: true } : null;
|
||||
})
|
||||
}),
|
||||
);
|
||||
};
|
||||
}
|
||||
|
@@ -65,8 +65,8 @@ describe('GroupFormComponent', () => {
|
||||
metadata: {
|
||||
'dc.description': [
|
||||
{
|
||||
value: groupDescription
|
||||
}
|
||||
value: groupDescription,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
@@ -105,7 +105,7 @@ describe('GroupFormComponent', () => {
|
||||
create(group: Group): Observable<RemoteData<Group>> {
|
||||
this.allGroups = [...this.allGroups, group];
|
||||
this.createdGroup = Object.assign({}, group, {
|
||||
_links: { self: { href: 'group-selflink' } }
|
||||
_links: { self: { href: 'group-selflink' } },
|
||||
});
|
||||
return createSuccessfulRemoteDataObject$(this.createdGroup);
|
||||
},
|
||||
@@ -114,15 +114,15 @@ describe('GroupFormComponent', () => {
|
||||
},
|
||||
getGroupEditPageRouterLinkWithID(id: string) {
|
||||
return `group-edit-page-for-${id}`;
|
||||
}
|
||||
},
|
||||
};
|
||||
authorizationService = jasmine.createSpyObj('authorizationService', {
|
||||
isAuthorized: observableOf(true)
|
||||
isAuthorized: observableOf(true),
|
||||
});
|
||||
dsoDataServiceStub = {
|
||||
findByHref(href: string): Observable<RemoteData<DSpaceObject>> {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
};
|
||||
builderService = Object.assign(getMockFormBuilderService(),{
|
||||
createFormGroup(formModel, options = null) {
|
||||
@@ -185,7 +185,7 @@ describe('GroupFormComponent', () => {
|
||||
},
|
||||
isObject(value) {
|
||||
return typeof value === 'object' && value !== null;
|
||||
}
|
||||
},
|
||||
});
|
||||
translateService = getMockTranslateService();
|
||||
router = new RouterMock();
|
||||
@@ -195,8 +195,8 @@ describe('GroupFormComponent', () => {
|
||||
TranslateModule.forRoot({
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
useClass: TranslateLoaderMock
|
||||
}
|
||||
useClass: TranslateLoaderMock,
|
||||
},
|
||||
}),
|
||||
],
|
||||
declarations: [GroupFormComponent],
|
||||
@@ -216,12 +216,12 @@ describe('GroupFormComponent', () => {
|
||||
{ provide: HALEndpointService, useValue: {} },
|
||||
{
|
||||
provide: ActivatedRoute,
|
||||
useValue: { data: observableOf({ dso: { payload: {} } }), params: observableOf({}) }
|
||||
useValue: { data: observableOf({ dso: { payload: {} } }), params: observableOf({}) },
|
||||
},
|
||||
{ provide: Router, useValue: router },
|
||||
{ provide: AuthorizationDataService, useValue: authorizationService },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
@@ -257,8 +257,8 @@ describe('GroupFormComponent', () => {
|
||||
metadata: {
|
||||
'dc.description': [
|
||||
{
|
||||
value: groupDescription
|
||||
}
|
||||
value: groupDescription,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
@@ -273,11 +273,11 @@ describe('GroupFormComponent', () => {
|
||||
const operations = [{
|
||||
op: 'add',
|
||||
path: '/metadata/dc.description',
|
||||
value: 'testDescription'
|
||||
value: 'testDescription',
|
||||
}, {
|
||||
op: 'replace',
|
||||
path: '/name',
|
||||
value: 'newGroupName'
|
||||
value: 'newGroupName',
|
||||
}];
|
||||
expect(groupsDataServiceStub.patch).toHaveBeenCalledWith(expected, operations);
|
||||
});
|
||||
@@ -289,7 +289,7 @@ describe('GroupFormComponent', () => {
|
||||
const operations = [{
|
||||
op: 'add',
|
||||
path: '/metadata/dc.description',
|
||||
value: 'testDescription'
|
||||
value: 'testDescription',
|
||||
}];
|
||||
expect(groupsDataServiceStub.patch).toHaveBeenCalledWith(expected, operations);
|
||||
});
|
||||
@@ -301,7 +301,7 @@ describe('GroupFormComponent', () => {
|
||||
const operations = [{
|
||||
op: 'replace',
|
||||
path: '/name',
|
||||
value: 'newGroupName'
|
||||
value: 'newGroupName',
|
||||
}];
|
||||
expect(groupsDataServiceStub.patch).toHaveBeenCalledWith(expected, operations);
|
||||
});
|
||||
@@ -338,8 +338,8 @@ describe('GroupFormComponent', () => {
|
||||
metadata: {
|
||||
'dc.description': [
|
||||
{
|
||||
value: groupDescription
|
||||
}
|
||||
value: groupDescription,
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
@@ -376,7 +376,7 @@ describe('GroupFormComponent', () => {
|
||||
const groupsDataServiceStubWithGroup = Object.assign(groupsDataServiceStub,{
|
||||
searchGroups(query: string): Observable<RemoteData<PaginatedList<Group>>> {
|
||||
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo(), [expected]));
|
||||
}
|
||||
},
|
||||
});
|
||||
component.formGroup.controls.groupName.setValue('testName');
|
||||
component.formGroup.controls.groupName.setAsyncValidators(ValidateGroupExists.createValidator(groupsDataServiceStubWithGroup));
|
||||
@@ -400,7 +400,7 @@ describe('GroupFormComponent', () => {
|
||||
|
||||
component.canEdit$ = observableOf(true);
|
||||
component.groupBeingEdited = {
|
||||
permanent: false
|
||||
permanent: false,
|
||||
} as Group;
|
||||
|
||||
fixture.detectChanges();
|
||||
|
@@ -6,7 +6,7 @@ import {
|
||||
DynamicFormControlModel,
|
||||
DynamicFormLayout,
|
||||
DynamicInputModel,
|
||||
DynamicTextAreaModel
|
||||
DynamicTextAreaModel,
|
||||
} from '@ng-dynamic-forms/core';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import {
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
getRemoteDataPayload,
|
||||
getFirstSucceededRemoteData,
|
||||
getFirstCompletedRemoteData,
|
||||
getFirstSucceededRemoteDataPayload
|
||||
getFirstSucceededRemoteDataPayload,
|
||||
} from '../../../core/shared/operators';
|
||||
import { AlertType } from '../../../shared/alert/aletr-type';
|
||||
import { ConfirmationModalComponent } from '../../../shared/confirmation-modal/confirmation-modal.component';
|
||||
@@ -51,7 +51,7 @@ import { environment } from '../../../../environments/environment';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-group-form',
|
||||
templateUrl: './group-form.component.html'
|
||||
templateUrl: './group-form.component.html',
|
||||
})
|
||||
/**
|
||||
* A form used for creating and editing groups
|
||||
@@ -83,13 +83,13 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
formLayout: DynamicFormLayout = {
|
||||
groupName: {
|
||||
grid: {
|
||||
host: 'row'
|
||||
}
|
||||
host: 'row',
|
||||
},
|
||||
},
|
||||
groupDescription: {
|
||||
grid: {
|
||||
host: 'row'
|
||||
}
|
||||
host: 'row',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -171,12 +171,12 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
(isAuthorized: ObservedValueOf<Observable<boolean>>, hasLinkedDSO: ObservedValueOf<Observable<boolean>>) => {
|
||||
return isAuthorized && !hasLinkedDSO;
|
||||
});
|
||||
})
|
||||
}),
|
||||
);
|
||||
observableCombineLatest(
|
||||
this.translateService.get(`${this.messagePrefix}.groupName`),
|
||||
this.translateService.get(`${this.messagePrefix}.groupCommunity`),
|
||||
this.translateService.get(`${this.messagePrefix}.groupDescription`)
|
||||
this.translateService.get(`${this.messagePrefix}.groupDescription`),
|
||||
).subscribe(([groupName, groupCommunity, groupDescription]) => {
|
||||
this.groupName = new DynamicInputModel({
|
||||
id: 'groupName',
|
||||
@@ -219,7 +219,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
this.groupDataService.getActiveGroup(),
|
||||
this.canEdit$,
|
||||
this.groupDataService.getActiveGroup()
|
||||
.pipe(filter((activeGroup) => hasValue(activeGroup)),switchMap((activeGroup) => this.getLinkedDSO(activeGroup).pipe(getFirstSucceededRemoteDataPayload())))
|
||||
.pipe(filter((activeGroup) => hasValue(activeGroup)),switchMap((activeGroup) => this.getLinkedDSO(activeGroup).pipe(getFirstSucceededRemoteDataPayload()))),
|
||||
).subscribe(([activeGroup, canEdit, linkedObject]) => {
|
||||
|
||||
if (activeGroup != null) {
|
||||
@@ -252,7 +252,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}, 200);
|
||||
}
|
||||
})
|
||||
}),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -280,9 +280,9 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
metadata: {
|
||||
'dc.description': [
|
||||
{
|
||||
value: this.groupDescription.value
|
||||
}
|
||||
]
|
||||
value: this.groupDescription.value,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
if (group === null) {
|
||||
@@ -290,7 +290,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
} else {
|
||||
this.editGroup(group);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -301,7 +301,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
createNewGroup(values) {
|
||||
const groupToCreate = Object.assign(new Group(), values);
|
||||
this.groupDataService.create(groupToCreate).pipe(
|
||||
getFirstCompletedRemoteData()
|
||||
getFirstCompletedRemoteData(),
|
||||
).subscribe((rd: RemoteData<Group>) => {
|
||||
if (rd.hasSucceeded) {
|
||||
this.notificationsService.success(this.translateService.get(this.messagePrefix + '.notification.created.success', { name: groupToCreate.name }));
|
||||
@@ -330,7 +330,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
// Relevant message for group name in use
|
||||
this.subs.push(this.groupDataService.searchGroups(group.name, {
|
||||
currentPage: 1,
|
||||
elementsPerPage: 0
|
||||
elementsPerPage: 0,
|
||||
}).pipe(getFirstSucceededRemoteData(), getRemoteDataPayload())
|
||||
.subscribe((list: PaginatedList<Group>) => {
|
||||
if (list.totalElements > 0) {
|
||||
@@ -352,7 +352,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
operations = [...operations, {
|
||||
op: 'add',
|
||||
path: '/metadata/dc.description',
|
||||
value: this.groupDescription.value
|
||||
value: this.groupDescription.value,
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -360,12 +360,12 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
operations = [...operations, {
|
||||
op: 'replace',
|
||||
path: '/name',
|
||||
value: this.groupName.value
|
||||
value: this.groupName.value,
|
||||
}];
|
||||
}
|
||||
|
||||
this.groupDataService.patch(group, operations).pipe(
|
||||
getFirstCompletedRemoteData()
|
||||
getFirstCompletedRemoteData(),
|
||||
).subscribe((rd: RemoteData<Group>) => {
|
||||
if (rd.hasSucceeded) {
|
||||
this.notificationsService.success(this.translateService.get(this.messagePrefix + '.notification.edited.success', { name: this.dsoNameService.getName(rd.payload) }));
|
||||
@@ -504,7 +504,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
|
||||
return getCollectionEditRolesRoute(rd.payload.id);
|
||||
}
|
||||
}
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -72,7 +72,7 @@ describe('MembersListComponent', () => {
|
||||
},
|
||||
getEPeoplePageRouterLink(): string {
|
||||
return '/access-control/epeople';
|
||||
}
|
||||
},
|
||||
};
|
||||
groupsDataServiceStub = {
|
||||
activeGroup: activeGroup,
|
||||
@@ -114,7 +114,7 @@ describe('MembersListComponent', () => {
|
||||
this.epersonMembers = [];
|
||||
}
|
||||
return observableOf(new RestResponse(true, 200, 'Success'));
|
||||
}
|
||||
},
|
||||
};
|
||||
builderService = getMockFormBuilderService();
|
||||
translateService = getMockTranslateService();
|
||||
@@ -125,8 +125,8 @@ describe('MembersListComponent', () => {
|
||||
TranslateModule.forRoot({
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
useClass: TranslateLoaderMock
|
||||
}
|
||||
useClass: TranslateLoaderMock,
|
||||
},
|
||||
}),
|
||||
],
|
||||
declarations: [MembersListComponent],
|
||||
@@ -139,7 +139,7 @@ describe('MembersListComponent', () => {
|
||||
{ provide: PaginationService, useValue: paginationService },
|
||||
{ provide: DSONameService, useValue: new DSONameServiceMock() },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
|
@@ -21,7 +21,7 @@ import {
|
||||
getFirstSucceededRemoteData,
|
||||
getFirstCompletedRemoteData,
|
||||
getAllCompletedRemoteData,
|
||||
getRemoteDataPayload
|
||||
getRemoteDataPayload,
|
||||
} from '../../../../core/shared/operators';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { PaginationComponentOptions } from '../../../../shared/pagination/pagination-component-options.model';
|
||||
@@ -69,7 +69,7 @@ export interface EPersonListActionConfig {
|
||||
|
||||
@Component({
|
||||
selector: 'ds-members-list',
|
||||
templateUrl: './members-list.component.html'
|
||||
templateUrl: './members-list.component.html',
|
||||
})
|
||||
/**
|
||||
* The list of members in the edit group page
|
||||
@@ -89,7 +89,7 @@ export class MembersListComponent implements OnInit, OnDestroy {
|
||||
remove: {
|
||||
css: 'btn-outline-danger',
|
||||
disabled: false,
|
||||
icon: 'fas fa-trash-alt fa-fw'
|
||||
icon: 'fas fa-trash-alt fa-fw',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -108,7 +108,7 @@ export class MembersListComponent implements OnInit, OnDestroy {
|
||||
configSearch: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||
id: 'sml',
|
||||
pageSize: 5,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
});
|
||||
/**
|
||||
* Pagination config used to display the list of EPerson Membes of active group being edited
|
||||
@@ -116,7 +116,7 @@ export class MembersListComponent implements OnInit, OnDestroy {
|
||||
config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||
id: 'ml',
|
||||
pageSize: 5,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -177,8 +177,8 @@ export class MembersListComponent implements OnInit, OnDestroy {
|
||||
switchMap((currentPagination) => {
|
||||
return this.ePersonDataService.findListByHref(this.groupBeingEdited._links.epersons.href, {
|
||||
currentPage: currentPagination.currentPage,
|
||||
elementsPerPage: currentPagination.pageSize
|
||||
}
|
||||
elementsPerPage: currentPagination.pageSize,
|
||||
},
|
||||
);
|
||||
}),
|
||||
getAllCompletedRemoteData(),
|
||||
@@ -219,7 +219,7 @@ export class MembersListComponent implements OnInit, OnDestroy {
|
||||
if (group != null) {
|
||||
return this.ePersonDataService.findListByHref(group._links.epersons.href, {
|
||||
currentPage: 1,
|
||||
elementsPerPage: 9999
|
||||
elementsPerPage: 9999,
|
||||
})
|
||||
.pipe(
|
||||
getFirstSucceededRemoteData(),
|
||||
@@ -292,14 +292,14 @@ export class MembersListComponent implements OnInit, OnDestroy {
|
||||
const scope: string = data.scope;
|
||||
if (query != null && this.currentSearchQuery !== query && this.groupBeingEdited) {
|
||||
this.router.navigate([], {
|
||||
queryParamsHandling: 'merge'
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
this.currentSearchQuery = query;
|
||||
this.paginationService.resetPage(this.configSearch.id);
|
||||
}
|
||||
if (scope != null && this.currentSearchScope !== scope && this.groupBeingEdited) {
|
||||
this.router.navigate([], {
|
||||
queryParamsHandling: 'merge'
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
this.currentSearchScope = scope;
|
||||
this.paginationService.resetPage(this.configSearch.id);
|
||||
@@ -308,7 +308,7 @@ export class MembersListComponent implements OnInit, OnDestroy {
|
||||
|
||||
return this.ePersonDataService.searchByScope(this.currentSearchScope, this.currentSearchQuery, {
|
||||
currentPage: paginationOptions.currentPage,
|
||||
elementsPerPage: paginationOptions.pageSize
|
||||
elementsPerPage: paginationOptions.pageSize,
|
||||
});
|
||||
}),
|
||||
getAllCompletedRemoteData(),
|
||||
|
@@ -19,7 +19,7 @@ import { GroupMock, GroupMock2 } from '../../../../shared/testing/group-mock';
|
||||
import { SubgroupsListComponent } from './subgroups-list.component';
|
||||
import {
|
||||
createSuccessfulRemoteDataObject$,
|
||||
createSuccessfulRemoteDataObject
|
||||
createSuccessfulRemoteDataObject,
|
||||
} from '../../../../shared/remote-data.utils';
|
||||
import { RouterMock } from '../../../../shared/mocks/router.mock';
|
||||
import { getMockFormBuilderService } from '../../../../shared/mocks/form-builder-service.mock';
|
||||
@@ -63,7 +63,7 @@ describe('SubgroupsListComponent', () => {
|
||||
return this.subgroups$.pipe(
|
||||
map((currentGroups: Group[]) => {
|
||||
return createSuccessfulRemoteDataObject(buildPaginatedList<Group>(new PageInfo(), currentGroups));
|
||||
})
|
||||
}),
|
||||
);
|
||||
},
|
||||
getGroupEditPageRouterLink(group: Group): string {
|
||||
@@ -92,7 +92,7 @@ describe('SubgroupsListComponent', () => {
|
||||
}
|
||||
}));
|
||||
return observableOf(new RestResponse(true, 200, 'Success'));
|
||||
}
|
||||
},
|
||||
};
|
||||
routerStub = new RouterMock();
|
||||
builderService = getMockFormBuilderService();
|
||||
@@ -104,8 +104,8 @@ describe('SubgroupsListComponent', () => {
|
||||
TranslateModule.forRoot({
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
useClass: TranslateLoaderMock
|
||||
}
|
||||
useClass: TranslateLoaderMock,
|
||||
},
|
||||
}),
|
||||
],
|
||||
declarations: [SubgroupsListComponent],
|
||||
@@ -117,7 +117,7 @@ describe('SubgroupsListComponent', () => {
|
||||
{ provide: Router, useValue: routerStub },
|
||||
{ provide: PaginationService, useValue: paginationService },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
@@ -153,7 +153,7 @@ describe('SubgroupsListComponent', () => {
|
||||
const addButton = fixture.debugElement.query(By.css('#subgroupsOfGroup tbody .deleteButton'));
|
||||
addButton.triggerEventHandler('click', {
|
||||
preventDefault: () => {/**/
|
||||
}
|
||||
},
|
||||
});
|
||||
tick();
|
||||
fixture.detectChanges();
|
||||
|
@@ -11,7 +11,7 @@ import { Group } from '../../../../core/eperson/models/group.model';
|
||||
import {
|
||||
getFirstCompletedRemoteData,
|
||||
getFirstSucceededRemoteData,
|
||||
getRemoteDataPayload
|
||||
getRemoteDataPayload,
|
||||
} from '../../../../core/shared/operators';
|
||||
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
|
||||
import { PaginationComponentOptions } from '../../../../shared/pagination/pagination-component-options.model';
|
||||
@@ -32,7 +32,7 @@ enum SubKey {
|
||||
|
||||
@Component({
|
||||
selector: 'ds-subgroups-list',
|
||||
templateUrl: './subgroups-list.component.html'
|
||||
templateUrl: './subgroups-list.component.html',
|
||||
})
|
||||
/**
|
||||
* The list of subgroups in the edit group page
|
||||
@@ -64,7 +64,7 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
|
||||
configSearch: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||
id: 'ssgl',
|
||||
pageSize: 5,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
});
|
||||
/**
|
||||
* Pagination config used to display the list of subgroups of currently active group being edited
|
||||
@@ -72,7 +72,7 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
|
||||
config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||
id: 'sgl',
|
||||
pageSize: 5,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
});
|
||||
|
||||
// The search form
|
||||
@@ -126,12 +126,12 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
|
||||
this.paginationService.getCurrentPagination(this.config.id, this.config).pipe(
|
||||
switchMap((config) => this.groupDataService.findListByHref(this.groupBeingEdited._links.subgroups.href, {
|
||||
currentPage: config.currentPage,
|
||||
elementsPerPage: config.pageSize
|
||||
elementsPerPage: config.pageSize,
|
||||
},
|
||||
true,
|
||||
true,
|
||||
followLink('object')
|
||||
))
|
||||
followLink('object'),
|
||||
)),
|
||||
).subscribe((rd: RemoteData<PaginatedList<Group>>) => {
|
||||
this.subGroups$.next(rd);
|
||||
}));
|
||||
@@ -150,7 +150,7 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
|
||||
} else {
|
||||
return this.groupDataService.findListByHref(activeGroup._links.subgroups.href, {
|
||||
currentPage: 1,
|
||||
elementsPerPage: 9999
|
||||
elementsPerPage: 9999,
|
||||
})
|
||||
.pipe(
|
||||
getFirstSucceededRemoteData(),
|
||||
@@ -229,9 +229,9 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
|
||||
this.subs.set(SubKey.SearchResults, this.paginationService.getCurrentPagination(this.configSearch.id, this.configSearch).pipe(
|
||||
switchMap((config) => this.groupDataService.searchGroups(this.currentSearchQuery, {
|
||||
currentPage: config.currentPage,
|
||||
elementsPerPage: config.pageSize
|
||||
}, true, true, followLink('object')
|
||||
))
|
||||
elementsPerPage: config.pageSize,
|
||||
}, true, true, followLink('object'),
|
||||
)),
|
||||
).subscribe((rd: RemoteData<PaginatedList<Group>>) => {
|
||||
this.searchResults$.next(rd);
|
||||
}));
|
||||
|
@@ -17,7 +17,7 @@ export class ValidateGroupExists {
|
||||
return (control: AbstractControl): Promise<ValidationErrors | null> | Observable<ValidationErrors | null> => {
|
||||
return groupDataService.searchGroups(control.value, {
|
||||
currentPage: 1,
|
||||
elementsPerPage: 100
|
||||
elementsPerPage: 100,
|
||||
})
|
||||
.pipe(
|
||||
getFirstSucceededRemoteListPayload(),
|
||||
|
@@ -13,7 +13,7 @@ describe('GroupPageGuard', () => {
|
||||
const routeSnapshotWithGroupId = {
|
||||
params: {
|
||||
groupId: groupUuid,
|
||||
}
|
||||
},
|
||||
} as unknown as ActivatedRouteSnapshot;
|
||||
|
||||
let guard: GroupPageGuard;
|
||||
@@ -50,10 +50,10 @@ describe('GroupPageGuard', () => {
|
||||
|
||||
it('should return true', (done) => {
|
||||
guard.canActivate(
|
||||
routeSnapshotWithGroupId, { url: 'current-url'} as any
|
||||
routeSnapshotWithGroupId, { url: 'current-url'} as any,
|
||||
).subscribe((result) => {
|
||||
expect(authorizationService.isAuthorized).toHaveBeenCalledWith(
|
||||
FeatureID.CanManageGroup, groupEndpointUrl, undefined
|
||||
FeatureID.CanManageGroup, groupEndpointUrl, undefined,
|
||||
);
|
||||
expect(result).toBeTrue();
|
||||
done();
|
||||
@@ -68,10 +68,10 @@ describe('GroupPageGuard', () => {
|
||||
|
||||
it('should not return true', (done) => {
|
||||
guard.canActivate(
|
||||
routeSnapshotWithGroupId, { url: 'current-url'} as any
|
||||
routeSnapshotWithGroupId, { url: 'current-url'} as any,
|
||||
).subscribe((result) => {
|
||||
expect(authorizationService.isAuthorized).toHaveBeenCalledWith(
|
||||
FeatureID.CanManageGroup, groupEndpointUrl, undefined
|
||||
FeatureID.CanManageGroup, groupEndpointUrl, undefined,
|
||||
);
|
||||
expect(result).not.toBeTrue();
|
||||
done();
|
||||
|
@@ -9,7 +9,7 @@ import { HALEndpointService } from '../../core/shared/hal-endpoint.service';
|
||||
import { map } from 'rxjs/operators';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class GroupPageGuard extends SomeFeatureAuthorizationGuard {
|
||||
|
||||
@@ -28,7 +28,7 @@ export class GroupPageGuard extends SomeFeatureAuthorizationGuard {
|
||||
|
||||
getObjectUrl(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<string> {
|
||||
return this.halEndpointService.getEndpoint(this.groupsEndpoint).pipe(
|
||||
map(groupsUrl => `${groupsUrl}/${route?.params?.groupId}`)
|
||||
map(groupsUrl => `${groupsUrl}/${route?.params?.groupId}`),
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -27,13 +27,13 @@ export function groupRegistryReducer(state = initialState, action: GroupRegistry
|
||||
|
||||
case GroupRegistryActionTypes.EDIT_GROUP: {
|
||||
return Object.assign({}, state, {
|
||||
editGroup: (action as GroupRegistryEditGroupAction).group
|
||||
editGroup: (action as GroupRegistryEditGroupAction).group,
|
||||
});
|
||||
}
|
||||
|
||||
case GroupRegistryActionTypes.CANCEL_EDIT_GROUP: {
|
||||
return Object.assign({}, state, {
|
||||
editGroup: null
|
||||
editGroup: null,
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -78,24 +78,24 @@ describe('GroupsRegistryComponent', () => {
|
||||
elementsPerPage: 1,
|
||||
totalElements: 0,
|
||||
totalPages: 0,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
}), []));
|
||||
case 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid/epersons':
|
||||
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({
|
||||
elementsPerPage: 1,
|
||||
totalElements: 1,
|
||||
totalPages: 1,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
}), [EPersonMock]));
|
||||
default:
|
||||
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({
|
||||
elementsPerPage: 1,
|
||||
totalElements: 0,
|
||||
totalPages: 0,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
}), []));
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
groupsDataServiceStub = {
|
||||
allGroups: mockGroups,
|
||||
@@ -106,21 +106,21 @@ describe('GroupsRegistryComponent', () => {
|
||||
elementsPerPage: 1,
|
||||
totalElements: 0,
|
||||
totalPages: 0,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
}), []));
|
||||
case 'https://dspace.4science.it/dspace-spring-rest/api/eperson/groups/testgroupid/groups':
|
||||
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({
|
||||
elementsPerPage: 1,
|
||||
totalElements: 1,
|
||||
totalPages: 1,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
}), [GroupMock2]));
|
||||
default:
|
||||
return createSuccessfulRemoteDataObject$(buildPaginatedList(new PageInfo({
|
||||
elementsPerPage: 1,
|
||||
totalElements: 0,
|
||||
totalPages: 0,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
}), []));
|
||||
}
|
||||
},
|
||||
@@ -136,7 +136,7 @@ describe('GroupsRegistryComponent', () => {
|
||||
elementsPerPage: this.allGroups.length,
|
||||
totalElements: this.allGroups.length,
|
||||
totalPages: 1,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
}), this.allGroups));
|
||||
}
|
||||
const result = this.allGroups.find((group: Group) => {
|
||||
@@ -146,7 +146,7 @@ describe('GroupsRegistryComponent', () => {
|
||||
elementsPerPage: [result].length,
|
||||
totalElements: [result].length,
|
||||
totalPages: 1,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
}), [result]));
|
||||
},
|
||||
delete(objectId: string, copyVirtualMetadata?: string[]): Observable<RemoteData<NoContent>> {
|
||||
@@ -156,7 +156,7 @@ describe('GroupsRegistryComponent', () => {
|
||||
dsoDataServiceStub = {
|
||||
findByHref(href: string): Observable<RemoteData<DSpaceObject>> {
|
||||
return createSuccessfulRemoteDataObject$(undefined);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
authorizationService = jasmine.createSpyObj('authorizationService', ['isAuthorized']);
|
||||
@@ -167,8 +167,8 @@ describe('GroupsRegistryComponent', () => {
|
||||
TranslateModule.forRoot({
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
useClass: TranslateLoaderMock
|
||||
}
|
||||
useClass: TranslateLoaderMock,
|
||||
},
|
||||
}),
|
||||
],
|
||||
declarations: [GroupsRegistryComponent],
|
||||
@@ -182,9 +182,9 @@ describe('GroupsRegistryComponent', () => {
|
||||
{ provide: Router, useValue: new RouterMock() },
|
||||
{ provide: AuthorizationDataService, useValue: authorizationService },
|
||||
{ provide: PaginationService, useValue: paginationService },
|
||||
{ provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) }
|
||||
{ provide: RequestService, useValue: jasmine.createSpyObj('requestService', ['removeByHrefSubstring']) },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
@@ -237,16 +237,16 @@ describe('GroupsRegistryComponent', () => {
|
||||
|
||||
it('should not check the canManageGroup permissions', () => {
|
||||
expect(authorizationService.isAuthorized).not.toHaveBeenCalledWith(
|
||||
FeatureID.CanManageGroup, mockGroups[0].self
|
||||
FeatureID.CanManageGroup, mockGroups[0].self,
|
||||
);
|
||||
expect(authorizationService.isAuthorized).not.toHaveBeenCalledWith(
|
||||
FeatureID.CanManageGroup, mockGroups[0].self, undefined // treated differently
|
||||
FeatureID.CanManageGroup, mockGroups[0].self, undefined, // treated differently
|
||||
);
|
||||
expect(authorizationService.isAuthorized).not.toHaveBeenCalledWith(
|
||||
FeatureID.CanManageGroup, mockGroups[1].self
|
||||
FeatureID.CanManageGroup, mockGroups[1].self,
|
||||
);
|
||||
expect(authorizationService.isAuthorized).not.toHaveBeenCalledWith(
|
||||
FeatureID.CanManageGroup, mockGroups[1].self, undefined // treated differently
|
||||
FeatureID.CanManageGroup, mockGroups[1].self, undefined, // treated differently
|
||||
);
|
||||
});
|
||||
});
|
||||
|
@@ -8,7 +8,7 @@ import {
|
||||
EMPTY,
|
||||
Observable,
|
||||
of as observableOf,
|
||||
Subscription
|
||||
Subscription,
|
||||
} from 'rxjs';
|
||||
import { catchError, defaultIfEmpty, map, switchMap, tap } from 'rxjs/operators';
|
||||
import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.service';
|
||||
@@ -28,7 +28,7 @@ import {
|
||||
getAllSucceededRemoteData,
|
||||
getFirstCompletedRemoteData,
|
||||
getFirstSucceededRemoteData,
|
||||
getRemoteDataPayload
|
||||
getRemoteDataPayload,
|
||||
} from '../../core/shared/operators';
|
||||
import { PageInfo } from '../../core/shared/page-info.model';
|
||||
import { hasValue } from '../../shared/empty.util';
|
||||
@@ -57,7 +57,7 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy {
|
||||
config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||
id: 'gl',
|
||||
pageSize: 5,
|
||||
currentPage: 1
|
||||
currentPage: 1,
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -155,7 +155,7 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy {
|
||||
this.canManageGroup$(isSiteAdmin, group),
|
||||
this.hasLinkedDSO(group),
|
||||
this.getSubgroups(group),
|
||||
this.getMembers(group)
|
||||
this.getMembers(group),
|
||||
]).pipe(
|
||||
map(([canDelete, canManageGroup, hasLinkedDSO, subgroups, members]:
|
||||
[boolean, boolean, boolean, RemoteData<PaginatedList<Group>>, RemoteData<PaginatedList<EPerson>>]) => {
|
||||
@@ -166,8 +166,8 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy {
|
||||
groupDtoModel.subgroups = subgroups.payload;
|
||||
groupDtoModel.epersons = members.payload;
|
||||
return groupDtoModel;
|
||||
}
|
||||
)
|
||||
},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return EMPTY;
|
||||
@@ -175,9 +175,9 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy {
|
||||
})]).pipe(defaultIfEmpty([]), map((dtos: GroupDtoModel[]) => {
|
||||
return buildPaginatedList(groups.pageInfo, dtos);
|
||||
}));
|
||||
})
|
||||
}),
|
||||
);
|
||||
})
|
||||
}),
|
||||
).subscribe((value: PaginatedList<GroupDtoModel>) => {
|
||||
this.groupsDto$.next(value);
|
||||
this.pageInfoState$.next(value.pageInfo);
|
||||
|
@@ -11,7 +11,7 @@ describe('AdminCurationTasksComponent', () => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot()],
|
||||
declarations: [AdminCurationTasksComponent],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
|
@@ -10,7 +10,7 @@ import { FileValidator } from '../../shared/utils/require-file.validator';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import {
|
||||
BATCH_IMPORT_SCRIPT_NAME,
|
||||
ScriptDataService
|
||||
ScriptDataService,
|
||||
} from '../../core/data/processes/script-data.service';
|
||||
import { Router } from '@angular/router';
|
||||
import { Location } from '@angular/common';
|
||||
@@ -31,14 +31,14 @@ describe('BatchImportPageComponent', () => {
|
||||
notificationService = new NotificationsServiceStub();
|
||||
scriptService = jasmine.createSpyObj('scriptService',
|
||||
{
|
||||
invoke: createSuccessfulRemoteDataObject$({ processId: '46' })
|
||||
}
|
||||
invoke: createSuccessfulRemoteDataObject$({ processId: '46' }),
|
||||
},
|
||||
);
|
||||
router = jasmine.createSpyObj('router', {
|
||||
navigateByUrl: jasmine.createSpy('navigateByUrl')
|
||||
navigateByUrl: jasmine.createSpy('navigateByUrl'),
|
||||
});
|
||||
locationStub = jasmine.createSpyObj('location', {
|
||||
back: jasmine.createSpy('back')
|
||||
back: jasmine.createSpy('back'),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ describe('BatchImportPageComponent', () => {
|
||||
imports: [
|
||||
FormsModule,
|
||||
TranslateModule.forRoot(),
|
||||
RouterTestingModule.withRoutes([])
|
||||
RouterTestingModule.withRoutes([]),
|
||||
],
|
||||
declarations: [BatchImportPageComponent, FileValueAccessorDirective, FileValidator],
|
||||
providers: [
|
||||
@@ -57,7 +57,7 @@ describe('BatchImportPageComponent', () => {
|
||||
{ provide: Router, useValue: router },
|
||||
{ provide: Location, useValue: locationStub },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
@@ -108,7 +108,7 @@ describe('BatchImportPageComponent', () => {
|
||||
it('metadata-import script is invoked with --zip fileName and the mockFile', () => {
|
||||
const parameterValues: ProcessParameter[] = [
|
||||
Object.assign(new ProcessParameter(), { name: '--add' }),
|
||||
Object.assign(new ProcessParameter(), { name: '--zip', value: 'filename.zip' })
|
||||
Object.assign(new ProcessParameter(), { name: '--zip', value: 'filename.zip' }),
|
||||
];
|
||||
expect(scriptService.invoke).toHaveBeenCalledWith(BATCH_IMPORT_SCRIPT_NAME, parameterValues, [fileMock]);
|
||||
});
|
||||
@@ -181,7 +181,7 @@ describe('BatchImportPageComponent', () => {
|
||||
it('metadata-import script is invoked with --url and the file url', () => {
|
||||
const parameterValues: ProcessParameter[] = [
|
||||
Object.assign(new ProcessParameter(), { name: '--add' }),
|
||||
Object.assign(new ProcessParameter(), { name: '--url', value: 'example.fileURL.com' })
|
||||
Object.assign(new ProcessParameter(), { name: '--url', value: 'example.fileURL.com' }),
|
||||
];
|
||||
expect(scriptService.invoke).toHaveBeenCalledWith(BATCH_IMPORT_SCRIPT_NAME, parameterValues, [null]);
|
||||
});
|
||||
|
@@ -11,7 +11,7 @@ import { Process } from '../../process-page/processes/process.model';
|
||||
import { isEmpty, isNotEmpty } from '../../shared/empty.util';
|
||||
import { getProcessDetailRoute } from '../../process-page/process-page-routing.paths';
|
||||
import {
|
||||
ImportBatchSelectorComponent
|
||||
ImportBatchSelectorComponent,
|
||||
} from '../../shared/dso-selector/modal-wrappers/import-batch-selector/import-batch-selector.component';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { take } from 'rxjs/operators';
|
||||
@@ -20,7 +20,7 @@ import { DSONameService } from '../../core/breadcrumbs/dso-name.service';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-batch-import-page',
|
||||
templateUrl: './batch-import-page.component.html'
|
||||
templateUrl: './batch-import-page.component.html',
|
||||
})
|
||||
export class BatchImportPageComponent {
|
||||
/**
|
||||
@@ -91,7 +91,7 @@ export class BatchImportPageComponent {
|
||||
}
|
||||
} else {
|
||||
const parameterValues: ProcessParameter[] = [
|
||||
Object.assign(new ProcessParameter(), { name: '--add' })
|
||||
Object.assign(new ProcessParameter(), { name: '--add' }),
|
||||
];
|
||||
if (this.isUpload) {
|
||||
parameterValues.push(Object.assign(new ProcessParameter(), { name: '--zip', value: this.fileObject.name }));
|
||||
|
@@ -28,14 +28,14 @@ describe('MetadataImportPageComponent', () => {
|
||||
notificationService = new NotificationsServiceStub();
|
||||
scriptService = jasmine.createSpyObj('scriptService',
|
||||
{
|
||||
invoke: createSuccessfulRemoteDataObject$({ processId: '45' })
|
||||
}
|
||||
invoke: createSuccessfulRemoteDataObject$({ processId: '45' }),
|
||||
},
|
||||
);
|
||||
router = jasmine.createSpyObj('router', {
|
||||
navigateByUrl: jasmine.createSpy('navigateByUrl')
|
||||
navigateByUrl: jasmine.createSpy('navigateByUrl'),
|
||||
});
|
||||
locationStub = jasmine.createSpyObj('location', {
|
||||
back: jasmine.createSpy('back')
|
||||
back: jasmine.createSpy('back'),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ describe('MetadataImportPageComponent', () => {
|
||||
imports: [
|
||||
FormsModule,
|
||||
TranslateModule.forRoot(),
|
||||
RouterTestingModule.withRoutes([])
|
||||
RouterTestingModule.withRoutes([]),
|
||||
],
|
||||
declarations: [MetadataImportPageComponent, FileValueAccessorDirective, FileValidator],
|
||||
providers: [
|
||||
@@ -54,7 +54,7 @@ describe('MetadataImportPageComponent', () => {
|
||||
{ provide: Router, useValue: router },
|
||||
{ provide: Location, useValue: locationStub },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
|
@@ -13,7 +13,7 @@ import { getProcessDetailRoute } from '../../process-page/process-page-routing.p
|
||||
|
||||
@Component({
|
||||
selector: 'ds-metadata-import-page',
|
||||
templateUrl: './metadata-import-page.component.html'
|
||||
templateUrl: './metadata-import-page.component.html',
|
||||
})
|
||||
|
||||
/**
|
||||
|
@@ -15,25 +15,25 @@ import { BITSTREAMFORMATS_MODULE_PATH } from './admin-registries-routing-paths';
|
||||
children: [
|
||||
{
|
||||
path: '',
|
||||
component: MetadataRegistryComponent
|
||||
component: MetadataRegistryComponent,
|
||||
},
|
||||
{
|
||||
path: ':schemaName',
|
||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
||||
component: MetadataSchemaComponent,
|
||||
data: {title: 'admin.registries.schema.title', breadcrumbKey: 'admin.registries.schema'}
|
||||
}
|
||||
]
|
||||
data: {title: 'admin.registries.schema.title', breadcrumbKey: 'admin.registries.schema'},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: BITSTREAMFORMATS_MODULE_PATH,
|
||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
||||
loadChildren: () => import('./bitstream-formats/bitstream-formats.module')
|
||||
.then((m) => m.BitstreamFormatsModule),
|
||||
data: {title: 'admin.registries.bitstream-formats.title', breadcrumbKey: 'admin.registries.bitstream-formats'}
|
||||
data: {title: 'admin.registries.bitstream-formats.title', breadcrumbKey: 'admin.registries.bitstream-formats'},
|
||||
},
|
||||
])
|
||||
]
|
||||
]),
|
||||
],
|
||||
})
|
||||
export class AdminRegistriesRoutingModule {
|
||||
|
||||
|
@@ -17,14 +17,14 @@ import { FormModule } from '../../shared/form/form.module';
|
||||
RouterModule,
|
||||
BitstreamFormatsModule,
|
||||
AdminRegistriesRoutingModule,
|
||||
FormModule
|
||||
FormModule,
|
||||
],
|
||||
declarations: [
|
||||
MetadataRegistryComponent,
|
||||
MetadataSchemaComponent,
|
||||
MetadataSchemaFormComponent,
|
||||
MetadataFieldFormComponent
|
||||
]
|
||||
MetadataFieldFormComponent,
|
||||
],
|
||||
})
|
||||
export class AdminRegistriesModule {
|
||||
|
||||
|
@@ -38,7 +38,7 @@ describe('AddBitstreamFormatComponent', () => {
|
||||
notificationService = new NotificationsServiceStub();
|
||||
bitstreamFormatDataService = jasmine.createSpyObj('bitstreamFormatDataService', {
|
||||
createBitstreamFormat: createSuccessfulRemoteDataObject$({}),
|
||||
clearBitStreamFormatRequests: observableOf(null)
|
||||
clearBitStreamFormatRequests: observableOf(null),
|
||||
});
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
@@ -49,7 +49,7 @@ describe('AddBitstreamFormatComponent', () => {
|
||||
{ provide: NotificationsService, useValue: notificationService },
|
||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService },
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
}).compileComponents();
|
||||
};
|
||||
|
||||
@@ -78,7 +78,7 @@ describe('AddBitstreamFormatComponent', () => {
|
||||
notificationService = new NotificationsServiceStub();
|
||||
bitstreamFormatDataService = jasmine.createSpyObj('bitstreamFormatDataService', {
|
||||
createBitstreamFormat: createFailedRemoteDataObject$('Error', 500),
|
||||
clearBitStreamFormatRequests: observableOf(null)
|
||||
clearBitStreamFormatRequests: observableOf(null),
|
||||
});
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
@@ -89,7 +89,7 @@ describe('AddBitstreamFormatComponent', () => {
|
||||
{ provide: NotificationsService, useValue: notificationService },
|
||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService },
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
}).compileComponents();
|
||||
}));
|
||||
beforeEach(initBeforeEach);
|
||||
|
@@ -44,7 +44,7 @@ export class AddBitstreamFormatComponent {
|
||||
this.notificationService.error(this.translateService.get('admin.registries.bitstream-formats.create.failure.head'),
|
||||
this.translateService.get('admin.registries.bitstream-formats.create.failure.content'));
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ export const BitstreamFormatsRegistryActionTypes = {
|
||||
|
||||
SELECT_FORMAT: type('dspace/bitstream-formats-registry/SELECT_FORMAT'),
|
||||
DESELECT_FORMAT: type('dspace/bitstream-formats-registry/DESELECT_FORMAT'),
|
||||
DESELECT_ALL_FORMAT: type('dspace/bitstream-formats-registry/DESELECT_ALL_FORMAT')
|
||||
DESELECT_ALL_FORMAT: type('dspace/bitstream-formats-registry/DESELECT_ALL_FORMAT'),
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -4,7 +4,7 @@ import { bitstreamFormatReducer, BitstreamFormatRegistryState } from './bitstrea
|
||||
import {
|
||||
BitstreamFormatsRegistryDeselectAction,
|
||||
BitstreamFormatsRegistryDeselectAllAction,
|
||||
BitstreamFormatsRegistrySelectAction
|
||||
BitstreamFormatsRegistrySelectAction,
|
||||
} from './bitstream-format.actions';
|
||||
|
||||
const bitstreamFormat1: BitstreamFormat = new BitstreamFormat();
|
||||
@@ -16,15 +16,15 @@ bitstreamFormat2.id = 'test-uuid-2';
|
||||
bitstreamFormat2.shortDescription = 'test-short-2';
|
||||
|
||||
const initialState: BitstreamFormatRegistryState = {
|
||||
selectedBitstreamFormats: []
|
||||
selectedBitstreamFormats: [],
|
||||
};
|
||||
|
||||
const bitstream1SelectedState: BitstreamFormatRegistryState = {
|
||||
selectedBitstreamFormats: [bitstreamFormat1]
|
||||
selectedBitstreamFormats: [bitstreamFormat1],
|
||||
};
|
||||
|
||||
const bitstream1and2SelectedState: BitstreamFormatRegistryState = {
|
||||
selectedBitstreamFormats: [bitstreamFormat1, bitstreamFormat2]
|
||||
selectedBitstreamFormats: [bitstreamFormat1, bitstreamFormat2],
|
||||
};
|
||||
|
||||
describe('BitstreamFormatReducer', () => {
|
||||
|
@@ -3,7 +3,7 @@ import {
|
||||
BitstreamFormatsRegistryAction,
|
||||
BitstreamFormatsRegistryActionTypes,
|
||||
BitstreamFormatsRegistryDeselectAction,
|
||||
BitstreamFormatsRegistrySelectAction
|
||||
BitstreamFormatsRegistrySelectAction,
|
||||
} from './bitstream-format.actions';
|
||||
|
||||
/**
|
||||
@@ -32,21 +32,21 @@ export function bitstreamFormatReducer(state = initialState, action: BitstreamFo
|
||||
|
||||
case BitstreamFormatsRegistryActionTypes.SELECT_FORMAT: {
|
||||
return Object.assign({}, state, {
|
||||
selectedBitstreamFormats: [...state.selectedBitstreamFormats, (action as BitstreamFormatsRegistrySelectAction).bitstreamFormat]
|
||||
selectedBitstreamFormats: [...state.selectedBitstreamFormats, (action as BitstreamFormatsRegistrySelectAction).bitstreamFormat],
|
||||
});
|
||||
}
|
||||
|
||||
case BitstreamFormatsRegistryActionTypes.DESELECT_FORMAT: {
|
||||
return Object.assign({}, state, {
|
||||
selectedBitstreamFormats: state.selectedBitstreamFormats.filter(
|
||||
(selectedBitstreamFormats) => selectedBitstreamFormats !== (action as BitstreamFormatsRegistryDeselectAction).bitstreamFormat
|
||||
)
|
||||
(selectedBitstreamFormats) => selectedBitstreamFormats !== (action as BitstreamFormatsRegistryDeselectAction).bitstreamFormat,
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
case BitstreamFormatsRegistryActionTypes.DESELECT_ALL_FORMAT: {
|
||||
return Object.assign({}, state, {
|
||||
selectedBitstreamFormats: []
|
||||
selectedBitstreamFormats: [],
|
||||
});
|
||||
}
|
||||
default:
|
||||
|
@@ -14,28 +14,28 @@ const BITSTREAMFORMAT_ADD_PATH = 'add';
|
||||
RouterModule.forChild([
|
||||
{
|
||||
path: '',
|
||||
component: BitstreamFormatsComponent
|
||||
component: BitstreamFormatsComponent,
|
||||
},
|
||||
{
|
||||
path: BITSTREAMFORMAT_ADD_PATH,
|
||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
||||
component: AddBitstreamFormatComponent,
|
||||
data: {breadcrumbKey: 'admin.registries.bitstream-formats.create'}
|
||||
data: {breadcrumbKey: 'admin.registries.bitstream-formats.create'},
|
||||
},
|
||||
{
|
||||
path: BITSTREAMFORMAT_EDIT_PATH,
|
||||
component: EditBitstreamFormatComponent,
|
||||
resolve: {
|
||||
bitstreamFormat: BitstreamFormatsResolver,
|
||||
breadcrumb: I18nBreadcrumbResolver
|
||||
breadcrumb: I18nBreadcrumbResolver,
|
||||
},
|
||||
data: {breadcrumbKey: 'admin.registries.bitstream-formats.edit'}
|
||||
data: {breadcrumbKey: 'admin.registries.bitstream-formats.edit'},
|
||||
},
|
||||
])
|
||||
]),
|
||||
],
|
||||
providers: [
|
||||
BitstreamFormatsResolver,
|
||||
]
|
||||
],
|
||||
})
|
||||
export class BitstreamFormatsRoutingModule {
|
||||
|
||||
|
@@ -21,7 +21,7 @@ import {
|
||||
createNoContentRemoteDataObject$,
|
||||
createSuccessfulRemoteDataObject,
|
||||
createSuccessfulRemoteDataObject$,
|
||||
createFailedRemoteDataObject$
|
||||
createFailedRemoteDataObject$,
|
||||
} from '../../../shared/remote-data.utils';
|
||||
import { createPaginatedList } from '../../../shared/testing/utils.test';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
@@ -79,7 +79,7 @@ describe('BitstreamFormatsComponent', () => {
|
||||
bitstreamFormat1,
|
||||
bitstreamFormat2,
|
||||
bitstreamFormat3,
|
||||
bitstreamFormat4
|
||||
bitstreamFormat4,
|
||||
];
|
||||
const mockFormatsRD = createSuccessfulRemoteDataObject(createPaginatedList(mockFormatsList));
|
||||
|
||||
@@ -96,7 +96,7 @@ describe('BitstreamFormatsComponent', () => {
|
||||
deselectBitstreamFormat: {},
|
||||
deselectAllBitstreamFormats: {},
|
||||
delete: createSuccessfulRemoteDataObject$({}),
|
||||
clearBitStreamFormatRequests: observableOf('cleared')
|
||||
clearBitStreamFormatRequests: observableOf('cleared'),
|
||||
});
|
||||
|
||||
paginationService = new PaginationServiceStub();
|
||||
@@ -108,8 +108,8 @@ describe('BitstreamFormatsComponent', () => {
|
||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
|
||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
||||
{ provide: NotificationsService, useValue: notificationsServiceStub },
|
||||
{ provide: PaginationService, useValue: paginationService }
|
||||
]
|
||||
{ provide: PaginationService, useValue: paginationService },
|
||||
],
|
||||
}).compileComponents();
|
||||
};
|
||||
|
||||
@@ -224,7 +224,7 @@ describe('BitstreamFormatsComponent', () => {
|
||||
deselectBitstreamFormat: {},
|
||||
deselectAllBitstreamFormats: {},
|
||||
delete: createNoContentRemoteDataObject$(),
|
||||
clearBitStreamFormatRequests: observableOf('cleared')
|
||||
clearBitStreamFormatRequests: observableOf('cleared'),
|
||||
});
|
||||
|
||||
paginationService = new PaginationServiceStub();
|
||||
@@ -236,10 +236,10 @@ describe('BitstreamFormatsComponent', () => {
|
||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
|
||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
||||
{ provide: NotificationsService, useValue: notificationsServiceStub },
|
||||
{ provide: PaginationService, useValue: paginationService }
|
||||
]
|
||||
{ provide: PaginationService, useValue: paginationService },
|
||||
],
|
||||
}).compileComponents();
|
||||
}
|
||||
},
|
||||
));
|
||||
|
||||
beforeEach(initBeforeEach);
|
||||
@@ -273,7 +273,7 @@ describe('BitstreamFormatsComponent', () => {
|
||||
deselectBitstreamFormat: {},
|
||||
deselectAllBitstreamFormats: {},
|
||||
delete: createFailedRemoteDataObject$(),
|
||||
clearBitStreamFormatRequests: observableOf('cleared')
|
||||
clearBitStreamFormatRequests: observableOf('cleared'),
|
||||
});
|
||||
|
||||
paginationService = new PaginationServiceStub();
|
||||
@@ -285,10 +285,10 @@ describe('BitstreamFormatsComponent', () => {
|
||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
|
||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
||||
{ provide: NotificationsService, useValue: notificationsServiceStub },
|
||||
{ provide: PaginationService, useValue: paginationService }
|
||||
]
|
||||
{ provide: PaginationService, useValue: paginationService },
|
||||
],
|
||||
}).compileComponents();
|
||||
}
|
||||
},
|
||||
));
|
||||
|
||||
beforeEach(initBeforeEach);
|
||||
|
@@ -19,7 +19,7 @@ import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||
*/
|
||||
@Component({
|
||||
selector: 'ds-bitstream-formats',
|
||||
templateUrl: './bitstream-formats.component.html'
|
||||
templateUrl: './bitstream-formats.component.html',
|
||||
})
|
||||
export class BitstreamFormatsComponent implements OnInit, OnDestroy {
|
||||
|
||||
@@ -35,7 +35,7 @@ export class BitstreamFormatsComponent implements OnInit, OnDestroy {
|
||||
pageConfig: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||
id: 'rbp',
|
||||
pageSize: 20,
|
||||
pageSizeOptions: [20, 40, 60, 80, 100]
|
||||
pageSizeOptions: [20, 40, 60, 80, 100],
|
||||
});
|
||||
|
||||
constructor(private notificationsService: NotificationsService,
|
||||
@@ -64,7 +64,7 @@ export class BitstreamFormatsComponent implements OnInit, OnDestroy {
|
||||
map((response: RemoteData<NoContent>) => response.hasSucceeded),
|
||||
)),
|
||||
// wait for all responses to come in and return them as a single array
|
||||
toArray()
|
||||
toArray(),
|
||||
).subscribe((results: boolean[]) => {
|
||||
// Count the number of succeeded and failed deletions
|
||||
const successResponses = results.filter((result: boolean) => result);
|
||||
@@ -101,7 +101,7 @@ export class BitstreamFormatsComponent implements OnInit, OnDestroy {
|
||||
return this.bitstreamFormatService.getSelectedBitstreamFormats().pipe(
|
||||
map((bitstreamFormats: BitstreamFormat[]) => {
|
||||
return bitstreamFormats.find((selectedFormat) => selectedFormat.id === bitstreamFormat.id) != null;
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ export class BitstreamFormatsComponent implements OnInit, OnDestroy {
|
||||
|
||||
const messages = observableCombineLatest(
|
||||
this.translateService.get(`${prefix}.${suffix}.head`),
|
||||
this.translateService.get(`${prefix}.${suffix}.amount`, {amount: amount})
|
||||
this.translateService.get(`${prefix}.${suffix}.amount`, {amount: amount}),
|
||||
);
|
||||
messages.subscribe(([head, content]) => {
|
||||
|
||||
@@ -144,7 +144,7 @@ export class BitstreamFormatsComponent implements OnInit, OnDestroy {
|
||||
this.bitstreamFormats = this.paginationService.getFindListOptions(this.pageConfig.id, this.pageConfig).pipe(
|
||||
switchMap((findListOptions: FindListOptions) => {
|
||||
return this.bitstreamFormatService.findAll(findListOptions);
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -15,14 +15,14 @@ import { FormModule } from '../../../shared/form/form.module';
|
||||
SharedModule,
|
||||
RouterModule,
|
||||
BitstreamFormatsRoutingModule,
|
||||
FormModule
|
||||
FormModule,
|
||||
],
|
||||
declarations: [
|
||||
BitstreamFormatsComponent,
|
||||
EditBitstreamFormatComponent,
|
||||
AddBitstreamFormatComponent,
|
||||
FormatFormComponent
|
||||
]
|
||||
FormatFormComponent,
|
||||
],
|
||||
})
|
||||
export class BitstreamFormatsModule {
|
||||
|
||||
|
@@ -24,7 +24,7 @@ export class BitstreamFormatsResolver implements Resolve<RemoteData<BitstreamFor
|
||||
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<RemoteData<BitstreamFormat>> {
|
||||
return this.bitstreamFormatDataService.findById(route.params.id)
|
||||
.pipe(
|
||||
getFirstCompletedRemoteData()
|
||||
getFirstCompletedRemoteData(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -17,7 +17,7 @@ import { EditBitstreamFormatComponent } from './edit-bitstream-format.component'
|
||||
import {
|
||||
createFailedRemoteDataObject$,
|
||||
createSuccessfulRemoteDataObject,
|
||||
createSuccessfulRemoteDataObject$
|
||||
createSuccessfulRemoteDataObject$,
|
||||
} from '../../../../shared/remote-data.utils';
|
||||
|
||||
describe('EditBitstreamFormatComponent', () => {
|
||||
@@ -36,8 +36,8 @@ describe('EditBitstreamFormatComponent', () => {
|
||||
|
||||
const routeStub = {
|
||||
data: observableOf({
|
||||
bitstreamFormat: createSuccessfulRemoteDataObject(bitstreamFormat)
|
||||
})
|
||||
bitstreamFormat: createSuccessfulRemoteDataObject(bitstreamFormat),
|
||||
}),
|
||||
};
|
||||
|
||||
let router;
|
||||
@@ -48,7 +48,7 @@ describe('EditBitstreamFormatComponent', () => {
|
||||
router = new RouterStub();
|
||||
notificationService = new NotificationsServiceStub();
|
||||
bitstreamFormatDataService = jasmine.createSpyObj('bitstreamFormatDataService', {
|
||||
updateBitstreamFormat: createSuccessfulRemoteDataObject$({})
|
||||
updateBitstreamFormat: createSuccessfulRemoteDataObject$({}),
|
||||
});
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
@@ -60,7 +60,7 @@ describe('EditBitstreamFormatComponent', () => {
|
||||
{ provide: NotificationsService, useValue: notificationService },
|
||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService },
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
}).compileComponents();
|
||||
};
|
||||
|
||||
@@ -99,7 +99,7 @@ describe('EditBitstreamFormatComponent', () => {
|
||||
router = new RouterStub();
|
||||
notificationService = new NotificationsServiceStub();
|
||||
bitstreamFormatDataService = jasmine.createSpyObj('bitstreamFormatDataService', {
|
||||
updateBitstreamFormat: createFailedRemoteDataObject$('Error', 500)
|
||||
updateBitstreamFormat: createFailedRemoteDataObject$('Error', 500),
|
||||
});
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
@@ -111,7 +111,7 @@ describe('EditBitstreamFormatComponent', () => {
|
||||
{ provide: NotificationsService, useValue: notificationService },
|
||||
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatDataService },
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
}).compileComponents();
|
||||
}));
|
||||
beforeEach(initBeforeEach);
|
||||
|
@@ -36,7 +36,7 @@ export class EditBitstreamFormatComponent implements OnInit {
|
||||
|
||||
ngOnInit(): void {
|
||||
this.bitstreamFormatRD$ = this.route.data.pipe(
|
||||
map((data) => data.bitstreamFormat as RemoteData<BitstreamFormat>)
|
||||
map((data) => data.bitstreamFormat as RemoteData<BitstreamFormat>),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ export class EditBitstreamFormatComponent implements OnInit {
|
||||
this.notificationService.error('admin.registries.bitstream-formats.edit.failure.head',
|
||||
'admin.registries.bitstream-formats.create.edit.content');
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ describe('FormatFormComponent', () => {
|
||||
providers: [
|
||||
{ provide: Router, useValue: router },
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA],
|
||||
}).compileComponents();
|
||||
};
|
||||
|
||||
|
@@ -9,7 +9,7 @@ import {
|
||||
DynamicFormService,
|
||||
DynamicInputModel,
|
||||
DynamicSelectModel,
|
||||
DynamicTextAreaModel
|
||||
DynamicTextAreaModel,
|
||||
} from '@ng-dynamic-forms/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { hasValue, isEmpty } from '../../../../shared/empty.util';
|
||||
@@ -22,7 +22,7 @@ import { environment } from '../../../../../environments/environment';
|
||||
*/
|
||||
@Component({
|
||||
selector: 'ds-bitstream-format-form',
|
||||
templateUrl: './format-form.component.html'
|
||||
templateUrl: './format-form.component.html',
|
||||
})
|
||||
export class FormatFormComponent implements OnInit {
|
||||
|
||||
@@ -58,8 +58,8 @@ export class FormatFormComponent implements OnInit {
|
||||
*/
|
||||
arrayInputElementLayout: DynamicFormControlLayout = {
|
||||
grid: {
|
||||
host: 'col'
|
||||
}
|
||||
host: 'col',
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -73,10 +73,10 @@ export class FormatFormComponent implements OnInit {
|
||||
hint: 'admin.registries.bitstream-formats.edit.shortDescription.hint',
|
||||
required: true,
|
||||
validators: {
|
||||
required: null
|
||||
required: null,
|
||||
},
|
||||
errorMessages: {
|
||||
required: 'Please enter a name for this bitstream format'
|
||||
required: 'Please enter a name for this bitstream format',
|
||||
},
|
||||
}),
|
||||
new DynamicInputModel({
|
||||
@@ -100,7 +100,7 @@ export class FormatFormComponent implements OnInit {
|
||||
options: this.supportLevelOptions,
|
||||
label: 'admin.registries.bitstream-formats.edit.supportLevel.label',
|
||||
hint: 'admin.registries.bitstream-formats.edit.supportLevel.hint',
|
||||
value: this.supportLevelOptions[0].value
|
||||
value: this.supportLevelOptions[0].value,
|
||||
|
||||
}),
|
||||
new DynamicCheckboxModel({
|
||||
@@ -117,8 +117,8 @@ export class FormatFormComponent implements OnInit {
|
||||
new DynamicInputModel({
|
||||
id: 'extension',
|
||||
placeholder: 'admin.registries.bitstream-formats.edit.extensions.placeholder',
|
||||
}, this.arrayInputElementLayout)
|
||||
]
|
||||
}, this.arrayInputElementLayout),
|
||||
],
|
||||
}, this.arrayElementLayout),
|
||||
];
|
||||
|
||||
@@ -146,7 +146,7 @@ export class FormatFormComponent implements OnInit {
|
||||
for (let i = 0; i < extenstions.length; i++) {
|
||||
formArray.insertGroup(i).group[0] = new DynamicInputModel({
|
||||
id: `extension-${i}`,
|
||||
value: extenstions[i]
|
||||
value: extenstions[i],
|
||||
}, this.arrayInputElementLayout);
|
||||
}
|
||||
}
|
||||
@@ -165,7 +165,7 @@ export class FormatFormComponent implements OnInit {
|
||||
onSubmit() {
|
||||
const updatedBitstreamFormat = Object.assign(new BitstreamFormat(),
|
||||
{
|
||||
id: this.bitstreamFormat.id
|
||||
id: this.bitstreamFormat.id,
|
||||
});
|
||||
|
||||
this.formModel.forEach(
|
||||
|
@@ -24,7 +24,7 @@ export const MetadataRegistryActionTypes = {
|
||||
CANCEL_EDIT_FIELD: type('dspace/metadata-registry/CANCEL_FIELD'),
|
||||
SELECT_FIELD: type('dspace/metadata-registry/SELECT_FIELD'),
|
||||
DESELECT_FIELD: type('dspace/metadata-registry/DESELECT_FIELD'),
|
||||
DESELECT_ALL_FIELD: type('dspace/metadata-registry/DESELECT_ALL_FIELD')
|
||||
DESELECT_ALL_FIELD: type('dspace/metadata-registry/DESELECT_ALL_FIELD'),
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -31,22 +31,22 @@ describe('MetadataRegistryComponent', () => {
|
||||
id: 1,
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/1'
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/1',
|
||||
},
|
||||
},
|
||||
prefix: 'dc',
|
||||
namespace: 'http://dublincore.org/documents/dcmi-terms/'
|
||||
namespace: 'http://dublincore.org/documents/dcmi-terms/',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/2'
|
||||
href: 'https://dspace7.4science.it/dspace-spring-rest/api/core/metadataschemas/2',
|
||||
},
|
||||
},
|
||||
prefix: 'mock',
|
||||
namespace: 'http://dspace.org/mockschema'
|
||||
}
|
||||
namespace: 'http://dspace.org/mockschema',
|
||||
},
|
||||
];
|
||||
const mockSchemas = createSuccessfulRemoteDataObject$(buildPaginatedList(null, mockSchemasList));
|
||||
/* eslint-disable no-empty,@typescript-eslint/no-empty-function */
|
||||
@@ -61,7 +61,7 @@ describe('MetadataRegistryComponent', () => {
|
||||
deleteMetadataSchema: () => observableOf(new RestResponse(true, 200, 'OK')),
|
||||
deselectAllMetadataSchema: () => {
|
||||
},
|
||||
clearMetadataSchemaRequests: () => observableOf(undefined)
|
||||
clearMetadataSchemaRequests: () => observableOf(undefined),
|
||||
};
|
||||
/* eslint-enable no-empty, @typescript-eslint/no-empty-function */
|
||||
|
||||
@@ -75,11 +75,11 @@ describe('MetadataRegistryComponent', () => {
|
||||
{ provide: RegistryService, useValue: registryServiceStub },
|
||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
||||
{ provide: PaginationService, useValue: paginationService },
|
||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() }
|
||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).overrideComponent(MetadataRegistryComponent, {
|
||||
set: { changeDetection: ChangeDetectionStrategy.Default }
|
||||
set: { changeDetection: ChangeDetectionStrategy.Default },
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
|
@@ -18,7 +18,7 @@ import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
@Component({
|
||||
selector: 'ds-metadata-registry',
|
||||
templateUrl: './metadata-registry.component.html',
|
||||
styleUrls: ['./metadata-registry.component.scss']
|
||||
styleUrls: ['./metadata-registry.component.scss'],
|
||||
})
|
||||
/**
|
||||
* A component used for managing all existing metadata schemas within the repository.
|
||||
@@ -36,7 +36,7 @@ export class MetadataRegistryComponent {
|
||||
*/
|
||||
config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||
id: 'rm',
|
||||
pageSize: 25
|
||||
pageSize: 25,
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -60,7 +60,7 @@ export class MetadataRegistryComponent {
|
||||
this.metadataSchemas = this.needsUpdate$.pipe(
|
||||
filter((update) => update === true),
|
||||
switchMap(() => this.paginationService.getCurrentPagination(this.config.id, this.config)),
|
||||
switchMap((currentPagination) => this.registryService.getMetadataSchemas(toFindListOptions(currentPagination)))
|
||||
switchMap((currentPagination) => this.registryService.getMetadataSchemas(toFindListOptions(currentPagination))),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ export class MetadataRegistryComponent {
|
||||
*/
|
||||
isActive(schema: MetadataSchema): Observable<boolean> {
|
||||
return this.getActiveSchema().pipe(
|
||||
map((activeSchema) => schema === activeSchema)
|
||||
map((activeSchema) => schema === activeSchema),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ export class MetadataRegistryComponent {
|
||||
*/
|
||||
isSelected(schema: MetadataSchema): Observable<boolean> {
|
||||
return this.registryService.getSelectedMetadataSchemas().pipe(
|
||||
map((schemas) => schemas.find((selectedSchema) => selectedSchema === schema) != null)
|
||||
map((schemas) => schemas.find((selectedSchema) => selectedSchema === schema) != null),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ export class MetadataRegistryComponent {
|
||||
this.registryService.deselectAllMetadataSchema();
|
||||
this.registryService.cancelEditMetadataSchema();
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ export class MetadataRegistryComponent {
|
||||
const suffix = success ? 'success' : 'failure';
|
||||
const messages = observableCombineLatest(
|
||||
this.translateService.get(success ? `${prefix}.${suffix}` : `${prefix}.${suffix}`),
|
||||
this.translateService.get(`${prefix}.deleted.${suffix}`, {amount: amount})
|
||||
this.translateService.get(`${prefix}.deleted.${suffix}`, {amount: amount}),
|
||||
);
|
||||
messages.subscribe(([head, content]) => {
|
||||
if (success) {
|
||||
|
@@ -8,7 +8,7 @@ import {
|
||||
MetadataRegistryEditFieldAction,
|
||||
MetadataRegistryEditSchemaAction,
|
||||
MetadataRegistrySelectFieldAction,
|
||||
MetadataRegistrySelectSchemaAction
|
||||
MetadataRegistrySelectSchemaAction,
|
||||
} from './metadata-registry.actions';
|
||||
import { metadataRegistryReducer, MetadataRegistryState } from './metadata-registry.reducers';
|
||||
import { MetadataSchema } from '../../../core/metadata/metadata-schema.model';
|
||||
@@ -27,11 +27,11 @@ const schema: MetadataSchema = Object.assign(new MetadataSchema(),
|
||||
id: 'schema-id',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'http://rest.self/schema/dc'
|
||||
href: 'http://rest.self/schema/dc',
|
||||
},
|
||||
},
|
||||
prefix: 'dc',
|
||||
namespace: 'http://dublincore.org/documents/dcmi-terms/'
|
||||
namespace: 'http://dublincore.org/documents/dcmi-terms/',
|
||||
});
|
||||
|
||||
const schema2: MetadataSchema = Object.assign(new MetadataSchema(),
|
||||
@@ -43,7 +43,7 @@ const schema2: MetadataSchema = Object.assign(new MetadataSchema(),
|
||||
},
|
||||
},
|
||||
prefix: 'dcterms',
|
||||
namespace: 'http://purl.org/dc/terms/'
|
||||
namespace: 'http://purl.org/dc/terms/',
|
||||
});
|
||||
|
||||
const field: MetadataField = Object.assign(new MetadataField(),
|
||||
@@ -57,7 +57,7 @@ const field: MetadataField = Object.assign(new MetadataField(),
|
||||
element: 'contributor',
|
||||
qualifier: 'author',
|
||||
scopeNote: 'Author of an item',
|
||||
schema: schema
|
||||
schema: schema,
|
||||
});
|
||||
|
||||
const field2: MetadataField = Object.assign(new MetadataField(),
|
||||
@@ -71,35 +71,35 @@ const field2: MetadataField = Object.assign(new MetadataField(),
|
||||
element: 'title',
|
||||
qualifier: null,
|
||||
scopeNote: 'Title of an item',
|
||||
schema: schema
|
||||
schema: schema,
|
||||
});
|
||||
|
||||
const initialState: MetadataRegistryState = {
|
||||
editSchema: null,
|
||||
selectedSchemas: [],
|
||||
editField: null,
|
||||
selectedFields: []
|
||||
selectedFields: [],
|
||||
};
|
||||
|
||||
const editState: MetadataRegistryState = {
|
||||
editSchema: schema,
|
||||
selectedSchemas: [],
|
||||
editField: field,
|
||||
selectedFields: []
|
||||
selectedFields: [],
|
||||
};
|
||||
|
||||
const selectState: MetadataRegistryState = {
|
||||
editSchema: null,
|
||||
selectedSchemas: [schema2],
|
||||
editField: null,
|
||||
selectedFields: [field2]
|
||||
selectedFields: [field2],
|
||||
};
|
||||
|
||||
const moreSelectState: MetadataRegistryState = {
|
||||
editSchema: null,
|
||||
selectedSchemas: [schema, schema2],
|
||||
editField: null,
|
||||
selectedFields: [field, field2]
|
||||
selectedFields: [field, field2],
|
||||
};
|
||||
|
||||
describe('metadataRegistryReducer', () => {
|
||||
|
@@ -6,7 +6,7 @@ import {
|
||||
MetadataRegistryEditFieldAction,
|
||||
MetadataRegistryEditSchemaAction,
|
||||
MetadataRegistrySelectFieldAction,
|
||||
MetadataRegistrySelectSchemaAction
|
||||
MetadataRegistrySelectSchemaAction,
|
||||
} from './metadata-registry.actions';
|
||||
import { MetadataField } from '../../../core/metadata/metadata-field.model';
|
||||
import { MetadataSchema } from '../../../core/metadata/metadata-schema.model';
|
||||
@@ -29,7 +29,7 @@ const initialState: MetadataRegistryState = {
|
||||
editSchema: null,
|
||||
selectedSchemas: [],
|
||||
editField: null,
|
||||
selectedFields: []
|
||||
selectedFields: [],
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -43,65 +43,65 @@ export function metadataRegistryReducer(state = initialState, action: MetadataRe
|
||||
|
||||
case MetadataRegistryActionTypes.EDIT_SCHEMA: {
|
||||
return Object.assign({}, state, {
|
||||
editSchema: (action as MetadataRegistryEditSchemaAction).schema
|
||||
editSchema: (action as MetadataRegistryEditSchemaAction).schema,
|
||||
});
|
||||
}
|
||||
|
||||
case MetadataRegistryActionTypes.CANCEL_EDIT_SCHEMA: {
|
||||
return Object.assign({}, state, {
|
||||
editSchema: null
|
||||
editSchema: null,
|
||||
});
|
||||
}
|
||||
|
||||
case MetadataRegistryActionTypes.SELECT_SCHEMA: {
|
||||
return Object.assign({}, state, {
|
||||
selectedSchemas: [...state.selectedSchemas, (action as MetadataRegistrySelectSchemaAction).schema]
|
||||
selectedSchemas: [...state.selectedSchemas, (action as MetadataRegistrySelectSchemaAction).schema],
|
||||
});
|
||||
}
|
||||
|
||||
case MetadataRegistryActionTypes.DESELECT_SCHEMA: {
|
||||
return Object.assign({}, state, {
|
||||
selectedSchemas: state.selectedSchemas.filter(
|
||||
(selectedSchema) => selectedSchema !== (action as MetadataRegistryDeselectSchemaAction).schema
|
||||
)
|
||||
(selectedSchema) => selectedSchema !== (action as MetadataRegistryDeselectSchemaAction).schema,
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
case MetadataRegistryActionTypes.DESELECT_ALL_SCHEMA: {
|
||||
return Object.assign({}, state, {
|
||||
selectedSchemas: []
|
||||
selectedSchemas: [],
|
||||
});
|
||||
}
|
||||
|
||||
case MetadataRegistryActionTypes.EDIT_FIELD: {
|
||||
return Object.assign({}, state, {
|
||||
editField: (action as MetadataRegistryEditFieldAction).field
|
||||
editField: (action as MetadataRegistryEditFieldAction).field,
|
||||
});
|
||||
}
|
||||
|
||||
case MetadataRegistryActionTypes.CANCEL_EDIT_FIELD: {
|
||||
return Object.assign({}, state, {
|
||||
editField: null
|
||||
editField: null,
|
||||
});
|
||||
}
|
||||
|
||||
case MetadataRegistryActionTypes.SELECT_FIELD: {
|
||||
return Object.assign({}, state, {
|
||||
selectedFields: [...state.selectedFields, (action as MetadataRegistrySelectFieldAction).field]
|
||||
selectedFields: [...state.selectedFields, (action as MetadataRegistrySelectFieldAction).field],
|
||||
});
|
||||
}
|
||||
|
||||
case MetadataRegistryActionTypes.DESELECT_FIELD: {
|
||||
return Object.assign({}, state, {
|
||||
selectedFields: state.selectedFields.filter(
|
||||
(selectedField) => selectedField !== (action as MetadataRegistryDeselectFieldAction).field
|
||||
)
|
||||
(selectedField) => selectedField !== (action as MetadataRegistryDeselectFieldAction).field,
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
case MetadataRegistryActionTypes.DESELECT_ALL_FIELD: {
|
||||
return Object.assign({}, state, {
|
||||
selectedFields: []
|
||||
selectedFields: [],
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -22,7 +22,7 @@ describe('MetadataSchemaFormComponent', () => {
|
||||
createOrUpdateMetadataSchema: (schema: MetadataSchema) => observableOf(schema),
|
||||
cancelEditMetadataSchema: () => {
|
||||
},
|
||||
clearMetadataSchemaRequests: () => observableOf(undefined)
|
||||
clearMetadataSchemaRequests: () => observableOf(undefined),
|
||||
};
|
||||
const formBuilderServiceStub = {
|
||||
createFormGroup: () => {
|
||||
@@ -32,7 +32,7 @@ describe('MetadataSchemaFormComponent', () => {
|
||||
reset(_value?: any, _options?: { onlySelf?: boolean; emitEvent?: boolean; }): void {
|
||||
},
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
/* eslint-enable no-empty, @typescript-eslint/no-empty-function */
|
||||
|
||||
@@ -42,9 +42,9 @@ describe('MetadataSchemaFormComponent', () => {
|
||||
declarations: [MetadataSchemaFormComponent, EnumKeysPipe],
|
||||
providers: [
|
||||
{ provide: RegistryService, useValue: registryServiceStub },
|
||||
{ provide: FormBuilderService, useValue: formBuilderServiceStub }
|
||||
{ provide: FormBuilderService, useValue: formBuilderServiceStub },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
@@ -64,7 +64,7 @@ describe('MetadataSchemaFormComponent', () => {
|
||||
|
||||
const expected = Object.assign(new MetadataSchema(), {
|
||||
namespace: namespace,
|
||||
prefix: prefix
|
||||
prefix: prefix,
|
||||
} as MetadataSchema);
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -90,7 +90,7 @@ describe('MetadataSchemaFormComponent', () => {
|
||||
const expectedWithId = Object.assign(new MetadataSchema(), {
|
||||
id: 1,
|
||||
namespace: namespace,
|
||||
prefix: prefix
|
||||
prefix: prefix,
|
||||
} as MetadataSchema);
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -3,7 +3,7 @@ import {
|
||||
DynamicFormControlModel,
|
||||
DynamicFormGroupModel,
|
||||
DynamicFormLayout,
|
||||
DynamicInputModel
|
||||
DynamicInputModel,
|
||||
} from '@ng-dynamic-forms/core';
|
||||
import { UntypedFormGroup } from '@angular/forms';
|
||||
import { RegistryService } from '../../../../core/registry/registry.service';
|
||||
@@ -15,7 +15,7 @@ import { MetadataSchema } from '../../../../core/metadata/metadata-schema.model'
|
||||
|
||||
@Component({
|
||||
selector: 'ds-metadata-schema-form',
|
||||
templateUrl: './metadata-schema-form.component.html'
|
||||
templateUrl: './metadata-schema-form.component.html',
|
||||
})
|
||||
/**
|
||||
* A form used for creating and editing metadata schemas
|
||||
@@ -53,14 +53,14 @@ export class MetadataSchemaFormComponent implements OnInit, OnDestroy {
|
||||
formLayout: DynamicFormLayout = {
|
||||
name: {
|
||||
grid: {
|
||||
host: 'col col-sm-6 d-inline-block'
|
||||
}
|
||||
host: 'col col-sm-6 d-inline-block',
|
||||
},
|
||||
},
|
||||
namespace: {
|
||||
grid: {
|
||||
host: 'col col-sm-6 d-inline-block'
|
||||
}
|
||||
}
|
||||
host: 'col col-sm-6 d-inline-block',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -79,7 +79,7 @@ export class MetadataSchemaFormComponent implements OnInit, OnDestroy {
|
||||
ngOnInit() {
|
||||
combineLatest([
|
||||
this.translateService.get(`${this.messagePrefix}.name`),
|
||||
this.translateService.get(`${this.messagePrefix}.namespace`)
|
||||
this.translateService.get(`${this.messagePrefix}.namespace`),
|
||||
]).subscribe(([name, namespace]) => {
|
||||
this.name = new DynamicInputModel({
|
||||
id: 'name',
|
||||
@@ -113,8 +113,8 @@ export class MetadataSchemaFormComponent implements OnInit, OnDestroy {
|
||||
new DynamicFormGroupModel(
|
||||
{
|
||||
id: 'metadatadataschemagroup',
|
||||
group:[this.namespace, this.name]
|
||||
})
|
||||
group:[this.namespace, this.name],
|
||||
}),
|
||||
];
|
||||
this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
|
||||
this.registryService.getActiveMetadataSchema().subscribe((schema: MetadataSchema) => {
|
||||
@@ -152,7 +152,7 @@ export class MetadataSchemaFormComponent implements OnInit, OnDestroy {
|
||||
(schema: MetadataSchema) => {
|
||||
const values = {
|
||||
prefix: this.name.value,
|
||||
namespace: this.namespace.value
|
||||
namespace: this.namespace.value,
|
||||
};
|
||||
if (schema == null) {
|
||||
this.registryService.createOrUpdateMetadataSchema(Object.assign(new MetadataSchema(), values)).subscribe((newSchema) => {
|
||||
@@ -169,7 +169,7 @@ export class MetadataSchemaFormComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
this.clearFields();
|
||||
this.registryService.cancelEditMetadataSchema();
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -21,7 +21,7 @@ describe('MetadataFieldFormComponent', () => {
|
||||
const metadataSchema = Object.assign(new MetadataSchema(), {
|
||||
id: 1,
|
||||
namespace: 'fake schema',
|
||||
prefix: 'fake'
|
||||
prefix: 'fake',
|
||||
});
|
||||
|
||||
/* eslint-disable no-empty,@typescript-eslint/no-empty-function */
|
||||
@@ -33,7 +33,7 @@ describe('MetadataFieldFormComponent', () => {
|
||||
},
|
||||
cancelEditMetadataSchema: () => {
|
||||
},
|
||||
clearMetadataFieldRequests: () => observableOf(undefined)
|
||||
clearMetadataFieldRequests: () => observableOf(undefined),
|
||||
};
|
||||
const formBuilderServiceStub = {
|
||||
createFormGroup: () => {
|
||||
@@ -43,7 +43,7 @@ describe('MetadataFieldFormComponent', () => {
|
||||
reset(_value?: any, _options?: { onlySelf?: boolean; emitEvent?: boolean; }): void {
|
||||
},
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
/* eslint-enable no-empty, @typescript-eslint/no-empty-function */
|
||||
|
||||
@@ -53,9 +53,9 @@ describe('MetadataFieldFormComponent', () => {
|
||||
declarations: [MetadataFieldFormComponent, EnumKeysPipe],
|
||||
providers: [
|
||||
{ provide: RegistryService, useValue: registryServiceStub },
|
||||
{ provide: FormBuilderService, useValue: formBuilderServiceStub }
|
||||
{ provide: FormBuilderService, useValue: formBuilderServiceStub },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
@@ -83,7 +83,7 @@ describe('MetadataFieldFormComponent', () => {
|
||||
const expected = Object.assign(new MetadataField(), {
|
||||
element: element,
|
||||
qualifier: qualifier,
|
||||
scopeNote: scopeNote
|
||||
scopeNote: scopeNote,
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -112,7 +112,7 @@ describe('MetadataFieldFormComponent', () => {
|
||||
schema: metadataSchema,
|
||||
element: element,
|
||||
qualifier: qualifier,
|
||||
scopeNote: scopeNote
|
||||
scopeNote: scopeNote,
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -3,7 +3,7 @@ import {
|
||||
DynamicFormControlModel,
|
||||
DynamicFormGroupModel,
|
||||
DynamicFormLayout,
|
||||
DynamicInputModel
|
||||
DynamicInputModel,
|
||||
} from '@ng-dynamic-forms/core';
|
||||
import { UntypedFormGroup } from '@angular/forms';
|
||||
import { RegistryService } from '../../../../core/registry/registry.service';
|
||||
@@ -16,7 +16,7 @@ import { MetadataField } from '../../../../core/metadata/metadata-field.model';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-metadata-field-form',
|
||||
templateUrl: './metadata-field-form.component.html'
|
||||
templateUrl: './metadata-field-form.component.html',
|
||||
})
|
||||
/**
|
||||
* A form used for creating and editing metadata fields
|
||||
@@ -64,19 +64,19 @@ export class MetadataFieldFormComponent implements OnInit, OnDestroy {
|
||||
formLayout: DynamicFormLayout = {
|
||||
element: {
|
||||
grid: {
|
||||
host: 'col col-sm-6 d-inline-block'
|
||||
}
|
||||
host: 'col col-sm-6 d-inline-block',
|
||||
},
|
||||
},
|
||||
qualifier: {
|
||||
grid: {
|
||||
host: 'col col-sm-6 d-inline-block'
|
||||
}
|
||||
host: 'col col-sm-6 d-inline-block',
|
||||
},
|
||||
},
|
||||
scopeNote: {
|
||||
grid: {
|
||||
host: 'col col-sm-12 d-inline-block'
|
||||
}
|
||||
}
|
||||
host: 'col col-sm-12 d-inline-block',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -101,7 +101,7 @@ export class MetadataFieldFormComponent implements OnInit, OnDestroy {
|
||||
combineLatest([
|
||||
this.translateService.get(`${this.messagePrefix}.element`),
|
||||
this.translateService.get(`${this.messagePrefix}.qualifier`),
|
||||
this.translateService.get(`${this.messagePrefix}.scopenote`)
|
||||
this.translateService.get(`${this.messagePrefix}.scopenote`),
|
||||
]).subscribe(([element, qualifier, scopenote]) => {
|
||||
this.element = new DynamicInputModel({
|
||||
id: 'element',
|
||||
@@ -142,8 +142,8 @@ export class MetadataFieldFormComponent implements OnInit, OnDestroy {
|
||||
new DynamicFormGroupModel(
|
||||
{
|
||||
id: 'metadatadatafieldgroup',
|
||||
group:[this.element, this.qualifier, this.scopeNote]
|
||||
})
|
||||
group:[this.element, this.qualifier, this.scopeNote],
|
||||
}),
|
||||
];
|
||||
this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
|
||||
this.registryService.getActiveMetadataField().subscribe((field: MetadataField): void => {
|
||||
@@ -200,7 +200,7 @@ export class MetadataFieldFormComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
this.clearFields();
|
||||
this.registryService.cancelEditMetadataField();
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -39,7 +39,7 @@ describe('MetadataSchemaComponent', () => {
|
||||
},
|
||||
},
|
||||
prefix: 'dc',
|
||||
namespace: 'http://dublincore.org/documents/dcmi-terms/'
|
||||
namespace: 'http://dublincore.org/documents/dcmi-terms/',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
@@ -49,8 +49,8 @@ describe('MetadataSchemaComponent', () => {
|
||||
},
|
||||
},
|
||||
prefix: 'mock',
|
||||
namespace: 'http://dspace.org/mockschema'
|
||||
}
|
||||
namespace: 'http://dspace.org/mockschema',
|
||||
},
|
||||
];
|
||||
const mockFieldsList = [
|
||||
{
|
||||
@@ -63,7 +63,7 @@ describe('MetadataSchemaComponent', () => {
|
||||
element: 'contributor',
|
||||
qualifier: 'advisor',
|
||||
scopeNote: null,
|
||||
schema: createSuccessfulRemoteDataObject$(mockSchemasList[0])
|
||||
schema: createSuccessfulRemoteDataObject$(mockSchemasList[0]),
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
@@ -75,7 +75,7 @@ describe('MetadataSchemaComponent', () => {
|
||||
element: 'contributor',
|
||||
qualifier: 'author',
|
||||
scopeNote: null,
|
||||
schema: createSuccessfulRemoteDataObject$(mockSchemasList[0])
|
||||
schema: createSuccessfulRemoteDataObject$(mockSchemasList[0]),
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
@@ -87,7 +87,7 @@ describe('MetadataSchemaComponent', () => {
|
||||
element: 'contributor',
|
||||
qualifier: 'editor',
|
||||
scopeNote: 'test scope note',
|
||||
schema: createSuccessfulRemoteDataObject$(mockSchemasList[1])
|
||||
schema: createSuccessfulRemoteDataObject$(mockSchemasList[1]),
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
@@ -99,8 +99,8 @@ describe('MetadataSchemaComponent', () => {
|
||||
element: 'contributor',
|
||||
qualifier: 'illustrator',
|
||||
scopeNote: null,
|
||||
schema: createSuccessfulRemoteDataObject$(mockSchemasList[1])
|
||||
}
|
||||
schema: createSuccessfulRemoteDataObject$(mockSchemasList[1]),
|
||||
},
|
||||
];
|
||||
const mockSchemas = createSuccessfulRemoteDataObject$(buildPaginatedList(null, mockSchemasList));
|
||||
/* eslint-disable no-empty,@typescript-eslint/no-empty-function */
|
||||
@@ -117,14 +117,14 @@ describe('MetadataSchemaComponent', () => {
|
||||
deleteMetadataField: () => observableOf(new RestResponse(true, 200, 'OK')),
|
||||
deselectAllMetadataField: () => {
|
||||
},
|
||||
clearMetadataFieldRequests: () => observableOf(undefined)
|
||||
clearMetadataFieldRequests: () => observableOf(undefined),
|
||||
};
|
||||
/* eslint-enable no-empty, @typescript-eslint/no-empty-function */
|
||||
const schemaNameParam = 'mock';
|
||||
const activatedRouteStub = Object.assign(new ActivatedRouteStub(), {
|
||||
params: observableOf({
|
||||
schemaName: schemaNameParam
|
||||
})
|
||||
schemaName: schemaNameParam,
|
||||
}),
|
||||
});
|
||||
|
||||
const paginationService = new PaginationServiceStub();
|
||||
@@ -139,9 +139,9 @@ describe('MetadataSchemaComponent', () => {
|
||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
|
||||
{ provide: Router, useValue: new RouterStub() },
|
||||
{ provide: PaginationService, useValue: paginationService },
|
||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() }
|
||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
|
@@ -7,7 +7,7 @@ import {
|
||||
combineLatest,
|
||||
Observable,
|
||||
of as observableOf,
|
||||
zip
|
||||
zip,
|
||||
} from 'rxjs';
|
||||
import { RemoteData } from '../../../core/data/remote-data';
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
@@ -26,7 +26,7 @@ import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
@Component({
|
||||
selector: 'ds-metadata-schema',
|
||||
templateUrl: './metadata-schema.component.html',
|
||||
styleUrls: ['./metadata-schema.component.scss']
|
||||
styleUrls: ['./metadata-schema.component.scss'],
|
||||
})
|
||||
/**
|
||||
* A component used for managing all existing metadata fields within the current metadata schema.
|
||||
@@ -49,7 +49,7 @@ export class MetadataSchemaComponent implements OnInit {
|
||||
config: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
|
||||
id: 'rm',
|
||||
pageSize: 25,
|
||||
pageSizeOptions: [25, 50, 100, 200]
|
||||
pageSizeOptions: [25, 50, 100, 200],
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -92,7 +92,7 @@ export class MetadataSchemaComponent implements OnInit {
|
||||
this.needsUpdate$.next(false);
|
||||
}
|
||||
return this.registryService.getMetadataFieldsBySchema(schema, toFindListOptions(currentPagination), !update, true);
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ export class MetadataSchemaComponent implements OnInit {
|
||||
*/
|
||||
isActive(field: MetadataField): Observable<boolean> {
|
||||
return this.getActiveField().pipe(
|
||||
map((activeField) => field === activeField)
|
||||
map((activeField) => field === activeField),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ export class MetadataSchemaComponent implements OnInit {
|
||||
*/
|
||||
isSelected(field: MetadataField): Observable<boolean> {
|
||||
return this.registryService.getSelectedMetadataFields().pipe(
|
||||
map((fields) => fields.find((selectedField) => selectedField === field) != null)
|
||||
map((fields) => fields.find((selectedField) => selectedField === field) != null),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ export class MetadataSchemaComponent implements OnInit {
|
||||
this.registryService.deselectAllMetadataField();
|
||||
this.registryService.cancelEditMetadataField();
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ export class MetadataSchemaComponent implements OnInit {
|
||||
const suffix = success ? 'success' : 'failure';
|
||||
const messages = observableCombineLatest(
|
||||
this.translateService.get(success ? `${prefix}.${suffix}` : `${prefix}.${suffix}`),
|
||||
this.translateService.get(`${prefix}.field.deleted.${suffix}`, { amount: amount })
|
||||
this.translateService.get(`${prefix}.field.deleted.${suffix}`, { amount: amount }),
|
||||
);
|
||||
messages.subscribe(([head, content]) => {
|
||||
if (success) {
|
||||
|
@@ -21,44 +21,44 @@ import { BatchImportPageComponent } from './admin-import-batch-page/batch-import
|
||||
path: 'search',
|
||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
||||
component: AdminSearchPageComponent,
|
||||
data: { title: 'admin.search.title', breadcrumbKey: 'admin.search' }
|
||||
data: { title: 'admin.search.title', breadcrumbKey: 'admin.search' },
|
||||
},
|
||||
{
|
||||
path: 'workflow',
|
||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
||||
component: AdminWorkflowPageComponent,
|
||||
data: { title: 'admin.workflow.title', breadcrumbKey: 'admin.workflow' }
|
||||
data: { title: 'admin.workflow.title', breadcrumbKey: 'admin.workflow' },
|
||||
},
|
||||
{
|
||||
path: 'curation-tasks',
|
||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
||||
component: AdminCurationTasksComponent,
|
||||
data: { title: 'admin.curation-tasks.title', breadcrumbKey: 'admin.curation-tasks' }
|
||||
data: { title: 'admin.curation-tasks.title', breadcrumbKey: 'admin.curation-tasks' },
|
||||
},
|
||||
{
|
||||
path: 'metadata-import',
|
||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
||||
component: MetadataImportPageComponent,
|
||||
data: { title: 'admin.metadata-import.title', breadcrumbKey: 'admin.metadata-import' }
|
||||
data: { title: 'admin.metadata-import.title', breadcrumbKey: 'admin.metadata-import' },
|
||||
},
|
||||
{
|
||||
path: 'batch-import',
|
||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
||||
component: BatchImportPageComponent,
|
||||
data: { title: 'admin.batch-import.title', breadcrumbKey: 'admin.batch-import' }
|
||||
data: { title: 'admin.batch-import.title', breadcrumbKey: 'admin.batch-import' },
|
||||
},
|
||||
{
|
||||
path: 'system-wide-alert',
|
||||
resolve: { breadcrumb: I18nBreadcrumbResolver },
|
||||
loadChildren: () => import('../system-wide-alert/system-wide-alert.module').then((m) => m.SystemWideAlertModule),
|
||||
data: {title: 'admin.system-wide-alert.title', breadcrumbKey: 'admin.system-wide-alert'}
|
||||
data: {title: 'admin.system-wide-alert.title', breadcrumbKey: 'admin.system-wide-alert'},
|
||||
},
|
||||
])
|
||||
]),
|
||||
],
|
||||
providers: [
|
||||
I18nBreadcrumbResolver,
|
||||
I18nBreadcrumbsService
|
||||
]
|
||||
I18nBreadcrumbsService,
|
||||
],
|
||||
})
|
||||
export class AdminRoutingModule {
|
||||
|
||||
|
@@ -10,7 +10,7 @@ describe('AdminSearchPageComponent', () => {
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [AdminSearchPageComponent],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
@@ -4,7 +4,7 @@ import { Context } from '../../core/shared/context.model';
|
||||
@Component({
|
||||
selector: 'ds-admin-search-page',
|
||||
templateUrl: './admin-search-page.component.html',
|
||||
styleUrls: ['./admin-search-page.component.scss']
|
||||
styleUrls: ['./admin-search-page.component.scss'],
|
||||
})
|
||||
|
||||
/**
|
||||
|
@@ -37,7 +37,7 @@ describe('CollectionAdminSearchResultGridElementComponent', () => {
|
||||
}
|
||||
|
||||
const linkService = jasmine.createSpyObj('linkService', {
|
||||
resolveLink: {}
|
||||
resolveLink: {},
|
||||
});
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
@@ -47,7 +47,7 @@ describe('CollectionAdminSearchResultGridElementComponent', () => {
|
||||
NoopAnimationsModule,
|
||||
TranslateModule.forRoot(),
|
||||
RouterTestingModule.withRoutes([]),
|
||||
SharedModule
|
||||
SharedModule,
|
||||
],
|
||||
declarations: [CollectionAdminSearchResultGridElementComponent],
|
||||
providers: [
|
||||
@@ -58,7 +58,7 @@ describe('CollectionAdminSearchResultGridElementComponent', () => {
|
||||
{ provide: FileService, useClass: FileServiceStub },
|
||||
{ provide: AuthorizationDataService, useClass: AuthorizationDataServiceStub },
|
||||
{ provide: ThemeService, useValue: getMockThemeService() },
|
||||
]
|
||||
],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
@@ -11,7 +11,7 @@ import { getCollectionEditRoute } from '../../../../../collection-page/collectio
|
||||
@Component({
|
||||
selector: 'ds-collection-admin-search-result-list-element',
|
||||
styleUrls: ['./collection-admin-search-result-grid-element.component.scss'],
|
||||
templateUrl: './collection-admin-search-result-grid-element.component.html'
|
||||
templateUrl: './collection-admin-search-result-grid-element.component.html',
|
||||
})
|
||||
/**
|
||||
* The component for displaying a list element for a collection search result on the admin search page
|
||||
|
@@ -39,7 +39,7 @@ describe('CommunityAdminSearchResultGridElementComponent', () => {
|
||||
}
|
||||
|
||||
const linkService = jasmine.createSpyObj('linkService', {
|
||||
resolveLink: {}
|
||||
resolveLink: {},
|
||||
});
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
@@ -49,7 +49,7 @@ describe('CommunityAdminSearchResultGridElementComponent', () => {
|
||||
NoopAnimationsModule,
|
||||
TranslateModule.forRoot(),
|
||||
RouterTestingModule.withRoutes([]),
|
||||
SharedModule
|
||||
SharedModule,
|
||||
],
|
||||
declarations: [CommunityAdminSearchResultGridElementComponent],
|
||||
providers: [
|
||||
@@ -61,7 +61,7 @@ describe('CommunityAdminSearchResultGridElementComponent', () => {
|
||||
{ provide: AuthorizationDataService, useClass: AuthorizationDataServiceStub },
|
||||
{ provide: ThemeService, useValue: getMockThemeService() },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
@@ -11,7 +11,7 @@ import { getCommunityEditRoute } from '../../../../../community-page/community-p
|
||||
@Component({
|
||||
selector: 'ds-community-admin-search-result-grid-element',
|
||||
styleUrls: ['./community-admin-search-result-grid-element.component.scss'],
|
||||
templateUrl: './community-admin-search-result-grid-element.component.html'
|
||||
templateUrl: './community-admin-search-result-grid-element.component.html',
|
||||
})
|
||||
/**
|
||||
* The component for displaying a list element for a community search result on the admin search page
|
||||
|
@@ -36,13 +36,13 @@ describe('ItemAdminSearchResultGridElementComponent', () => {
|
||||
const mockBitstreamDataService = {
|
||||
getThumbnailFor(item: Item): Observable<RemoteData<Bitstream>> {
|
||||
return createSuccessfulRemoteDataObject$(new Bitstream());
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const mockAccessStatusDataService = {
|
||||
findAccessStatusFor(item: Item): Observable<RemoteData<AccessStatusObject>> {
|
||||
return createSuccessfulRemoteDataObject$(new AccessStatusObject());
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const mockThemeService = getMockThemeService();
|
||||
@@ -63,7 +63,7 @@ describe('ItemAdminSearchResultGridElementComponent', () => {
|
||||
NoopAnimationsModule,
|
||||
TranslateModule.forRoot(),
|
||||
RouterTestingModule.withRoutes([]),
|
||||
SharedModule
|
||||
SharedModule,
|
||||
],
|
||||
providers: [
|
||||
{ provide: TruncatableService, useValue: mockTruncatableService },
|
||||
@@ -74,7 +74,7 @@ describe('ItemAdminSearchResultGridElementComponent', () => {
|
||||
{ provide: FileService, useClass: FileServiceStub },
|
||||
{ provide: AuthorizationDataService, useClass: AuthorizationDataServiceStub },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
@@ -3,7 +3,7 @@ import { Item } from '../../../../../core/shared/item.model';
|
||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||
import {
|
||||
getListableObjectComponent,
|
||||
listableObjectComponent
|
||||
listableObjectComponent,
|
||||
} from '../../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||
import { Context } from '../../../../../core/shared/context.model';
|
||||
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
|
||||
@@ -19,7 +19,7 @@ import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service
|
||||
@Component({
|
||||
selector: 'ds-item-admin-search-result-grid-element',
|
||||
styleUrls: ['./item-admin-search-result-grid-element.component.scss'],
|
||||
templateUrl: './item-admin-search-result-grid-element.component.html'
|
||||
templateUrl: './item-admin-search-result-grid-element.component.html',
|
||||
})
|
||||
/**
|
||||
* The component for displaying a list element for an item search result on the admin search page
|
||||
@@ -55,7 +55,7 @@ export class ItemAdminSearchResultGridElementComponent extends SearchResultGridE
|
||||
undefined,
|
||||
[
|
||||
[this.badges.nativeElement],
|
||||
[this.buttons.nativeElement]
|
||||
[this.buttons.nativeElement],
|
||||
]);
|
||||
(componentRef.instance as any).object = this.object;
|
||||
(componentRef.instance as any).index = this.index;
|
||||
|
@@ -34,13 +34,13 @@ describe('CollectionAdminSearchResultListElementComponent', () => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
RouterTestingModule.withRoutes([])
|
||||
RouterTestingModule.withRoutes([]),
|
||||
],
|
||||
declarations: [CollectionAdminSearchResultListElementComponent],
|
||||
providers: [{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: environment }],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
@@ -11,7 +11,7 @@ import { getCollectionEditRoute } from '../../../../../collection-page/collectio
|
||||
@Component({
|
||||
selector: 'ds-collection-admin-search-result-list-element',
|
||||
styleUrls: ['./collection-admin-search-result-list-element.component.scss'],
|
||||
templateUrl: './collection-admin-search-result-list-element.component.html'
|
||||
templateUrl: './collection-admin-search-result-list-element.component.html',
|
||||
})
|
||||
/**
|
||||
* The component for displaying a list element for a collection search result on the admin search page
|
||||
|
@@ -34,13 +34,13 @@ describe('CommunityAdminSearchResultListElementComponent', () => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
RouterTestingModule.withRoutes([])
|
||||
RouterTestingModule.withRoutes([]),
|
||||
],
|
||||
declarations: [CommunityAdminSearchResultListElementComponent],
|
||||
providers: [{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: environment }],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
@@ -11,7 +11,7 @@ import { getCommunityEditRoute } from '../../../../../community-page/community-p
|
||||
@Component({
|
||||
selector: 'ds-community-admin-search-result-list-element',
|
||||
styleUrls: ['./community-admin-search-result-list-element.component.scss'],
|
||||
templateUrl: './community-admin-search-result-list-element.component.html'
|
||||
templateUrl: './community-admin-search-result-list-element.component.html',
|
||||
})
|
||||
/**
|
||||
* The component for displaying a list element for a community search result on the admin search page
|
||||
|
@@ -31,13 +31,13 @@ describe('ItemAdminSearchResultListElementComponent', () => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
RouterTestingModule.withRoutes([])
|
||||
RouterTestingModule.withRoutes([]),
|
||||
],
|
||||
declarations: [ItemAdminSearchResultListElementComponent],
|
||||
providers: [{ provide: TruncatableService, useValue: {} },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: environment }],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
@@ -10,7 +10,7 @@ import { SearchResultListElementComponent } from '../../../../../shared/object-l
|
||||
@Component({
|
||||
selector: 'ds-item-admin-search-result-list-element',
|
||||
styleUrls: ['./item-admin-search-result-list-element.component.scss'],
|
||||
templateUrl: './item-admin-search-result-list-element.component.html'
|
||||
templateUrl: './item-admin-search-result-list-element.component.html',
|
||||
})
|
||||
/**
|
||||
* The component for displaying a list element for an item search result on the admin search page
|
||||
|
@@ -14,7 +14,7 @@ import {
|
||||
ITEM_EDIT_PRIVATE_PATH,
|
||||
ITEM_EDIT_PUBLIC_PATH,
|
||||
ITEM_EDIT_REINSTATE_PATH,
|
||||
ITEM_EDIT_WITHDRAW_PATH
|
||||
ITEM_EDIT_WITHDRAW_PATH,
|
||||
} from '../../../item-page/edit-item-page/edit-item-page.routing-paths';
|
||||
|
||||
describe('ItemAdminSearchResultActionsComponent', () => {
|
||||
@@ -34,10 +34,10 @@ describe('ItemAdminSearchResultActionsComponent', () => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
RouterTestingModule.withRoutes([])
|
||||
RouterTestingModule.withRoutes([]),
|
||||
],
|
||||
declarations: [ItemAdminSearchResultActionsComponent],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
@@ -8,13 +8,13 @@ import {
|
||||
ITEM_EDIT_PUBLIC_PATH,
|
||||
ITEM_EDIT_PRIVATE_PATH,
|
||||
ITEM_EDIT_REINSTATE_PATH,
|
||||
ITEM_EDIT_WITHDRAW_PATH
|
||||
ITEM_EDIT_WITHDRAW_PATH,
|
||||
} from '../../../item-page/edit-item-page/edit-item-page.routing-paths';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-item-admin-search-result-actions-element',
|
||||
styleUrls: ['./item-admin-search-result-actions.component.scss'],
|
||||
templateUrl: './item-admin-search-result-actions.component.html'
|
||||
templateUrl: './item-admin-search-result-actions.component.html',
|
||||
})
|
||||
/**
|
||||
* The component for displaying the actions for a list element for an item search result on the admin search page
|
||||
|
@@ -20,7 +20,7 @@ const ENTRY_COMPONENTS = [
|
||||
ItemAdminSearchResultGridElementComponent,
|
||||
CommunityAdminSearchResultGridElementComponent,
|
||||
CollectionAdminSearchResultGridElementComponent,
|
||||
ItemAdminSearchResultActionsComponent
|
||||
ItemAdminSearchResultActionsComponent,
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
@@ -28,12 +28,12 @@ const ENTRY_COMPONENTS = [
|
||||
SearchModule,
|
||||
SharedModule.withEntryComponents(),
|
||||
JournalEntitiesModule.withEntryComponents(),
|
||||
ResearchEntitiesModule.withEntryComponents()
|
||||
ResearchEntitiesModule.withEntryComponents(),
|
||||
],
|
||||
declarations: [
|
||||
AdminSearchPageComponent,
|
||||
...ENTRY_COMPONENTS
|
||||
]
|
||||
...ENTRY_COMPONENTS,
|
||||
],
|
||||
})
|
||||
export class AdminSearchModule {
|
||||
/**
|
||||
@@ -43,7 +43,7 @@ export class AdminSearchModule {
|
||||
static withEntryComponents() {
|
||||
return {
|
||||
ngModule: SharedModule,
|
||||
providers: ENTRY_COMPONENTS.map((component) => ({provide: component}))
|
||||
providers: ENTRY_COMPONENTS.map((component) => ({provide: component})),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -27,11 +27,11 @@ describe('AdminSidebarSectionComponent', () => {
|
||||
{provide: 'sectionDataProvider', useValue: {model: {link: 'google.com'}, icon: iconString}},
|
||||
{provide: MenuService, useValue: menuService},
|
||||
{provide: CSSVariableService, useClass: CSSVariableServiceStub},
|
||||
]
|
||||
],
|
||||
}).overrideComponent(AdminSidebarSectionComponent, {
|
||||
set: {
|
||||
entryComponents: [TestComponent]
|
||||
}
|
||||
entryComponents: [TestComponent],
|
||||
},
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
@@ -67,11 +67,11 @@ describe('AdminSidebarSectionComponent', () => {
|
||||
{provide: 'sectionDataProvider', useValue: {model: {link: 'google.com', disabled: true}, icon: iconString}},
|
||||
{provide: MenuService, useValue: menuService},
|
||||
{provide: CSSVariableService, useClass: CSSVariableServiceStub},
|
||||
]
|
||||
],
|
||||
}).overrideComponent(AdminSidebarSectionComponent, {
|
||||
set: {
|
||||
entryComponents: [TestComponent]
|
||||
}
|
||||
entryComponents: [TestComponent],
|
||||
},
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
@@ -102,7 +102,7 @@ describe('AdminSidebarSectionComponent', () => {
|
||||
// declare a test component
|
||||
@Component({
|
||||
selector: 'ds-test-cmp',
|
||||
template: ``
|
||||
template: ``,
|
||||
})
|
||||
class TestComponent {
|
||||
}
|
||||
|
@@ -37,23 +37,23 @@ describe('AdminSidebarComponent', () => {
|
||||
lastModified: '2018',
|
||||
_links: {
|
||||
self: {
|
||||
href: 'https://localhost:8000/items/fake-id'
|
||||
}
|
||||
}
|
||||
href: 'https://localhost:8000/items/fake-id',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
const routeStub = {
|
||||
data: observableOf({
|
||||
dso: createSuccessfulRemoteDataObject(mockItem)
|
||||
dso: createSuccessfulRemoteDataObject(mockItem),
|
||||
}),
|
||||
children: []
|
||||
children: [],
|
||||
};
|
||||
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
authorizationService = jasmine.createSpyObj('authorizationService', {
|
||||
isAuthorized: observableOf(true)
|
||||
isAuthorized: observableOf(true),
|
||||
});
|
||||
scriptService = jasmine.createSpyObj('scriptService', { scriptWithNameExistsAndCanExecute: observableOf(true) });
|
||||
TestBed.configureTestingModule({
|
||||
@@ -72,15 +72,15 @@ describe('AdminSidebarComponent', () => {
|
||||
{
|
||||
provide: NgbModal, useValue: {
|
||||
open: () => {/*comment*/
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).overrideComponent(AdminSidebarComponent, {
|
||||
set: {
|
||||
changeDetection: ChangeDetectionStrategy.Default,
|
||||
}
|
||||
},
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
@@ -146,7 +146,7 @@ describe('AdminSidebarComponent', () => {
|
||||
const sidebarToggler = fixture.debugElement.query(By.css('#sidebar-collapse-toggle > a'));
|
||||
sidebarToggler.triggerEventHandler('click', {
|
||||
preventDefault: () => {/**/
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -161,7 +161,7 @@ describe('AdminSidebarComponent', () => {
|
||||
const sidebarToggler = fixture.debugElement.query(By.css('nav.navbar'));
|
||||
sidebarToggler.triggerEventHandler('mouseenter', {
|
||||
preventDefault: () => {/**/
|
||||
}
|
||||
},
|
||||
});
|
||||
tick(99);
|
||||
expect(menuService.expandMenuPreview).not.toHaveBeenCalled();
|
||||
@@ -176,7 +176,7 @@ describe('AdminSidebarComponent', () => {
|
||||
const sidebarToggler = fixture.debugElement.query(By.css('nav.navbar'));
|
||||
sidebarToggler.triggerEventHandler('mouseleave', {
|
||||
preventDefault: () => {/**/
|
||||
}
|
||||
},
|
||||
});
|
||||
tick(399);
|
||||
expect(menuService.collapseMenuPreview).not.toHaveBeenCalled();
|
||||
|
@@ -18,7 +18,7 @@ import { ThemeService } from '../../shared/theme-support/theme.service';
|
||||
selector: 'ds-admin-sidebar',
|
||||
templateUrl: './admin-sidebar.component.html',
|
||||
styleUrls: ['./admin-sidebar.component.scss'],
|
||||
animations: [slideSidebar]
|
||||
animations: [slideSidebar],
|
||||
})
|
||||
export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
/**
|
||||
@@ -58,7 +58,7 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
private authService: AuthService,
|
||||
public authorizationService: AuthorizationDataService,
|
||||
public route: ActivatedRoute,
|
||||
protected themeService: ThemeService
|
||||
protected themeService: ThemeService,
|
||||
) {
|
||||
super(menuService, injector, authorizationService, route, themeService);
|
||||
this.inFocus$ = new BehaviorSubject(false);
|
||||
@@ -83,13 +83,13 @@ export class AdminSidebarComponent extends MenuComponent implements OnInit {
|
||||
});
|
||||
this.sidebarExpanded = combineLatest([this.menuCollapsed, this.menuPreviewCollapsed])
|
||||
.pipe(
|
||||
map(([collapsed, previewCollapsed]) => (!collapsed || !previewCollapsed))
|
||||
map(([collapsed, previewCollapsed]) => (!collapsed || !previewCollapsed)),
|
||||
);
|
||||
this.inFocus$.pipe(
|
||||
debounceTime(50),
|
||||
distinctUntilChanged(), // disregard focusout in situations like --(focusout)-(focusin)--
|
||||
withLatestFrom(
|
||||
combineLatest([this.menuCollapsed, this.menuPreviewCollapsed])
|
||||
combineLatest([this.menuCollapsed, this.menuPreviewCollapsed]),
|
||||
),
|
||||
).subscribe(([inFocus, [collapsed, previewCollapsed]]) => {
|
||||
if (collapsed) {
|
||||
|
@@ -27,11 +27,11 @@ describe('ExpandableAdminSidebarSectionComponent', () => {
|
||||
{ provide: MenuService, useValue: menuService },
|
||||
{ provide: CSSVariableService, useClass: CSSVariableServiceStub },
|
||||
{ provide: Router, useValue: new RouterStub() },
|
||||
]
|
||||
],
|
||||
}).overrideComponent(ExpandableAdminSidebarSectionComponent, {
|
||||
set: {
|
||||
entryComponents: [TestComponent]
|
||||
}
|
||||
entryComponents: [TestComponent],
|
||||
},
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
@@ -59,7 +59,7 @@ describe('ExpandableAdminSidebarSectionComponent', () => {
|
||||
const sidebarToggler = fixture.debugElement.query(By.css('.sidebar-section > div.nav-item'));
|
||||
sidebarToggler.triggerEventHandler('click', {
|
||||
preventDefault: () => {/**/
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -72,7 +72,7 @@ describe('ExpandableAdminSidebarSectionComponent', () => {
|
||||
// declare a test component
|
||||
@Component({
|
||||
selector: 'ds-test-cmp',
|
||||
template: ``
|
||||
template: ``,
|
||||
})
|
||||
class TestComponent {
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ import { Router } from '@angular/router';
|
||||
selector: 'li[ds-expandable-admin-sidebar-section]',
|
||||
templateUrl: './expandable-admin-sidebar-section.component.html',
|
||||
styleUrls: ['./expandable-admin-sidebar-section.component.scss'],
|
||||
animations: [rotate, slide, bgColor]
|
||||
animations: [rotate, slide, bgColor],
|
||||
})
|
||||
|
||||
@rendersSectionForMenu(MenuID.ADMIN, true)
|
||||
@@ -70,7 +70,7 @@ export class ExpandableAdminSidebarSectionComponent extends AdminSidebarSectionC
|
||||
this.sidebarPreviewCollapsed = this.menuService.isMenuPreviewCollapsed(this.menuID);
|
||||
this.expanded = combineLatestObservable(this.active, this.sidebarCollapsed, this.sidebarPreviewCollapsed)
|
||||
.pipe(
|
||||
map(([active, sidebarCollapsed, sidebarPreviewCollapsed]) => (active && (!sidebarCollapsed || !sidebarPreviewCollapsed)))
|
||||
map(([active, sidebarCollapsed, sidebarPreviewCollapsed]) => (active && (!sidebarCollapsed || !sidebarPreviewCollapsed))),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@ describe('AdminSearchPageComponent', () => {
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [AdminWorkflowPageComponent],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
@@ -4,7 +4,7 @@ import { Context } from '../../core/shared/context.model';
|
||||
@Component({
|
||||
selector: 'ds-admin-workflow-page',
|
||||
templateUrl: './admin-workflow-page.component.html',
|
||||
styleUrls: ['./admin-workflow-page.component.scss']
|
||||
styleUrls: ['./admin-workflow-page.component.scss'],
|
||||
})
|
||||
|
||||
/**
|
||||
|
@@ -9,7 +9,7 @@ import { WorkflowItemAdminWorkflowActionsComponent } from './workflow-item-admin
|
||||
import { WorkflowItem } from '../../../../../core/submission/models/workflowitem.model';
|
||||
import {
|
||||
getWorkflowItemDeleteRoute,
|
||||
getWorkflowItemSendBackRoute
|
||||
getWorkflowItemSendBackRoute,
|
||||
} from '../../../../../workflowitems-edit-page/workflowitems-edit-page-routing-paths';
|
||||
import { of } from 'rxjs';
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
@@ -37,10 +37,10 @@ describe('WorkflowItemAdminWorkflowActionsComponent', () => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
RouterTestingModule.withRoutes([])
|
||||
RouterTestingModule.withRoutes([]),
|
||||
],
|
||||
declarations: [WorkflowItemAdminWorkflowActionsComponent],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
@@ -3,13 +3,13 @@ import { Component, Input } from '@angular/core';
|
||||
import { WorkflowItem } from '../../../../../core/submission/models/workflowitem.model';
|
||||
import {
|
||||
getWorkflowItemDeleteRoute,
|
||||
getWorkflowItemSendBackRoute
|
||||
getWorkflowItemSendBackRoute,
|
||||
} from '../../../../../workflowitems-edit-page/workflowitems-edit-page-routing-paths';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-workflow-item-admin-workflow-actions-element',
|
||||
styleUrls: ['./workflow-item-admin-workflow-actions.component.scss'],
|
||||
templateUrl: './workflow-item-admin-workflow-actions.component.html'
|
||||
templateUrl: './workflow-item-admin-workflow-actions.component.html',
|
||||
})
|
||||
/**
|
||||
* The component for displaying the actions for a list element for a workflow-item on the admin workflow search page
|
||||
|
@@ -17,7 +17,7 @@ describe('SupervisionOrderGroupSelectorComponent', () => {
|
||||
const modalStub = jasmine.createSpyObj('modalStub', ['close']);
|
||||
|
||||
const supervisionOrderDataService: any = jasmine.createSpyObj('supervisionOrderDataService', {
|
||||
create: of(new SupervisionOrder())
|
||||
create: of(new SupervisionOrder()),
|
||||
});
|
||||
|
||||
const selectedOrderType = 'NONE';
|
||||
@@ -38,7 +38,7 @@ describe('SupervisionOrderGroupSelectorComponent', () => {
|
||||
{ provide: SupervisionOrderDataService, useValue: supervisionOrderDataService },
|
||||
{ provide: NotificationsService, useValue: {} },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).compileComponents();
|
||||
|
||||
}));
|
||||
|
@@ -21,14 +21,14 @@ describe('SupervisionOrderStatusComponent', () => {
|
||||
TranslateModule.forRoot({
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
useClass: TranslateLoaderMock
|
||||
}
|
||||
})
|
||||
useClass: TranslateLoaderMock,
|
||||
},
|
||||
}),
|
||||
],
|
||||
declarations: [ SupervisionOrderStatusComponent, VarDirective ],
|
||||
schemas: [
|
||||
NO_ERRORS_SCHEMA
|
||||
]
|
||||
NO_ERRORS_SCHEMA,
|
||||
],
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
@@ -38,7 +38,7 @@ describe('SupervisionOrderStatusComponent', () => {
|
||||
component = fixture.componentInstance;
|
||||
component.supervisionOrderList = supervisionOrderListMock;
|
||||
component.ngOnChanges( {
|
||||
supervisionOrderList: new SimpleChange(null, supervisionOrderListMock, true)
|
||||
supervisionOrderList: new SimpleChange(null, supervisionOrderListMock, true),
|
||||
});
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
@@ -18,7 +18,7 @@ export interface SupervisionOrderListEntry {
|
||||
@Component({
|
||||
selector: 'ds-supervision-order-status',
|
||||
templateUrl: './supervision-order-status.component.html',
|
||||
styleUrls: ['./supervision-order-status.component.scss']
|
||||
styleUrls: ['./supervision-order-status.component.scss'],
|
||||
})
|
||||
export class SupervisionOrderStatusComponent implements OnChanges {
|
||||
|
||||
@@ -61,13 +61,13 @@ export class SupervisionOrderStatusComponent implements OnChanges {
|
||||
if (sogRD.hasSucceeded) {
|
||||
const entry: SupervisionOrderListEntry = {
|
||||
supervisionOrder: so,
|
||||
group: sogRD.payload
|
||||
group: sogRD.payload,
|
||||
};
|
||||
return entry;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
})
|
||||
}),
|
||||
)),
|
||||
reduce((acc: SupervisionOrderListEntry[], value: any) => {
|
||||
if (isNotEmpty(value)) {
|
||||
|
@@ -24,7 +24,7 @@ import { SupervisionOrderDataService } from '../../../../../core/supervision-ord
|
||||
import { ConfirmationModalComponent } from '../../../../../shared/confirmation-modal/confirmation-modal.component';
|
||||
import { supervisionOrderEntryMock } from '../../../../../shared/testing/supervision-order.mock';
|
||||
import {
|
||||
SupervisionOrderGroupSelectorComponent
|
||||
SupervisionOrderGroupSelectorComponent,
|
||||
} from './supervision-order-group-selector/supervision-order-group-selector.component';
|
||||
|
||||
describe('WorkspaceItemAdminWorkflowActionsComponent', () => {
|
||||
@@ -56,15 +56,15 @@ describe('WorkspaceItemAdminWorkflowActionsComponent', () => {
|
||||
imports: [
|
||||
NgbModalModule,
|
||||
TranslateModule.forRoot(),
|
||||
RouterTestingModule.withRoutes([])
|
||||
RouterTestingModule.withRoutes([]),
|
||||
],
|
||||
declarations: [WorkspaceItemAdminWorkflowActionsComponent],
|
||||
providers: [
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: NotificationsService, useValue: notificationService },
|
||||
{ provide: SupervisionOrderDataService, useValue: supervisionOrderDataService }
|
||||
{ provide: SupervisionOrderDataService, useValue: supervisionOrderDataService },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
@@ -97,7 +97,7 @@ describe('WorkspaceItemAdminWorkflowActionsComponent', () => {
|
||||
beforeEach(() => {
|
||||
spyOn(component.delete, 'emit');
|
||||
spyOn((component as any).modalService, 'open').and.returnValue({
|
||||
componentInstance: { response: of(true) }
|
||||
componentInstance: { response: of(true) },
|
||||
});
|
||||
});
|
||||
|
||||
@@ -138,7 +138,7 @@ describe('WorkspaceItemAdminWorkflowActionsComponent', () => {
|
||||
beforeEach(() => {
|
||||
spyOn(component.create, 'emit');
|
||||
spyOn((component as any).modalService, 'open').and.returnValue({
|
||||
componentInstance: { create: of(true) }
|
||||
componentInstance: { create: of(true) },
|
||||
});
|
||||
});
|
||||
|
||||
@@ -146,7 +146,7 @@ describe('WorkspaceItemAdminWorkflowActionsComponent', () => {
|
||||
component.openSupervisionModal();
|
||||
expect((component as any).modalService.open).toHaveBeenCalledWith(SupervisionOrderGroupSelectorComponent, {
|
||||
size: 'lg',
|
||||
backdrop: 'static'
|
||||
backdrop: 'static',
|
||||
});
|
||||
expect(component.create.emit).toHaveBeenCalled();
|
||||
});
|
||||
|
@@ -8,10 +8,10 @@ import { TranslateService } from '@ngx-translate/core';
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
import { getFirstSucceededRemoteDataPayload } from '../../../../../core/shared/operators';
|
||||
import {
|
||||
SupervisionOrderGroupSelectorComponent
|
||||
SupervisionOrderGroupSelectorComponent,
|
||||
} from './supervision-order-group-selector/supervision-order-group-selector.component';
|
||||
import {
|
||||
getWorkspaceItemDeleteRoute
|
||||
getWorkspaceItemDeleteRoute,
|
||||
} from '../../../../../workflowitems-edit-page/workflowitems-edit-page-routing-paths';
|
||||
import { ITEM_EDIT_AUTHORIZATIONS_PATH } from '../../../../../item-page/edit-item-page/edit-item-page.routing-paths';
|
||||
import { WorkspaceItem } from '../../../../../core/submission/models/workspaceitem.model';
|
||||
@@ -28,7 +28,7 @@ import { getSearchResultFor } from '../../../../../shared/search/search-result-e
|
||||
@Component({
|
||||
selector: 'ds-workspace-item-admin-workflow-actions-element',
|
||||
styleUrls: ['./workspace-item-admin-workflow-actions.component.scss'],
|
||||
templateUrl: './workspace-item-admin-workflow-actions.component.html'
|
||||
templateUrl: './workspace-item-admin-workflow-actions.component.html',
|
||||
})
|
||||
/**
|
||||
* The component for displaying the actions for a list element for a workspace-item on the admin workflow search page
|
||||
@@ -94,7 +94,7 @@ export class WorkspaceItemAdminWorkflowActionsComponent implements OnInit {
|
||||
);
|
||||
|
||||
item$.pipe(
|
||||
map((item: Item) => this.getPoliciesRoute(item))
|
||||
map((item: Item) => this.getPoliciesRoute(item)),
|
||||
).subscribe((route: string[]) => {
|
||||
this.resourcePoliciesPageRoute = route;
|
||||
});
|
||||
@@ -143,22 +143,22 @@ export class WorkspaceItemAdminWorkflowActionsComponent implements OnInit {
|
||||
null,
|
||||
this.translateService.get(
|
||||
this.messagePrefix + '.notification.deleted.success',
|
||||
{ name: this.dsoNameService.getName(supervisionOrderEntry.group) }
|
||||
)
|
||||
{ name: this.dsoNameService.getName(supervisionOrderEntry.group) },
|
||||
),
|
||||
);
|
||||
} else {
|
||||
this.notificationsService.error(
|
||||
null,
|
||||
this.translateService.get(
|
||||
this.messagePrefix + '.notification.deleted.failure',
|
||||
{ name: this.dsoNameService.getName(supervisionOrderEntry.group) }
|
||||
)
|
||||
{ name: this.dsoNameService.getName(supervisionOrderEntry.group) },
|
||||
),
|
||||
);
|
||||
}
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
})
|
||||
}),
|
||||
).subscribe((result: boolean) => {
|
||||
if (result) {
|
||||
this.delete.emit(this.convertReloadedObject());
|
||||
@@ -172,7 +172,7 @@ export class WorkspaceItemAdminWorkflowActionsComponent implements OnInit {
|
||||
openSupervisionModal() {
|
||||
const supervisionModal: NgbModalRef = this.modalService.open(SupervisionOrderGroupSelectorComponent, {
|
||||
size: 'lg',
|
||||
backdrop: 'static'
|
||||
backdrop: 'static',
|
||||
});
|
||||
supervisionModal.componentInstance.itemUUID = this.item.uuid;
|
||||
supervisionModal.componentInstance.create.subscribe(() => {
|
||||
@@ -186,7 +186,7 @@ export class WorkspaceItemAdminWorkflowActionsComponent implements OnInit {
|
||||
private convertReloadedObject(): DSpaceObject {
|
||||
const constructor = getSearchResultFor((this.wsi as any).constructor);
|
||||
return Object.assign(new constructor(), this.wsi, {
|
||||
indexableObject: this.wsi
|
||||
indexableObject: this.wsi,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -8,20 +8,20 @@ import { CollectionElementLinkType } from '../../../../../shared/object-collecti
|
||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import {
|
||||
WorkflowItemSearchResultAdminWorkflowGridElementComponent
|
||||
WorkflowItemSearchResultAdminWorkflowGridElementComponent,
|
||||
} from './workflow-item-search-result-admin-workflow-grid-element.component';
|
||||
import { WorkflowItem } from '../../../../../core/submission/models/workflowitem.model';
|
||||
import { LinkService } from '../../../../../core/cache/builders/link.service';
|
||||
import { followLink } from '../../../../../shared/utils/follow-link-config.model';
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
import {
|
||||
ItemGridElementComponent
|
||||
ItemGridElementComponent,
|
||||
} from '../../../../../shared/object-grid/item-grid-element/item-types/item/item-grid-element.component';
|
||||
import {
|
||||
ListableObjectDirective
|
||||
ListableObjectDirective,
|
||||
} from '../../../../../shared/object-collection/shared/listable-object/listable-object.directive';
|
||||
import {
|
||||
WorkflowItemSearchResult
|
||||
WorkflowItemSearchResult,
|
||||
} from '../../../../../shared/object-collection/shared/workflow-item-search-result.model';
|
||||
import { BitstreamDataService } from '../../../../../core/data/bitstream-data.service';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-data.utils';
|
||||
@@ -67,16 +67,16 @@ describe('WorkflowItemSearchResultAdminWorkflowGridElementComponent', () => {
|
||||
{
|
||||
provide: TruncatableService, useValue: {
|
||||
isCollapsed: () => observableOf(true),
|
||||
}
|
||||
},
|
||||
},
|
||||
{ provide: BitstreamDataService, useValue: {} },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
.overrideComponent(WorkflowItemSearchResultAdminWorkflowGridElementComponent, {
|
||||
set: {
|
||||
entryComponents: [ItemGridElementComponent]
|
||||
}
|
||||
entryComponents: [ItemGridElementComponent],
|
||||
},
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
@@ -3,7 +3,7 @@ import { Item } from '../../../../../core/shared/item.model';
|
||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||
import {
|
||||
getListableObjectComponent,
|
||||
listableObjectComponent
|
||||
listableObjectComponent,
|
||||
} from '../../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||
import { Context } from '../../../../../core/shared/context.model';
|
||||
import { SearchResultGridElementComponent } from '../../../../../shared/object-grid/search-result-grid-element/search-result-grid-element.component';
|
||||
@@ -18,7 +18,7 @@ import { followLink } from '../../../../../shared/utils/follow-link-config.model
|
||||
import { RemoteData } from '../../../../../core/data/remote-data';
|
||||
import {
|
||||
getAllSucceededRemoteData,
|
||||
getRemoteDataPayload
|
||||
getRemoteDataPayload,
|
||||
} from '../../../../../core/shared/operators';
|
||||
import { take } from 'rxjs/operators';
|
||||
import { WorkflowItemSearchResult } from '../../../../../shared/object-collection/shared/workflow-item-search-result.model';
|
||||
@@ -29,7 +29,7 @@ import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service
|
||||
@Component({
|
||||
selector: 'ds-workflow-item-search-result-admin-workflow-grid-element',
|
||||
styleUrls: ['./workflow-item-search-result-admin-workflow-grid-element.component.scss'],
|
||||
templateUrl: './workflow-item-search-result-admin-workflow-grid-element.component.html'
|
||||
templateUrl: './workflow-item-search-result-admin-workflow-grid-element.component.html',
|
||||
})
|
||||
/**
|
||||
* The component for displaying a grid element for an workflow item on the admin workflow search page
|
||||
@@ -61,7 +61,7 @@ export class WorkflowItemSearchResultAdminWorkflowGridElementComponent extends S
|
||||
private linkService: LinkService,
|
||||
protected truncatableService: TruncatableService,
|
||||
private themeService: ThemeService,
|
||||
protected bitstreamDataService: BitstreamDataService
|
||||
protected bitstreamDataService: BitstreamDataService,
|
||||
) {
|
||||
super(dsoNameService, truncatableService, bitstreamDataService);
|
||||
}
|
||||
@@ -86,14 +86,14 @@ export class WorkflowItemSearchResultAdminWorkflowGridElementComponent extends S
|
||||
undefined,
|
||||
[
|
||||
[this.badges.nativeElement],
|
||||
[this.buttons.nativeElement]
|
||||
[this.buttons.nativeElement],
|
||||
]);
|
||||
(componentRef.instance as any).object = item;
|
||||
(componentRef.instance as any).index = this.index;
|
||||
(componentRef.instance as any).linkType = this.linkType;
|
||||
(componentRef.instance as any).listID = this.listID;
|
||||
componentRef.changeDetectorRef.detectChanges();
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -10,20 +10,20 @@ import { TruncatableService } from '../../../../../shared/truncatable/truncatabl
|
||||
import { CollectionElementLinkType } from '../../../../../shared/object-collection/collection-element-link.type';
|
||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||
import {
|
||||
WorkspaceItemSearchResultAdminWorkflowGridElementComponent
|
||||
WorkspaceItemSearchResultAdminWorkflowGridElementComponent,
|
||||
} from './workspace-item-search-result-admin-workflow-grid-element.component';
|
||||
import { WorkflowItem } from '../../../../../core/submission/models/workflowitem.model';
|
||||
import { LinkService } from '../../../../../core/cache/builders/link.service';
|
||||
import { followLink } from '../../../../../shared/utils/follow-link-config.model';
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
import {
|
||||
ItemGridElementComponent
|
||||
ItemGridElementComponent,
|
||||
} from '../../../../../shared/object-grid/item-grid-element/item-types/item/item-grid-element.component';
|
||||
import {
|
||||
ListableObjectDirective
|
||||
ListableObjectDirective,
|
||||
} from '../../../../../shared/object-collection/shared/listable-object/listable-object.directive';
|
||||
import {
|
||||
WorkflowItemSearchResult
|
||||
WorkflowItemSearchResult,
|
||||
} from '../../../../../shared/object-collection/shared/workflow-item-search-result.model';
|
||||
import { BitstreamDataService } from '../../../../../core/data/bitstream-data.service';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-data.utils';
|
||||
@@ -32,7 +32,7 @@ import { getMockThemeService } from '../../../../../shared/mocks/theme-service.m
|
||||
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
|
||||
import {
|
||||
supervisionOrderPaginatedListRD,
|
||||
supervisionOrderPaginatedListRD$
|
||||
supervisionOrderPaginatedListRD$,
|
||||
} from '../../../../../shared/testing/supervision-order.mock';
|
||||
import { SupervisionOrderDataService } from '../../../../../core/supervision-order/supervision-order-data.service';
|
||||
import { DSpaceObject } from '../../../../../core/shared/dspace-object.model';
|
||||
@@ -79,17 +79,17 @@ describe('WorkspaceItemSearchResultAdminWorkflowGridElementComponent', () => {
|
||||
{
|
||||
provide: TruncatableService, useValue: {
|
||||
isCollapsed: () => observableOf(true),
|
||||
}
|
||||
},
|
||||
},
|
||||
{ provide: BitstreamDataService, useValue: {} },
|
||||
{ provide: SupervisionOrderDataService, useValue: supervisionOrderDataService }
|
||||
{ provide: SupervisionOrderDataService, useValue: supervisionOrderDataService },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
.overrideComponent(WorkspaceItemSearchResultAdminWorkflowGridElementComponent, {
|
||||
set: {
|
||||
entryComponents: [ItemGridElementComponent]
|
||||
}
|
||||
entryComponents: [ItemGridElementComponent],
|
||||
},
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
@@ -7,17 +7,17 @@ import { Item } from '../../../../../core/shared/item.model';
|
||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||
import {
|
||||
getListableObjectComponent,
|
||||
listableObjectComponent
|
||||
listableObjectComponent,
|
||||
} from '../../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||
import { Context } from '../../../../../core/shared/context.model';
|
||||
import {
|
||||
SearchResultGridElementComponent
|
||||
SearchResultGridElementComponent,
|
||||
} from '../../../../../shared/object-grid/search-result-grid-element/search-result-grid-element.component';
|
||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||
import { BitstreamDataService } from '../../../../../core/data/bitstream-data.service';
|
||||
import { GenericConstructor } from '../../../../../core/shared/generic-constructor';
|
||||
import {
|
||||
ListableObjectDirective
|
||||
ListableObjectDirective,
|
||||
} from '../../../../../shared/object-collection/shared/listable-object/listable-object.directive';
|
||||
import { WorkspaceItem } from '../../../../../core/submission/models/workspaceitem.model';
|
||||
import { LinkService } from '../../../../../core/cache/builders/link.service';
|
||||
@@ -26,10 +26,10 @@ import { RemoteData } from '../../../../../core/data/remote-data';
|
||||
import {
|
||||
getAllSucceededRemoteData,
|
||||
getFirstCompletedRemoteData,
|
||||
getRemoteDataPayload
|
||||
getRemoteDataPayload,
|
||||
} from '../../../../../core/shared/operators';
|
||||
import {
|
||||
WorkspaceItemSearchResult
|
||||
WorkspaceItemSearchResult,
|
||||
} from '../../../../../shared/object-collection/shared/workspace-item-search-result.model';
|
||||
import { ThemeService } from '../../../../../shared/theme-support/theme.service';
|
||||
import { DSpaceObject } from '../../../../../core/shared/dspace-object.model';
|
||||
@@ -42,7 +42,7 @@ import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service
|
||||
@Component({
|
||||
selector: 'ds-workflow-item-search-result-admin-workflow-grid-element',
|
||||
styleUrls: ['./workspace-item-search-result-admin-workflow-grid-element.component.scss'],
|
||||
templateUrl: './workspace-item-search-result-admin-workflow-grid-element.component.html'
|
||||
templateUrl: './workspace-item-search-result-admin-workflow-grid-element.component.html',
|
||||
})
|
||||
/**
|
||||
* The component for displaying a grid element for an workflow item on the admin workflow search page
|
||||
@@ -111,20 +111,20 @@ export class WorkspaceItemSearchResultAdminWorkflowGridElementComponent extends
|
||||
undefined,
|
||||
[
|
||||
[this.badges.nativeElement],
|
||||
[this.buttons.nativeElement]
|
||||
[this.buttons.nativeElement],
|
||||
]);
|
||||
(componentRef.instance as any).object = item;
|
||||
(componentRef.instance as any).index = this.index;
|
||||
(componentRef.instance as any).linkType = this.linkType;
|
||||
(componentRef.instance as any).listID = this.listID;
|
||||
componentRef.changeDetectorRef.detectChanges();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
this.item$.pipe(
|
||||
take(1),
|
||||
tap((item: Item) => this.itemId = item.id),
|
||||
mergeMap((item: Item) => this.retrieveSupervisorOrders(item.id))
|
||||
mergeMap((item: Item) => this.retrieveSupervisorOrders(item.id)),
|
||||
).subscribe((supervisionOrderList: SupervisionOrder[]) => {
|
||||
this.supervisionOrder$.next(supervisionOrderList);
|
||||
});
|
||||
@@ -147,10 +147,10 @@ export class WorkspaceItemSearchResultAdminWorkflowGridElementComponent extends
|
||||
*/
|
||||
private retrieveSupervisorOrders(itemId): Observable<SupervisionOrder[]> {
|
||||
return this.supervisionOrderDataService.searchByItem(
|
||||
itemId, false, true, followLink('group')
|
||||
itemId, false, true, followLink('group'),
|
||||
).pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
map((soRD: RemoteData<PaginatedList<SupervisionOrder>>) => soRD.hasSucceeded && !soRD.hasNoContent ? soRD.payload.page : [])
|
||||
map((soRD: RemoteData<PaginatedList<SupervisionOrder>>) => soRD.hasSucceeded && !soRD.hasNoContent ? soRD.payload.page : []),
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -10,13 +10,13 @@ import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { WorkflowItem } from '../../../../../core/submission/models/workflowitem.model';
|
||||
import {
|
||||
WorkflowItemSearchResultAdminWorkflowListElementComponent
|
||||
WorkflowItemSearchResultAdminWorkflowListElementComponent,
|
||||
} from './workflow-item-search-result-admin-workflow-list-element.component';
|
||||
import { LinkService } from '../../../../../core/cache/builders/link.service';
|
||||
import { followLink } from '../../../../../shared/utils/follow-link-config.model';
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
import {
|
||||
WorkflowItemSearchResult
|
||||
WorkflowItemSearchResult,
|
||||
} from '../../../../../shared/object-collection/shared/workflow-item-search-result.model';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-data.utils';
|
||||
import { getMockLinkService } from '../../../../../shared/mocks/link-service.mock';
|
||||
@@ -58,9 +58,9 @@ describe('WorkflowItemSearchResultAdminWorkflowListElementComponent', () => {
|
||||
{ provide: TruncatableService, useValue: mockTruncatableService },
|
||||
{ provide: LinkService, useValue: linkService },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: APP_CONFIG, useValue: environment }
|
||||
{ provide: APP_CONFIG, useValue: environment },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { Component, Inject, OnInit } from '@angular/core';
|
||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||
import {
|
||||
listableObjectComponent
|
||||
listableObjectComponent,
|
||||
} from '../../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||
import { Context } from '../../../../../core/shared/context.model';
|
||||
import { WorkflowItem } from '../../../../../core/submission/models/workflowitem.model';
|
||||
@@ -12,11 +12,11 @@ import { RemoteData } from '../../../../../core/data/remote-data';
|
||||
import { getAllSucceededRemoteData, getRemoteDataPayload } from '../../../../../core/shared/operators';
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
import {
|
||||
SearchResultListElementComponent
|
||||
SearchResultListElementComponent,
|
||||
} from '../../../../../shared/object-list/search-result-list-element/search-result-list-element.component';
|
||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||
import {
|
||||
WorkflowItemSearchResult
|
||||
WorkflowItemSearchResult,
|
||||
} from '../../../../../shared/object-collection/shared/workflow-item-search-result.model';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { APP_CONFIG, AppConfig } from '../../../../../../config/app-config.interface';
|
||||
@@ -25,7 +25,7 @@ import { APP_CONFIG, AppConfig } from '../../../../../../config/app-config.inter
|
||||
@Component({
|
||||
selector: 'ds-workflow-item-search-result-admin-workflow-list-element',
|
||||
styleUrls: ['./workflow-item-search-result-admin-workflow-list-element.component.scss'],
|
||||
templateUrl: './workflow-item-search-result-admin-workflow-list-element.component.html'
|
||||
templateUrl: './workflow-item-search-result-admin-workflow-list-element.component.html',
|
||||
})
|
||||
/**
|
||||
* The component for displaying a list element for a workflow item on the admin workflow search page
|
||||
@@ -40,7 +40,7 @@ export class WorkflowItemSearchResultAdminWorkflowListElementComponent extends S
|
||||
constructor(private linkService: LinkService,
|
||||
protected truncatableService: TruncatableService,
|
||||
public dsoNameService: DSONameService,
|
||||
@Inject(APP_CONFIG) protected appConfig: AppConfig
|
||||
@Inject(APP_CONFIG) protected appConfig: AppConfig,
|
||||
) {
|
||||
super(truncatableService, dsoNameService, appConfig);
|
||||
}
|
||||
|
@@ -11,13 +11,13 @@ import { CollectionElementLinkType } from '../../../../../shared/object-collecti
|
||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||
import { WorkflowItem } from '../../../../../core/submission/models/workflowitem.model';
|
||||
import {
|
||||
WorkspaceItemSearchResultAdminWorkflowListElementComponent
|
||||
WorkspaceItemSearchResultAdminWorkflowListElementComponent,
|
||||
} from './workspace-item-search-result-admin-workflow-list-element.component';
|
||||
import { LinkService } from '../../../../../core/cache/builders/link.service';
|
||||
import { followLink } from '../../../../../shared/utils/follow-link-config.model';
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
import {
|
||||
WorkflowItemSearchResult
|
||||
WorkflowItemSearchResult,
|
||||
} from '../../../../../shared/object-collection/shared/workflow-item-search-result.model';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../../../shared/remote-data.utils';
|
||||
import { getMockLinkService } from '../../../../../shared/mocks/link-service.mock';
|
||||
@@ -28,7 +28,7 @@ import { environment } from '../../../../../../environments/environment';
|
||||
import { SupervisionOrderDataService } from '../../../../../core/supervision-order/supervision-order-data.service';
|
||||
import {
|
||||
supervisionOrderPaginatedListRD,
|
||||
supervisionOrderPaginatedListRD$
|
||||
supervisionOrderPaginatedListRD$,
|
||||
} from '../../../../../shared/testing/supervision-order.mock';
|
||||
import { DSpaceObject } from '../../../../../core/shared/dspace-object.model';
|
||||
|
||||
@@ -71,9 +71,9 @@ describe('WorkspaceItemSearchResultAdminWorkflowListElementComponent', () => {
|
||||
{ provide: LinkService, useValue: linkService },
|
||||
{ provide: DSONameService, useClass: DSONameServiceMock },
|
||||
{ provide: SupervisionOrderDataService, useValue: supervisionOrderDataService },
|
||||
{ provide: APP_CONFIG, useValue: environment }
|
||||
{ provide: APP_CONFIG, useValue: environment },
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
@@ -5,7 +5,7 @@ import { map, mergeMap, take, tap } from 'rxjs/operators';
|
||||
|
||||
import { ViewMode } from '../../../../../core/shared/view-mode.model';
|
||||
import {
|
||||
listableObjectComponent
|
||||
listableObjectComponent,
|
||||
} from '../../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
|
||||
import { Context } from '../../../../../core/shared/context.model';
|
||||
import { WorkspaceItem } from '../../../../../core/submission/models/workspaceitem.model';
|
||||
@@ -15,17 +15,17 @@ import { RemoteData } from '../../../../../core/data/remote-data';
|
||||
import {
|
||||
getAllSucceededRemoteData,
|
||||
getFirstCompletedRemoteData,
|
||||
getRemoteDataPayload
|
||||
getRemoteDataPayload,
|
||||
} from '../../../../../core/shared/operators';
|
||||
import { Item } from '../../../../../core/shared/item.model';
|
||||
import {
|
||||
SearchResultListElementComponent
|
||||
SearchResultListElementComponent,
|
||||
} from '../../../../../shared/object-list/search-result-list-element/search-result-list-element.component';
|
||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
|
||||
import { APP_CONFIG, AppConfig } from '../../../../../../config/app-config.interface';
|
||||
import {
|
||||
WorkspaceItemSearchResult
|
||||
WorkspaceItemSearchResult,
|
||||
} from '../../../../../shared/object-collection/shared/workspace-item-search-result.model';
|
||||
import { SupervisionOrder } from '../../../../../core/supervision-order/models/supervision-order.model';
|
||||
import { SupervisionOrderDataService } from '../../../../../core/supervision-order/supervision-order-data.service';
|
||||
@@ -36,7 +36,7 @@ import { DSpaceObject } from '../../../../../core/shared/dspace-object.model';
|
||||
@Component({
|
||||
selector: 'ds-workflow-item-search-result-admin-workflow-list-element',
|
||||
styleUrls: ['./workspace-item-search-result-admin-workflow-list-element.component.scss'],
|
||||
templateUrl: './workspace-item-search-result-admin-workflow-list-element.component.html'
|
||||
templateUrl: './workspace-item-search-result-admin-workflow-list-element.component.html',
|
||||
})
|
||||
/**
|
||||
* The component for displaying a list element for a workflow item on the admin workflow search page
|
||||
@@ -62,7 +62,7 @@ export class WorkspaceItemSearchResultAdminWorkflowListElementComponent extends
|
||||
public dsoNameService: DSONameService,
|
||||
protected supervisionOrderDataService: SupervisionOrderDataService,
|
||||
protected truncatableService: TruncatableService,
|
||||
@Inject(APP_CONFIG) protected appConfig: AppConfig
|
||||
@Inject(APP_CONFIG) protected appConfig: AppConfig,
|
||||
) {
|
||||
super(truncatableService, dsoNameService, appConfig);
|
||||
}
|
||||
@@ -78,7 +78,7 @@ export class WorkspaceItemSearchResultAdminWorkflowListElementComponent extends
|
||||
this.item$.pipe(
|
||||
take(1),
|
||||
tap((item: Item) => this.itemId = item.id),
|
||||
mergeMap((item: Item) => this.retrieveSupervisorOrders(item.id))
|
||||
mergeMap((item: Item) => this.retrieveSupervisorOrders(item.id)),
|
||||
).subscribe((supervisionOrderList: SupervisionOrder[]) => {
|
||||
this.supervisionOrder$.next(supervisionOrderList);
|
||||
});
|
||||
@@ -92,10 +92,10 @@ export class WorkspaceItemSearchResultAdminWorkflowListElementComponent extends
|
||||
*/
|
||||
private retrieveSupervisorOrders(itemId): Observable<SupervisionOrder[]> {
|
||||
return this.supervisionOrderDataService.searchByItem(
|
||||
itemId, false, true, followLink('group')
|
||||
itemId, false, true, followLink('group'),
|
||||
).pipe(
|
||||
getFirstCompletedRemoteData(),
|
||||
map((soRD: RemoteData<PaginatedList<SupervisionOrder>>) => soRD.hasSucceeded && !soRD.hasNoContent ? soRD.payload.page : [])
|
||||
map((soRD: RemoteData<PaginatedList<SupervisionOrder>>) => soRD.hasSucceeded && !soRD.hasNoContent ? soRD.payload.page : []),
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -2,30 +2,30 @@ import { NgModule } from '@angular/core';
|
||||
|
||||
import { SharedModule } from '../../shared/shared.module';
|
||||
import {
|
||||
WorkflowItemSearchResultAdminWorkflowGridElementComponent
|
||||
WorkflowItemSearchResultAdminWorkflowGridElementComponent,
|
||||
} from './admin-workflow-search-results/admin-workflow-search-result-grid-element/workflow-item/workflow-item-search-result-admin-workflow-grid-element.component';
|
||||
import {
|
||||
WorkflowItemAdminWorkflowActionsComponent
|
||||
WorkflowItemAdminWorkflowActionsComponent,
|
||||
} from './admin-workflow-search-results/actions/workflow-item/workflow-item-admin-workflow-actions.component';
|
||||
import {
|
||||
WorkflowItemSearchResultAdminWorkflowListElementComponent
|
||||
WorkflowItemSearchResultAdminWorkflowListElementComponent,
|
||||
} from './admin-workflow-search-results/admin-workflow-search-result-list-element/workflow-item/workflow-item-search-result-admin-workflow-list-element.component';
|
||||
import { AdminWorkflowPageComponent } from './admin-workflow-page.component';
|
||||
import { SearchModule } from '../../shared/search/search.module';
|
||||
import {
|
||||
WorkspaceItemAdminWorkflowActionsComponent
|
||||
WorkspaceItemAdminWorkflowActionsComponent,
|
||||
} from './admin-workflow-search-results/actions/workspace-item/workspace-item-admin-workflow-actions.component';
|
||||
import {
|
||||
WorkspaceItemSearchResultAdminWorkflowListElementComponent
|
||||
WorkspaceItemSearchResultAdminWorkflowListElementComponent,
|
||||
} from './admin-workflow-search-results/admin-workflow-search-result-list-element/workspace-item/workspace-item-search-result-admin-workflow-list-element.component';
|
||||
import {
|
||||
WorkspaceItemSearchResultAdminWorkflowGridElementComponent
|
||||
WorkspaceItemSearchResultAdminWorkflowGridElementComponent,
|
||||
} from './admin-workflow-search-results/admin-workflow-search-result-grid-element/workspace-item/workspace-item-search-result-admin-workflow-grid-element.component';
|
||||
import {
|
||||
SupervisionOrderGroupSelectorComponent
|
||||
SupervisionOrderGroupSelectorComponent,
|
||||
} from './admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component';
|
||||
import {
|
||||
SupervisionOrderStatusComponent
|
||||
SupervisionOrderStatusComponent,
|
||||
} from './admin-workflow-search-results/actions/workspace-item/supervision-order-status/supervision-order-status.component';
|
||||
|
||||
const ENTRY_COMPONENTS = [
|
||||
@@ -33,13 +33,13 @@ const ENTRY_COMPONENTS = [
|
||||
WorkflowItemSearchResultAdminWorkflowListElementComponent,
|
||||
WorkflowItemSearchResultAdminWorkflowGridElementComponent,
|
||||
WorkspaceItemSearchResultAdminWorkflowListElementComponent,
|
||||
WorkspaceItemSearchResultAdminWorkflowGridElementComponent
|
||||
WorkspaceItemSearchResultAdminWorkflowGridElementComponent,
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
SearchModule,
|
||||
SharedModule.withEntryComponents()
|
||||
SharedModule.withEntryComponents(),
|
||||
],
|
||||
declarations: [
|
||||
AdminWorkflowPageComponent,
|
||||
@@ -47,11 +47,11 @@ const ENTRY_COMPONENTS = [
|
||||
SupervisionOrderStatusComponent,
|
||||
WorkflowItemAdminWorkflowActionsComponent,
|
||||
WorkspaceItemAdminWorkflowActionsComponent,
|
||||
...ENTRY_COMPONENTS
|
||||
...ENTRY_COMPONENTS,
|
||||
],
|
||||
exports: [
|
||||
AdminWorkflowPageComponent
|
||||
]
|
||||
AdminWorkflowPageComponent,
|
||||
],
|
||||
})
|
||||
export class AdminWorkflowModuleModule {
|
||||
/**
|
||||
@@ -61,7 +61,7 @@ export class AdminWorkflowModuleModule {
|
||||
static withEntryComponents() {
|
||||
return {
|
||||
ngModule: SharedModule,
|
||||
providers: ENTRY_COMPONENTS.map((component) => ({provide: component}))
|
||||
providers: ENTRY_COMPONENTS.map((component) => ({provide: component})),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@@ -34,8 +34,8 @@ const ENTRY_COMPONENTS = [
|
||||
declarations: [
|
||||
AdminCurationTasksComponent,
|
||||
MetadataImportPageComponent,
|
||||
BatchImportPageComponent
|
||||
]
|
||||
BatchImportPageComponent,
|
||||
],
|
||||
})
|
||||
export class AdminModule {
|
||||
/**
|
||||
@@ -45,7 +45,7 @@ export class AdminModule {
|
||||
static withEntryComponents() {
|
||||
return {
|
||||
ngModule: AdminModule,
|
||||
providers: ENTRY_COMPONENTS.map((component) => ({provide: component}))
|
||||
providers: ENTRY_COMPONENTS.map((component) => ({provide: component})),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user