Fixed lint errors and add lint fix script

This commit is contained in:
Giuseppe Digilio
2020-12-04 10:32:46 +01:00
parent 587affd064
commit 20b5721e3c
322 changed files with 759 additions and 752 deletions

View File

@@ -15,7 +15,7 @@ export class ProtractorPage {
}
waitUntilNotLoading(): promise.Promise<unknown> {
const loading = element(by.css('.loader'))
const loading = element(by.css('.loader'));
const EC = protractor.ExpectedConditions;
const notLoading = EC.not(EC.presenceOf(loading));
return browser.wait(notLoading, 10000);

View File

@@ -29,6 +29,7 @@
"test": "npm run ng-high-memory -- test --sourceMap=true --watch=true",
"test:headless": "npm run ng-high-memory -- test --watch=false --sourceMap=true --browsers=ChromeHeadless --code-coverage",
"lint": "ng lint",
"lint-fix": "npm run ng-high-memory lint --fix=true",
"e2e": "ng e2e",
"e2e:ci": "ng e2e --protractor-config=./e2e/protractor-ci.conf.js",
"compile:server": "webpack --config webpack.server.config.js --progress --color",

View File

@@ -46,4 +46,4 @@ export class EPeopleRegistryCancelEPersonAction implements Action {
*/
export type EPeopleRegistryAction
= EPeopleRegistryEditEPersonAction
| EPeopleRegistryCancelEPersonAction
| EPeopleRegistryCancelEPersonAction;

View File

@@ -114,7 +114,7 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
onPageChange(event) {
if (this.config.currentPage !== event) {
this.config.currentPage = event;
this.search({ scope: this.currentSearchScope, query: this.currentSearchQuery })
this.search({ scope: this.currentSearchScope, query: this.currentSearchQuery });
}
}
@@ -139,7 +139,7 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
currentPage: this.config.currentPage,
elementsPerPage: this.config.pageSize
}).subscribe((peopleRD) => {
this.ePeople$.next(peopleRD)
this.ePeople$.next(peopleRD);
}
));
@@ -157,7 +157,7 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
);
})).pipe(map((dtos: EpersonDtoModel[]) => {
return new PaginatedList(epeople.pageInfo, dtos);
}))
}));
})).subscribe((value) => {
this.ePeopleDto$.next(value);
this.pageInfoState$.next(value.pageInfo);
@@ -195,7 +195,7 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
this.isEPersonFormShown = true;
}
});
this.scrollToTop()
this.scrollToTop();
}
/**
@@ -220,7 +220,7 @@ export class EPeopleRegistryComponent implements OnInit, OnDestroy {
const errorResponse = restResponse as ErrorResponse;
this.notificationsService.error('Error occured when trying to delete EPerson with id: ' + ePerson.id + ' with code: ' + errorResponse.statusCode + ' and message: ' + errorResponse.errorMessage);
}
})
});
}}
});
}

View File

@@ -441,10 +441,10 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
this.notificationsService.error('Error occured when trying to delete EPerson with id: ' + eperson.id + ' with code: ' + restResponse.statusCode + ' and message: ' + restResponse.statusText);
}
this.cancelForm.emit();
})
});
}}
});
})
});
}
/**

View File

@@ -99,7 +99,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
ngOnInit() {
this.subs.push(this.route.params.subscribe((params) => {
this.setActiveGroup(params.groupId)
this.setActiveGroup(params.groupId);
}));
combineLatest(
this.translateService.get(`${this.messagePrefix}.groupName`),
@@ -263,7 +263,7 @@ export class GroupFormComponent implements OnInit, OnDestroy {
getRemoteDataPayload())
.subscribe((group: Group) => {
this.groupDataService.editGroup(group);
})
});
}
});
}

View File

@@ -112,7 +112,7 @@ export class MembersListComponent implements OnInit, OnDestroy {
this.ePeopleMembersOfGroup = this.ePersonDataService.findAllByHref(this.groupBeingEdited._links.epersons.href, {
currentPage: event,
elementsPerPage: this.config.pageSize
})
});
}
/**
@@ -163,11 +163,11 @@ export class MembersListComponent implements OnInit, OnDestroy {
getSucceededRemoteData(),
getRemoteDataPayload(),
map((listEPeopleInGroup: PaginatedList<EPerson>) => listEPeopleInGroup.page.filter((ePersonInList: EPerson) => ePersonInList.id === possibleMember.id)),
map((epeople: EPerson[]) => epeople.length > 0))
map((epeople: EPerson[]) => epeople.length > 0));
} else {
return observableOf(false);
}
}))
}));
}
/**
@@ -208,7 +208,7 @@ export class MembersListComponent implements OnInit, OnDestroy {
this.ePeopleMembersOfGroup = this.ePersonDataService.findAllByHref(activeGroup._links.epersons.href, {
currentPage: this.configSearch.currentPage,
elementsPerPage: this.configSearch.pageSize
})
});
}
/**
@@ -232,7 +232,7 @@ export class MembersListComponent implements OnInit, OnDestroy {
} else {
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.failure.' + messageSuffix, { name: nameObject }));
}
})
});
}
/**

View File

@@ -128,7 +128,7 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
getSucceededRemoteData(),
getRemoteDataPayload(),
map((listTotalGroups: PaginatedList<Group>) => listTotalGroups.page.filter((groupInList: Group) => groupInList.id === possibleSubgroup.id)),
map((groups: Group[]) => groups.length > 0))
map((groups: Group[]) => groups.length > 0));
}
} else {
return observableOf(false);
@@ -238,7 +238,7 @@ export class SubgroupsListComponent implements OnInit, OnDestroy {
} else {
this.notificationsService.error(this.translateService.get(this.messagePrefix + '.notification.failure.' + messageSuffix, { name: nameObject }));
}
})
});
}
/**

View File

@@ -46,4 +46,4 @@ export class GroupRegistryCancelGroupAction implements Action {
*/
export type GroupRegistryAction
= GroupRegistryEditGroupAction
| GroupRegistryCancelGroupAction
| GroupRegistryCancelGroupAction;

View File

@@ -70,7 +70,7 @@ export class GroupsRegistryComponent implements OnInit {
*/
onPageChange(event) {
this.config.currentPage = event;
this.search({ query: this.currentSearchQuery })
this.search({ query: this.currentSearchQuery });
}
/**
@@ -105,7 +105,7 @@ export class GroupsRegistryComponent implements OnInit {
} else {
this.notificationsService.error(this.translateService.get(this.messagePrefix + 'notification.deleted.failure', { name: group.name }));
}
})
});
}
}
@@ -114,7 +114,7 @@ export class GroupsRegistryComponent implements OnInit {
*/
public forceUpdateGroup() {
this.groupService.clearGroupsRequests();
this.search({ query: this.currentSearchQuery })
this.search({ query: this.currentSearchQuery });
}
/**

View File

@@ -61,4 +61,4 @@ export class BitstreamFormatsRegistryDeselectAllAction implements Action {
export type BitstreamFormatsRegistryAction
= BitstreamFormatsRegistrySelectAction
| BitstreamFormatsRegistryDeselectAction
| BitstreamFormatsRegistryDeselectAllAction
| BitstreamFormatsRegistryDeselectAllAction;

View File

@@ -155,7 +155,7 @@ export class MetadataRegistryComponent {
this.forceUpdateSchemas();
});
}
)
);
}
/**
@@ -172,9 +172,9 @@ export class MetadataRegistryComponent {
);
messages.subscribe(([head, content]) => {
if (success) {
this.notificationsService.success(head, content)
this.notificationsService.success(head, content);
} else {
this.notificationsService.error(head, content)
this.notificationsService.error(head, content);
}
});
}

View File

@@ -182,7 +182,7 @@ export class MetadataSchemaComponent implements OnInit {
this.forceUpdateFields();
});
}
)
);
}
/**
@@ -199,9 +199,9 @@ export class MetadataSchemaComponent implements OnInit {
);
messages.subscribe(([head, content]) => {
if (success) {
this.notificationsService.success(head, content)
this.notificationsService.success(head, content);
} else {
this.notificationsService.error(head, content)
this.notificationsService.error(head, content);
}
});
}

View File

@@ -60,6 +60,6 @@ export class ItemAdminSearchResultGridElementComponent extends SearchResultGridE
* @returns {GenericConstructor<Component>}
*/
private getComponent(): GenericConstructor<Component> {
return getListableObjectComponent(this.object.getRenderTypes(), ViewMode.GridElement, undefined)
return getListableObjectComponent(this.object.getRenderTypes(), ViewMode.GridElement, undefined);
}
}

