ESLint: fix indentation

This commit is contained in:
Yury Bondarenko
2023-06-27 16:14:46 +02:00
parent b505cbc690
commit 0690a201dc
410 changed files with 3488 additions and 3488 deletions

View File

@@ -99,7 +99,7 @@ describe('EPeopleRegistryComponent', () => {
deleteEPerson(ePerson: EPerson): Observable<boolean> {
this.allEpeople = this.allEpeople.filter((ePerson2: EPerson) => {
return (ePerson2.uuid !== ePerson.uuid);
});
});
return observableOf(true);
},
editEPerson(ePerson: EPerson) {

View File

@@ -157,34 +157,34 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
}
this.findListOptionsSub = this.paginationService.getCurrentPagination(this.config.id, this.config).pipe(
switchMap((findListOptions) => {
const query: string = data.query;
const scope: string = data.scope;
if (query != null && this.currentSearchQuery !== query) {
this.router.navigate([this.epersonService.getEPeoplePageRouterLink()], {
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'
});
this.currentSearchScope = scope;
this.paginationService.resetPage(this.config.id);
}
return this.epersonService.searchByScope(this.currentSearchScope, this.currentSearchQuery, {
currentPage: findListOptions.currentPage,
elementsPerPage: findListOptions.pageSize
const query: string = data.query;
const scope: string = data.scope;
if (query != null && this.currentSearchQuery !== query) {
this.router.navigate([this.epersonService.getEPeoplePageRouterLink()], {
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'
});
this.currentSearchScope = scope;
this.paginationService.resetPage(this.config.id);
}
return this.epersonService.searchByScope(this.currentSearchScope, this.currentSearchQuery, {
currentPage: findListOptions.currentPage,
elementsPerPage: findListOptions.pageSize
});
}
),
getAllSucceededRemoteData(),
).subscribe((peopleRD) => {
this.ePeople$.next(peopleRD.payload);
this.pageInfoState$.next(peopleRD.payload.pageInfo);
}
this.ePeople$.next(peopleRD.payload);
this.pageInfoState$.next(peopleRD.payload.pageInfo);
}
);
}

View File

