ESLint: fix prefer-const violations

This commit is contained in:
Yury Bondarenko
2023-05-08 16:37:23 +02:00
parent 702246be38
commit 95d3ff6569
27 changed files with 46 additions and 62 deletions

View File

@@ -76,7 +76,7 @@ export class SupervisionOrderGroupSelectorComponent {
save() { save() {
this.isSubmitted = true; this.isSubmitted = true;
if (this.selectedOrderType && this.selectedGroup) { if (this.selectedOrderType && this.selectedGroup) {
let supervisionDataObject = new SupervisionOrder(); const supervisionDataObject = new SupervisionOrder();
supervisionDataObject.ordertype = this.selectedOrderType; supervisionDataObject.ordertype = this.selectedOrderType;
this.supervisionOrderDataService.create(supervisionDataObject, this.itemUUID, this.selectedGroup.uuid, this.selectedOrderType).pipe( this.supervisionOrderDataService.create(supervisionDataObject, this.itemUUID, this.selectedGroup.uuid, this.selectedOrderType).pipe(
getFirstCompletedRemoteData(), getFirstCompletedRemoteData(),

View File

@@ -90,7 +90,7 @@ export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent {
this.subs.push( this.subs.push(
observableCombineLatest([firstItemRD, lastItemRD]).subscribe(([firstItem, lastItem]) => { observableCombineLatest([firstItemRD, lastItemRD]).subscribe(([firstItem, lastItem]) => {
let lowerLimit = this.getLimit(firstItem, metadataKeys, this.appConfig.browseBy.defaultLowerLimit); let lowerLimit = this.getLimit(firstItem, metadataKeys, this.appConfig.browseBy.defaultLowerLimit);
let upperLimit = this.getLimit(lastItem, metadataKeys, new Date().getUTCFullYear()); const upperLimit = this.getLimit(lastItem, metadataKeys, new Date().getUTCFullYear());
const options = []; const options = [];
const oneYearBreak = Math.floor((upperLimit - this.appConfig.browseBy.oneYearLimit) / 5) * 5; const oneYearBreak = Math.floor((upperLimit - this.appConfig.browseBy.oneYearLimit) / 5) * 5;
const fiveYearBreak = Math.floor((upperLimit - this.appConfig.browseBy.fiveYearLimit) / 10) * 10; const fiveYearBreak = Math.floor((upperLimit - this.appConfig.browseBy.fiveYearLimit) / 10) * 10;

View File

@@ -280,9 +280,7 @@ export class CommunityListService {
* @param community Community being checked whether it is expandable (if it has subcommunities or collections) * @param community Community being checked whether it is expandable (if it has subcommunities or collections)
*/ */
public getIsExpandable(community: Community): Observable<boolean> { public getIsExpandable(community: Community): Observable<boolean> {
let hasSubcoms$: Observable<boolean>; const hasSubcoms$ = this.communityDataService.findByParent(community.uuid, this.configOnePage)
let hasColls$: Observable<boolean>;
hasSubcoms$ = this.communityDataService.findByParent(community.uuid, this.configOnePage)
.pipe( .pipe(
map((rd: RemoteData<PaginatedList<Community>>) => { map((rd: RemoteData<PaginatedList<Community>>) => {
if (hasValue(rd) && hasValue(rd.payload)) { if (hasValue(rd) && hasValue(rd.payload)) {
@@ -293,7 +291,7 @@ export class CommunityListService {
}), }),
); );
hasColls$ = this.collectionDataService.findByParent(community.uuid, this.configOnePage) const hasColls$ = this.collectionDataService.findByParent(community.uuid, this.configOnePage)
.pipe( .pipe(
map((rd: RemoteData<PaginatedList<Collection>>) => { map((rd: RemoteData<PaginatedList<Collection>>) => {
if (hasValue(rd) && hasValue(rd.payload)) { if (hasValue(rd) && hasValue(rd.payload)) {
@@ -304,12 +302,9 @@ export class CommunityListService {
}), }),
); );
let hasChildren$: Observable<boolean>; return observableCombineLatest(hasSubcoms$, hasColls$).pipe(
hasChildren$ = observableCombineLatest(hasSubcoms$, hasColls$).pipe(
map(([hasSubcoms, hasColls]: [boolean, boolean]) => hasSubcoms || hasColls) map(([hasSubcoms, hasColls]: [boolean, boolean]) => hasSubcoms || hasColls)
); );
return hasChildren$;
} }
} }

View File

@@ -260,9 +260,8 @@ export class AuthService {
select(getAuthenticationToken), select(getAuthenticationToken),
take(1), take(1),
map((authTokenInfo: AuthTokenInfo) => { map((authTokenInfo: AuthTokenInfo) => {
let token: AuthTokenInfo;
// Retrieve authentication token info and check if is valid // Retrieve authentication token info and check if is valid
token = isNotEmpty(authTokenInfo) ? authTokenInfo : this.storage.get(TOKENITEM); const token = isNotEmpty(authTokenInfo) ? authTokenInfo : this.storage.get(TOKENITEM);
if (isNotEmpty(token) && token.hasOwnProperty('accessToken') && isNotEmpty(token.accessToken) && !this.isTokenExpired(token)) { if (isNotEmpty(token) && token.hasOwnProperty('accessToken') && isNotEmpty(token.accessToken) && !this.isTokenExpired(token)) {
return token; return token;
} else { } else {

View File

@@ -87,10 +87,9 @@ export class FindAllDataImpl<T extends CacheableObject> extends BaseDataService<
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved * @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/ */
getFindAllHref(options: FindListOptions = {}, linkPath?: string, ...linksToFollow: FollowLinkConfig<T>[]): Observable<string> { getFindAllHref(options: FindListOptions = {}, linkPath?: string, ...linksToFollow: FollowLinkConfig<T>[]): Observable<string> {
let endpoint$: Observable<string>;
const args = []; const args = [];
endpoint$ = this.getBrowseEndpoint(options).pipe( const endpoint$ = this.getBrowseEndpoint(options).pipe(
filter((href: string) => isNotEmpty(href)), filter((href: string) => isNotEmpty(href)),
map((href: string) => isNotEmpty(linkPath) ? `${href}/${linkPath}` : href), map((href: string) => isNotEmpty(linkPath) ? `${href}/${linkPath}` : href),
distinctUntilChanged(), distinctUntilChanged(),

View File

@@ -112,10 +112,9 @@ export class SearchDataImpl<T extends CacheableObject> extends BaseDataService<T
* @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved * @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved
*/ */
getSearchByHref(searchMethod: string, options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<T>[]): Observable<string> { getSearchByHref(searchMethod: string, options: FindListOptions = {}, ...linksToFollow: FollowLinkConfig<T>[]): Observable<string> {
let result$: Observable<string>;
const args = []; const args = [];
result$ = this.getSearchEndpoint(searchMethod); const result$ = this.getSearchEndpoint(searchMethod);
return result$.pipe(map((result: string) => this.buildHrefFromFindOptions(result, options, args, ...linksToFollow))); return result$.pipe(map((result: string) => this.buildHrefFromFindOptions(result, options, args, ...linksToFollow)));
} }

View File

@@ -95,7 +95,7 @@ export class DsoRedirectService {
if (response.hasSucceeded) { if (response.hasSucceeded) {
const dso = response.payload; const dso = response.payload;
if (hasValue(dso.uuid)) { if (hasValue(dso.uuid)) {
let newRoute = getDSORoute(dso); const newRoute = getDSORoute(dso);
if (hasValue(newRoute)) { if (hasValue(newRoute)) {
// Use a "301 Moved Permanently" redirect for SEO purposes // Use a "301 Moved Permanently" redirect for SEO purposes
this.hardRedirectService.redirect(newRoute, 301); this.hardRedirectService.redirect(newRoute, 301);

View File

@@ -264,7 +264,7 @@ export class RelationshipDataService extends IdentifiableDataService<Relationshi
* @param options * @param options
*/ */
getRelatedItemsByLabel(item: Item, label: string, options?: FindListOptions): Observable<RemoteData<PaginatedList<Item>>> { getRelatedItemsByLabel(item: Item, label: string, options?: FindListOptions): Observable<RemoteData<PaginatedList<Item>>> {
let linksToFollow: FollowLinkConfig<Relationship>[] = itemLinksToFollow(options.fetchThumbnail); const linksToFollow: FollowLinkConfig<Relationship>[] = itemLinksToFollow(options.fetchThumbnail);
linksToFollow.push(followLink('relationshipType')); linksToFollow.push(followLink('relationshipType'));
return this.getItemRelationshipsByLabel(item, label, options, true, true, ...linksToFollow).pipe(this.paginatedRelationsToItems(item.uuid)); return this.getItemRelationshipsByLabel(item, label, options, true, true, ...linksToFollow).pipe(this.paginatedRelationsToItems(item.uuid));

View File

@@ -184,7 +184,7 @@ export class ItemAuthorizationsComponent implements OnInit, OnDestroy {
mergeMap((list: PaginatedList<Bundle>) => list.page), mergeMap((list: PaginatedList<Bundle>) => list.page),
map((bundle: Bundle) => ({ id: bundle.id, bitstreams: this.getBundleBitstreams(bundle) })) map((bundle: Bundle) => ({ id: bundle.id, bitstreams: this.getBundleBitstreams(bundle) }))
).subscribe((entry: BundleBitstreamsMapEntry) => { ).subscribe((entry: BundleBitstreamsMapEntry) => {
let bitstreamMapValues: BitstreamMapValue = { const bitstreamMapValues: BitstreamMapValue = {
isCollapsed: true, isCollapsed: true,
allBitstreamsLoaded: false, allBitstreamsLoaded: false,
bitstreams: null bitstreams: null
@@ -239,14 +239,14 @@ export class ItemAuthorizationsComponent implements OnInit, OnDestroy {
*/ */
onBitstreamsLoad(bundle: Bundle) { onBitstreamsLoad(bundle: Bundle) {
return this.getBundleBitstreams(bundle).subscribe((res: PaginatedList<Bitstream>) => { return this.getBundleBitstreams(bundle).subscribe((res: PaginatedList<Bitstream>) => {
let nextBitstreams = res?.page.slice(this.bitstreamPageSize, this.bitstreamPageSize + this.bitstreamSize); const nextBitstreams = res?.page.slice(this.bitstreamPageSize, this.bitstreamPageSize + this.bitstreamSize);
let bitstreamsToShow = this.bundleBitstreamsMap.get(bundle.id).bitstreams.pipe( const bitstreamsToShow = this.bundleBitstreamsMap.get(bundle.id).bitstreams.pipe(
map((existingBits: Bitstream[])=> { map((existingBits: Bitstream[])=> {
return [... existingBits, ...nextBitstreams]; return [... existingBits, ...nextBitstreams];
}) })
); );
this.bitstreamPageSize = this.bitstreamPageSize + this.bitstreamSize; this.bitstreamPageSize = this.bitstreamPageSize + this.bitstreamSize;
let bitstreamMapValues: BitstreamMapValue = { const bitstreamMapValues: BitstreamMapValue = {
bitstreams: bitstreamsToShow , bitstreams: bitstreamsToShow ,
isCollapsed: this.bundleBitstreamsMap.get(bundle.id).isCollapsed, isCollapsed: this.bundleBitstreamsMap.get(bundle.id).isCollapsed,
allBitstreamsLoaded: res?.page.length <= this.bitstreamPageSize allBitstreamsLoaded: res?.page.length <= this.bitstreamPageSize

View File

@@ -493,7 +493,7 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy {
); );
// this adds thumbnail images when required by configuration // this adds thumbnail images when required by configuration
let linksToFollow: FollowLinkConfig<Relationship>[] = itemLinksToFollow(this.fetchThumbnail); const linksToFollow: FollowLinkConfig<Relationship>[] = itemLinksToFollow(this.fetchThumbnail);
this.subs.push( this.subs.push(
observableCombineLatest([ observableCombineLatest([

View File

@@ -103,7 +103,7 @@ export class ItemStatusComponent implements OnInit {
); );
// Observable for configuration determining whether the Register DOI feature is enabled // Observable for configuration determining whether the Register DOI feature is enabled
let registerConfigEnabled$: Observable<boolean> = this.configurationService.findByPropertyName('identifiers.item-status.register-doi').pipe( const registerConfigEnabled$: Observable<boolean> = this.configurationService.findByPropertyName('identifiers.item-status.register-doi').pipe(
getFirstCompletedRemoteData(), getFirstCompletedRemoteData(),
map((rd: RemoteData<ConfigurationProperty>) => { map((rd: RemoteData<ConfigurationProperty>) => {
// If the config property is exposed via rest and has a value set, return it // If the config property is exposed via rest and has a value set, return it
@@ -147,7 +147,7 @@ export class ItemStatusComponent implements OnInit {
getFirstSucceededRemoteData(), getFirstSucceededRemoteData(),
getRemoteDataPayload(), getRemoteDataPayload(),
mergeMap((data: IdentifierData) => { mergeMap((data: IdentifierData) => {
let identifiers = data.identifiers; const identifiers = data.identifiers;
let no_doi = true; let no_doi = true;
let pending = false; let pending = false;
if (identifiers !== undefined && identifiers !== null) { if (identifiers !== undefined && identifiers !== null) {
@@ -174,7 +174,7 @@ export class ItemStatusComponent implements OnInit {
}), }),
// Switch map pushes the register DOI operation onto a copy of the base array then returns to the pipe // Switch map pushes the register DOI operation onto a copy of the base array then returns to the pipe
switchMap((showDoi: boolean) => { switchMap((showDoi: boolean) => {
let ops = [...operations]; const ops = [...operations];
if (showDoi) { if (showDoi) {
ops.push(new ItemOperation('register-doi', this.getCurrentUrl(item) + '/register-doi', FeatureID.CanRegisterDOI, true)); ops.push(new ItemOperation('register-doi', this.getCurrentUrl(item) + '/register-doi', FeatureID.CanRegisterDOI, true));
} }

View File

@@ -84,7 +84,7 @@ export class MetadataValuesComponent implements OnChanges {
* @param value the specific metadata value being linked * @param value the specific metadata value being linked
*/ */
getQueryParams(value) { getQueryParams(value) {
let queryParams = {startsWith: value}; const queryParams = {startsWith: value};
if (this.browseDefinition.getRenderType() === VALUE_LIST_BROWSE_DEFINITION.value) { if (this.browseDefinition.getRenderType() === VALUE_LIST_BROWSE_DEFINITION.value) {
return {value: value}; return {value: value};
} }

View File

@@ -48,7 +48,7 @@ export class MediaViewerVideoComponent {
.filter((media: Bitstream) => media.name.substring(0, (media.name.length - 7)).toLowerCase() === name.toLowerCase()); .filter((media: Bitstream) => media.name.substring(0, (media.name.length - 7)).toLowerCase() === name.toLowerCase());
for (const media of filteredCapMedias) { for (const media of filteredCapMedias) {
let srclang: string = media.name.slice(-6, -4).toLowerCase(); const srclang: string = media.name.slice(-6, -4).toLowerCase();
capInfos.push(new CaptionInfo( capInfos.push(new CaptionInfo(
media._links.content.href, media._links.content.href,
srclang, srclang,

View File

@@ -183,7 +183,7 @@ export class RegisterEmailFormComponent implements OnDestroy, OnInit {
* Registration of an email address * Registration of an email address
*/ */
registration(captchaToken = null) { registration(captchaToken = null) {
let registerEmail$ = captchaToken ? const registerEmail$ = captchaToken ?
this.epersonRegistrationService.registerEmail(this.email.value, captchaToken, this.typeRequest) : this.epersonRegistrationService.registerEmail(this.email.value, captchaToken, this.typeRequest) :
this.epersonRegistrationService.registerEmail(this.email.value, null, this.typeRequest); this.epersonRegistrationService.registerEmail(this.email.value, null, this.typeRequest);
this.subscriptions.push(registerEmail$.subscribe((response: RemoteData<Registration>) => { this.subscriptions.push(registerEmail$.subscribe((response: RemoteData<Registration>) => {

View File

@@ -96,7 +96,7 @@ export class BulkAccessControlService {
* @param payload * @param payload
*/ */
export const convertToBulkAccessControlFileModel = (payload: { state: AccessControlFormState, bitstreamAccess: AccessCondition[], itemAccess: AccessCondition[] }): BulkAccessControlFileModel => { export const convertToBulkAccessControlFileModel = (payload: { state: AccessControlFormState, bitstreamAccess: AccessCondition[], itemAccess: AccessCondition[] }): BulkAccessControlFileModel => {
let finalPayload: BulkAccessControlFileModel = {}; const finalPayload: BulkAccessControlFileModel = {};
const itemEnabled = payload.state.item.toggleStatus; const itemEnabled = payload.state.item.toggleStatus;
const bitstreamEnabled = payload.state.bitstream.toggleStatus; const bitstreamEnabled = payload.state.bitstream.toggleStatus;

View File

@@ -108,7 +108,7 @@ export class BrowserKlaroService extends KlaroService {
const servicesToHide$: Observable<string[]> = observableCombineLatest([hideGoogleAnalytics$, hideRegistrationVerification$]).pipe( const servicesToHide$: Observable<string[]> = observableCombineLatest([hideGoogleAnalytics$, hideRegistrationVerification$]).pipe(
map(([hideGoogleAnalytics, hideRegistrationVerification]) => { map(([hideGoogleAnalytics, hideRegistrationVerification]) => {
let servicesToHideArray: string[] = []; const servicesToHideArray: string[] = [];
if (hideGoogleAnalytics) { if (hideGoogleAnalytics) {
servicesToHideArray.push(this.GOOGLE_ANALYTICS_SERVICE_NAME); servicesToHideArray.push(this.GOOGLE_ANALYTICS_SERVICE_NAME);
} }

View File

@@ -228,7 +228,7 @@ export class DSOSelectorComponent implements OnInit, OnDestroy {
*/ */
search(query: string, page: number, useCache: boolean = true): Observable<RemoteData<PaginatedList<SearchResult<DSpaceObject>>>> { search(query: string, page: number, useCache: boolean = true): Observable<RemoteData<PaginatedList<SearchResult<DSpaceObject>>>> {
// default sort is only used when there is not query // default sort is only used when there is not query
let efectiveSort = query ? null : this.sort; const efectiveSort = query ? null : this.sort;
return this.searchService.search( return this.searchService.search(
new PaginatedSearchOptions({ new PaginatedSearchOptions({
query: query, query: query,

View File

@@ -86,7 +86,6 @@ export class DynamicConcatModel extends DynamicFormGroupModel {
} }
set value(value: string | FormFieldMetadataValueObject) { set value(value: string | FormFieldMetadataValueObject) {
let values;
let tempValue: string; let tempValue: string;
if (typeof value === 'string') { if (typeof value === 'string') {
@@ -97,15 +96,19 @@ export class DynamicConcatModel extends DynamicFormGroupModel {
if (hasNoValue(tempValue)) { if (hasNoValue(tempValue)) {
tempValue = ''; tempValue = '';
} }
values = [...tempValue.split(this.separator), null].map((v) =>
// todo: this used to be valid, but results in a type error now -- REMEMBER TO INVESTIGATE!
const values = [...tempValue.split(this.separator), null].map((v) =>
Object.assign(new FormFieldMetadataValueObject(), value, { display: v, value: v })); Object.assign(new FormFieldMetadataValueObject(), value, { display: v, value: v }));
if (values[0].value) { if (values[0].value) {
// @ts-ignore
(this.get(0) as DsDynamicInputModel).value = values[0]; (this.get(0) as DsDynamicInputModel).value = values[0];
} else { } else {
(this.get(0) as DsDynamicInputModel).value = undefined; (this.get(0) as DsDynamicInputModel).value = undefined;
} }
if (values[1].value) { if (values[1].value) {
// @ts-ignore
(this.get(1) as DsDynamicInputModel).value = values[1]; (this.get(1) as DsDynamicInputModel).value = values[1];
} else { } else {
(this.get(1) as DsDynamicInputModel).value = undefined; (this.get(1) as DsDynamicInputModel).value = undefined;

View File

@@ -1,7 +1,6 @@
import {Inject} from '@angular/core'; import {Inject} from '@angular/core';
import { FormFieldModel } from '../models/form-field.model'; import { FormFieldModel } from '../models/form-field.model';
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model'; import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
import { DynamicFormControlLayout, } from '@ng-dynamic-forms/core';
import { import {
CONCAT_FIRST_INPUT_SUFFIX, CONCAT_FIRST_INPUT_SUFFIX,
CONCAT_GROUP_SUFFIX, CONCAT_GROUP_SUFFIX,
@@ -38,12 +37,9 @@ export class ConcatFieldParser extends FieldParser {
} }
public modelFactory(fieldValue?: FormFieldMetadataValueObject | any, label?: boolean): any { public modelFactory(fieldValue?: FormFieldMetadataValueObject | any, label?: boolean): any {
let clsGroup: DynamicFormControlLayout;
let clsInput: DynamicFormControlLayout;
const id: string = this.configData.selectableMetadata[0].metadata; const id: string = this.configData.selectableMetadata[0].metadata;
clsInput = { const clsInput = {
grid: { grid: {
host: 'col-sm-6' host: 'col-sm-6'
} }
@@ -105,7 +101,7 @@ export class ConcatFieldParser extends FieldParser {
concatGroup.group.push(model1); concatGroup.group.push(model1);
concatGroup.group.push(model2); concatGroup.group.push(model2);
clsGroup = { const clsGroup = {
element: { element: {
control: 'form-row', control: 'form-row',
} }

View File

@@ -1,5 +1,4 @@
import { FieldParser } from './field-parser'; import { FieldParser } from './field-parser';
import { DynamicFormControlLayout } from '@ng-dynamic-forms/core';
import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model'; import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model';
import { import {
DsDynamicTextAreaModel, DsDynamicTextAreaModel,
@@ -12,9 +11,7 @@ export class TextareaFieldParser extends FieldParser {
public modelFactory(fieldValue?: FormFieldMetadataValueObject | any, label?: boolean): any { public modelFactory(fieldValue?: FormFieldMetadataValueObject | any, label?: boolean): any {
const textAreaModelConfig: DsDynamicTextAreaModelConfig = this.initModel(null, label); const textAreaModelConfig: DsDynamicTextAreaModelConfig = this.initModel(null, label);
let layout: DynamicFormControlLayout; const layout = {
layout = {
element: { element: {
label: 'col-form-label' label: 'col-form-label'
} }

View File

@@ -2,7 +2,7 @@ import findIndex from 'lodash/findIndex';
import isEqual from 'lodash/isEqual'; import isEqual from 'lodash/isEqual';
import isObject from 'lodash/isObject'; import isObject from 'lodash/isObject';
import { BehaviorSubject } from 'rxjs'; import { BehaviorSubject } from 'rxjs';
import { ChipsItem, ChipsItemIcon } from './chips-item.model'; import { ChipsItem } from './chips-item.model';
import { hasValue, isNotEmpty } from '../../../empty.util'; import { hasValue, isNotEmpty } from '../../../empty.util';
import { MetadataIconConfig } from '../../../../../config/submission-config.interface'; import { MetadataIconConfig } from '../../../../../config/submission-config.interface';
import { FormFieldMetadataValueObject } from '../../builder/models/form-field-metadata-value.model'; import { FormFieldMetadataValueObject } from '../../builder/models/form-field-metadata-value.model';
@@ -123,12 +123,10 @@ export class Chips {
config = (configIndex !== -1) ? this.iconsConfig[configIndex] : defaultConfig; config = (configIndex !== -1) ? this.iconsConfig[configIndex] : defaultConfig;
if (hasValue(value) && isNotEmpty(config) && !this.hasPlaceholder(value)) { if (hasValue(value) && isNotEmpty(config) && !this.hasPlaceholder(value)) {
let icon: ChipsItemIcon;
const visibleWhenAuthorityEmpty = this.displayObj !== metadata; const visibleWhenAuthorityEmpty = this.displayObj !== metadata;
// Set icon // Set icon
icon = { const icon = {
metadata, metadata,
visibleWhenAuthorityEmpty, visibleWhenAuthorityEmpty,
style: config.style style: config.style

View File

@@ -21,8 +21,7 @@ export class NotificationsService {
} }
private add(notification: Notification) { private add(notification: Notification) {
let notificationAction; const notificationAction = new NewNotificationAction(notification);
notificationAction = new NewNotificationAction(notification);
this.store.dispatch(notificationAction); this.store.dispatch(notificationAction);
} }

View File

@@ -21,7 +21,7 @@ export class BrowseLinkMetadataListElementComponent extends MetadataRepresentati
* expects 'startsWith' (eg browse by date) or 'value' (eg browse by title) * expects 'startsWith' (eg browse by date) or 'value' (eg browse by title)
*/ */
getQueryParams() { getQueryParams() {
let queryParams = {startsWith: this.mdRepresentation.getValue()}; const queryParams = {startsWith: this.mdRepresentation.getValue()};
if (this.mdRepresentation.browseDefinition.getRenderType() === VALUE_LIST_BROWSE_DEFINITION.value) { if (this.mdRepresentation.browseDefinition.getRenderType() === VALUE_LIST_BROWSE_DEFINITION.value) {
return {value: this.mdRepresentation.getValue()}; return {value: this.mdRepresentation.getValue()};
} }

View File

@@ -21,7 +21,7 @@ export class PlainTextMetadataListElementComponent extends MetadataRepresentatio
* expects 'startsWith' (eg browse by date) or 'value' (eg browse by title) * expects 'startsWith' (eg browse by date) or 'value' (eg browse by title)
*/ */
getQueryParams() { getQueryParams() {
let queryParams = {startsWith: this.mdRepresentation.getValue()}; const queryParams = {startsWith: this.mdRepresentation.getValue()};
if (this.mdRepresentation.browseDefinition.getRenderType() === VALUE_LIST_BROWSE_DEFINITION.value) { if (this.mdRepresentation.browseDefinition.getRenderType() === VALUE_LIST_BROWSE_DEFINITION.value) {
return {value: this.mdRepresentation.getValue()}; return {value: this.mdRepresentation.getValue()};
} }

View File

@@ -333,11 +333,10 @@ export class PaginationComponent implements OnDestroy, OnInit {
if (collectionSize) { if (collectionSize) {
showingDetails = this.paginationService.getCurrentPagination(this.id, this.paginationOptions).pipe( showingDetails = this.paginationService.getCurrentPagination(this.id, this.paginationOptions).pipe(
map((currentPaginationOptions) => { map((currentPaginationOptions) => {
let firstItem;
let lastItem; let lastItem;
const pageMax = currentPaginationOptions.pageSize * currentPaginationOptions.currentPage; const pageMax = currentPaginationOptions.pageSize * currentPaginationOptions.currentPage;
firstItem = currentPaginationOptions.pageSize * (currentPaginationOptions.currentPage - 1) + 1; const firstItem = currentPaginationOptions.pageSize * (currentPaginationOptions.currentPage - 1) + 1;
if (collectionSize > pageMax) { if (collectionSize > pageMax) {
lastItem = pageMax; lastItem = pageMax;
} else { } else {

View File

@@ -432,7 +432,7 @@ export class SearchComponent implements OnInit {
private retrieveSearchResults(searchOptions: PaginatedSearchOptions) { private retrieveSearchResults(searchOptions: PaginatedSearchOptions) {
this.resultsRD$.next(null); this.resultsRD$.next(null);
this.lastSearchOptions = searchOptions; this.lastSearchOptions = searchOptions;
let followLinks = [ const followLinks = [
followLink<Item>('thumbnail', { isOptional: true }), followLink<Item>('thumbnail', { isOptional: true }),
followLink<SubmissionObject>('item', { isOptional: true }, followLink<Item>('thumbnail', { isOptional: true })) as any, followLink<SubmissionObject>('item', { isOptional: true }, followLink<Item>('thumbnail', { isOptional: true })) as any,
followLink<Item>('accessStatus', { isOptional: true, shouldEmbed: environment.item.showAccessStatuses }), followLink<Item>('accessStatus', { isOptional: true, shouldEmbed: environment.item.showAccessStatuses }),

View File

@@ -115,7 +115,7 @@ export class SubscriptionModalComponent implements OnInit {
this.subscriptionForm.valueChanges.subscribe((newValue) => { this.subscriptionForm.valueChanges.subscribe((newValue) => {
let anyFrequencySelected = false; let anyFrequencySelected = false;
for (let f of this.frequencyDefaultValues) { for (const f of this.frequencyDefaultValues) {
anyFrequencySelected = anyFrequencySelected || newValue.content.frequencies[f]; anyFrequencySelected = anyFrequencySelected || newValue.content.frequencies[f];
} }
this.isValid = anyFrequencySelected; this.isValid = anyFrequencySelected;
@@ -124,11 +124,11 @@ export class SubscriptionModalComponent implements OnInit {
initFormByAllSubscriptions(): void { initFormByAllSubscriptions(): void {
this.subscriptionForm = new UntypedFormGroup({}); this.subscriptionForm = new UntypedFormGroup({});
for (let t of this.subscriptionDefaultTypes) { for (const t of this.subscriptionDefaultTypes) {
const formGroup = new UntypedFormGroup({}); const formGroup = new UntypedFormGroup({});
formGroup.addControl('subscriptionId', this.formBuilder.control('')); formGroup.addControl('subscriptionId', this.formBuilder.control(''));
formGroup.addControl('frequencies', this.formBuilder.group({})); formGroup.addControl('frequencies', this.formBuilder.group({}));
for (let f of this.frequencyDefaultValues) { for (const f of this.frequencyDefaultValues) {
(formGroup.controls.frequencies as UntypedFormGroup).addControl(f, this.formBuilder.control(false)); (formGroup.controls.frequencies as UntypedFormGroup).addControl(f, this.formBuilder.control(false));
} }
this.subscriptionForm.addControl(t, formGroup); this.subscriptionForm.addControl(t, formGroup);
@@ -145,7 +145,7 @@ export class SubscriptionModalComponent implements OnInit {
formGroup.addControl('subscriptionId', this.formBuilder.control(this.subscription.id)); formGroup.addControl('subscriptionId', this.formBuilder.control(this.subscription.id));
formGroup.addControl('frequencies', this.formBuilder.group({})); formGroup.addControl('frequencies', this.formBuilder.group({}));
(formGroup.get('frequencies') as UntypedFormGroup).addValidators(Validators.required); (formGroup.get('frequencies') as UntypedFormGroup).addValidators(Validators.required);
for (let f of this.frequencyDefaultValues) { for (const f of this.frequencyDefaultValues) {
const value = findIndex(this.subscription.subscriptionParameterList, ['value', f]) !== -1; const value = findIndex(this.subscription.subscriptionParameterList, ['value', f]) !== -1;
(formGroup.controls.frequencies as UntypedFormGroup).addControl(f, this.formBuilder.control(value)); (formGroup.controls.frequencies as UntypedFormGroup).addControl(f, this.formBuilder.control(value));
} }
@@ -167,12 +167,12 @@ export class SubscriptionModalComponent implements OnInit {
next: (res: PaginatedList<Subscription>) => { next: (res: PaginatedList<Subscription>) => {
if (res.pageInfo.totalElements > 0) { if (res.pageInfo.totalElements > 0) {
this.showDeleteInfo$.next(true); this.showDeleteInfo$.next(true);
for (let subscription of res.page) { for (const subscription of res.page) {
const type = subscription.subscriptionType; const type = subscription.subscriptionType;
const subscriptionGroup: UntypedFormGroup = this.subscriptionForm.get(type) as UntypedFormGroup; const subscriptionGroup: UntypedFormGroup = this.subscriptionForm.get(type) as UntypedFormGroup;
if (isNotEmpty(subscriptionGroup)) { if (isNotEmpty(subscriptionGroup)) {
subscriptionGroup.controls.subscriptionId.setValue(subscription.id); subscriptionGroup.controls.subscriptionId.setValue(subscription.id);
for (let parameter of subscription.subscriptionParameterList.filter((p) => p.name === 'frequency')) { for (const parameter of subscription.subscriptionParameterList.filter((p) => p.name === 'frequency')) {
(subscriptionGroup.controls.frequencies as UntypedFormGroup).controls[parameter.value]?.setValue(true); (subscriptionGroup.controls.frequencies as UntypedFormGroup).controls[parameter.value]?.setValue(true);
} }
} }
@@ -266,7 +266,7 @@ export class SubscriptionModalComponent implements OnInit {
subscriptionParameterList: [] subscriptionParameterList: []
}; };
for (let frequency of this.frequencyDefaultValues) { for (const frequency of this.frequencyDefaultValues) {
if (frequencies.value[frequency]) { if (frequencies.value[frequency]) {
body.subscriptionParameterList.push( body.subscriptionParameterList.push(
{ {