View File

@@ -34,7 +34,7 @@ export class ItemAdminSearchResultActionsComponent {
* Returns the path to the edit page of this item
*/
getEditRoute(): string {
return getItemEditRoute(this.item.uuid)
return getItemEditRoute(this.item.uuid);
}
/**

View File

@@ -84,7 +84,7 @@ export class WorkflowItemSearchResultAdminWorkflowGridElementComponent extends S
(componentRef.instance as any).listID = this.listID;
componentRef.changeDetectorRef.detectChanges();
}
)
);
}
/**
@@ -92,7 +92,7 @@ export class WorkflowItemSearchResultAdminWorkflowGridElementComponent extends S
* @returns {GenericConstructor<Component>}
*/
private getComponent(item: Item): GenericConstructor<Component> {
return getListableObjectComponent(item.getRenderTypes(), ViewMode.GridElement, undefined)
return getListableObjectComponent(item.getRenderTypes(), ViewMode.GridElement, undefined);
}
}

View File

@@ -30,7 +30,7 @@ export class WorkflowItemAdminWorkflowActionsComponent {
*/
getDeleteRoute(): string {
return getWorkflowItemDeleteRoute(this.wfi.id)
return getWorkflowItemDeleteRoute(this.wfi.id);
}
/**

View File

@@ -34,7 +34,7 @@ export class BitstreamPageResolver implements Resolve<RemoteData<Bitstream>> {
* 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(): Array<FollowLinkConfig<Bitstream>> {
get followLinks(): FollowLinkConfig<Bitstream>[] {
return [
followLink('bundle', undefined, true, followLink('item')),
followLink('format')

View File

@@ -326,7 +326,7 @@ export class EditBitstreamPageComponent implements OnInit, OnDestroy {
this.updateFieldTranslations();
})
);
};
}
/**
* Update the current form values with bitstream properties

View File

@@ -44,7 +44,7 @@ export class BrowseByTitlePageComponent extends BrowseByMetadataPageComponent {
.subscribe((params) => {
this.browseId = params.id || this.defaultBrowseId;
this.updatePageWithItems(browseParamsToOptions(params, this.paginationConfig, this.sortConfig, this.browseId), undefined);
this.updateParent(params.scope)
this.updateParent(params.scope);
}));
this.updateStartsWithTextOptions();
}

View File

@@ -122,7 +122,7 @@ export class CollectionItemMapperComponent implements OnInit {
if (shouldUpdate) {
return this.collectionDataService.getMappedItems(collectionRD.payload.id, Object.assign(options, {
sort: this.defaultSortOptions
}),followLink('owningCollection'))
}),followLink('owningCollection'));
}
})
);
@@ -249,7 +249,7 @@ export class CollectionItemMapperComponent implements OnInit {
getRemoteDataPayload(),
take(1)
).subscribe((collection: Collection) => {
this.router.navigate(['/collections/', collection.id])
this.router.navigate(['/collections/', collection.id]);
});
}

View File

@@ -13,11 +13,11 @@ export function getCollectionPageRoute(collectionId: string) {
}
export function getCollectionEditRoute(id: string) {
return new URLCombiner(getCollectionModuleRoute(), id, COLLECTION_EDIT_PATH).toString()
return new URLCombiner(getCollectionModuleRoute(), id, COLLECTION_EDIT_PATH).toString();
}
export function getCollectionCreateRoute() {
return new URLCombiner(getCollectionModuleRoute(), COLLECTION_CREATE_PATH).toString()
return new URLCombiner(getCollectionModuleRoute(), COLLECTION_CREATE_PATH).toString();
}
export const COLLECTION_CREATE_PATH = 'create';

View File

@@ -84,7 +84,7 @@ export class CollectionPageComponent implements OnInit {
pagination: dto.paginationConfig,
sort: dto.sortConfig,
dsoTypes: [DSpaceObjectType.ITEM]
})).pipe(toDSpaceObjectListRD()) as Observable<RemoteData<PaginatedList<Item>>>
})).pipe(toDSpaceObjectListRD()) as Observable<RemoteData<PaginatedList<Item>>>;
}),
startWith(undefined) // Make sure switching pages shows loading component
)
@@ -94,7 +94,7 @@ export class CollectionPageComponent implements OnInit {
this.route.queryParams.pipe(take(1)).subscribe((params) => {
this.metadata.processRemoteData(this.collectionRD$);
this.onPaginationChange(params);
})
});
}
isNotEmpty(object: any) {

View File

@@ -25,7 +25,7 @@ export class CollectionRolesComponent implements OnInit {
return this.dsoRD$.pipe(
getSucceededRemoteData(),
getRemoteDataPayload(),
)
);
}
/**

View File

@@ -432,7 +432,7 @@ export class CollectionSourceComponent extends AbstractTrackableComponent implem
updateContentSource(updateHarvestType: boolean) {
this.inputModels.forEach(
(fieldModel: DynamicInputModel) => {
this.updateContentSourceField(fieldModel, updateHarvestType)
this.updateContentSourceField(fieldModel, updateHarvestType);
}
);
this.saveFieldUpdate();

View File

@@ -26,6 +26,6 @@ export class EditCollectionPageComponent extends EditComColPageComponent<Collect
* @param collection The collection for which the url is requested
*/
getPageUrl(collection: Collection): string {
return getCollectionPageRoute(collection.id)
return getCollectionPageRoute(collection.id);
}
}

View File

@@ -13,11 +13,11 @@ export function getCommunityPageRoute(communityId: string) {
}
export function getCommunityEditRoute(id: string) {
return new URLCombiner(getCommunityModuleRoute(), id, COMMUNITY_EDIT_PATH).toString()
return new URLCombiner(getCommunityModuleRoute(), id, COMMUNITY_EDIT_PATH).toString();
}
export function getCommunityCreateRoute() {
return new URLCombiner(getCommunityModuleRoute(), COMMUNITY_CREATE_PATH).toString()
return new URLCombiner(getCommunityModuleRoute(), COMMUNITY_CREATE_PATH).toString();
}
export const COMMUNITY_CREATE_PATH = 'create';

View File

@@ -25,7 +25,7 @@ export class CommunityRolesComponent implements OnInit {
return this.dsoRD$.pipe(
getSucceededRemoteData(),
getRemoteDataPayload(),
)
);
}
/**

View File

@@ -26,6 +26,6 @@ export class EditCommunityPageComponent extends EditComColPageComponent<Communit
* @param community The community for which the url is requested
*/
getPageUrl(community: Community): string {
return getCommunityPageRoute(community.id)
return getCommunityPageRoute(community.id);
}
}

View File

@@ -38,7 +38,7 @@ export class AbstractItemUpdateComponent extends AbstractTrackableComponent impl
public translateService: TranslateService,
public route: ActivatedRoute
) {
super(objectUpdatesService, notificationsService, translateService)
super(objectUpdatesService, notificationsService, translateService);
}
/**

View File

@@ -55,6 +55,6 @@ export class EditItemPageComponent implements OnInit {
* @param item The item for which the url is requested
*/
getItemPage(item: Item): string {
return getItemPageRoute(item.id)
return getItemPageRoute(item.id);
}
}

View File