@@ -112,60 +112,60 @@ describe('EPersonFormComponent', () => {
createFormGroup(formModel, options = null) {
const controls = {};
formModel.forEach( model => {
model.parent = parent;
const controlModel = model;
const controlState = { value: controlModel.value, disabled: controlModel.disabled };
const controlOptions = this.createAbstractControlOptions(controlModel.validators, controlModel.asyncValidators, controlModel.updateOn);
controls[model.id] = new UntypedFormControl(controlState, controlOptions);
model.parent = parent;
const controlModel = model;
const controlState = { value: controlModel.value, disabled: controlModel.disabled };
const controlOptions = this.createAbstractControlOptions(controlModel.validators, controlModel.asyncValidators, controlModel.updateOn);
controls[model.id] = new UntypedFormControl(controlState, controlOptions);
});
return new UntypedFormGroup(controls, options);
},
createAbstractControlOptions(validatorsConfig = null, asyncValidatorsConfig = null, updateOn = null) {
return {
validators: validatorsConfig !== null ? this.getValidators(validatorsConfig) : null,
validators: validatorsConfig !== null ? this.getValidators(validatorsConfig) : null,
};
},
getValidators(validatorsConfig) {
return this.getValidatorFns(validatorsConfig);
return this.getValidatorFns(validatorsConfig);
},
getValidatorFns(validatorsConfig, validatorsToken = this._NG_VALIDATORS) {
let validatorFns = [];
if (this.isObject(validatorsConfig)) {
validatorFns = Object.keys(validatorsConfig).map(validatorConfigKey => {
const validatorConfigValue = validatorsConfig[validatorConfigKey];
if (this.isValidatorDescriptor(validatorConfigValue)) {
const descriptor = validatorConfigValue;
return this.getValidatorFn(descriptor.name, descriptor.args, validatorsToken);
}
return this.getValidatorFn(validatorConfigKey, validatorConfigValue, validatorsToken);
});
validatorFns = Object.keys(validatorsConfig).map(validatorConfigKey => {
const validatorConfigValue = validatorsConfig[validatorConfigKey];
if (this.isValidatorDescriptor(validatorConfigValue)) {
const descriptor = validatorConfigValue;
return this.getValidatorFn(descriptor.name, descriptor.args, validatorsToken);
}
return this.getValidatorFn(validatorConfigKey, validatorConfigValue, validatorsToken);
});
}
return validatorFns;
},
getValidatorFn(validatorName, validatorArgs = null, validatorsToken = this._NG_VALIDATORS) {
let validatorFn;
if (Validators.hasOwnProperty(validatorName)) { // Built-in Angular Validators
validatorFn = Validators[validatorName];
validatorFn = Validators[validatorName];
} else { // Custom Validators
if (this._DYNAMIC_VALIDATORS && this._DYNAMIC_VALIDATORS.has(validatorName)) {
validatorFn = this._DYNAMIC_VALIDATORS.get(validatorName);
} else if (validatorsToken) {
validatorFn = validatorsToken.find(validator => validator.name === validatorName);
}
if (this._DYNAMIC_VALIDATORS && this._DYNAMIC_VALIDATORS.has(validatorName)) {
validatorFn = this._DYNAMIC_VALIDATORS.get(validatorName);
} else if (validatorsToken) {
validatorFn = validatorsToken.find(validator => validator.name === validatorName);
}
}
if (validatorFn === undefined) { // throw when no validator could be resolved
throw new Error(`validator '${validatorName}' is not provided via NG_VALIDATORS, NG_ASYNC_VALIDATORS or DYNAMIC_FORM_VALIDATORS`);
throw new Error(`validator '${validatorName}' is not provided via NG_VALIDATORS, NG_ASYNC_VALIDATORS or DYNAMIC_FORM_VALIDATORS`);
}
if (validatorArgs !== null) {
return validatorFn(validatorArgs);
return validatorFn(validatorArgs);
}
return validatorFn;
},
},
isValidatorDescriptor(value) {
if (this.isObject(value)) {
return value.hasOwnProperty('name') && value.hasOwnProperty('args');
}
return false;
if (this.isObject(value)) {
return value.hasOwnProperty('name') && value.hasOwnProperty('args');
}
return false;
},
isObject(value) {
return typeof value === 'object' && value !== null;

View File

@@ -528,14 +528,14 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
if (hasValue(this.epersonInitial.email)) {
this.epersonRegistrationService.registerEmail(this.epersonInitial.email, null, TYPE_REQUEST_FORGOT).pipe(getFirstCompletedRemoteData())
.subscribe((response: RemoteData<Registration>) => {
if (response.hasSucceeded) {
this.notificationsService.success(this.translateService.get('admin.access-control.epeople.actions.reset'),
this.translateService.get('forgot-email.form.success.content', {email: this.epersonInitial.email}));
} else {
this.notificationsService.error(this.translateService.get('forgot-email.form.error.head'),
this.translateService.get('forgot-email.form.error.content', {email: this.epersonInitial.email}));
}
if (response.hasSucceeded) {
this.notificationsService.success(this.translateService.get('admin.access-control.epeople.actions.reset'),
this.translateService.get('forgot-email.form.success.content', {email: this.epersonInitial.email}));
} else {
this.notificationsService.error(this.translateService.get('forgot-email.form.error.head'),
this.translateService.get('forgot-email.form.error.content', {email: this.epersonInitial.email}));
}
}
);
}
}

View File

@@ -128,60 +128,60 @@ describe('GroupFormComponent', () => {
createFormGroup(formModel, options = null) {
const controls = {};
formModel.forEach( model => {
model.parent = parent;
const controlModel = model;
const controlState = { value: controlModel.value, disabled: controlModel.disabled };
const controlOptions = this.createAbstractControlOptions(controlModel.validators, controlModel.asyncValidators, controlModel.updateOn);
controls[model.id] = new UntypedFormControl(controlState, controlOptions);
model.parent = parent;
const controlModel = model;
const controlState = { value: controlModel.value, disabled: controlModel.disabled };
const controlOptions = this.createAbstractControlOptions(controlModel.validators, controlModel.asyncValidators, controlModel.updateOn);
controls[model.id] = new UntypedFormControl(controlState, controlOptions);
});
return new UntypedFormGroup(controls, options);
},
createAbstractControlOptions(validatorsConfig = null, asyncValidatorsConfig = null, updateOn = null) {
return {
validators: validatorsConfig !== null ? this.getValidators(validatorsConfig) : null,
validators: validatorsConfig !== null ? this.getValidators(validatorsConfig) : null,
};
},
getValidators(validatorsConfig) {
return this.getValidatorFns(validatorsConfig);
return this.getValidatorFns(validatorsConfig);
},
getValidatorFns(validatorsConfig, validatorsToken = this._NG_VALIDATORS) {
let validatorFns = [];
if (this.isObject(validatorsConfig)) {
validatorFns = Object.keys(validatorsConfig).map(validatorConfigKey => {
const validatorConfigValue = validatorsConfig[validatorConfigKey];
if (this.isValidatorDescriptor(validatorConfigValue)) {
const descriptor = validatorConfigValue;
return this.getValidatorFn(descriptor.name, descriptor.args, validatorsToken);
}
return this.getValidatorFn(validatorConfigKey, validatorConfigValue, validatorsToken);
});
validatorFns = Object.keys(validatorsConfig).map(validatorConfigKey => {
const validatorConfigValue = validatorsConfig[validatorConfigKey];
if (this.isValidatorDescriptor(validatorConfigValue)) {
const descriptor = validatorConfigValue;
return this.getValidatorFn(descriptor.name, descriptor.args, validatorsToken);
}
return this.getValidatorFn(validatorConfigKey, validatorConfigValue, validatorsToken);
});
}
return validatorFns;
},
getValidatorFn(validatorName, validatorArgs = null, validatorsToken = this._NG_VALIDATORS) {
let validatorFn;
if (Validators.hasOwnProperty(validatorName)) { // Built-in Angular Validators
validatorFn = Validators[validatorName];
validatorFn = Validators[validatorName];
} else { // Custom Validators
if (this._DYNAMIC_VALIDATORS && this._DYNAMIC_VALIDATORS.has(validatorName)) {
validatorFn = this._DYNAMIC_VALIDATORS.get(validatorName);
} else if (validatorsToken) {
validatorFn = validatorsToken.find(validator => validator.name === validatorName);
}
if (this._DYNAMIC_VALIDATORS && this._DYNAMIC_VALIDATORS.has(validatorName)) {
validatorFn = this._DYNAMIC_VALIDATORS.get(validatorName);
} else if (validatorsToken) {
validatorFn = validatorsToken.find(validator => validator.name === validatorName);
}
}
if (validatorFn === undefined) { // throw when no validator could be resolved
throw new Error(`validator '${validatorName}' is not provided via NG_VALIDATORS, NG_ASYNC_VALIDATORS or DYNAMIC_FORM_VALIDATORS`);
throw new Error(`validator '${validatorName}' is not provided via NG_VALIDATORS, NG_ASYNC_VALIDATORS or DYNAMIC_FORM_VALIDATORS`);
}
if (validatorArgs !== null) {
return validatorFn(validatorArgs);
return validatorFn(validatorArgs);
}
return validatorFn;
},
},
isValidatorDescriptor(value) {
if (this.isObject(value)) {
return value.hasOwnProperty('name') && value.hasOwnProperty('args');
}
return false;
if (this.isObject(value)) {
return value.hasOwnProperty('name') && value.hasOwnProperty('args');
}
return false;
},
isObject(value) {
return typeof value === 'object' && value !== null;

View File

@@ -77,21 +77,21 @@ export interface EPersonListActionConfig {
export class MembersListComponent implements OnInit, OnDestroy {
@Input()
messagePrefix: string;
messagePrefix: string;
@Input()
actionConfig: EPersonListActionConfig = {
add: {
css: 'btn-outline-primary',
disabled: false,
icon: 'fas fa-plus fa-fw',
},
remove: {
css: 'btn-outline-danger',
disabled: false,
icon: 'fas fa-trash-alt fa-fw'
},
};
actionConfig: EPersonListActionConfig = {
add: {
css: 'btn-outline-primary',
disabled: false,
icon: 'fas fa-plus fa-fw',
},
remove: {
css: 'btn-outline-danger',
disabled: false,
icon: 'fas fa-trash-alt fa-fw'
},
};
/**
* EPeople being displayed in search result, initially all members, after search result of search
@@ -176,9 +176,9 @@ export class MembersListComponent implements OnInit, OnDestroy {
this.paginationService.getCurrentPagination(this.config.id, this.config).pipe(
switchMap((currentPagination) => {
return this.ePersonDataService.findListByHref(this.groupBeingEdited._links.epersons.href, {
currentPage: currentPagination.currentPage,
elementsPerPage: currentPagination.pageSize
}
currentPage: currentPagination.currentPage,
elementsPerPage: currentPagination.pageSize
}
);
}),
getAllCompletedRemoteData(),

View File

@@ -40,7 +40,7 @@ enum SubKey {
export class SubgroupsListComponent implements OnInit, OnDestroy {
@Input()
messagePrefix: string;
messagePrefix: string;
/**
* Result of search groups, initially all groups
@@ -125,12 +125,12 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
SubKey.Members,
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
},
true,
true,
followLink('object')
currentPage: config.currentPage,
elementsPerPage: config.pageSize
},
true,
true,
followLink('object')
))
).subscribe((rd: RemoteData<PaginatedList<Group>>) => {
this.subGroups$.next(rd);

View File

@@ -16,9 +16,9 @@ export class ValidateGroupExists {
static createValidator(groupDataService: GroupDataService) {
return (control: AbstractControl): Promise<ValidationErrors | null> | Observable<ValidationErrors | null> => {
return groupDataService.searchGroups(control.value, {
currentPage: 1,
elementsPerPage: 100
})
currentPage: 1,
elementsPerPage: 100
})
.pipe(
getFirstSucceededRemoteListPayload(),
map( (groups: Group[]) => {

View File

@@ -159,14 +159,14 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy {
]).pipe(
map(([canDelete, canManageGroup, hasLinkedDSO, subgroups, members]:
[boolean, boolean, boolean, RemoteData<PaginatedList<Group>>, RemoteData<PaginatedList<EPerson>>]) => {
const groupDtoModel: GroupDtoModel = new GroupDtoModel();
groupDtoModel.ableToDelete = canDelete && !hasLinkedDSO;
groupDtoModel.ableToEdit = canManageGroup;
groupDtoModel.group = group;
groupDtoModel.subgroups = subgroups.payload;
groupDtoModel.epersons = members.payload;
return groupDtoModel;
}
const groupDtoModel: GroupDtoModel = new GroupDtoModel();
groupDtoModel.ableToDelete = canDelete && !hasLinkedDSO;
groupDtoModel.ableToEdit = canManageGroup;
groupDtoModel.group = group;
groupDtoModel.subgroups = subgroups.payload;
groupDtoModel.epersons = members.payload;
return groupDtoModel;
}
)
);
} else {
@@ -185,7 +185,7 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy {
});
this.subs.push(this.searchSub);
}
}
canManageGroup$(isSiteAdmin: boolean, group: Group): Observable<boolean> {
if (isSiteAdmin) {
@@ -210,7 +210,7 @@ export class GroupsRegistryComponent implements OnInit, OnDestroy {
this.translateService.get(this.messagePrefix + 'notification.deleted.failure.title', { name: this.dsoNameService.getName(group.group) }),
this.translateService.get(this.messagePrefix + 'notification.deleted.failure.content', { cause: rd.errorMessage }));
}
});
});
}
}

View File

@@ -35,16 +35,16 @@ export class AddBitstreamFormatComponent {
this.bitstreamFormatDataService.createBitstreamFormat(bitstreamFormat).pipe(
getFirstCompletedRemoteData(),
).subscribe((response: RemoteData<BitstreamFormat>) => {
if (response.hasSucceeded) {
this.notificationService.success(this.translateService.get('admin.registries.bitstream-formats.create.success.head'),
this.translateService.get('admin.registries.bitstream-formats.create.success.content'));
this.router.navigate([getBitstreamFormatsModuleRoute()]);
this.bitstreamFormatDataService.clearBitStreamFormatRequests().subscribe();
} else {
this.notificationService.error(this.translateService.get('admin.registries.bitstream-formats.create.failure.head'),
this.translateService.get('admin.registries.bitstream-formats.create.failure.content'));
}
if (response.hasSucceeded) {
this.notificationService.success(this.translateService.get('admin.registries.bitstream-formats.create.success.head'),
this.translateService.get('admin.registries.bitstream-formats.create.success.content'));
this.router.navigate([getBitstreamFormatsModuleRoute()]);
this.bitstreamFormatDataService.clearBitStreamFormatRequests().subscribe();
} else {
this.notificationService.error(this.translateService.get('admin.registries.bitstream-formats.create.failure.head'),
this.translateService.get('admin.registries.bitstream-formats.create.failure.content'));
}
}
);
}
}

View File

@@ -212,34 +212,34 @@ describe('BitstreamFormatsComponent', () => {
describe('deleteFormats success', () => {
beforeEach(waitForAsync(() => {
notificationsServiceStub = new NotificationsServiceStub();
notificationsServiceStub = new NotificationsServiceStub();
scheduler = getTestScheduler();
scheduler = getTestScheduler();
bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', {
findAll: observableOf(mockFormatsRD),
find: createSuccessfulRemoteDataObject$(mockFormatsList[0]),
getSelectedBitstreamFormats: observableOf(mockFormatsList),
selectBitstreamFormat: {},
deselectBitstreamFormat: {},
deselectAllBitstreamFormats: {},
delete: createNoContentRemoteDataObject$(),
clearBitStreamFormatRequests: observableOf('cleared')
});
bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', {
findAll: observableOf(mockFormatsRD),
find: createSuccessfulRemoteDataObject$(mockFormatsList[0]),
getSelectedBitstreamFormats: observableOf(mockFormatsList),
selectBitstreamFormat: {},
deselectBitstreamFormat: {},
deselectAllBitstreamFormats: {},
delete: createNoContentRemoteDataObject$(),
clearBitStreamFormatRequests: observableOf('cleared')
});
paginationService = new PaginationServiceStub();
TestBed.configureTestingModule({
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
declarations: [BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe],
providers: [
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
{ provide: NotificationsService, useValue: notificationsServiceStub },
{ provide: PaginationService, useValue: paginationService }
]
}).compileComponents();
}
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
declarations: [BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe],
providers: [
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
{ provide: NotificationsService, useValue: notificationsServiceStub },
{ provide: PaginationService, useValue: paginationService }
]
}).compileComponents();
}
));
beforeEach(initBeforeEach);
@@ -261,34 +261,34 @@ describe('BitstreamFormatsComponent', () => {
describe('deleteFormats error', () => {
beforeEach(waitForAsync(() => {
notificationsServiceStub = new NotificationsServiceStub();
notificationsServiceStub = new NotificationsServiceStub();
scheduler = getTestScheduler();
scheduler = getTestScheduler();
bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', {
findAll: observableOf(mockFormatsRD),
find: createSuccessfulRemoteDataObject$(mockFormatsList[0]),
getSelectedBitstreamFormats: observableOf(mockFormatsList),
selectBitstreamFormat: {},
deselectBitstreamFormat: {},
deselectAllBitstreamFormats: {},
delete: createFailedRemoteDataObject$(),
clearBitStreamFormatRequests: observableOf('cleared')
});
bitstreamFormatService = jasmine.createSpyObj('bitstreamFormatService', {
findAll: observableOf(mockFormatsRD),
find: createSuccessfulRemoteDataObject$(mockFormatsList[0]),
getSelectedBitstreamFormats: observableOf(mockFormatsList),
selectBitstreamFormat: {},
deselectBitstreamFormat: {},
deselectAllBitstreamFormats: {},
delete: createFailedRemoteDataObject$(),
clearBitStreamFormatRequests: observableOf('cleared')
});
paginationService = new PaginationServiceStub();
TestBed.configureTestingModule({
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
declarations: [BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe],
providers: [
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
{ provide: NotificationsService, useValue: notificationsServiceStub },
{ provide: PaginationService, useValue: paginationService }
]
}).compileComponents();
}
imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
declarations: [BitstreamFormatsComponent, PaginationComponent, EnumKeysPipe],
providers: [
{ provide: BitstreamFormatDataService, useValue: bitstreamFormatService },
{ provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
{ provide: NotificationsService, useValue: notificationsServiceStub },
{ provide: PaginationService, useValue: paginationService }
]
}).compileComponents();
}
));
beforeEach(initBeforeEach);

View File

@@ -49,15 +49,15 @@ export class EditBitstreamFormatComponent implements OnInit {
this.bitstreamFormatDataService.updateBitstreamFormat(bitstreamFormat).pipe(
getFirstCompletedRemoteData(),
).subscribe((response: RemoteData<BitstreamFormat>) => {
if (response.hasSucceeded) {
this.notificationService.success(this.translateService.get('admin.registries.bitstream-formats.edit.success.head'),
this.translateService.get('admin.registries.bitstream-formats.edit.success.content'));
this.router.navigate([getBitstreamFormatsModuleRoute()]);
} else {
this.notificationService.error('admin.registries.bitstream-formats.edit.failure.head',
'admin.registries.bitstream-formats.create.edit.content');
}
if (response.hasSucceeded) {
this.notificationService.success(this.translateService.get('admin.registries.bitstream-formats.edit.success.head'),
this.translateService.get('admin.registries.bitstream-formats.edit.success.content'));
this.router.navigate([getBitstreamFormatsModuleRoute()]);
} else {
this.notificationService.error('admin.registries.bitstream-formats.edit.failure.head',
'admin.registries.bitstream-formats.create.edit.content');
}
}
);
}
}

View File

@@ -82,33 +82,33 @@ export class MetadataSchemaFormComponent implements OnInit, OnDestroy {
this.translateService.get(`${this.messagePrefix}.namespace`)
]).subscribe(([name, namespace]) => {
this.name = new DynamicInputModel({
id: 'name',
label: name,
name: 'name',
validators: {
required: null,
pattern: '^[^. ,]*$',
maxLength: 32,
},
required: true,
errorMessages: {
pattern: 'error.validation.metadata.name.invalid-pattern',
maxLength: 'error.validation.metadata.name.max-length',
},
});
id: 'name',
label: name,
name: 'name',
validators: {
required: null,
pattern: '^[^. ,]*$',
maxLength: 32,
},
required: true,
errorMessages: {
pattern: 'error.validation.metadata.name.invalid-pattern',
maxLength: 'error.validation.metadata.name.max-length',
},
});
this.namespace = new DynamicInputModel({
id: 'namespace',
label: namespace,
name: 'namespace',
validators: {
required: null,
maxLength: 256,
},
required: true,
errorMessages: {
maxLength: 'error.validation.metadata.namespace.max-length',
},
});
id: 'namespace',
label: namespace,
name: 'namespace',
validators: {
required: null,
maxLength: 256,
},
required: true,
errorMessages: {
maxLength: 'error.validation.metadata.namespace.max-length',
},
});
this.formModel = [
new DynamicFormGroupModel(
{

View File

@@ -140,10 +140,10 @@ export class MetadataFieldFormComponent implements OnInit, OnDestroy {
});
this.formModel = [
new DynamicFormGroupModel(
{
id: 'metadatadatafieldgroup',
group:[this.element, this.qualifier, this.scopeNote]
})
{
id: 'metadatadatafieldgroup',
group:[this.element, this.qualifier, this.scopeNote]
})
];
this.formGroup = this.formBuilderService.createFormGroup(this.formModel);
this.registryService.getActiveMetadataField().subscribe((field: MetadataField): void => {

View File

@@ -30,7 +30,7 @@ describe('SupervisionOrderStatusComponent', () => {
NO_ERRORS_SCHEMA
]
})
.compileComponents();
.compileComponents();
});
beforeEach(() => {

View File

@@ -11,7 +11,7 @@ import { URLCombiner } from '../../../../../core/url-combiner/url-combiner';
import { WorkspaceItemAdminWorkflowActionsComponent } from './workspace-item-admin-workflow-actions.component';
import { WorkspaceItem } from '../../../../../core/submission/models/workspaceitem.model';
import {
getWorkspaceItemDeleteRoute,
getWorkspaceItemDeleteRoute,
} from '../../../../../workflowitems-edit-page/workflowitems-edit-page-routing-paths';
import { Item } from '../../../../../core/shared/item.model';
import { RemoteData } from '../../../../../core/data/remote-data';

View File

@@ -11,7 +11,7 @@ import {
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';

View File

@@ -75,25 +75,25 @@ export class WorkflowItemSearchResultAdminWorkflowGridElementComponent extends S
this.dso = this.linkService.resolveLink(this.dso, followLink('item'));
this.item$ = (this.dso.item as Observable<RemoteData<Item>>).pipe(getAllSucceededRemoteData(), getRemoteDataPayload());
this.item$.pipe(take(1)).subscribe((item: Item) => {
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.getComponent(item));
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.getComponent(item));
const viewContainerRef = this.listableObjectDirective.viewContainerRef;
viewContainerRef.clear();
const viewContainerRef = this.listableObjectDirective.viewContainerRef;
viewContainerRef.clear();
const componentRef = viewContainerRef.createComponent(
componentFactory,
0,
undefined,
[
[this.badges.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();
}
const componentRef = viewContainerRef.createComponent(
componentFactory,
0,
undefined,
[
[this.badges.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();
}
);
}

View File

@@ -100,25 +100,25 @@ export class WorkspaceItemSearchResultAdminWorkflowGridElementComponent extends
this.dso = this.linkService.resolveLink(this.dso, followLink('item'));
this.item$ = (this.dso.item as Observable<RemoteData<Item>>).pipe(getAllSucceededRemoteData(), getRemoteDataPayload());
this.item$.pipe(take(1)).subscribe((item: Item) => {
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.getComponent(item));
const componentFactory = this.componentFactoryResolver.resolveComponentFactory(this.getComponent(item));
const viewContainerRef = this.listableObjectDirective.viewContainerRef;
viewContainerRef.clear();
const viewContainerRef = this.listableObjectDirective.viewContainerRef;
viewContainerRef.clear();
const componentRef = viewContainerRef.createComponent(
componentFactory,
0,
undefined,
[
[this.badges.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();
}
const componentRef = viewContainerRef.createComponent(
componentFactory,
0,
undefined,
[
[this.badges.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(

View File

@@ -248,7 +248,7 @@ import { ThemedPageErrorComponent } from './page-error/themed-page-error.compone
initialNavigation: 'enabledBlocking',
preloadingStrategy: NoPreloading,
onSameUrlNavigation: 'reload',
})
})
],
exports: [RouterModule],
})

View File

@@ -11,7 +11,7 @@ import { getFirstCompletedRemoteData } from '../core/shared/operators';
* The self links defined in this list are expected to be requested somewhere in the near future
* Requesting them as embeds will limit the number of requests
*/
export const BITSTREAM_PAGE_LINKS_TO_FOLLOW: FollowLinkConfig<Bitstream>[] = [
export const BITSTREAM_PAGE_LINKS_TO_FOLLOW: FollowLinkConfig<Bitstream>[] = [
followLink('bundle', {}, followLink('primaryBitstream'), followLink('item')),
followLink('format')
];
@@ -37,12 +37,12 @@ export class BitstreamPageResolver implements Resolve<RemoteData<Bitstream>> {
getFirstCompletedRemoteData(),
);
}
/**
/**
* Method that returns the follow links to already resolve
* The self links defined in this list are expected to be requested somewhere in the near future
* Requesting them as embeds will limit the number of requests
*/
get followLinks(): FollowLinkConfig<Bitstream>[] {
return BITSTREAM_PAGE_LINKS_TO_FOLLOW;
}
get followLinks(): FollowLinkConfig<Bitstream>[] {
return BITSTREAM_PAGE_LINKS_TO_FOLLOW;
}
}

View File

@@ -129,11 +129,11 @@ describe('EditBitstreamPageComponent', () => {
const result = createSuccessfulRemoteDataObject$(bundle);
primaryBitstreamService = jasmine.createSpyObj('PrimaryBitstreamService',
{
put: result,
create: result,
delete: result,
});
{
put: result,
create: result,
delete: result,
});
});
@@ -535,120 +535,120 @@ describe('EditBitstreamPageComponent', () => {
});
});
describe('ignore OTHERCONTENT bundle', () => {
describe('ignore OTHERCONTENT bundle', () => {
const bundleName = 'OTHERCONTENT';
const bundleName = 'OTHERCONTENT';
beforeEach(waitForAsync(() => {
beforeEach(waitForAsync(() => {
bitstream = Object.assign(new Bitstream(), {
metadata: {
'dc.description': [
{
value: 'Bitstream description'
}
],
'dc.title': [
{
value: 'Bitstream title'
}
],
'iiif.label': [
{
value: 'chapter one'
}
],
'iiif.toc': [
{
value: 'chapter one'
}
],
'iiif.image.width': [
{
value: '2400'
}
],
'iiif.image.height': [
{
value: '2800'
}
],
},
format: createSuccessfulRemoteDataObject$(allFormats[2]),
_links: {
self: 'bitstream-selflink'
},
bundle: createSuccessfulRemoteDataObject$({
_links: {
primaryBitstream: {
href: 'bundle-selflink'
}
},
item: createSuccessfulRemoteDataObject$(Object.assign(new Item(), {
uuid: 'some-uuid',
firstMetadataValue(keyOrKeys: string | string[], valueFilter?: MetadataValueFilter): string {
return 'True';
}
}))
}),
});
bitstreamService = jasmine.createSpyObj('bitstreamService', {
findById: createSuccessfulRemoteDataObject$(bitstream),
findByHref: createSuccessfulRemoteDataObject$(bitstream),
update: createSuccessfulRemoteDataObject$(bitstream),
updateFormat: createSuccessfulRemoteDataObject$(bitstream),
commitUpdates: {},
patch: {}
});
dsoNameService = jasmine.createSpyObj('dsoNameService', {
getName: bundleName
});
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), RouterTestingModule],
declarations: [EditBitstreamPageComponent, FileSizePipe, VarDirective],
providers: [
{provide: NotificationsService, useValue: notificationsService},
{provide: DynamicFormService, useValue: formService},
{provide: ActivatedRoute,
useValue: {
data: observableOf({bitstream: createSuccessfulRemoteDataObject(bitstream)}),
snapshot: {queryParams: {}}
}
},
{provide: BitstreamDataService, useValue: bitstreamService},
{provide: DSONameService, useValue: dsoNameService},
{provide: BitstreamFormatDataService, useValue: bitstreamFormatService},
{ provide: PrimaryBitstreamService, useValue: primaryBitstreamService },
ChangeDetectorRef
bitstream = Object.assign(new Bitstream(), {
metadata: {
'dc.description': [
{
value: 'Bitstream description'
}
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents();
}));
'dc.title': [
{
value: 'Bitstream title'
}
],
'iiif.label': [
{
value: 'chapter one'
}
],
'iiif.toc': [
{
value: 'chapter one'
}
],
'iiif.image.width': [
{
value: '2400'
}
],
'iiif.image.height': [
{
value: '2800'
}
],
},
format: createSuccessfulRemoteDataObject$(allFormats[2]),
_links: {
self: 'bitstream-selflink'
},
bundle: createSuccessfulRemoteDataObject$({
_links: {
primaryBitstream: {
href: 'bundle-selflink'
}
},
item: createSuccessfulRemoteDataObject$(Object.assign(new Item(), {
uuid: 'some-uuid',
firstMetadataValue(keyOrKeys: string | string[], valueFilter?: MetadataValueFilter): string {
return 'True';
}
}))
}),
});
bitstreamService = jasmine.createSpyObj('bitstreamService', {
findById: createSuccessfulRemoteDataObject$(bitstream),
findByHref: createSuccessfulRemoteDataObject$(bitstream),
update: createSuccessfulRemoteDataObject$(bitstream),
updateFormat: createSuccessfulRemoteDataObject$(bitstream),
commitUpdates: {},
patch: {}
});
dsoNameService = jasmine.createSpyObj('dsoNameService', {
getName: bundleName
});
TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), RouterTestingModule],
declarations: [EditBitstreamPageComponent, FileSizePipe, VarDirective],
providers: [
{provide: NotificationsService, useValue: notificationsService},
{provide: DynamicFormService, useValue: formService},
{provide: ActivatedRoute,
useValue: {
data: observableOf({bitstream: createSuccessfulRemoteDataObject(bitstream)}),
snapshot: {queryParams: {}}
}
},
{provide: BitstreamDataService, useValue: bitstreamService},
{provide: DSONameService, useValue: dsoNameService},
{provide: BitstreamFormatDataService, useValue: bitstreamFormatService},
{ provide: PrimaryBitstreamService, useValue: primaryBitstreamService },
ChangeDetectorRef
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(EditBitstreamPageComponent);
comp = fixture.componentInstance;
fixture.detectChanges();
router = TestBed.inject(Router);
spyOn(router, 'navigate');
});
describe('EditBitstreamPageComponent with IIIF fields', () => {
let rawForm;
beforeEach(() => {
fixture = TestBed.createComponent(EditBitstreamPageComponent);
comp = fixture.componentInstance;
fixture.detectChanges();
router = TestBed.inject(Router);
spyOn(router, 'navigate');
rawForm = comp.formGroup.getRawValue();
});
describe('EditBitstreamPageComponent with IIIF fields', () => {
let rawForm;
beforeEach(() => {
rawForm = comp.formGroup.getRawValue();
});
it('should NOT set is IIIF to true', () => {
expect(comp.isIIIF).toBeFalse();
});
it('should put the \"IIIF Label\" input not to be shown', () => {
expect(rawForm.iiifLabelContainer).toBeFalsy();
});
it('should NOT set is IIIF to true', () => {
expect(comp.isIIIF).toBeFalse();
});
it('should put the \"IIIF Label\" input not to be shown', () => {
expect(rawForm.iiifLabelContainer).toBeFalsy();
});
});
});
});

View File

@@ -135,9 +135,9 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
* The Dynamic Switch Model for the file's name
*/
primaryBitstreamModel = new DynamicCustomSwitchModel({
id: 'primaryBitstream',
name: 'primaryBitstream'
}
id: 'primaryBitstream',
name: 'primaryBitstream'
}
);
/**
@@ -170,15 +170,15 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
* The Dynamic Input Model for the iiif label
*/
iiifLabelModel = new DsDynamicInputModel({
hasSelectableMetadata: false, metadataFields: [], repeatable: false, submissionId: '',
id: 'iiifLabel',
name: 'iiifLabel'
},
{
grid: {
host: 'col col-lg-6 d-inline-block'
}
});
hasSelectableMetadata: false, metadataFields: [], repeatable: false, submissionId: '',
id: 'iiifLabel',
name: 'iiifLabel'
},
{
grid: {
host: 'col col-lg-6 d-inline-block'
}
});
iiifLabelContainer = new DynamicFormGroupModel({
id: 'iiifLabelContainer',
group: [this.iiifLabelModel]
@@ -382,7 +382,7 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
private notificationsService: NotificationsService,
private bitstreamFormatService: BitstreamFormatDataService,
private primaryBitstreamService: PrimaryBitstreamService,
) {
) {
}
/**

View File

@@ -28,21 +28,21 @@ export class LegacyBitstreamUrlResolver implements Resolve<RemoteData<Bitstream>
*/
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot):
Observable<RemoteData<Bitstream>> {
const prefix = route.params.prefix;
const suffix = route.params.suffix;
const filename = route.params.filename;
const prefix = route.params.prefix;
const suffix = route.params.suffix;
const filename = route.params.filename;
let sequenceId = route.params.sequence_id;
if (hasNoValue(sequenceId)) {
sequenceId = route.queryParams.sequenceId;
}
let sequenceId = route.params.sequence_id;
if (hasNoValue(sequenceId)) {
sequenceId = route.queryParams.sequenceId;
}
return this.bitstreamDataService.findByItemHandle(
`${prefix}/${suffix}`,
sequenceId,
filename,
).pipe(
getFirstCompletedRemoteData()
);
return this.bitstreamDataService.findByItemHandle(
`${prefix}/${suffix}`,
sequenceId,
filename,
).pipe(
getFirstCompletedRemoteData()
);
}
}