@@ -22,7 +22,7 @@ import { FindListOptions } from '../../../core/data/request.models';
*/
interface BundleBitstreamsMapEntry {
id: string;
bitstreams: Observable<PaginatedList<Bitstream>>
bitstreams: Observable<PaginatedList<Bitstream>>;
}
@Component({
@@ -89,7 +89,7 @@ export class ItemAuthorizationsComponent implements OnInit, OnDestroy {
getFirstSucceededRemoteDataWithNotEmptyPayload(),
catchError((error) => {
console.error(error);
return observableOf(new PaginatedList(null, []))
return observableOf(new PaginatedList(null, []));
})
);
@@ -105,9 +105,9 @@ export class ItemAuthorizationsComponent implements OnInit, OnDestroy {
mergeMap((list: PaginatedList<Bundle>) => list.page),
map((bundle: Bundle) => ({ id: bundle.id, bitstreams: this.getBundleBitstreams(bundle) }))
).subscribe((entry: BundleBitstreamsMapEntry) => {
this.bundleBitstreamsMap.set(entry.id, entry.bitstreams)
this.bundleBitstreamsMap.set(entry.id, entry.bitstreams);
})
)
);
}
/**
@@ -117,7 +117,7 @@ export class ItemAuthorizationsComponent implements OnInit, OnDestroy {
return this.item$.pipe(
map((item: Item) => item.id),
first((UUID: string) => isNotEmpty(UUID))
)
);
}
/**
@@ -139,9 +139,9 @@ export class ItemAuthorizationsComponent implements OnInit, OnDestroy {
getFirstSucceededRemoteDataPayload(),
catchError((error) => {
console.error(error);
return observableOf(new PaginatedList(null, []))
return observableOf(new PaginatedList(null, []));
})
)
);
}
/**
@@ -150,6 +150,6 @@ export class ItemAuthorizationsComponent implements OnInit, OnDestroy {
ngOnDestroy(): void {
this.subs
.filter((subscription) => hasValue(subscription))
.forEach((subscription) => subscription.unsubscribe())
.forEach((subscription) => subscription.unsubscribe());
}
}

View File

@@ -105,7 +105,7 @@ export class ItemCollectionMapperComponent implements OnInit {
this.itemCollectionsRD$ = observableCombineLatest(this.itemRD$, this.shouldUpdate$).pipe(
map(([itemRD, shouldUpdate]) => {
if (shouldUpdate) {
return itemRD.payload
return itemRD.payload;
}
}),
switchMap((item: Item) => this.itemDataService.getMappedCollections(item.id))
@@ -283,7 +283,7 @@ export class ItemCollectionMapperComponent implements OnInit {
getRemoteDataPayload(),
take(1)
).subscribe((item: Item) => {
this.router.navigate(['/items/', item.id])
this.router.navigate(['/items/', item.id]);
});
}

View File

@@ -158,7 +158,7 @@ export class ItemDeleteComponent
*/
getRelationshipMessageKey(label: string): string {
if (hasValue(label) && label.indexOf('Of') > -1) {
return `relationships.${label.substring(0, label.indexOf('Of') + 2)}`
return `relationships.${label.substring(0, label.indexOf('Of') + 2)}`;
} else {
return label;
}
@@ -176,7 +176,7 @@ export class ItemDeleteComponent
map((isLeftItem) => isLeftItem ? relationshipType.leftwardType : relationshipType.rightwardType),
)
),
)
);
}
/**
@@ -267,7 +267,7 @@ export class ItemDeleteComponent
return {
metadataField: key,
metadataValue: metadata,
}
};
}))
.reduce((previous, current) => previous.concat(current))
),

View File

@@ -129,7 +129,7 @@ export class EditInPlaceFieldComponent implements OnInit, OnChanges {
take(1))
.subscribe((fieldNames: string[]) => {
this.setInputSuggestions(fieldNames);
})
});
} else {
this.metadataFieldSuggestions.next([]);
}

View File

@@ -122,7 +122,7 @@ export class ItemMetadataComponent extends AbstractItemUpdateComponent {
this.updates$ = this.objectUpdatesService.getFieldUpdates(this.url, this.item.metadataAsList);
this.notificationsService.success(this.getNotificationTitle('saved'), this.getNotificationContent('saved'));
}
)
);
} else {
this.notificationsService.error(this.getNotificationTitle('invalid'), this.getNotificationContent('invalid'));
}

View File

@@ -85,8 +85,8 @@ export class ItemMoveComponent implements OnInit {
first(),
map((rd: RemoteData<PaginatedList<SearchResult<DSpaceObject>>>) => {
return rd.payload.page.map((searchResult) => {
return searchResult.indexableObject
})
return searchResult.indexableObject;
});
}) ,
);

View File

@@ -64,7 +64,7 @@ export class EditRelationshipListComponent implements OnInit {
return this.getLabel().pipe(
map((label) => {
if (hasValue(label) && label.indexOf('Of') > -1) {
return `relationships.${label.substring(0, label.indexOf('Of') + 2)}`
return `relationships.${label.substring(0, label.indexOf('Of') + 2)}`;
} else {
return label;
}

View File

@@ -109,7 +109,7 @@ export class EditRelationshipComponent implements OnChanges {
keepLeftVirtualMetadata: selection[0] === true,
keepRightVirtualMetadata: selection[1] === true,
}
) as DeleteRelationship
) as DeleteRelationship;
}),
take(1),
).subscribe((deleteRelationship: DeleteRelationship) =>

View File

@@ -133,7 +133,7 @@ export class ItemRelationshipsComponent extends AbstractItemUpdateComponent impl
Object.assign(new Relationship(), relationship, {uuid: relationship.id})
)),
switchMap((relationships: Relationship[]) => {
return this.objectUpdatesService.getFieldUpdatesExclusive(this.url, relationships) as Observable<FieldUpdates>
return this.objectUpdatesService.getFieldUpdatesExclusive(this.url, relationships) as Observable<FieldUpdates>;
}),
map((fieldUpdates: FieldUpdates) =>
Object.values(fieldUpdates)

View File

@@ -117,7 +117,7 @@ export class ItemStatusComponent implements OnInit {
* @returns {string} url
*/
getItemPage(item: Item): string {
return getItemPageRoute(item.id)
return getItemPageRoute(item.id);
}
/**

View File

@@ -62,7 +62,7 @@ export class AbstractSimpleItemActionComponent implements OnInit {
*/
performAction() {
// Overwrite in subclasses
};
}
/**
* Process the response obtained during the performAction method and navigate back to the edit page

View File

@@ -74,7 +74,7 @@ export class VirtualMetadataComponent implements OnInit {
return {
metadataField: key,
metadataValue: metadata,
}
};
})
)
.reduce((previous, current) => previous.concat(current), []);
@@ -115,6 +115,6 @@ export class VirtualMetadataComponent implements OnInit {
* Represents a virtual metadata entry.
*/
export interface VirtualMetadata {
metadataField: string,
metadataValue: MetadataValue,
metadataField: string;
metadataValue: MetadataValue;
}

View File

@@ -11,7 +11,7 @@ export function getItemPageRoute(itemId: string) {
}
export function getItemEditRoute(id: string) {
return new URLCombiner(getItemModuleRoute(), id, ITEM_EDIT_PATH).toString()
return new URLCombiner(getItemModuleRoute(), id, ITEM_EDIT_PATH).toString();
}
export const ITEM_EDIT_PATH = 'edit';

View File

@@ -17,7 +17,7 @@ import { hasValue } from '../../../../shared/empty.util';
export const compareArraysUsing = <T>(mapFn: (t: T) => any) =>
(a: T[], b: T[]): boolean => {
if (!Array.isArray(a) || ! Array.isArray(b)) {
return false
return false;
}
const aIds = a.map(mapFn);
@@ -95,6 +95,6 @@ export const paginatedRelationsToItems = (thisId: string) =>
map((relatedItems: Item[]) =>
Object.assign(relationshipsRD, { payload: Object.assign(relationshipsRD.payload, { page: relatedItems } )})
)
)
);
})
);

View File

@@ -18,11 +18,11 @@ export class TabbedRelatedEntitiesSearchComponent implements OnInit {
* The types of relationships to fetch items for
* e.g. 'isAuthorOfPublication'
*/
@Input() relationTypes: Array<{
@Input() relationTypes: {
label: string,
filter: string,
configuration?: string
}>;
}[];
/**
* The item to render relationships for

View File

@@ -66,7 +66,7 @@ export class LoginPageComponent implements OnDestroy, OnInit {
this.store.dispatch(new AuthenticationSuccessAction(authToken));
}
}
})
});
}
/**

View File

@@ -29,7 +29,7 @@ export class ObjectNotFoundComponent implements OnInit {
route.params.subscribe((params) => {
this.idType = params.idType;
this.id = params.id;
})
});
}
ngOnInit(): void {

View File

@@ -111,7 +111,7 @@ export class MyDSpaceConfigurationService extends SearchConfigurationService {
});
return configurationOptions;
})
)
);
}
}

View File

@@ -31,7 +31,7 @@ export class MyDSpaceNewSubmissionComponent implements OnDestroy, OnInit {
/**
* Output that emits the workspace item when the upload has completed
*/
@Output() uploadEnd = new EventEmitter<Array<SearchResult<DSpaceObject>>>();
@Output() uploadEnd = new EventEmitter<SearchResult<DSpaceObject>[]>();
/**
* The UploaderOptions object

View File

@@ -139,9 +139,9 @@ export class MyDSpacePageComponent implements OnInit {
.pipe(
map((configuration: string) => {
if (configuration === 'workspace') {
return Context.Workspace
return Context.Workspace;
} else {
return Context.Workflow
return Context.Workflow;
}
})
);
@@ -152,7 +152,7 @@ export class MyDSpacePageComponent implements OnInit {
* Set the sidebar to a collapsed state
*/
public closeSidebar(): void {
this.sidebarService.collapse()
this.sidebarService.collapse();
}
/**

View File

@@ -62,7 +62,7 @@ export class SearchTrackerComponent extends SearchComponent implements OnInit {
.subscribe((entry) => {
const config: PaginatedSearchOptions = entry.searchOptions;
const searchQueryResponse: SearchQueryResponse = entry.response;
const filters: Array<{ filter: string, operator: string, value: string, label: string; }> = [];
const filters: { filter: string, operator: string, value: string, label: string; }[] = [];
const appliedFilters = searchQueryResponse.appliedFilters || [];
for (let i = 0, filtersLength = appliedFilters.length; i < filtersLength; i++) {
const appliedFilter = appliedFilters[i];
@@ -84,7 +84,7 @@ export class SearchTrackerComponent extends SearchComponent implements OnInit {
},
filters: filters,
},
})
});
});
}
}

View File

@@ -146,7 +146,7 @@ export class SearchComponent implements OnInit {
* Set the sidebar to a collapsed state
*/
public closeSidebar(): void {
this.sidebarService.collapse()
this.sidebarService.collapse();
}
/**

View File

@@ -52,14 +52,14 @@ export abstract class WorkflowItemActionPageComponent implements OnInit {
if (successful) {
const title = this.translationService.get('workflow-item.' + this.type + '.notification.success.title');
const content = this.translationService.get('workflow-item.' + this.type + '.notification.success.content');
this.notificationsService.success(title, content)
this.notificationsService.success(title, content);
} else {
const title = this.translationService.get('workflow-item.' + this.type + '.notification.error.title');
const content = this.translationService.get('workflow-item.' + this.type + '.notification.error.content');
this.notificationsService.error(title, content)
this.notificationsService.error(title, content);
}
this.previousPage();
})
});
}
/**

View File

@@ -6,15 +6,15 @@ export function getWorkflowItemPageRoute(wfiId: string) {
}
export function getWorkflowItemEditRoute(wfiId: string) {
return new URLCombiner(getWorkflowItemModuleRoute(), wfiId, WORKFLOW_ITEM_EDIT_PATH).toString()
return new URLCombiner(getWorkflowItemModuleRoute(), wfiId, WORKFLOW_ITEM_EDIT_PATH).toString();
}
export function getWorkflowItemDeleteRoute(wfiId: string) {
return new URLCombiner(getWorkflowItemModuleRoute(), wfiId, WORKFLOW_ITEM_DELETE_PATH).toString()
return new URLCombiner(getWorkflowItemModuleRoute(), wfiId, WORKFLOW_ITEM_DELETE_PATH).toString();
}
export function getWorkflowItemSendBackRoute(wfiId: string) {
return new URLCombiner(getWorkflowItemModuleRoute(), wfiId, WORKFLOW_ITEM_SEND_BACK_PATH).toString()
return new URLCombiner(getWorkflowItemModuleRoute(), wfiId, WORKFLOW_ITEM_SEND_BACK_PATH).toString();
}
export const WORKFLOW_ITEM_EDIT_PATH = 'edit';

View File

@@ -169,7 +169,7 @@ export class AppComponent implements OnInit, AfterViewInit {
private initializeKlaro() {
if (hasValue(this.cookiesService)) {
this.cookiesService.initialize()
this.cookiesService.initialize();
}
}
}

View File

@@ -11,7 +11,7 @@ export function debugMetaReducer(reducer) {
console.log('action', JSON.stringify(action));
console.log('------------------------------------');
return reducer(state, action);
}
};
}
export function universalMetaReducer(reducer) {
@@ -25,7 +25,7 @@ export function universalMetaReducer(reducer) {
break;
}
return reducer(state, action);
}
};
}
export const debugMetaReducers = [

View File

@@ -47,7 +47,7 @@ export function getBase() {
return environment.ui.nameSpace;
}
export function getMetaReducers(): Array<MetaReducer<AppState>> {
export function getMetaReducers(): MetaReducer<AppState>[] {
return environment.debug ? [...appMetaReducers, ...debugMetaReducers] : appMetaReducers;
}

View File

@@ -44,7 +44,7 @@ export class ShowMoreFlatNode {
}
// Helper method to combine an flatten an array of observables of flatNode arrays
export const combineAndFlatten = (obsList: Array<Observable<FlatNode[]>>): Observable<FlatNode[]> =>
export const combineAndFlatten = (obsList: Observable<FlatNode[]>[]): Observable<FlatNode[]> =>
observableCombineLatest([...obsList]).pipe(
map((matrix: any[][]) => [].concat(...matrix))
);
@@ -138,18 +138,18 @@ export class CommunityListService {
topCommunities.push(this.getTopCommunities(pagination));
}
const topComs$ = observableCombineLatest([...topCommunities]).pipe(
map((coms: Array<PaginatedList<Community>>) => {
map((coms: PaginatedList<Community>[]) => {
const newPages: Community[][] = coms.map((unit: PaginatedList<Community>) => unit.page);
const newPage: Community[] = [].concat(...newPages);
let newPageInfo = new PageInfo();
if (coms && coms.length > 0) {
newPageInfo = Object.assign({}, coms[0].pageInfo, { currentPage })
newPageInfo = Object.assign({}, coms[0].pageInfo, { currentPage });
}
return new PaginatedList(newPageInfo, newPage);
})
);
return topComs$.pipe(mergeMap((topComs: PaginatedList<Community>) => this.transformListOfCommunities(topComs, 0, null, expandedNodes)));
};
}
/**
* Puts the initial top level communities in a list to be called upon
@@ -185,7 +185,7 @@ export class CommunityListService {
}
let obsList = listOfPaginatedCommunities.page
.map((community: Community) => {
return this.transformCommunity(community, level, parent, expandedNodes)
return this.transformCommunity(community, level, parent, expandedNodes);
});
if (currentPage < listOfPaginatedCommunities.totalPages && currentPage === listOfPaginatedCommunities.currentPage) {
obsList = [...obsList, observableOf([showMoreFlatNode('community', level, parent)])];

View File

@@ -23,9 +23,9 @@ export class CommunityListSaveAction implements Action {
};
constructor(expandedNodes: FlatNode[], loadingNode: FlatNode) {
this.payload = { expandedNodes, loadingNode }
this.payload = { expandedNodes, loadingNode };
}
};
}
/**
* Export a type alias of all actions in this action group

View File

@@ -27,7 +27,7 @@ export function CommunityListReducer(state = initialState, action: CommunityList
return Object.assign({}, state, {
expandedNodes: (action as CommunityListSaveAction).payload.expandedNodes,
loadingNode: (action as CommunityListSaveAction).payload.loadingNode,
})
});
}
default: {
return state;

View File

@@ -238,7 +238,7 @@ export class AuthEffects {
.pipe(
map((authMethodModels: AuthMethod[]) => new RetrieveAuthMethodsSuccessAction(authMethodModels)),
catchError((error) => observableOf(new RetrieveAuthMethodsErrorAction()))
)
);
})
);

View File

@@ -73,7 +73,7 @@ export class AuthInterceptor implements HttpInterceptor {
* @param http
*/
private isLoginResponse(http: HttpRequest<any> | HttpResponseBase): boolean {
return http.url && http.url.endsWith('/authn/login')
return http.url && http.url.endsWith('/authn/login');
}
/**
@@ -270,7 +270,7 @@ export class AuthInterceptor implements HttpInterceptor {
body: Object.assign(response.body, {
authMethods: this.parseAuthMethodsFromHeaders(response.headers)
})
})
});
} else {
// logout successfully
authRes = response.clone({

View File

@@ -1,7 +1,7 @@
export interface AuthError {
error: string,
message: string,
path: string,
status: number
timestamp: number
error: string;
message: string;
path: string;
status: number;
timestamp: number;
}

View File

@@ -16,7 +16,7 @@ export class TokenResponseParsingService implements ResponseParsingService {
if (isNotEmpty(data.payload) && isNotEmpty(data.payload.token) && (data.statusCode === 200)) {
return new TokenResponse(data.payload.token, true, data.statusCode, data.statusText);
} else {
return new TokenResponse(null, false, data.statusCode, data.statusText)
return new TokenResponse(null, false, data.statusCode, data.statusText);
}
}

View File

@@ -21,7 +21,7 @@ export class CollectionBreadcrumbResolver extends DSOBreadcrumbResolver<Collecti
* 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(): Array<FollowLinkConfig<Collection>> {
get followLinks(): FollowLinkConfig<Collection>[] {
return [
followLink('parentCommunity', undefined, true,
followLink('parentCommunity')

View File

@@ -21,7 +21,7 @@ export class CommunityBreadcrumbResolver extends DSOBreadcrumbResolver<Community
* 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(): Array<FollowLinkConfig<Community>> {
get followLinks(): FollowLinkConfig<Community>[] {
return [
followLink('parentCommunity')
];

View File

@@ -50,5 +50,5 @@ export abstract class DSOBreadcrumbResolver<T extends ChildHALResource & DSpaceO
* 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
*/
abstract get followLinks(): Array<FollowLinkConfig<T>>;
abstract get followLinks(): FollowLinkConfig<T>[];
}