View File

@@ -61,11 +61,11 @@ describe('BrowseByDatePageComponent', () => {
}
});
const mockBrowseService = {
getBrowseEntriesFor: (options: BrowseEntrySearchOptions) => toRemoteData([]),
getBrowseItemsFor: (value: string, options: BrowseEntrySearchOptions) => toRemoteData([firstItem]),
getFirstItemFor: (definition: string, scope?: string, sortDirection?: SortDirection) => null
};
const mockBrowseService = {
getBrowseEntriesFor: (options: BrowseEntrySearchOptions) => toRemoteData([]),
getBrowseItemsFor: (value: string, options: BrowseEntrySearchOptions) => toRemoteData([firstItem]),
getFirstItemFor: (definition: string, scope?: string, sortDirection?: SortDirection) => null
};
const mockDsoService = {
findById: () => createSuccessfulRemoteDataObject$(mockCommunity)

View File

@@ -110,7 +110,7 @@ export class BrowseByMetadataPageComponent implements OnInit, OnDestroy {
/**
* The authority key (may be undefined) associated with {@link #value}.
*/
authority: string;
authority: string;
/**
* The current startsWith option (fetched and updated from query-params)
@@ -133,11 +133,11 @@ export class BrowseByMetadataPageComponent implements OnInit, OnDestroy {
this.fetchThumbnails = this.appConfig.browseBy.showThumbnails;
this.paginationConfig = Object.assign(new PaginationComponentOptions(), {
id: BBM_PAGINATION_ID,
currentPage: 1,
pageSize: this.appConfig.browseBy.pageSize,
});
}
id: BBM_PAGINATION_ID,
currentPage: 1,
pageSize: this.appConfig.browseBy.pageSize,
});
}
ngOnInit(): void {
@@ -152,28 +152,28 @@ export class BrowseByMetadataPageComponent implements OnInit, OnDestroy {
return [Object.assign({}, routeParams, queryParams),currentPage,currentSort];
})
).subscribe(([params, currentPage, currentSort]: [Params, PaginationComponentOptions, SortOptions]) => {
this.browseId = params.id || this.defaultBrowseId;
this.authority = params.authority;
this.browseId = params.id || this.defaultBrowseId;
this.authority = params.authority;
if (typeof params.value === 'string'){
this.value = params.value.trim();
} else {
this.value = '';
}
if (typeof params.value === 'string'){
this.value = params.value.trim();
} else {
this.value = '';
}
if (typeof params.startsWith === 'string'){
this.startsWith = params.startsWith.trim();
}
if (typeof params.startsWith === 'string'){
this.startsWith = params.startsWith.trim();
}
if (isNotEmpty(this.value)) {
this.updatePageWithItems(
browseParamsToOptions(params, currentPage, currentSort, this.browseId, this.fetchThumbnails), this.value, this.authority);
} else {
this.updatePage(browseParamsToOptions(params, currentPage, currentSort, this.browseId, false));
}
this.updateParent(params.scope);
this.updateLogo();
}));
if (isNotEmpty(this.value)) {
this.updatePageWithItems(
browseParamsToOptions(params, currentPage, currentSort, this.browseId, this.fetchThumbnails), this.value, this.authority);
} else {
this.updatePage(browseParamsToOptions(params, currentPage, currentSort, this.browseId, false));
}
this.updateParent(params.scope);
this.updateLogo();
}));
this.updateStartsWithTextOptions();
}
@@ -290,9 +290,9 @@ export class BrowseByMetadataPageComponent implements OnInit, OnDestroy {
* @returns BrowseEntrySearchOptions instance
*/
export function getBrowseSearchOptions(defaultBrowseId: string,
paginationConfig: PaginationComponentOptions,
sortConfig: SortOptions,
fetchThumbnails?: boolean) {
paginationConfig: PaginationComponentOptions,
sortConfig: SortOptions,
fetchThumbnails?: boolean) {
if (!hasValue(fetchThumbnails)) {
fetchThumbnails = false;
}
@@ -309,10 +309,10 @@ export function getBrowseSearchOptions(defaultBrowseId: string,
* @param fetchThumbnail Optional parameter for requesting thumbnail images
*/
export function browseParamsToOptions(params: any,
paginationConfig: PaginationComponentOptions,
sortConfig: SortOptions,
metadata?: string,
fetchThumbnail?: boolean): BrowseEntrySearchOptions {
paginationConfig: PaginationComponentOptions,
sortConfig: SortOptions,
metadata?: string,
fetchThumbnail?: boolean): BrowseEntrySearchOptions {
return new BrowseEntrySearchOptions(
metadata,
paginationConfig,

View File

@@ -36,7 +36,7 @@ describe('BrowseByTaxonomyPageComponent', () => {
],
schemas: [NO_ERRORS_SCHEMA]
})
.compileComponents();
.compileComponents();
});
beforeEach(() => {

View File

@@ -86,9 +86,9 @@ export class BrowseByTaxonomyPageComponent implements OnInit, OnDestroy {
* @param detail VocabularyEntryDetail to be added
*/
onSelect(detail: VocabularyEntryDetail): void {
this.selectedItems.push(detail);
this.filterValues = this.selectedItems
.map((item: VocabularyEntryDetail) => `${item.value},equals`);
this.selectedItems.push(detail);
this.filterValues = this.selectedItems
.map((item: VocabularyEntryDetail) => `${item.value},equals`);
this.updateQueryParams();
}

View File

@@ -98,9 +98,9 @@ export class CollectionFormComponent extends ComColFormComponent<Collection> imp
// retrieve all entity types to populate the dropdowns selection
entities$.subscribe((entityTypes: ItemType[]) => {
entityTypes
.filter((type: ItemType) => type.label !== NONE_ENTITY_TYPE)
.forEach((type: ItemType, index: number) => {
entityTypes
.filter((type: ItemType) => type.label !== NONE_ENTITY_TYPE)
.forEach((type: ItemType, index: number) => {
this.entityTypeSelection.add({
disabled: false,
label: type.label,
@@ -112,10 +112,10 @@ export class CollectionFormComponent extends ComColFormComponent<Collection> imp
}
});
this.formModel = [...collectionFormModels, this.entityTypeSelection];
this.formModel = [...collectionFormModels, this.entityTypeSelection];
super.ngOnInit();
this.chd.detectChanges();
super.ngOnInit();
this.chd.detectChanges();
});
}

View File

@@ -176,16 +176,16 @@ export class CollectionItemMapperComponent implements OnInit {
map((collectionRD: RemoteData<Collection>) => collectionRD.payload),
switchMap((collection: Collection) =>
observableCombineLatest(ids.map((id: string) => {
if (remove) {
return this.itemDataService.removeMappingFromCollection(id, collection.id).pipe(
getFirstCompletedRemoteData()
);
} else {
return this.itemDataService.mapToCollection(id, collection._links.self.href).pipe(
getFirstCompletedRemoteData()
);
}
if (remove) {
return this.itemDataService.removeMappingFromCollection(id, collection.id).pipe(
getFirstCompletedRemoteData()
);
} else {
return this.itemDataService.mapToCollection(id, collection._links.self.href).pipe(
getFirstCompletedRemoteData()
);
}
}
))
)
);

View File

@@ -38,6 +38,6 @@ export class CreateCollectionPageGuard implements CanActivate {
this.router.navigate(['/404']);
}
})
);
);
}
}

View File

@@ -10,7 +10,7 @@ xdescribe('CollectionAccessControlComponent', () => {
await TestBed.configureTestingModule({
declarations: [ CollectionAccessControlComponent ]
})
.compileComponents();
.compileComponents();
});
beforeEach(() => {

View File

@@ -101,29 +101,29 @@ export class CollectionSourceControlsComponent implements OnDestroy {
map((rd) => rd.payload),
hasValueOperator(),
).subscribe((process: Process) => {
if (process.processStatus.toString() !== ProcessStatus[ProcessStatus.COMPLETED].toString() &&
if (process.processStatus.toString() !== ProcessStatus[ProcessStatus.COMPLETED].toString() &&
process.processStatus.toString() !== ProcessStatus[ProcessStatus.FAILED].toString()) {
// Ping the current process state every 5s
setTimeout(() => {
this.requestService.setStaleByHrefSubstring(process._links.self.href);
}, 5000);
}
if (process.processStatus.toString() === ProcessStatus[ProcessStatus.FAILED].toString()) {
this.notificationsService.error(this.translateService.get('collection.source.controls.test.failed'));
this.testConfigRunning$.next(false);
}
if (process.processStatus.toString() === ProcessStatus[ProcessStatus.COMPLETED].toString()) {
this.bitstreamService.findByHref(process._links.output.href).pipe(getFirstSucceededRemoteDataPayload()).subscribe((bitstream) => {
this.httpClient.get(bitstream._links.content.href, {responseType: 'text'}).subscribe((data: any) => {
const output = data.replaceAll(new RegExp('.*\\@(.*)', 'g'), '$1')
.replaceAll('The script has started', '')
.replaceAll('The script has completed', '');
this.notificationsService.info(this.translateService.get('collection.source.controls.test.completed'), output);
});
});
this.testConfigRunning$.next(false);
}
// Ping the current process state every 5s
setTimeout(() => {
this.requestService.setStaleByHrefSubstring(process._links.self.href);
}, 5000);
}
if (process.processStatus.toString() === ProcessStatus[ProcessStatus.FAILED].toString()) {
this.notificationsService.error(this.translateService.get('collection.source.controls.test.failed'));
this.testConfigRunning$.next(false);
}
if (process.processStatus.toString() === ProcessStatus[ProcessStatus.COMPLETED].toString()) {
this.bitstreamService.findByHref(process._links.output.href).pipe(getFirstSucceededRemoteDataPayload()).subscribe((bitstream) => {
this.httpClient.get(bitstream._links.content.href, {responseType: 'text'}).subscribe((data: any) => {
const output = data.replaceAll(new RegExp('.*\\@(.*)', 'g'), '$1')
.replaceAll('The script has started', '')
.replaceAll('The script has completed', '');
this.notificationsService.info(this.translateService.get('collection.source.controls.test.completed'), output);
});
});
this.testConfigRunning$.next(false);
}
}
));
}
@@ -153,24 +153,24 @@ export class CollectionSourceControlsComponent implements OnDestroy {
map((rd) => rd.payload),
hasValueOperator(),
).subscribe((process) => {
if (process.processStatus.toString() !== ProcessStatus[ProcessStatus.COMPLETED].toString() &&
if (process.processStatus.toString() !== ProcessStatus[ProcessStatus.COMPLETED].toString() &&
process.processStatus.toString() !== ProcessStatus[ProcessStatus.FAILED].toString()) {
// Ping the current process state every 5s
setTimeout(() => {
this.requestService.setStaleByHrefSubstring(process._links.self.href);
this.requestService.setStaleByHrefSubstring(this.collection._links.self.href);
}, 5000);
}
if (process.processStatus.toString() === ProcessStatus[ProcessStatus.FAILED].toString()) {
this.notificationsService.error(this.translateService.get('collection.source.controls.import.failed'));
this.importRunning$.next(false);
}
if (process.processStatus.toString() === ProcessStatus[ProcessStatus.COMPLETED].toString()) {
this.notificationsService.success(this.translateService.get('collection.source.controls.import.completed'));
// Ping the current process state every 5s
setTimeout(() => {
this.requestService.setStaleByHrefSubstring(process._links.self.href);
this.requestService.setStaleByHrefSubstring(this.collection._links.self.href);
this.importRunning$.next(false);
}
}, 5000);
}
if (process.processStatus.toString() === ProcessStatus[ProcessStatus.FAILED].toString()) {
this.notificationsService.error(this.translateService.get('collection.source.controls.import.failed'));
this.importRunning$.next(false);
}
if (process.processStatus.toString() === ProcessStatus[ProcessStatus.COMPLETED].toString()) {
this.notificationsService.success(this.translateService.get('collection.source.controls.import.completed'));
this.requestService.setStaleByHrefSubstring(this.collection._links.self.href);
this.importRunning$.next(false);
}
}
));
}
@@ -200,24 +200,24 @@ export class CollectionSourceControlsComponent implements OnDestroy {
map((rd) => rd.payload),
hasValueOperator(),
).subscribe((process) => {
if (process.processStatus.toString() !== ProcessStatus[ProcessStatus.COMPLETED].toString() &&
if (process.processStatus.toString() !== ProcessStatus[ProcessStatus.COMPLETED].toString() &&
process.processStatus.toString() !== ProcessStatus[ProcessStatus.FAILED].toString()) {
// Ping the current process state every 5s
setTimeout(() => {
this.requestService.setStaleByHrefSubstring(process._links.self.href);
this.requestService.setStaleByHrefSubstring(this.collection._links.self.href);
}, 5000);
}
if (process.processStatus.toString() === ProcessStatus[ProcessStatus.FAILED].toString()) {
this.notificationsService.error(this.translateService.get('collection.source.controls.reset.failed'));
this.reImportRunning$.next(false);
}
if (process.processStatus.toString() === ProcessStatus[ProcessStatus.COMPLETED].toString()) {
this.notificationsService.success(this.translateService.get('collection.source.controls.reset.completed'));
// Ping the current process state every 5s
setTimeout(() => {
this.requestService.setStaleByHrefSubstring(process._links.self.href);
this.requestService.setStaleByHrefSubstring(this.collection._links.self.href);
this.reImportRunning$.next(false);
}
}, 5000);
}
if (process.processStatus.toString() === ProcessStatus[ProcessStatus.FAILED].toString()) {
this.notificationsService.error(this.translateService.get('collection.source.controls.reset.failed'));
this.reImportRunning$.next(false);
}
if (process.processStatus.toString() === ProcessStatus[ProcessStatus.COMPLETED].toString()) {
this.notificationsService.success(this.translateService.get('collection.source.controls.reset.completed'));
this.requestService.setStaleByHrefSubstring(this.collection._links.self.href);
this.reImportRunning$.next(false);
}
}
));
}