View File

@@ -41,7 +41,7 @@ export class DSOBreadcrumbsService implements BreadcrumbsService<ChildHALResourc
switchMap((parentRD: RemoteData<ChildHALResource & DSpaceObject>) => {
if (hasValue(parentRD.payload)) {
const parent = parentRD.payload;
return this.getBreadcrumbs(parent, getDSORoute(parent))
return this.getBreadcrumbs(parent, getDSORoute(parent));
}
return observableOf([]);

View File

@@ -24,7 +24,7 @@ export class I18nBreadcrumbResolver implements Resolve<BreadcrumbConfig<string>>
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): BreadcrumbConfig<string> {
const key = route.data.breadcrumbKey;
if (hasNoValue(key)) {
throw new Error('You provided an i18nBreadcrumbResolver for url \"' + route.url + '\" but no breadcrumbKey in the route\'s data')
throw new Error('You provided an i18nBreadcrumbResolver for url \"' + route.url + '\" but no breadcrumbKey in the route\'s data');
}
const fullPath = currentPathFromSnapshot(route);
return { provider: this.breadcrumbService, key: key, url: fullPath };

View File

@@ -21,7 +21,7 @@ export class ItemBreadcrumbResolver extends DSOBreadcrumbResolver<Item> {
* 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(): Array<FollowLinkConfig<Item>> {
get followLinks(): FollowLinkConfig<Item>[] {
return [
followLink('owningCollection', undefined, true,
followLink('parentCommunity', undefined, true,

View File

@@ -77,7 +77,7 @@ export class BrowseService {
ensureArrayHasValue(),
map((definitions: BrowseDefinition[]) => definitions
.map((definition: BrowseDefinition) => {
return Object.assign(new BrowseDefinition(), definition)
return Object.assign(new BrowseDefinition(), definition);
})),
distinctUntilChanged(),
);

View File

@@ -111,7 +111,7 @@ export const link = <T extends HALResource>(
});
linkMap.set(target.constructor, targetMap);
}
};
};
/**
@@ -155,5 +155,5 @@ export function inheritLinkAnnotations(parent: any): any {
});
linkMap.set(child, childMap);
}
};
}

View File

@@ -25,7 +25,7 @@ export class LinkService {
* @param model the {@link HALResource} to resolve the links for
* @param linksToFollow the {@link FollowLinkConfig}s to resolve
*/
public resolveLinks<T extends HALResource>(model: T, ...linksToFollow: Array<FollowLinkConfig<T>>): T {
public resolveLinks<T extends HALResource>(model: T, ...linksToFollow: FollowLinkConfig<T>[]): T {
linksToFollow.forEach((linkToFollow: FollowLinkConfig<T>) => {
this.resolveLink(model, linkToFollow);
});

View File

@@ -29,7 +29,7 @@ export class RemoteDataBuildService {
* @param href$ Observable href of object we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
buildSingle<T extends CacheableObject>(href$: string | Observable<string>, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<RemoteData<T>> {
buildSingle<T extends CacheableObject>(href$: string | Observable<string>, ...linksToFollow: FollowLinkConfig<T>[]): Observable<RemoteData<T>> {
if (typeof href$ === 'string') {
href$ = observableOf(href$);
}
@@ -117,7 +117,7 @@ export class RemoteDataBuildService {
* @param href$ Observable href of objects we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
buildList<T extends CacheableObject>(href$: string | Observable<string>, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<RemoteData<PaginatedList<T>>> {
buildList<T extends CacheableObject>(href$: string | Observable<string>, ...linksToFollow: FollowLinkConfig<T>[]): Observable<RemoteData<PaginatedList<T>>> {
if (typeof href$ === 'string') {
href$ = observableOf(href$);
}
@@ -154,7 +154,7 @@ export class RemoteDataBuildService {
return this.toRemoteDataObservable(requestEntry$, payload$);
}
aggregate<T>(input: Array<Observable<RemoteData<T>>>): Observable<RemoteData<T[]>> {
aggregate<T>(input: Observable<RemoteData<T>>[]): Observable<RemoteData<T[]>> {
if (isEmpty(input)) {
return createSuccessfulRemoteDataObject$([]);
@@ -223,7 +223,7 @@ export class RemoteDataBuildService {
error,
payload
);
}))
}));
}
private toPaginatedList<T>(input: Observable<RemoteData<T[] | PaginatedList<T>>>, pageInfo: PageInfo): Observable<RemoteData<PaginatedList<T>>> {
@@ -232,7 +232,7 @@ export class RemoteDataBuildService {
const rdAny = rd as any;
const newRD = new RemoteData(rdAny.requestPending, rdAny.responsePending, rdAny.isSuccessful, rd.error, undefined);
if (Array.isArray(rd.payload)) {
return Object.assign(newRD, { payload: new PaginatedList(pageInfo, rd.payload) })
return Object.assign(newRD, { payload: new PaginatedList(pageInfo, rd.payload) });
} else if (isNotUndefined(rd.payload)) {
return Object.assign(newRD, { payload: new PaginatedList(pageInfo, rd.payload.page) });
} else {

View File

@@ -45,7 +45,7 @@ export class CacheableObject extends TypedObject implements HALResource {
_links: {
self: HALLink;
}
};
// isNew: boolean;
// dirtyType: DirtyType;
// hasDirtyAttributes: boolean;
@@ -74,7 +74,7 @@ export class ObjectCacheEntry implements CacheEntry {
* and ObjectCacheEntries as values
*/
export interface ObjectCacheState {
[href: string]: ObjectCacheEntry
[href: string]: ObjectCacheEntry;
}
// Object.create(null) ensures the object has no default js properties (e.g. `__proto__`)
@@ -98,11 +98,11 @@ export function objectCacheReducer(state = initialState, action: ObjectCacheActi
}
case ObjectCacheActionTypes.REMOVE: {
return removeFromObjectCache(state, action as RemoveFromObjectCacheAction)
return removeFromObjectCache(state, action as RemoveFromObjectCacheAction);
}
case ObjectCacheActionTypes.RESET_TIMESTAMPS: {
return resetObjectCacheTimestamps(state, action as ResetObjectCacheTimestampsAction)
return resetObjectCacheTimestamps(state, action as ResetObjectCacheTimestampsAction);
}
case ObjectCacheActionTypes.ADD_PATCH: {

View File

@@ -90,7 +90,7 @@ export class ObjectCacheService {
select(selfLinkFromUuidSelector(uuid)),
mergeMap((selfLink: string) => this.getObjectBySelfLink<T>(selfLink)
)
)
);
}
/**
@@ -118,7 +118,7 @@ export class ObjectCacheService {
if (typeof type !== 'function') {
throw new Error(`${type} is not a valid constructor for ${JSON.stringify(entry.data)}`);
}
return Object.assign(new type(), entry.data) as T
return Object.assign(new type(), entry.data) as T;
})
);
}

View File

@@ -193,7 +193,7 @@ export class PostPatchSuccessResponse extends RestResponse {
export class SubmissionSuccessResponse extends RestResponse {
constructor(
public dataDefinition: Array<SubmissionObject | ConfigObject | string>,
public dataDefinition: (SubmissionObject | ConfigObject | string)[],
public statusCode: number,
public statusText: string,
public pageInfo?: PageInfo

View File

@@ -79,4 +79,4 @@ export class EmptySSBAction implements Action {
export type ServerSyncBufferAction
= AddToSSBAction
| CommitSSBAction
| EmptySSBAction
| EmptySSBAction;

View File

@@ -39,7 +39,7 @@ export class ServerSyncBufferEffects {
const timeoutInSeconds = autoSyncConfig.timePerMethod[action.payload.method] || autoSyncConfig.defaultTime;
return observableOf(new CommitSSBAction(action.payload.method)).pipe(
delay(timeoutInSeconds * 1000),
)
);
})
);
@@ -57,7 +57,7 @@ export class ServerSyncBufferEffects {
select(serverSyncBufferSelector()),
take(1), /* necessary, otherwise delay will not have any effect after the first run */
switchMap((bufferState: ServerSyncBufferState) => {
const actions: Array<Observable<Action>> = bufferState.buffer
const actions: Observable<Action>[] = bufferState.buffer
.filter((entry: ServerSyncBufferEntry) => {
/* If there's a request method, filter
If there's no filter, commit everything */

View File

@@ -42,7 +42,7 @@ export function serverSyncBufferReducer(state = initialState, action: ServerSync
switch (action.type) {
case ServerSyncBufferActionTypes.ADD: {
return addToServerSyncQueue(state, action as AddToSSBAction)
return addToServerSyncQueue(state, action as AddToSSBAction);
}
case ServerSyncBufferActionTypes.EMPTY: {

View File

@@ -9,8 +9,8 @@ import { ConfigObject } from './config.model';
* An interface that define section visibility and its properties.
*/
export interface SubmissionSectionVisibility {
main: any,
other: any
main: any;
other: any;
}
@typedObject
@@ -49,6 +49,6 @@ export class SubmissionSectionModel extends ConfigObject {
_links: {
self: HALLink;
config: HALLink;
}
};
}

View File

@@ -16,15 +16,15 @@ import { historyReducer, HistoryState } from './history/history.reducer';
export interface CoreState {
'bitstreamFormats': BitstreamFormatRegistryState;
'cache/object': ObjectCacheState,
'cache/syncbuffer': ServerSyncBufferState,
'cache/object-updates': ObjectUpdatesState
'data/request': RequestState,
'cache/object': ObjectCacheState;
'cache/syncbuffer': ServerSyncBufferState;
'cache/object-updates': ObjectUpdatesState;
'data/request': RequestState;
'history': HistoryState;
'index': MetaIndexState,
'auth': AuthState,
'json/patch': JsonPatchOperationsState,
'route': RouteState
'index': MetaIndexState;
'auth': AuthState;
'json/patch': JsonPatchOperationsState;
'route': RouteState;
}
export const coreReducers: ActionReducerMap<CoreState> = {

View File

@@ -28,7 +28,7 @@ export class ArrayMoveChangeAnalyzer<T> {
op: 'move',
from: '/' + movedIndex,
path: '/' + otherIndex
}) as MoveOperation)
}) as MoveOperation);
}
}
});

View File

@@ -63,7 +63,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));
}
}
});

View File

@@ -68,7 +68,7 @@ export class BitstreamDataService extends DataService<Bitstream> {
* @param bundle the bundle to retrieve bitstreams from
* @param options options for the find all request
*/
findAllByBundle(bundle: Bundle, options?: FindListOptions, ...linksToFollow: Array<FollowLinkConfig<Bitstream>>): Observable<RemoteData<PaginatedList<Bitstream>>> {
findAllByBundle(bundle: Bundle, options?: FindListOptions, ...linksToFollow: FollowLinkConfig<Bitstream>[]): Observable<RemoteData<PaginatedList<Bitstream>>> {
return this.findAllByHref(bundle._links.bitstreams.href, options, ...linksToFollow);
}
@@ -163,13 +163,13 @@ export class BitstreamDataService extends DataService<Bitstream> {
* @param options the {@link FindListOptions} for the request
* @param linksToFollow the {@link FollowLinkConfig}s for the request
*/
public findAllByItemAndBundleName(item: Item, bundleName: string, options?: FindListOptions, ...linksToFollow: Array<FollowLinkConfig<Bitstream>>): Observable<RemoteData<PaginatedList<Bitstream>>> {
public findAllByItemAndBundleName(item: Item, bundleName: string, options?: FindListOptions, ...linksToFollow: FollowLinkConfig<Bitstream>[]): Observable<RemoteData<PaginatedList<Bitstream>>> {
return this.bundleService.findByItemAndName(item, bundleName).pipe(
switchMap((bundleRD: RemoteData<Bundle>) => {
if (bundleRD.hasSucceeded && hasValue(bundleRD.payload)) {
return this.findAllByBundle(bundleRD.payload, options, ...linksToFollow);
} else if (!bundleRD.hasSucceeded && bundleRD.error.statusCode === 404) {
return createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), []))
return createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), []));
} else {
return [bundleRD as any];
}

View File

@@ -54,7 +54,7 @@ export class BundleDataService extends DataService<Bundle> {
* @param options the {@link FindListOptions} for the request
* @param linksToFollow the {@link FollowLinkConfig}s for the request
*/
findAllByItem(item: Item, options?: FindListOptions, ...linksToFollow: Array<FollowLinkConfig<Bundle>>): Observable<RemoteData<PaginatedList<Bundle>>> {
findAllByItem(item: Item, options?: FindListOptions, ...linksToFollow: FollowLinkConfig<Bundle>[]): Observable<RemoteData<PaginatedList<Bundle>>> {
return this.findAllByHref(item._links.bundles.href, options, ...linksToFollow);
}
@@ -66,7 +66,7 @@ export class BundleDataService extends DataService<Bundle> {
* @param linksToFollow the {@link FollowLinkConfig}s for the request
*/
// TODO should be implemented rest side
findByItemAndName(item: Item, bundleName: string, ...linksToFollow: Array<FollowLinkConfig<Bundle>>): Observable<RemoteData<Bundle>> {
findByItemAndName(item: Item, bundleName: string, ...linksToFollow: FollowLinkConfig<Bundle>[]): Observable<RemoteData<Bundle>> {
return this.findAllByItem(item, { elementsPerPage: Number.MAX_SAFE_INTEGER }, ...linksToFollow).pipe(
map((rd: RemoteData<PaginatedList<Bundle>>) => {
if (hasValue(rd.payload) && hasValue(rd.payload.page)) {
@@ -81,7 +81,7 @@ export class BundleDataService extends DataService<Bundle> {
matchingBundle
);
} else {
return new RemoteData(false, false, false, new RemoteDataError(404, 'Not found', `The bundle with name ${bundleName} was not found.` ))
return new RemoteData(false, false, false, new RemoteDataError(404, 'Not found', `The bundle with name ${bundleName} was not found.` ));
}
} else {
return rd as any;
@@ -108,7 +108,7 @@ export class BundleDataService extends DataService<Bundle> {
* @param searchOptions The search options to use
* @param linksToFollow The {@link FollowLinkConfig}s for the request
*/
getBitstreams(bundleId: string, searchOptions?: PaginatedSearchOptions, ...linksToFollow: Array<FollowLinkConfig<Bitstream>>): Observable<RemoteData<PaginatedList<Bitstream>>> {
getBitstreams(bundleId: string, searchOptions?: PaginatedSearchOptions, ...linksToFollow: FollowLinkConfig<Bitstream>[]): Observable<RemoteData<PaginatedList<Bitstream>>> {
const hrefObs = this.getBitstreamsEndpoint(bundleId, searchOptions);
hrefObs.pipe(

View File

@@ -77,7 +77,7 @@ export class CollectionDataService extends ComColDataService<Collection> {
* @return Observable<RemoteData<PaginatedList<Collection>>>
* collection list
*/
getAuthorizedCollection(query: string, options: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<Collection>>): Observable<RemoteData<PaginatedList<Collection>>> {
getAuthorizedCollection(query: string, options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<Collection>[]): Observable<RemoteData<PaginatedList<Collection>>> {
const searchHref = 'findSubmitAuthorized';
options = Object.assign({}, options, {
searchParams: [new RequestParam('query', query)]
@@ -219,7 +219,7 @@ export class CollectionDataService extends ComColDataService<Collection> {
* @param searchOptions Search options to sort or filter out items
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
getMappedItems(collectionId: string, searchOptions?: PaginatedSearchOptions, ...linksToFollow: Array<FollowLinkConfig<Item>>): Observable<RemoteData<PaginatedList<DSpaceObject>>> {
getMappedItems(collectionId: string, searchOptions?: PaginatedSearchOptions, ...linksToFollow: FollowLinkConfig<Item>[]): Observable<RemoteData<PaginatedList<DSpaceObject>>> {
const requestUuid = this.requestService.generateRequestId();
const href$ = this.getMappedItemsEndpoint(collectionId).pipe(

View File

@@ -97,7 +97,7 @@ export abstract class ComColDataService<T extends CacheableObject> extends DataS
public getLogoEndpoint(id: string): Observable<string> {
return this.halService.getEndpoint(this.linkPath).pipe(
switchMap((href: string) => this.halService.getEndpoint('logo', `${href}/${id}`))
)
);
}
/**

View File

@@ -71,7 +71,7 @@ export abstract class DataService<T extends CacheableObject> implements UpdateDa
* Return an observable that emits created HREF
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
public getFindAllHref(options: FindListOptions = {}, linkPath?: string, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<string> {
public getFindAllHref(options: FindListOptions = {}, linkPath?: string, ...linksToFollow: FollowLinkConfig<T>[]): Observable<string> {
let endpoint$: Observable<string>;
const args = [];
@@ -93,7 +93,7 @@ export abstract class DataService<T extends CacheableObject> implements UpdateDa
* Return an observable that emits created HREF
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
public getSearchByHref(searchMethod: string, options: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<string> {
public getSearchByHref(searchMethod: string, options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<T>[]): Observable<string> {
let result$: Observable<string>;
const args = [];
@@ -112,7 +112,7 @@ export abstract class DataService<T extends CacheableObject> implements UpdateDa
* Return an observable that emits created HREF
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
public buildHrefFromFindOptions(href: string, options: FindListOptions, extraArgs: string[] = [], ...linksToFollow: Array<FollowLinkConfig<T>>): string {
public buildHrefFromFindOptions(href: string, options: FindListOptions, extraArgs: string[] = [], ...linksToFollow: FollowLinkConfig<T>[]): string {
let args = [...extraArgs];
if (hasValue(options.currentPage) && typeof options.currentPage === 'number') {
@@ -131,7 +131,7 @@ export abstract class DataService<T extends CacheableObject> implements UpdateDa
if (hasValue(options.searchParams)) {
options.searchParams.forEach((param: RequestParam) => {
args = [...args, `${param.fieldName}=${param.fieldValue}`];
})
});
}
args = this.addEmbedParams(args, ...linksToFollow);
if (isNotEmpty(args)) {
@@ -151,13 +151,13 @@ export abstract class DataService<T extends CacheableObject> implements UpdateDa
* @return {Observable<string>}
* Return an observable that emits created HREF
*/
protected buildHrefWithParams(href: string, params: RequestParam[], ...linksToFollow: Array<FollowLinkConfig<T>>): string {
protected buildHrefWithParams(href: string, params: RequestParam[], ...linksToFollow: FollowLinkConfig<T>[]): string {
let args = [];
if (hasValue(params)) {
params.forEach((param: RequestParam) => {
args.push(`${param.fieldName}=${param.fieldValue}`);
})
});
}
args = this.addEmbedParams(args, ...linksToFollow);
@@ -173,7 +173,7 @@ export abstract class DataService<T extends CacheableObject> implements UpdateDa
* @param args params for the query string
* @param linksToFollow links we want to embed in query string if shouldEmbed is true
*/
protected addEmbedParams(args: string[], ...linksToFollow: Array<FollowLinkConfig<T>>) {
protected addEmbedParams(args: string[], ...linksToFollow: FollowLinkConfig<T>[]) {
linksToFollow.forEach((linkToFollow: FollowLinkConfig<T>) => {
if (linkToFollow !== undefined && linkToFollow.shouldEmbed) {
const embedString = 'embed=' + String(linkToFollow.name);
@@ -189,7 +189,7 @@ export abstract class DataService<T extends CacheableObject> implements UpdateDa
* @param embedString embedString so far (recursive)
* @param linksToFollow links we want to embed in query string if shouldEmbed is true
*/
protected addNestedEmbeds(embedString: string, ...linksToFollow: Array<FollowLinkConfig<T>>): string {
protected addNestedEmbeds(embedString: string, ...linksToFollow: FollowLinkConfig<T>[]): string {
let nestEmbed = embedString;
linksToFollow.forEach((linkToFollow: FollowLinkConfig<T>) => {
if (linkToFollow !== undefined && linkToFollow.shouldEmbed) {
@@ -211,7 +211,7 @@ export abstract class DataService<T extends CacheableObject> implements UpdateDa
* @return {Observable<RemoteData<PaginatedList<T>>>}
* Return an observable that emits object list
*/
findAll(options: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<RemoteData<PaginatedList<T>>> {
findAll(options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<T>[]): Observable<RemoteData<PaginatedList<T>>> {
return this.findList(this.getFindAllHref(options), options, ...linksToFollow);
}
@@ -222,7 +222,7 @@ export abstract class DataService<T extends CacheableObject> implements UpdateDa
* @param options Find list options object
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
protected findList(href$, options: FindListOptions, ...linksToFollow: Array<FollowLinkConfig<T>>) {
protected findList(href$, options: FindListOptions, ...linksToFollow: FollowLinkConfig<T>[]) {
href$.pipe(
first((href: string) => hasValue(href)))
.subscribe((href: string) => {
@@ -242,7 +242,7 @@ export abstract class DataService<T extends CacheableObject> implements UpdateDa
* @param resourceID The identifier for the object
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
getIDHref(endpoint, resourceID, ...linksToFollow: Array<FollowLinkConfig<T>>): string {
getIDHref(endpoint, resourceID, ...linksToFollow: FollowLinkConfig<T>[]): string {
return this.buildHrefFromFindOptions(endpoint + '/' + resourceID, {}, [], ...linksToFollow);
}
@@ -251,7 +251,7 @@ export abstract class DataService<T extends CacheableObject> implements UpdateDa
* @param resourceID The identifier for the object
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
getIDHrefObs(resourceID: string, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<string> {
getIDHrefObs(resourceID: string, ...linksToFollow: FollowLinkConfig<T>[]): Observable<string> {
return this.getEndpoint().pipe(
map((endpoint: string) => this.getIDHref(endpoint, resourceID, ...linksToFollow)));
}
@@ -262,7 +262,7 @@ export abstract class DataService<T extends CacheableObject> implements UpdateDa
* @param id ID of object we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
findById(id: string, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<RemoteData<T>> {
findById(id: string, ...linksToFollow: FollowLinkConfig<T>[]): Observable<RemoteData<T>> {
const hrefObs = this.getIDHrefObs(encodeURIComponent(id), ...linksToFollow);
hrefObs.pipe(
@@ -284,7 +284,7 @@ export abstract class DataService<T extends CacheableObject> implements UpdateDa
* @param href The url of object we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
findByHref(href: string, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<RemoteData<T>> {
findByHref(href: string, ...linksToFollow: FollowLinkConfig<T>[]): Observable<RemoteData<T>> {
const requestHref = this.buildHrefFromFindOptions(href, {}, [], ...linksToFollow);
const request = new GetRequest(this.requestService.generateRequestId(), requestHref);
if (hasValue(this.responseMsToLive)) {
@@ -301,7 +301,7 @@ export abstract class DataService<T extends CacheableObject> implements UpdateDa
* @param findListOptions Find list options object
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
findAllByHref(href: string, findListOptions: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<RemoteData<PaginatedList<T>>> {
findAllByHref(href: string, findListOptions: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<T>[]): Observable<RemoteData<PaginatedList<T>>> {
const requestHref = this.buildHrefFromFindOptions(href, findListOptions, [], ...linksToFollow);
const request = new GetRequest(this.requestService.generateRequestId(), requestHref);
if (hasValue(this.responseMsToLive)) {
@@ -331,7 +331,7 @@ export abstract class DataService<T extends CacheableObject> implements UpdateDa
* @return {Observable<RemoteData<PaginatedList<T>>}
* Return an observable that emits response from the server
*/
searchBy(searchMethod: string, options: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<T>>): Observable<RemoteData<PaginatedList<T>>> {
searchBy(searchMethod: string, options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<T>[]): Observable<RemoteData<PaginatedList<T>>> {
const requestId = this.requestService.generateRequestId();
const hrefObs = this.getSearchByHref(searchMethod, options, ...linksToFollow);
@@ -456,7 +456,7 @@ export abstract class DataService<T extends CacheableObject> implements UpdateDa
if (hasValue(this.responseMsToLive)) {
request.responseMsToLive = this.responseMsToLive;
}
return request
return request;
})
);
@@ -485,7 +485,7 @@ export abstract class DataService<T extends CacheableObject> implements UpdateDa
return selfLink$.pipe(
switchMap((selfLink: string) => this.findByHref(selfLink)),
)
);
}
/**
@@ -511,7 +511,7 @@ export abstract class DataService<T extends CacheableObject> implements UpdateDa
if (hasValue(this.responseMsToLive)) {
request.responseMsToLive = this.responseMsToLive;
}
return request
return request;
})
);

View File

@@ -46,7 +46,7 @@ export class DsoRedirectDataService extends DataService<any> {
}
}
getIDHref(endpoint, resourceID, ...linksToFollow: Array<FollowLinkConfig<any>>): string {
getIDHref(endpoint, resourceID, ...linksToFollow: FollowLinkConfig<any>[]): string {
// Supporting both identifier (pid) and uuid (dso) endpoints
return this.buildHrefFromFindOptions( endpoint.replace(/\{\?id\}/, `?id=${resourceID}`)
.replace(/\{\?uuid\}/, `?uuid=${resourceID}`),
@@ -73,11 +73,11 @@ export class DsoRedirectDataService extends DataService<any> {
getEndpointFromDSOType(dsoType: string): string {
// Are there other types to consider?
if (dsoType.startsWith('item')) {
return 'items'
return 'items';
} else if (dsoType.startsWith('community')) {
return 'communities';
} else if (dsoType.startsWith('collection')) {
return 'collections'
return 'collections';
} else {
return '';
}

View File

@@ -31,7 +31,7 @@ export class DSOResponseParsingService extends BaseResponseParsingService implem
let objectList = processRequestDTO;
if (hasNoValue(processRequestDTO)) {
return new DSOSuccessResponse([], data.statusCode, data.statusText, undefined)
return new DSOSuccessResponse([], data.statusCode, data.statusText, undefined);
}
if (hasValue(processRequestDTO.page)) {
objectList = processRequestDTO.page;
@@ -39,7 +39,7 @@ export class DSOResponseParsingService extends BaseResponseParsingService implem
objectList = [processRequestDTO];
}
const selfLinks = objectList.map((no) => no._links.self.href);
return new DSOSuccessResponse(selfLinks, data.statusCode, data.statusText, this.processPageInfo(data.payload))
return new DSOSuccessResponse(selfLinks, data.statusCode, data.statusText, this.processPageInfo(data.payload));
}
}

View File

@@ -32,7 +32,7 @@ class DataServiceImpl extends DataService<DSpaceObject> {
super();
}
getIDHref(endpoint, resourceID, ...linksToFollow: Array<FollowLinkConfig<DSpaceObject>>): string {
getIDHref(endpoint, resourceID, ...linksToFollow: FollowLinkConfig<DSpaceObject>[]): string {
return this.buildHrefFromFindOptions( endpoint.replace(/\{\?uuid\}/, `?uuid=${resourceID}`),
{}, [], ...linksToFollow);
}

View File

@@ -68,7 +68,7 @@ export class ItemTypeDataService {
* @param href The url of {@link ItemType} we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
findByHref(href: string, ...linksToFollow: Array<FollowLinkConfig<ItemType>>): Observable<RemoteData<ItemType>> {
findByHref(href: string, ...linksToFollow: FollowLinkConfig<ItemType>[]): Observable<RemoteData<ItemType>> {
return this.dataService.findByHref(href, ...linksToFollow);
}
@@ -78,7 +78,7 @@ export class ItemTypeDataService {
* @param href The url of the {@link ItemType} we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
findByAllHref(href: string, findListOptions: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<ItemType>>): Observable<RemoteData<PaginatedList<ItemType>>> {
findByAllHref(href: string, findListOptions: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<ItemType>[]): Observable<RemoteData<PaginatedList<ItemType>>> {
return this.dataService.findAllByHref(href, findListOptions, ...linksToFollow);
}
}

View File

@@ -56,7 +56,7 @@ export class EntityTypeService extends DataService<ItemType> {
* @param entityTypeId
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
getEntityTypeRelationships(entityTypeId: string, ...linksToFollow: Array<FollowLinkConfig<RelationshipType>>): Observable<RemoteData<PaginatedList<RelationshipType>>> {
getEntityTypeRelationships(entityTypeId: string, ...linksToFollow: FollowLinkConfig<RelationshipType>[]): Observable<RemoteData<PaginatedList<RelationshipType>>> {
const href$ = this.getRelationshipTypesEndpoint(entityTypeId);

View File

@@ -82,7 +82,7 @@ export class AuthorizationDataService extends DataService<Authorization> {
* @param options {@link FindListOptions} to provide pagination and/or additional arguments
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
searchByObject(featureId?: FeatureID, objectUrl?: string, ePersonUuid?: string, options: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<Authorization>>): Observable<RemoteData<PaginatedList<Authorization>>> {
searchByObject(featureId?: FeatureID, objectUrl?: string, ePersonUuid?: string, options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<Authorization>[]): Observable<RemoteData<PaginatedList<Authorization>>> {
return observableOf(new AuthorizationSearchParams(objectUrl, ePersonUuid, featureId)).pipe(
addSiteObjectUrlIfEmpty(this.siteService),
switchMap((params: AuthorizationSearchParams) => {
@@ -100,7 +100,7 @@ export class AuthorizationDataService extends DataService<Authorization> {
* @return {Observable<RemoteData<PaginatedList<Authorization>>}
* Return an observable that emits response from the server
*/
searchBy(searchMethod: string, options: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<Authorization>>): Observable<RemoteData<PaginatedList<Authorization>>> {
searchBy(searchMethod: string, options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<Authorization>[]): Observable<RemoteData<PaginatedList<Authorization>>> {
const hrefObs = this.getSearchByHref(searchMethod, options, ...linksToFollow);
return hrefObs.pipe(
@@ -130,7 +130,7 @@ export class AuthorizationDataService extends DataService<Authorization> {
if (isNotEmpty(options.searchParams)) {
params = [...options.searchParams];
}
params.push(new RequestParam('uri', objectUrl))
params.push(new RequestParam('uri', objectUrl));
if (hasValue(featureId)) {
params.push(new RequestParam('feature', featureId));
}

View File

@@ -45,7 +45,7 @@ export const addAuthenticatedUserUuidIfEmpty = (authService: AuthService) =>
map((ePerson) => Object.assign({}, params, { ePersonUuid: ePerson.uuid }))
);
} else {
return observableOf(params)
return observableOf(params);
}
})
);

View File

@@ -50,7 +50,7 @@ export class FeatureDataService extends DataService<Feature> {
* @return {Observable<RemoteData<PaginatedList<Feature>>}
* Return an observable that emits response from the server
*/
searchBy(searchMethod: string, options: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<Feature>>): Observable<RemoteData<PaginatedList<Feature>>> {
searchBy(searchMethod: string, options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<Feature>[]): Observable<RemoteData<PaginatedList<Feature>>> {
const hrefObs = this.getSearchByHref(searchMethod, options, ...linksToFollow);
return hrefObs.pipe(

View File

@@ -101,7 +101,7 @@ class DataServiceImpl extends ItemDataService {
* @param collectionID
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
findByCollectionID(collectionID: string, ...linksToFollow: Array<FollowLinkConfig<Item>>): Observable<RemoteData<Item>> {
findByCollectionID(collectionID: string, ...linksToFollow: FollowLinkConfig<Item>[]): Observable<RemoteData<Item>> {
this.setCollectionEndpoint(collectionID);
return super.findById(collectionID, ...linksToFollow);
}
@@ -175,7 +175,7 @@ export class ItemTemplateDataService implements UpdateDataService<Item> {
* @param collectionID
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
findByCollectionID(collectionID: string, ...linksToFollow: Array<FollowLinkConfig<Item>>): Observable<RemoteData<Item>> {
findByCollectionID(collectionID: string, ...linksToFollow: FollowLinkConfig<Item>[]): Observable<RemoteData<Item>> {
return this.dataService.findByCollectionID(collectionID, ...linksToFollow);
}

View File

@@ -68,7 +68,7 @@ export class LicenseDataService {
* @param href The URL of object we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
findByHref(href: string, ...linksToFollow: Array<FollowLinkConfig<License>>): Observable<RemoteData<License>> {
findByHref(href: string, ...linksToFollow: FollowLinkConfig<License>[]): Observable<RemoteData<License>> {
return this.dataService.findByHref(href, ...linksToFollow);
}
@@ -78,7 +78,7 @@ export class LicenseDataService {
* @param href The URL of object we want to retrieve
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/
findByAllHref(href: string, findListOptions: FindListOptions = {}, ...linksToFollow: Array<FollowLinkConfig<License>>): Observable<RemoteData<PaginatedList<License>>> {
findByAllHref(href: string, findListOptions: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<License>[]): Observable<RemoteData<PaginatedList<License>>> {
return this.dataService.findAllByHref(href, findListOptions, ...linksToFollow);
}
}

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