View File

@@ -64,7 +64,7 @@ import { CollectionAccessControlComponent } from './collection-access-control/co
component: CollectionAccessControlComponent,
data: { title: 'collection.edit.tabs.access-control.title', showBreadcrumbs: true }
},
/* {
/* {
path: 'authorizations',
component: CollectionAuthorizationsComponent,
data: { title: 'collection.edit.tabs.authorizations.title', showBreadcrumbs: true }

View File

@@ -38,10 +38,10 @@ describe('CommunityListService', () => {
id: 'ce64f48e-2c9b-411a-ac36-ee429c0e6a88',
uuid: 'ce64f48e-2c9b-411a-ac36-ee429c0e6a88',
}),
Object.assign(new Community(), {
id: '59ee713b-ee53-4220-8c3f-9860dc84fe33',
uuid: '59ee713b-ee53-4220-8c3f-9860dc84fe33',
})
Object.assign(new Community(), {
id: '59ee713b-ee53-4220-8c3f-9860dc84fe33',
uuid: '59ee713b-ee53-4220-8c3f-9860dc84fe33',
})
];
mockCollectionsPage1 = [
Object.assign(new Collection(), {

View File

@@ -150,15 +150,15 @@ export class CommunityListService {
*/
private getTopCommunities(options: FindListOptions): Observable<PaginatedList<Community>> {
return this.communityDataService.findTop({
currentPage: options.currentPage,
elementsPerPage: this.pageSize,
sort: {
field: options.sort.field,
direction: options.sort.direction
}
},
followLink('subcommunities', { findListOptions: this.configOnePage }),
followLink('collections', { findListOptions: this.configOnePage }))
currentPage: options.currentPage,
elementsPerPage: this.pageSize,
sort: {
field: options.sort.field,
direction: options.sort.direction
}
},
followLink('subcommunities', { findListOptions: this.configOnePage }),
followLink('collections', { findListOptions: this.configOnePage }))
.pipe(
getFirstSucceededRemoteData(),
map((results) => results.payload),
@@ -173,9 +173,9 @@ export class CommunityListService {
* @param expandedNodes List of expanded nodes; if a node is not expanded its subcommunities and collections need not be added to the list
*/
public transformListOfCommunities(listOfPaginatedCommunities: PaginatedList<Community>,
level: number,
parent: FlatNode,
expandedNodes: FlatNode[]): Observable<FlatNode[]> {
level: number,
parent: FlatNode,
expandedNodes: FlatNode[]): Observable<FlatNode[]> {
if (isNotEmpty(listOfPaginatedCommunities.page)) {
let currentPage = listOfPaginatedCommunities.currentPage;
if (isNotEmpty(parent)) {
@@ -222,11 +222,11 @@ export class CommunityListService {
let subcoms = [];
for (let i = 1; i <= currentCommunityPage; i++) {
const nextSetOfSubcommunitiesPage = this.communityDataService.findByParent(community.uuid, {
elementsPerPage: this.pageSize,
currentPage: i
},
followLink('subcommunities', { findListOptions: this.configOnePage }),
followLink('collections', { findListOptions: this.configOnePage }))
elementsPerPage: this.pageSize,
currentPage: i
},
followLink('subcommunities', { findListOptions: this.configOnePage }),
followLink('collections', { findListOptions: this.configOnePage }))
.pipe(
getFirstCompletedRemoteData(),
switchMap((rd: RemoteData<PaginatedList<Community>>) => {

View File

@@ -27,11 +27,11 @@ describe('CommunityListComponent', () => {
uuid: 'ce64f48e-2c9b-411a-ac36-ee429c0e6a88',
name: 'subcommunity1',
}),
Object.assign(new Community(), {
id: '59ee713b-ee53-4220-8c3f-9860dc84fe33',
uuid: '59ee713b-ee53-4220-8c3f-9860dc84fe33',
name: 'subcommunity2',
})
Object.assign(new Community(), {
id: '59ee713b-ee53-4220-8c3f-9860dc84fe33',
uuid: '59ee713b-ee53-4220-8c3f-9860dc84fe33',
name: 'subcommunity2',
})
];
const mockCollectionsPage1 = [
Object.assign(new Collection(), {

View File

@@ -85,7 +85,7 @@ export class CommunityFormComponent extends ComColFormComponent<Community> imple
ngOnChanges(changes: SimpleChanges) {
const dsoChange: SimpleChange = changes.dso;
if (this.dso && dsoChange && !dsoChange.isFirstChange()) {
super.ngOnInit();
super.ngOnInit();
}
}
}

View File

@@ -38,7 +38,7 @@ export class CreateCommunityPageGuard implements CanActivate {
this.router.navigate(['/404']);
}
}
)
);
)
);
}
}

View File

@@ -10,7 +10,7 @@ xdescribe('CommunityAccessControlComponent', () => {
await TestBed.configureTestingModule({
declarations: [ CommunityAccessControlComponent ]
})
.compileComponents();
.compileComponents();
});
beforeEach(() => {

View File

@@ -45,54 +45,54 @@ describe('CommunityPageSubCollectionList Component', () => {
]
}
}),
Object.assign(new Community(), {
id: '123456789-2',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'Collection 2' }
]
}
}),
Object.assign(new Community(), {
id: '123456789-3',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'Collection 3' }
]
}
}),
Object.assign(new Community(), {
id: '123456789-4',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'Collection 4' }
]
}
}),
Object.assign(new Community(), {
id: '123456789-5',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'Collection 5' }
]
}
}),
Object.assign(new Community(), {
id: '123456789-6',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'Collection 6' }
]
}
}),
Object.assign(new Community(), {
id: '123456789-7',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'Collection 7' }
]
}
})
Object.assign(new Community(), {
id: '123456789-2',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'Collection 2' }
]
}
}),
Object.assign(new Community(), {
id: '123456789-3',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'Collection 3' }
]
}
}),
Object.assign(new Community(), {
id: '123456789-4',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'Collection 4' }
]
}
}),
Object.assign(new Community(), {
id: '123456789-5',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'Collection 5' }
]
}
}),
Object.assign(new Community(), {
id: '123456789-6',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'Collection 6' }
]
}
}),
Object.assign(new Community(), {
id: '123456789-7',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'Collection 7' }
]
}
})
];
const mockCommunity = Object.assign(new Community(), {

View File

@@ -74,8 +74,8 @@ export class CommunityPageSubCollectionListComponent implements OnInit, OnDestro
* Initialise the list of collections
*/
initPage() {
const pagination$ = this.paginationService.getCurrentPagination(this.config.id, this.config);
const sort$ = this.paginationService.getCurrentSort(this.config.id, this.sortConfig);
const pagination$ = this.paginationService.getCurrentPagination(this.config.id, this.config);
const sort$ = this.paginationService.getCurrentSort(this.config.id, this.sortConfig);
observableCombineLatest([pagination$, sort$]).pipe(
switchMap(([currentPagination, currentSort]) => {

View File

@@ -45,54 +45,54 @@ describe('CommunityPageSubCommunityListComponent Component', () => {
]
}
}),
Object.assign(new Community(), {
id: '123456789-2',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'SubCommunity 2' }
]
}
}),
Object.assign(new Community(), {
id: '123456789-3',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'SubCommunity 3' }
]
}
}),
Object.assign(new Community(), {
id: '12345678942',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'SubCommunity 4' }
]
}
}),
Object.assign(new Community(), {
id: '123456789-5',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'SubCommunity 5' }
]
}
}),
Object.assign(new Community(), {
id: '123456789-6',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'SubCommunity 6' }
]
}
}),
Object.assign(new Community(), {
id: '123456789-7',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'SubCommunity 7' }
]
}
})
Object.assign(new Community(), {
id: '123456789-2',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'SubCommunity 2' }
]
}
}),
Object.assign(new Community(), {
id: '123456789-3',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'SubCommunity 3' }
]
}
}),
Object.assign(new Community(), {
id: '12345678942',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'SubCommunity 4' }
]
}
}),
Object.assign(new Community(), {
id: '123456789-5',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'SubCommunity 5' }
]
}
}),
Object.assign(new Community(), {
id: '123456789-6',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'SubCommunity 6' }
]
}
}),
Object.assign(new Community(), {
id: '123456789-7',
metadata: {
'dc.title': [
{ language: 'en_US', value: 'SubCommunity 7' }
]
}
})
];
const mockCommunity = Object.assign(new Community(), {

View File

@@ -24,7 +24,7 @@ export abstract class AuthRequestService {
constructor(protected halService: HALEndpointService,
protected requestService: RequestService,
private rdbService: RemoteDataBuildService
) {
) {
}
/**

View File

@@ -58,7 +58,7 @@ import { AuthorizationDataService } from '../data/feature-authorization/authoriz
// Action Types that do not break/prevent the user from an idle state
const IDLE_TIMER_IGNORE_TYPES: string[]
= [...Object.values(AuthActionTypes).filter((t: string) => t !== AuthActionTypes.UNSET_USER_AS_IDLE),
...Object.values(RequestActionTypes), ...Object.values(NotificationsActionTypes)];
...Object.values(RequestActionTypes), ...Object.values(NotificationsActionTypes)];
@Injectable()
export class AuthEffects {
@@ -213,7 +213,7 @@ export class AuthEffects {
* authorizations endpoint, to be sure to have consistent responses after a login with external idp
*
*/
invalidateAuthorizationsRequestCache$ = createEffect(() => this.actions$
invalidateAuthorizationsRequestCache$ = createEffect(() => this.actions$
.pipe(ofType(StoreActionTypes.REHYDRATE),
tap(() => this.authorizationsService.invalidateAuthorizationsRequestCache())
), { dispatch: false });

View File

@@ -208,7 +208,7 @@ export class AuthInterceptor implements HttpInterceptor {
status: 500,
timestamp: Date.now(),
path: ''
};
};
}
} else {
authStatus.error = error;

View File

@@ -28,14 +28,14 @@ export class AuthStatus implements CacheableObject {
* The unique identifier of this auth status
*/
@autoserialize
id: string;
id: string;
/**
* The type for this AuthStatus
*/
@excludeFromEquals
@autoserialize
type: ResourceType;
type: ResourceType;
/**
* The UUID of this auth status
@@ -43,25 +43,25 @@ export class AuthStatus implements CacheableObject {
* It is based on the ID, so it will be the same for each refresh.
*/
@deserializeAs(new IDToUUIDSerializer('auth-status'), 'id')
uuid: string;
uuid: string;
/**
* True if REST API is up and running, should never return false
*/
@autoserialize
okay: boolean;
okay: boolean;
/**
* If the auth status represents an authenticated state
*/
@autoserialize
authenticated: boolean;
authenticated: boolean;
/**
* The {@link HALLink}s for this AuthStatus
*/
@deserialize
_links: {
_links: {
self: HALLink;
eperson: HALLink;
specialGroups: HALLink;
@@ -72,32 +72,32 @@ export class AuthStatus implements CacheableObject {
* Will be undefined unless the eperson {@link HALLink} has been resolved.
*/
@link(EPERSON)
eperson?: Observable<RemoteData<EPerson>>;
eperson?: Observable<RemoteData<EPerson>>;
/**
* The SpecialGroup of this auth status
* Will be undefined unless the SpecialGroup {@link HALLink} has been resolved.
*/
@link(GROUP, true)
specialGroups?: Observable<RemoteData<PaginatedList<Group>>>;
specialGroups?: Observable<RemoteData<PaginatedList<Group>>>;
/**
* True if the token is valid, false if there was no token or the token wasn't valid
*/
@autoserialize
token?: AuthTokenInfo;
token?: AuthTokenInfo;
/**
* Authentication error if there was one for this status
*/
// TODO should be refactored to use the RemoteData error
@autoserialize
error?: AuthError;
error?: AuthError;
/**
* All authentication methods enabled at the backend
*/
@autoserialize
authMethods: AuthMethod[];
authMethods: AuthMethod[];
}

View File

@@ -17,19 +17,19 @@ export class ShortLivedToken implements CacheableObject {
*/
@excludeFromEquals
@autoserialize
type: ResourceType;
type: ResourceType;
/**
* The value for this ShortLivedToken
*/
@autoserializeAs('token')
value: string;
value: string;
/**
* The {@link HALLink}s for this ShortLivedToken
*/
@deserialize
_links: {
_links: {
self: HALLink;
};
}

View File

@@ -45,11 +45,11 @@ export class ServerAuthRequestService extends AuthRequestService {
map((response: HttpResponse<any>) => response.headers.get(XSRF_RESPONSE_HEADER)),
// Use that token to create an HttpHeaders object
map((xsrfToken: string) => new HttpHeaders()
.set('Content-Type', 'application/json; charset=utf-8')
// set the token as the XSRF header
.set(XSRF_REQUEST_HEADER, xsrfToken)
// and as the DSPACE-XSRF-COOKIE
.set('Cookie', `${DSPACE_XSRF_COOKIE}=${xsrfToken}`)),
.set('Content-Type', 'application/json; charset=utf-8')
// set the token as the XSRF header
.set(XSRF_REQUEST_HEADER, xsrfToken)
// and as the DSPACE-XSRF-COOKIE
.set('Cookie', `${DSPACE_XSRF_COOKIE}=${xsrfToken}`)),
map((headers: HttpHeaders) =>
// Create a new PostRequest using those headers and the given href
new PostRequest(

View File

@@ -25,9 +25,9 @@ import { BrowseDefinition } from '../shared/browse-definition.model';
* Use a GET request specific for BrowseDefinitions.
*/
export const createAndSendBrowseDefinitionGetRequest = (requestService: RequestService,
responseMsToLive: number,
href$: string | Observable<string>,
useCachedVersionIfAvailable: boolean = true): void => {
responseMsToLive: number,
href$: string | Observable<string>,
useCachedVersionIfAvailable: boolean = true): void => {
if (isNotEmpty(href$)) {
if (typeof href$ === 'string') {
href$ = observableOf(href$);

View File

@@ -65,7 +65,7 @@ export const link = <T extends HALResource>(
resourceType: ResourceType,
isList = false,
linkName?: keyof T['_links'],
) => {
) => {
return (target: T, propertyName: string) => {
let targetMap = linkMap.get(target.constructor);

View File

@@ -3,9 +3,9 @@ import { autoserialize } from 'cerialize';
export class SelfLink {
@autoserialize
self: string;
self: string;
@autoserialize
uuid: string;
uuid: string;
}

View File

@@ -16,7 +16,7 @@ export class ObjectCacheEffects {
* This assumes that the server cached everything a negligible
* time ago, and will likely need to be revisited later
*/
fixTimestampsOnRehydrate = createEffect(() => this.actions$
fixTimestampsOnRehydrate = createEffect(() => this.actions$
.pipe(ofType(StoreActionTypes.REHYDRATE),
map(() => new ResetObjectCacheTimestampsAction(new Date().getTime()))
));

View File

@@ -82,12 +82,12 @@ export class ObjectCacheService {
const cacheEntry$ = this.getByHref(href);
const altLinks$ = cacheEntry$.pipe(map((entry: ObjectCacheEntry) => entry.alternativeLinks), take(1));
const childLinks$ = cacheEntry$.pipe(map((entry: ObjectCacheEntry) => {
return Object
.entries(entry.data._links)
.filter(([key, value]: [string, HALLink]) => key !== 'self')
.map(([key, value]: [string, HALLink]) => value.href);
}),
take(1)
return Object
.entries(entry.data._links)
.filter(([key, value]: [string, HALLink]) => key !== 'self')
.map(([key, value]: [string, HALLink]) => value.href);
}),
take(1)
);
this.removeLinksFromAlternativeLinkIndex(altLinks$);
this.removeLinksFromAlternativeLinkIndex(childLinks$);
@@ -96,8 +96,8 @@ export class ObjectCacheService {
private removeLinksFromAlternativeLinkIndex(links$: Observable<string[]>) {
links$.subscribe((links: string[]) => links.forEach((link: string) => {
this.store.dispatch(new RemoveFromIndexBySubstringAction(IndexName.ALTERNATIVE_OBJECT_LINK, link));
}
this.store.dispatch(new RemoveFromIndexBySubstringAction(IndexName.ALTERNATIVE_OBJECT_LINK, link));
}
));
}
@@ -129,14 +129,14 @@ export class ObjectCacheService {
getObjectByHref<T extends CacheableObject>(href: string): Observable<T> {
return this.getByHref(href).pipe(
map((entry: ObjectCacheEntry) => {
if (isNotEmpty(entry.patches)) {
const flatPatch: Operation[] = [].concat(...entry.patches.map((patch) => patch.operations));
const patchedData = applyPatch(entry.data, flatPatch, undefined, false).newDocument;
return Object.assign({}, entry, { data: patchedData });
} else {
return entry;
}
if (isNotEmpty(entry.patches)) {
const flatPatch: Operation[] = [].concat(...entry.patches.map((patch) => patch.operations));
const patchedData = applyPatch(entry.data, flatPatch, undefined, false).newDocument;
return Object.assign({}, entry, { data: patchedData });
} else {
return entry;
}
}
),
map((entry: ObjectCacheEntry) => {
const type: GenericConstructor<T> = getClassForType((entry.data as any).type);

View File

@@ -32,7 +32,7 @@ export class ServerSyncBufferEffects {
* Then dispatch a CommitSSBAction
* When the delay is running, no new AddToSSBActions are processed in this effect
*/
setTimeoutForServerSync = createEffect(() => this.actions$
setTimeoutForServerSync = createEffect(() => this.actions$
.pipe(
ofType(ServerSyncBufferActionTypes.ADD),
exhaustMap((action: AddToSSBAction) => {
@@ -50,7 +50,7 @@ export class ServerSyncBufferEffects {
* When the list of actions is not empty, also dispatch an EmptySSBAction
* When the list is empty dispatch a NO_ACTION placeholder action
*/
commitServerSyncBuffer = createEffect(() => this.actions$
commitServerSyncBuffer = createEffect(() => this.actions$
.pipe(
ofType(ServerSyncBufferActionTypes.COMMIT),
switchMap((action: CommitSSBAction) => {
@@ -78,8 +78,8 @@ export class ServerSyncBufferEffects {
/* Add extra action to array, to make sure the ServerSyncBuffer is emptied afterwards */
if (isNotEmpty(actions) && isNotUndefined(actions[0])) {
return observableCombineLatest(...actions).pipe(
switchMap((array) => [...array, new EmptySSBAction(action.payload)])
);
switchMap((array) => [...array, new EmptySSBAction(action.payload)])
);
} else {
return observableOf(new NoOpAction());
}

View File

@@ -86,9 +86,9 @@ function addToServerSyncQueue(state: ServerSyncBufferState, action: AddToSSBActi
* the new state, with a new entry added to the buffer
*/
function emptyServerSyncQueue(state: ServerSyncBufferState, action: EmptySSBAction): ServerSyncBufferState {
let newBuffer = [];
if (hasValue(action.payload)) {
newBuffer = state.buffer.filter((entry) => entry.method !== action.payload);
}
return Object.assign({}, state, { buffer: newBuffer });
let newBuffer = [];
if (hasValue(action.payload)) {
newBuffer = state.buffer.filter((entry) => entry.method !== action.payload);
}
return Object.assign({}, state, { buffer: newBuffer });
}

View File

@@ -20,19 +20,19 @@ export class BulkAccessConditionOptions extends ConfigObject {
*/
@excludeFromEquals
@autoserialize
type: ResourceType;
type: ResourceType;
@autoserializeAs(String, 'name')
uuid: string;
uuid: string;
@autoserialize
id: string;
id: string;
@autoserialize
itemAccessConditionOptions: AccessesConditionOption[];
itemAccessConditionOptions: AccessesConditionOption[];
@autoserialize
bitstreamAccessConditionOptions: AccessesConditionOption[];
bitstreamAccessConditionOptions: AccessesConditionOption[];
_links: { self: HALLink };
}

View File

@@ -3,43 +3,43 @@
*/
export class AccessesConditionOption {
/**
/**
* The name for this Access Condition
*/
name: string;
name: string;
/**
/**
* The groupName for this Access Condition
*/
groupName: string;
groupName: string;
/**
/**
* A boolean representing if this Access Condition has a start date
*/
hasStartDate: boolean;
hasStartDate: boolean;
/**
/**
* A boolean representing if this Access Condition has an end date
*/
hasEndDate: boolean;
hasEndDate: boolean;
/**
/**
* Maximum value of the start date
*/
endDateLimit?: string;
endDateLimit?: string;
/**
/**
* Maximum value of the end date
*/
startDateLimit?: string;
startDateLimit?: string;
/**
/**
* Maximum value of the start date
*/
maxStartDate?: string;
maxStartDate?: string;
/**
/**
* Maximum value of the end date
*/
maxEndDate?: string;
maxEndDate?: string;
}

View File

@@ -17,25 +17,25 @@ export class SubmissionAccessModel extends ConfigObject {
* A list of available item access conditions
*/
@autoserialize
accessConditionOptions: AccessesConditionOption[];
accessConditionOptions: AccessesConditionOption[];
/**
* Boolean that indicates whether the current item must be findable via search or browse.
*/
@autoserialize
discoverable: boolean;
discoverable: boolean;
/**
* Boolean that indicates whether or not the user can change the discoverable flag.
*/
@autoserialize
canChangeDiscoverable: boolean;
canChangeDiscoverable: boolean;
/**
* The links to all related resources returned by the rest api.
*/
@deserialize
_links: {
_links: {
self: HALLink
};

View File

@@ -18,20 +18,20 @@ export class SubmissionDefinitionModel extends ConfigObject {
* A boolean representing if this submission definition is the default or not
*/
@autoserialize
isDefault: boolean;
isDefault: boolean;
/**
* A list of SubmissionSectionModel that are present in this submission definition
*/
// TODO refactor using remotedata
@deserialize
sections: PaginatedList<SubmissionSectionModel>;
sections: PaginatedList<SubmissionSectionModel>;
/**
* The links to all related resources returned by the rest api.
*/
@deserialize
_links: {
_links: {
self: HALLink,
collections: HALLink,
sections: HALLink

View File

@@ -23,5 +23,5 @@ export class SubmissionFormModel extends ConfigObject {
* An array of [FormRowModel] that are present in this form
*/
@autoserialize
rows: FormRowModel[];
rows: FormRowModel[];
}

View File

@@ -22,31 +22,31 @@ export class SubmissionSectionModel extends ConfigObject {
* The header for this section
*/
@autoserialize
header: string;
header: string;
/**
* A boolean representing if this submission section is the mandatory or not
*/
@autoserialize
mandatory: boolean;
mandatory: boolean;
/**
* A string representing the kind of section object
*/
@autoserialize
sectionType: SectionsType;
sectionType: SectionsType;
/**
* The [SubmissionSectionVisibility] object for this section
*/
@autoserialize
visibility: SubmissionSectionVisibility;
visibility: SubmissionSectionVisibility;
/**
* The {@link HALLink}s for this SubmissionSectionModel
*/
@deserialize
_links: {
_links: {
self: HALLink;
config: HALLink;
};

View File

@@ -16,22 +16,22 @@ export class SubmissionUploadModel extends ConfigObject {
* A list of available bitstream access conditions
*/
@autoserialize
accessConditionOptions: AccessConditionOption[];
accessConditionOptions: AccessConditionOption[];
/**
* An object representing the configuration describing the bitstream metadata form
*/
@link(SUBMISSION_FORMS_TYPE)
metadata?: Observable<RemoteData<SubmissionFormsModel>>;
metadata?: Observable<RemoteData<SubmissionFormsModel>>;
@autoserialize
required: boolean;
required: boolean;
@autoserialize
maxSize: number;
maxSize: number;
@deserialize
_links: {
_links: {
metadata: HALLink
self: HALLink
};

View File

@@ -23,13 +23,13 @@ export abstract class ConfigObject implements CacheableObject {
*/
@excludeFromEquals
@autoserialize
type: ResourceType;
type: ResourceType;
/**
* The links to all related resources returned by the rest api.
*/
@deserialize
_links: {
_links: {
self: HALLink,
[name: string]: HALLink
};

View File

@@ -1,5 +1,5 @@
import {
BitstreamFormatRegistryState
BitstreamFormatRegistryState
} from '../admin/admin-registries/bitstream-formats/bitstream-format.reducers';
import { ObjectCacheState } from './cache/object-cache.reducer';
import { ServerSyncBufferState } from './cache/server-sync-buffer.reducer';

View File

@@ -64,7 +64,7 @@ export abstract class BaseResponseParsingService {
} else if (isRestDataObject(data._embedded[property])) {
object[property] = this.retrieveObjectOrUrl(parsedObj);
} else if (Array.isArray(parsedObj)) {
object[property] = parsedObj.map((obj) => this.retrieveObjectOrUrl(obj));
object[property] = parsedObj.map((obj) => this.retrieveObjectOrUrl(obj));
}
}
});
@@ -102,8 +102,8 @@ export abstract class BaseResponseParsingService {
protected processArray<ObjectDomain>(data: any, request: RestRequest): ObjectDomain[] {
let array: ObjectDomain[] = [];
data.forEach((datum) => {
array = [...array, this.process(datum, request)];
}
array = [...array, this.process(datum, request)];
}
);
return array;
}

View File

@@ -373,10 +373,10 @@ export class BaseDataService<T extends CacheableObject> implements HALDataServic
return this.hasCachedResponse(href$).pipe(
switchMap((hasCachedResponse) => {
if (hasCachedResponse) {
return this.rdbService.buildSingle(href$).pipe(
getFirstCompletedRemoteData(),
map((rd => rd.hasFailed))
);
return this.rdbService.buildSingle(href$).pipe(
getFirstCompletedRemoteData(),
map((rd => rd.hasFailed))
);
}
return observableOf(false);
})

View File

@@ -143,8 +143,8 @@ describe('FindAllDataImpl', () => {
options = {};
(service as any).getFindAllHref(options).subscribe((value) => {
expect(value).toBe(endpoint);
},
expect(value).toBe(endpoint);
},
);
});

View File

@@ -26,22 +26,22 @@ describe('BrowseResponseParsingService', () => {
describe('', () => {
const mockFlatBrowse = {
id: 'title',
browseType: 'flatBrowse',
type: 'browse',
};
id: 'title',
browseType: 'flatBrowse',
type: 'browse',
};
const mockValueList = {
id: 'author',
browseType: 'valueList',
type: 'browse',
};
id: 'author',
browseType: 'valueList',
type: 'browse',
};
const mockHierarchicalBrowse = {
id: 'srsc',
browseType: 'hierarchicalBrowse',
type: 'browse',
};
id: 'srsc',
browseType: 'hierarchicalBrowse',
type: 'browse',
};
it('should deserialize flatBrowses correctly', () => {
let deserialized = service.deserialize(mockFlatBrowse);

View File

@@ -42,7 +42,7 @@ class DsoByIdOrUUIDDataService extends IdentifiableDataService<DSpaceObject> {
// interpolate id/uuid as query parameter
(endpoint: string, resourceID: string): string => {
return endpoint.replace(/{\?id}/, `?id=${resourceID}`)
.replace(/{\?uuid}/, `?uuid=${resourceID}`);
.replace(/{\?uuid}/, `?uuid=${resourceID}`);
},
);
}

View File

@@ -184,8 +184,8 @@ export class DspaceRestResponseParsingService implements ResponseParsingService
protected processArray<ObjectDomain>(data: any, request: RestRequest): ObjectDomain[] {
let array: ObjectDomain[] = [];
data.forEach((datum) => {
array = [...array, this.process(datum, request)];
}
array = [...array, this.process(datum, request)];
}
);
return array;
}

View File

@@ -11,17 +11,17 @@ import { FeatureID } from '../feature-id';
* management rights
*/
@Injectable({
providedIn: 'root'
providedIn: 'root'
})
export class StatisticsAdministratorGuard extends SingleFeatureAuthorizationGuard {
constructor(protected authorizationService: AuthorizationDataService, protected router: Router, protected authService: AuthService) {
super(authorizationService, router, authService);
}
constructor(protected authorizationService: AuthorizationDataService, protected router: Router, protected authService: AuthService) {
super(authorizationService, router, authService);
}
/**
/**
* Check group management rights
*/
getFeatureID(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<FeatureID> {
return observableOf(FeatureID.CanViewUsageStatistics);
}
getFeatureID(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<FeatureID> {
return observableOf(FeatureID.CanViewUsageStatistics);
}
}

View File

@@ -5,11 +5,11 @@ import { RequestParam } from '../cache/models/request-param.model';
* The options for a find list request
*/
export class FindListOptions {
scopeID?: string;
elementsPerPage?: number;
currentPage?: number;
sort?: SortOptions;
searchParams?: RequestParam[];
startsWith?: string;
fetchThumbnail?: boolean;
scopeID?: string;
elementsPerPage?: number;
currentPage?: number;
sort?: SortOptions;
searchParams?: RequestParam[];
startsWith?: string;
fetchThumbnail?: boolean;
}

View File

@@ -23,60 +23,60 @@ describe(`HrefOnlyDataService`, () => {
expect((service as any).dataService).toBeInstanceOf(BaseDataService);
});
describe(`findByHref`, () => {
beforeEach(() => {
spy = spyOn((service as any).dataService, 'findByHref').and.returnValue(createSuccessfulRemoteDataObject$(null));
});
describe(`findByHref`, () => {
beforeEach(() => {
spy = spyOn((service as any).dataService, 'findByHref').and.returnValue(createSuccessfulRemoteDataObject$(null));
});
it(`should forward to findByHref on the internal DataService`, () => {
service.findByHref(href, false, false, ...followLinks);
expect(spy).toHaveBeenCalledWith(href, false, false, ...followLinks);
});
it(`should forward to findByHref on the internal DataService`, () => {
service.findByHref(href, false, false, ...followLinks);
expect(spy).toHaveBeenCalledWith(href, false, false, ...followLinks);
});
describe(`when useCachedVersionIfAvailable is omitted`, () => {
it(`should call findByHref on the internal DataService with useCachedVersionIfAvailable = true`, () => {
service.findByHref(href);
expect(spy).toHaveBeenCalledWith(jasmine.anything(), true, jasmine.anything());
});
});
describe(`when reRequestOnStale is omitted`, () => {
it(`should call findByHref on the internal DataService with reRequestOnStale = true`, () => {
service.findByHref(href);
expect(spy).toHaveBeenCalledWith(jasmine.anything(), jasmine.anything(), true);
});
describe(`when useCachedVersionIfAvailable is omitted`, () => {
it(`should call findByHref on the internal DataService with useCachedVersionIfAvailable = true`, () => {
service.findByHref(href);
expect(spy).toHaveBeenCalledWith(jasmine.anything(), true, jasmine.anything());
});
});
describe(`findListByHref`, () => {
beforeEach(() => {
spy = spyOn((service as any).dataService, 'findListByHref').and.returnValue(createSuccessfulRemoteDataObject$(null));
});
it(`should delegate to findListByHref on the internal DataService`, () => {
service.findListByHref(href, findListOptions, false, false, ...followLinks);
expect(spy).toHaveBeenCalledWith(href, findListOptions, false, false, ...followLinks);
});
describe(`when findListOptions is omitted`, () => {
it(`should call findListByHref on the internal DataService with findListOptions = {}`, () => {
service.findListByHref(href);
expect(spy).toHaveBeenCalledWith(jasmine.anything(), {}, jasmine.anything(), jasmine.anything());
});
});
describe(`when useCachedVersionIfAvailable is omitted`, () => {
it(`should call findListByHref on the internal DataService with useCachedVersionIfAvailable = true`, () => {
service.findListByHref(href);
expect(spy).toHaveBeenCalledWith(jasmine.anything(), jasmine.anything(), true, jasmine.anything());
});
});
describe(`when reRequestOnStale is omitted`, () => {
it(`should call findListByHref on the internal DataService with reRequestOnStale = true`, () => {
service.findListByHref(href);
expect(spy).toHaveBeenCalledWith(jasmine.anything(), jasmine.anything(), jasmine.anything(), true);
});
describe(`when reRequestOnStale is omitted`, () => {
it(`should call findByHref on the internal DataService with reRequestOnStale = true`, () => {
service.findByHref(href);
expect(spy).toHaveBeenCalledWith(jasmine.anything(), jasmine.anything(), true);
});
});
});
describe(`findListByHref`, () => {
beforeEach(() => {
spy = spyOn((service as any).dataService, 'findListByHref').and.returnValue(createSuccessfulRemoteDataObject$(null));
});
it(`should delegate to findListByHref on the internal DataService`, () => {
service.findListByHref(href, findListOptions, false, false, ...followLinks);
expect(spy).toHaveBeenCalledWith(href, findListOptions, false, false, ...followLinks);
});
describe(`when findListOptions is omitted`, () => {
it(`should call findListByHref on the internal DataService with findListOptions = {}`, () => {
service.findListByHref(href);
expect(spy).toHaveBeenCalledWith(jasmine.anything(), {}, jasmine.anything(), jasmine.anything());
});
});
describe(`when useCachedVersionIfAvailable is omitted`, () => {
it(`should call findListByHref on the internal DataService with useCachedVersionIfAvailable = true`, () => {
service.findListByHref(href);
expect(spy).toHaveBeenCalledWith(jasmine.anything(), jasmine.anything(), true, jasmine.anything());
});
});
describe(`when reRequestOnStale is omitted`, () => {
it(`should call findListByHref on the internal DataService with reRequestOnStale = true`, () => {
service.findListByHref(href);
expect(spy).toHaveBeenCalledWith(jasmine.anything(), jasmine.anything(), jasmine.anything(), true);
});
});
});
});

View File

@@ -85,8 +85,8 @@ describe('ObjectUpdatesEffects', () => {
updatesEffects.removeAfterDiscardOrReinstateOnUndo$.pipe(
filter(((action) => hasValue(action))))
.subscribe((t) => {
expect(t).toEqual(removeAction);
}
expect(t).toEqual(removeAction);
}
)
;
});
@@ -101,8 +101,8 @@ describe('ObjectUpdatesEffects', () => {
actions = hot('a', { a: new DiscardObjectUpdatesAction(testURL, infoNotification) });
actions = hot('b', { b: new ReinstateObjectUpdatesAction(testURL) });
updatesEffects.removeAfterDiscardOrReinstateOnUndo$.subscribe((t) => {
expect(t).toEqual(new NoOpAction());
}
expect(t).toEqual(new NoOpAction());
}
);
});
});

View File

@@ -52,7 +52,7 @@ export class ObjectUpdatesEffects {
/**
* Effect that makes sure all last fired ObjectUpdatesActions are stored in the map of this service, with the url as their key
*/
mapLastActions$ = createEffect(() => this.actions$
mapLastActions$ = createEffect(() => this.actions$
.pipe(
ofType(...Object.values(ObjectUpdatesActionTypes)),
map((action: ObjectUpdatesAction) => {
@@ -69,16 +69,16 @@ export class ObjectUpdatesEffects {
/**
* Effect that makes sure all last fired NotificationActions are stored in the notification map of this service, with the id as their key
*/
mapLastNotificationActions$ = createEffect(() => this.actions$
mapLastNotificationActions$ = createEffect(() => this.actions$
.pipe(
ofType(...Object.values(NotificationsActionTypes)),
map((action: RemoveNotificationAction) => {
const id: string = action.payload.id || action.payload || this.allIdentifier;
if (hasNoValue(this.notificationActionMap$[id])) {
this.notificationActionMap$[id] = new Subject<NotificationsActions>();
}
this.notificationActionMap$[id].next(action);
const id: string = action.payload.id || action.payload || this.allIdentifier;
if (hasNoValue(this.notificationActionMap$[id])) {
this.notificationActionMap$[id] = new Subject<NotificationsActions>();
}
this.notificationActionMap$[id].next(action);
}
)
), { dispatch: false });
@@ -88,51 +88,51 @@ export class ObjectUpdatesEffects {
* When a REINSTATE action is fired during the timeout, a NO_ACTION action will be returned
* When any other ObjectUpdatesAction is fired during the timeout, a RemoteObjectUpdatesAction will be returned
*/
removeAfterDiscardOrReinstateOnUndo$ = createEffect(() => this.actions$
removeAfterDiscardOrReinstateOnUndo$ = createEffect(() => this.actions$
.pipe(
ofType(ObjectUpdatesActionTypes.DISCARD),
switchMap((action: DiscardObjectUpdatesAction) => {
const url: string = action.payload.url;
const notification: INotification = action.payload.notification;
const timeOut = notification.options.timeOut;
const url: string = action.payload.url;
const notification: INotification = action.payload.notification;
const timeOut = notification.options.timeOut;
let removeAction: Action = new RemoveObjectUpdatesAction(action.payload.url);
if (action.payload.discardAll) {
removeAction = new RemoveAllObjectUpdatesAction();
}
return observableRace(
// Either wait for the delay and perform a remove action
observableOf(removeAction).pipe(delay(timeOut)),
// Or wait for a a user action
this.actionMap$[url].pipe(
take(1),
tap(() => {
this.notificationsService.remove(notification);
}),
map((updateAction: ObjectUpdatesAction) => {
if (updateAction.type === ObjectUpdatesActionTypes.REINSTATE) {
// If someone reinstated, do nothing, just let the reinstating happen
return new NoOpAction();
}
// If someone performed another action, assume the user does not want to reinstate and remove all changes
return removeAction;
})
),
this.notificationActionMap$[notification.id].pipe(
filter((notificationsAction: NotificationsActions) => notificationsAction.type === NotificationsActionTypes.REMOVE_NOTIFICATION),
map(() => {
return removeAction;
})
),
this.notificationActionMap$[this.allIdentifier].pipe(
filter((notificationsAction: NotificationsActions) => notificationsAction.type === NotificationsActionTypes.REMOVE_ALL_NOTIFICATIONS),
map(() => {
return removeAction;
})
)
);
let removeAction: Action = new RemoveObjectUpdatesAction(action.payload.url);
if (action.payload.discardAll) {
removeAction = new RemoveAllObjectUpdatesAction();
}
return observableRace(
// Either wait for the delay and perform a remove action
observableOf(removeAction).pipe(delay(timeOut)),
// Or wait for a a user action
this.actionMap$[url].pipe(
take(1),
tap(() => {
this.notificationsService.remove(notification);
}),
map((updateAction: ObjectUpdatesAction) => {
if (updateAction.type === ObjectUpdatesActionTypes.REINSTATE) {
// If someone reinstated, do nothing, just let the reinstating happen
return new NoOpAction();
}
// If someone performed another action, assume the user does not want to reinstate and remove all changes
return removeAction;
})
),
this.notificationActionMap$[notification.id].pipe(
filter((notificationsAction: NotificationsActions) => notificationsAction.type === NotificationsActionTypes.REMOVE_NOTIFICATION),
map(() => {
return removeAction;
})
),
this.notificationActionMap$[this.allIdentifier].pipe(
filter((notificationsAction: NotificationsActions) => notificationsAction.type === NotificationsActionTypes.REMOVE_ALL_NOTIFICATIONS),
map(() => {
return removeAction;
})
)
);
}
)
));

View File

@@ -139,16 +139,16 @@ export class ObjectUpdatesService {
return objectUpdates.pipe(
hasValueOperator(),
map((objectEntry) => {
const fieldUpdates: FieldUpdates = {};
for (const object of initialFields) {
let fieldUpdate = objectEntry.fieldUpdates[object.uuid];
if (isEmpty(fieldUpdate)) {
fieldUpdate = { field: object, changeType: undefined };
const fieldUpdates: FieldUpdates = {};
for (const object of initialFields) {
let fieldUpdate = objectEntry.fieldUpdates[object.uuid];
if (isEmpty(fieldUpdate)) {
fieldUpdate = { field: object, changeType: undefined };
}
fieldUpdates[object.uuid] = fieldUpdate;
}
fieldUpdates[object.uuid] = fieldUpdate;
}
return fieldUpdates;
}));
return fieldUpdates;
}));
}
/**
@@ -234,7 +234,7 @@ export class ObjectUpdatesService {
.pipe(
select(virtualMetadataSourceSelector(url, relationship)),
map((virtualMetadataSource) => virtualMetadataSource && virtualMetadataSource[item]),
);
);
}
/**

View File

@@ -64,13 +64,13 @@ export class PaginatedList<T> extends CacheableObject {
* The type of the list
*/
@excludeFromEquals
type = PAGINATED_LIST;
type = PAGINATED_LIST;
/**
* The type of objects in the list
*/
@autoserialize
objectType?: ResourceType;
objectType?: ResourceType;
/**
* The list of objects that represents the current page
@@ -81,13 +81,13 @@ export class PaginatedList<T> extends CacheableObject {
* the {@link PageInfo} object
*/
@autoserialize
pageInfo?: PageInfo;
pageInfo?: PageInfo;
/**
* The {@link HALLink}s for this PaginatedList
*/
@deserialize
_links: {
_links: {
self: HALLink;
page: HALLink[];
first?: HALLink;

View File

@@ -64,7 +64,7 @@ export class PrimaryBitstreamService {
endpointURL,
primaryBitstreamSelfLink,
this.getHttpOptions()
);
);
this.requestService.send(request);

View File

@@ -264,7 +264,7 @@ describe('RelationshipDataService', () => {
authority: 'virtual::related-creator',
place: 3,
}),
Object.assign(new MetadataValue(), {
Object.assign(new MetadataValue(), {
language: null,
value: 'Related Creator with authority - unauthorized',
authority: 'virtual::related-creator-unauthorized',

View File

@@ -169,7 +169,7 @@ export class RelationshipDataService extends IdentifiableDataService<Relationshi
switchMap((rel: Relationship) => observableCombineLatest(
rel.leftItem.pipe(getFirstSucceededRemoteData(), getRemoteDataPayload()),
rel.rightItem.pipe(getFirstSucceededRemoteData(), getRemoteDataPayload())
)
)
),
take(1)
).subscribe(([item1, item2]) => {
@@ -237,7 +237,7 @@ export class RelationshipDataService extends IdentifiableDataService<Relationshi
return relationshipType.rightwardType;
}
})
)
)
));
}
@@ -346,21 +346,21 @@ export class RelationshipDataService extends IdentifiableDataService<Relationshi
followLink('leftItem'),
followLink('rightItem')
).pipe(
getFirstSucceededRemoteData(),
// the mergemap below will emit all elements of the list as separate events
mergeMap((relationshipListRD: RemoteData<PaginatedList<Relationship>>) => relationshipListRD.payload.page),
mergeMap((relationship: Relationship) => {
return observableCombineLatest([
this.itemService.findByHref(relationship._links.leftItem.href).pipe(compareItemsByUUID(item2)),
this.itemService.findByHref(relationship._links.rightItem.href).pipe(compareItemsByUUID(item2))
]).pipe(
map(([isLeftItem, isRightItem]) => isLeftItem || isRightItem),
map((isMatch) => isMatch ? relationship : undefined)
);
}),
filter((relationship) => hasValue(relationship)),
take(1)
);
getFirstSucceededRemoteData(),
// the mergemap below will emit all elements of the list as separate events
mergeMap((relationshipListRD: RemoteData<PaginatedList<Relationship>>) => relationshipListRD.payload.page),
mergeMap((relationship: Relationship) => {
return observableCombineLatest([
this.itemService.findByHref(relationship._links.leftItem.href).pipe(compareItemsByUUID(item2)),
this.itemService.findByHref(relationship._links.rightItem.href).pipe(compareItemsByUUID(item2))
]).pipe(
map(([isLeftItem, isRightItem]) => isLeftItem || isRightItem),
map((isMatch) => isMatch ? relationship : undefined)
);
}),
filter((relationship) => hasValue(relationship)),
take(1)
);
}
/**
@@ -494,31 +494,31 @@ export class RelationshipDataService extends IdentifiableDataService<Relationshi
searchByItemsAndType(typeId: string,itemUuid: string,relationshipLabel: string, arrayOfItemIds: string[] ): Observable<RemoteData<PaginatedList<Relationship>>> {
const searchParams = [
{
fieldName: 'typeId',
fieldValue: typeId
},
{
fieldName: 'focusItem',
fieldValue: itemUuid
},
{
fieldName: 'relationshipLabel',
fieldValue: relationshipLabel
},
{
fieldName: 'size',
fieldValue: arrayOfItemIds.length
},
{
fieldName: 'embed',
fieldValue: 'leftItem'
},
{
fieldName: 'embed',
fieldValue: 'rightItem'
},
];
{
fieldName: 'typeId',
fieldValue: typeId
},
{
fieldName: 'focusItem',
fieldValue: itemUuid
},
{
fieldName: 'relationshipLabel',
fieldValue: relationshipLabel
},
{
fieldName: 'size',
fieldValue: arrayOfItemIds.length
},
{
fieldName: 'embed',
fieldValue: 'leftItem'
},
{
fieldName: 'embed',
fieldValue: 'rightItem'
},
];
arrayOfItemIds.forEach( (itemId) => {
searchParams.push(

View File

@@ -62,33 +62,33 @@ export class RelationshipTypeDataService extends BaseDataService<RelationshipTyp
getRelationshipTypeByLabelAndTypes(relationshipTypeLabel: string, firstItemType: string, secondItemType: string): Observable<RelationshipType> {
// Retrieve all relationship types from the server in a single page
return this.findAllData.findAll({ currentPage: 1, elementsPerPage: 9999 }, true, true, followLink('leftType'), followLink('rightType'))
.pipe(
getFirstSucceededRemoteData(),
// Emit each type in the page array separately
switchMap((typeListRD: RemoteData<PaginatedList<RelationshipType>>) => typeListRD.payload.page),
// Check each type individually, to see if it matches the provided types
mergeMap((relationshipType: RelationshipType) => {
if (relationshipType.leftwardType === relationshipTypeLabel) {
return this.checkType(relationshipType, firstItemType, secondItemType);
} else if (relationshipType.rightwardType === relationshipTypeLabel) {
return this.checkType(relationshipType, secondItemType, firstItemType);
} else {
return [null];
}
}),
// Wait for all types to be checked and emit once, with the results combined back into an
// array
toArray(),
// Look for a match in the array and emit it if found, or null if one isn't found
map((types: RelationshipType[]) => {
const match = types.find((type: RelationshipType) => hasValue(type));
if (hasValue(match)) {
return match;
} else {
return null;
}
}),
);
.pipe(
getFirstSucceededRemoteData(),
// Emit each type in the page array separately
switchMap((typeListRD: RemoteData<PaginatedList<RelationshipType>>) => typeListRD.payload.page),
// Check each type individually, to see if it matches the provided types
mergeMap((relationshipType: RelationshipType) => {
if (relationshipType.leftwardType === relationshipTypeLabel) {
return this.checkType(relationshipType, firstItemType, secondItemType);
} else if (relationshipType.rightwardType === relationshipTypeLabel) {
return this.checkType(relationshipType, secondItemType, firstItemType);
} else {
return [null];
}
}),
// Wait for all types to be checked and emit once, with the results combined back into an
// array
toArray(),
// Look for a match in the array and emit it if found, or null if one isn't found
map((types: RelationshipType[]) => {
const match = types.find((type: RelationshipType) => hasValue(type));
if (hasValue(match)) {
return match;
} else {
return null;
}
}),
);
}
/**

View File

@@ -6,8 +6,8 @@ import { ResponseState } from './response-state.model';
* An entry for a request in the NgRx store
*/
export class RequestEntry {
request: RestRequestWithResponseParser;
state: RequestEntryState;
response: ResponseState;
lastUpdated: number;
request: RestRequestWithResponseParser;
state: RequestEntryState;
response: ResponseState;
lastUpdated: number;
}

View File

@@ -25,7 +25,7 @@ import { RequestEntry } from './request-entry.model';
@Injectable()
export class RequestEffects {
execute = createEffect(() => this.actions$.pipe(
execute = createEffect(() => this.actions$.pipe(
ofType(RequestActionTypes.EXECUTE),
mergeMap((action: RequestExecuteAction) => {
return this.requestService.getByUUID(action.payload).pipe(
@@ -64,7 +64,7 @@ export class RequestEffects {
* This assumes that the server cached everything a negligible
* time ago, and will likely need to be revisited later
*/
fixTimestampsOnRehydrate = createEffect(() => this.actions$
fixTimestampsOnRehydrate = createEffect(() => this.actions$
.pipe(ofType(StoreActionTypes.REHYDRATE),
map(() => new ResetResponseTimestampsAction(new Date().getTime()))
));

View File

@@ -188,14 +188,14 @@ export class RequestService {
private fixRequestHeaders() {
return (source: Observable<RequestEntry>): Observable<RequestEntry> => {
return source.pipe(map((entry: RequestEntry) => {
// Headers break after being retrieved from the store (because of lazy initialization)
// Combining them with a new object fixes this issue
if (hasValue(entry) && hasValue(entry.request) && hasValue(entry.request.options) && hasValue(entry.request.options.headers)) {
entry = cloneDeep(entry);
entry.request.options.headers = Object.assign(new HttpHeaders(), entry.request.options.headers);
}
return entry;
})
// Headers break after being retrieved from the store (because of lazy initialization)
// Combining them with a new object fixes this issue
if (hasValue(entry) && hasValue(entry.request) && hasValue(entry.request.options) && hasValue(entry.request.options.headers)) {
entry = cloneDeep(entry);
entry.request.options.headers = Object.assign(new HttpHeaders(), entry.request.options.headers);
}
return entry;
})
);
};
}
@@ -331,7 +331,7 @@ export class RequestService {
map((request: RequestEntry) => isStale(request.state)),
filter((stale: boolean) => stale),
take(1),
);
);
}
/**

View File

@@ -5,9 +5,9 @@ import { UnCacheableObject } from '../shared/uncacheable-object.model';
* The response substate in the NgRx store
*/
export class ResponseState {
timeCompleted: number;
statusCode: number;
errorMessage?: string;
payloadLink?: HALLink;
unCacheableObject?: UnCacheableObject;
timeCompleted: number;
statusCode: number;
errorMessage?: string;
payloadLink?: HALLink;
unCacheableObject?: UnCacheableObject;
}

View File

@@ -6,15 +6,15 @@ import { HttpOptions } from '../dspace-rest/dspace-rest.service';
* A request to the DSpace REST API
*/
export abstract class RestRequest {
public responseMsToLive = environment.cache.msToLive.default;
public isMultipart = false;
public responseMsToLive = environment.cache.msToLive.default;
public isMultipart = false;
constructor(
constructor(
public uuid: string,
public href: string,
public method: RestRequestMethod = RestRequestMethod.GET,
public body?: any,
public options?: HttpOptions,
) {
}
) {
}
}

View File

@@ -18,37 +18,37 @@ export class Root implements CacheableObject {
*/
@excludeFromEquals
@autoserialize
type: ResourceType;
type: ResourceType;
/**
* The url for the dspace UI
*/
@autoserialize
dspaceUI: string;
dspaceUI: string;
/**
* The repository Name
*/
@autoserialize
dspaceName: string;
dspaceName: string;
/**
* The url for the rest api
*/
@autoserialize
dspaceServer: string;
dspaceServer: string;
/**
* The current DSpace version
*/
@autoserialize
dspaceVersion: string;
dspaceVersion: string;
/**
* The {@link HALLink}s for the root object
*/
@deserialize
_links: {
_links: {
self: HALLink;
[k: string]: HALLink | HALLink[];
};

View File

@@ -5,13 +5,13 @@ import { DSpaceSerializer } from './dspace.serializer';
class TestModel implements HALResource {
@autoserialize
id: string;
id: string;
@autoserialize
name: string;
name: string;
@deserialize
_links: {
_links: {
self: HALLink;
parents: HALLink;
};

View File

@@ -5,17 +5,17 @@ import { EPerson } from './eperson.model';
*/
export class EpersonDtoModel {
/**
/**
* The EPerson linked to this object
*/
public eperson: EPerson;
/**
public eperson: EPerson;
/**
* Whether or not the linked EPerson is able to be deleted
*/
public ableToDelete: boolean;
/**
public ableToDelete: boolean;
/**
* Whether or not this EPerson is member of group on page it is being used on
*/
public memberOfGroup: boolean;
public memberOfGroup: boolean;
}

View File

@@ -40,7 +40,7 @@ export class Group extends DSpaceObject {
* The {@link HALLink}s for this Group
*/
@deserialize
_links: {
_links: {
self: HALLink;
subgroups: HALLink;
epersons: HALLink;

View File

@@ -24,7 +24,7 @@ import { CoreState } from '../core-state.model';
@Injectable()
export class UUIDIndexEffects {
addObject$ = createEffect(() => this.actions$
addObject$ = createEffect(() => this.actions$
.pipe(
ofType(ObjectCacheActionTypes.ADD),
filter((action: AddToObjectCacheAction) => hasValue(action.payload.objectToCache.uuid)),
@@ -41,7 +41,7 @@ export class UUIDIndexEffects {
* Adds an alternative link to an object to the ALTERNATIVE_OBJECT_LINK index
* When the self link of the objectToCache is not the same as the alternativeLink
*/
addAlternativeObjectLink$ = createEffect(() => this.actions$
addAlternativeObjectLink$ = createEffect(() => this.actions$
.pipe(
ofType(ObjectCacheActionTypes.ADD),
map((action: AddToObjectCacheAction) => {
@@ -59,7 +59,7 @@ export class UUIDIndexEffects {
})
));
removeObject$ = createEffect(() => this.actions$
removeObject$ = createEffect(() => this.actions$
.pipe(
ofType(ObjectCacheActionTypes.REMOVE),
map((action: RemoveFromObjectCacheAction) => {
@@ -70,18 +70,18 @@ export class UUIDIndexEffects {
})
));
addRequest$ = createEffect(() => this.actions$
addRequest$ = createEffect(() => this.actions$
.pipe(
ofType(RequestActionTypes.CONFIGURE),
filter((action: RequestConfigureAction) => action.payload.method === RestRequestMethod.GET),
switchMap((action: RequestConfigureAction) => {
const href = getUrlWithoutEmbedParams(action.payload.href);
return this.store.pipe(
select(uuidFromHrefSelector(href)),
take(1),
map((uuid: string) => [action, uuid])
);
}
select(uuidFromHrefSelector(href)),
take(1),
map((uuid: string) => [action, uuid])
);
}
),
switchMap(([action, uuid]: [RequestConfigureAction, string]) => {
let actions = [];

View File

@@ -17,7 +17,7 @@ export class JsonPatchOperationsEffects {
/**
* Dispatches a FlushPatchOperationsAction for every dispatched CommitPatchOperationsAction
*/
commit$ = createEffect(() => this.actions$.pipe(
commit$ = createEffect(() => this.actions$.pipe(
ofType(JsonPatchOperationsActionTypes.COMMIT_JSON_PATCH_OPERATIONS),
map((action: CommitPatchOperationsAction) => {
return new FlushPatchOperationsAction(action.payload.resourceType, action.payload.resourceId);

View File

@@ -100,7 +100,7 @@ export abstract class JsonPatchOperationsService<ResponseDefinitionDomain, Patch
}
}),
distinctUntilChanged()
);
);
}))
);
}

View File

@@ -80,7 +80,7 @@ export class LocaleService {
mergeMap(([isAuthenticated, isLoaded]) => {
// TODO to enabled again when https://github.com/DSpace/dspace-angular/issues/739 will be resolved
const epersonLang$: Observable<string[]> = observableOf([]);
/* if (isAuthenticated && isLoaded) {
/* if (isAuthenticated && isLoaded) {
epersonLang$ = this.authService.getAuthenticatedUserFromStore().pipe(
take(1),
map((eperson) => {
@@ -176,11 +176,11 @@ export class LocaleService {
divisor = 1;
}
languages.forEach( (lang) => {
let value = lang + ';q=';
let quality = (v - idx++) / v;
quality = ((languages.length > 10) ? quality.toFixed(2) : quality) as number;
value += quality / divisor;
langWithPrior.push(value);
let value = lang + ';q=';
let quality = (v - idx++) / v;
quality = ((languages.length > 10) ? quality.toFixed(2) : quality) as number;
value += quality / divisor;
langWithPrior.push(value);
});
return langWithPrior;
}

View File

@@ -25,37 +25,37 @@ export class MetadataField extends ListableObject implements HALResource {
*/
@excludeFromEquals
@autoserialize
type: ResourceType;
type: ResourceType;
/**
* The identifier of this metadata field
*/
@autoserialize
id: number;
id: number;
/**
* The element of this metadata field
*/
@autoserialize
element: string;
element: string;
/**
* The qualifier of this metadata field
*/
@autoserialize
qualifier: string;
qualifier: string;
/**
* The scope note of this metadata field
*/
@autoserialize
scopeNote: string;
scopeNote: string;
/**
* The {@link HALLink}s for this MetadataField
*/
@deserialize
_links: {
_links: {
self: HALLink,
schema: HALLink
};
@@ -65,7 +65,7 @@ export class MetadataField extends ListableObject implements HALResource {
* Will be undefined unless the schema {@link HALLink} has been resolved.
*/
@link(METADATA_SCHEMA)
schema?: Observable<RemoteData<MetadataSchema>>;
schema?: Observable<RemoteData<MetadataSchema>>;
/**
* Method to print this metadata field as a string without the schema

View File

@@ -19,29 +19,29 @@ export class MetadataSchema extends ListableObject implements HALResource {
* The unique identifier for this metadata schema
*/
@autoserialize
id: number;
id: number;
/**
* The object type
*/
@excludeFromEquals
@autoserialize
type: ResourceType;
type: ResourceType;
/**
* A unique prefix that defines this schema
*/
@autoserialize
prefix: string;
prefix: string;
/**
* The namespace of this metadata schema
*/
@autoserialize
namespace: string;
namespace: string;
@deserialize
_links: {
_links: {
self: HALLink,
};

View File

@@ -308,11 +308,11 @@ export class MetadataService {
true,
followLink('primaryBitstream'),
followLink('bitstreams', {
findListOptions: {
// limit the number of bitstreams used to find the citation pdf url to the number
// shown by default on an item page
elementsPerPage: this.appConfig.item.bitstream.pageSize
}
findListOptions: {
// limit the number of bitstreams used to find the citation pdf url to the number
// shown by default on an item page
elementsPerPage: this.appConfig.item.bitstream.pageSize
}
}, followLink('format')),
).pipe(
getFirstSucceededRemoteDataPayload(),

View File

@@ -19,49 +19,49 @@ export class OrcidHistory extends CacheableObject {
*/
@excludeFromEquals
@autoserialize
type: ResourceType;
type: ResourceType;
/**
* The identifier of this Orcid History record
*/
@autoserialize
id: number;
id: number;
/**
* The name of the related entity
*/
@autoserialize
entityName: string;
entityName: string;
/**
* The identifier of the profileItem of this Orcid History record.
*/
@autoserialize
profileItemId: string;
profileItemId: string;
/**
* The identifier of the entity related to this Orcid History record.
*/
@autoserialize
entityId: string;
entityId: string;
/**
* The type of the entity related to this Orcid History record.
*/
@autoserialize
entityType: string;
entityType: string;
/**
* The response status coming from ORCID api.
*/
@autoserialize
status: number;
status: number;
/**
* The putCode assigned by ORCID to the entity.
*/
@autoserialize
putCode: string;
putCode: string;
/**
* The last send attempt timestamp.
@@ -82,7 +82,7 @@ export class OrcidHistory extends CacheableObject {
* The {@link HALLink}s for this Orcid History record
*/
@deserialize
_links: {
_links: {
self: HALLink,
};

View File

@@ -19,49 +19,49 @@ export class OrcidQueue extends CacheableObject {
*/
@excludeFromEquals
@autoserialize
type: ResourceType;
type: ResourceType;
/**
* The identifier of this Orcid Queue record
*/
@autoserialize
id: number;
id: number;
/**
* The record description.
*/
@autoserialize
description: string;
description: string;
/**
* The identifier of the profileItem of this Orcid Queue record.
*/
@autoserialize
profileItemId: string;
profileItemId: string;
/**
* The identifier of the entity related to this Orcid Queue record.
*/
@autoserialize
entityId: string;
entityId: string;
/**
* The type of this Orcid Queue record.
*/
@autoserialize
recordType: string;
recordType: string;
/**
* The operation related to this Orcid Queue record.
*/
@autoserialize
operation: string;
operation: string;
/**
* The {@link HALLink}s for this Orcid Queue record
*/
@deserialize
_links: {
_links: {
self: HALLink,
};

Some files were not shown because too many files have changed in this diff Show More