From 702246be380525874387c91d159752642c327cec Mon Sep 17 00:00:00 2001 From: Yury Bondarenko Date: Mon, 8 May 2023 15:53:05 +0200 Subject: [PATCH 01/33] ESLint: enforce prefer-const where possible https://eslint.org/docs/latest/rules/prefer-const In our tests we use this pattern a lot: ``` let something; beforeEach(() => { something = ...; }); ``` This is not valid ~ prefer-const, but can be "let through" with some configuration. However, this would make the rule too loose for the non-test codebase. Therefore, we enable it overall but turn it off for tests only -- the `*.spec.ts` overrides apply to test files only and take precedence over `*.ts` --- .eslintrc.json | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index af1b97849b6..7361034a438 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -104,7 +104,7 @@ "allowTernary": true } ], - "prefer-const": "off", // todo: re-enable & fix errors (more strict than it used to be in TSLint) + "prefer-const": "error", "prefer-spread": "off", "no-underscore-dangle": "off", @@ -213,6 +213,21 @@ ] } }, + { + "files": [ + "*.spec.ts" + ], + "parserOptions": { + "project": [ + "./tsconfig.json", + "./cypress/tsconfig.json" + ], + "createDefaultProgram": true + }, + "rules": { + "prefer-const": "off" + } + }, { "files": [ "*.html" From 95d3ff6569ed7f3e596f22b604a43da973e8946f Mon Sep 17 00:00:00 2001 From: Yury Bondarenko Date: Mon, 8 May 2023 16:37:23 +0200 Subject: [PATCH 02/33] ESLint: fix prefer-const violations --- .../supervision-order-group-selector.component.ts | 2 +- .../browse-by-date-page.component.ts | 2 +- .../community-list-page/community-list-service.ts | 11 +++-------- src/app/core/auth/auth.service.ts | 3 +-- src/app/core/data/base/find-all-data.ts | 3 +-- src/app/core/data/base/search-data.ts | 3 +-- src/app/core/data/dso-redirect.service.ts | 2 +- src/app/core/data/relationship-data.service.ts | 2 +- .../item-authorizations.component.ts | 8 ++++---- .../edit-relationship-list.component.ts | 2 +- .../item-status/item-status.component.ts | 6 +++--- .../metadata-values/metadata-values.component.ts | 2 +- .../media-viewer-video.component.ts | 2 +- .../register-email-form.component.ts | 2 +- .../bulk-access-control.service.ts | 2 +- src/app/shared/cookies/browser-klaro.service.ts | 2 +- .../dso-selector/dso-selector.component.ts | 2 +- .../models/ds-dynamic-concat.model.ts | 7 +++++-- .../form/builder/parsers/concat-field-parser.ts | 8 ++------ .../form/builder/parsers/textarea-field-parser.ts | 5 +---- src/app/shared/form/chips/models/chips.model.ts | 6 ++---- .../shared/notifications/notifications.service.ts | 3 +-- .../browse-link-metadata-list-element.component.ts | 2 +- .../plain-text-metadata-list-element.component.ts | 2 +- src/app/shared/pagination/pagination.component.ts | 3 +-- src/app/shared/search/search.component.ts | 2 +- .../subscription-modal.component.ts | 14 +++++++------- 27 files changed, 46 insertions(+), 62 deletions(-) diff --git a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component.ts b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component.ts index 2eec0cfd0cc..8cfdcdc5236 100644 --- a/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component.ts +++ b/src/app/admin/admin-workflow-page/admin-workflow-search-results/actions/workspace-item/supervision-order-group-selector/supervision-order-group-selector.component.ts @@ -76,7 +76,7 @@ export class SupervisionOrderGroupSelectorComponent { save() { this.isSubmitted = true; if (this.selectedOrderType && this.selectedGroup) { - let supervisionDataObject = new SupervisionOrder(); + const supervisionDataObject = new SupervisionOrder(); supervisionDataObject.ordertype = this.selectedOrderType; this.supervisionOrderDataService.create(supervisionDataObject, this.itemUUID, this.selectedGroup.uuid, this.selectedOrderType).pipe( getFirstCompletedRemoteData(), diff --git a/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.ts b/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.ts index 7074190e1eb..c1d6a072b35 100644 --- a/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.ts +++ b/src/app/browse-by/browse-by-date-page/browse-by-date-page.component.ts @@ -90,7 +90,7 @@ export class BrowseByDatePageComponent extends BrowseByMetadataPageComponent { this.subs.push( observableCombineLatest([firstItemRD, lastItemRD]).subscribe(([firstItem, lastItem]) => { 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 oneYearBreak = Math.floor((upperLimit - this.appConfig.browseBy.oneYearLimit) / 5) * 5; const fiveYearBreak = Math.floor((upperLimit - this.appConfig.browseBy.fiveYearLimit) / 10) * 10; diff --git a/src/app/community-list-page/community-list-service.ts b/src/app/community-list-page/community-list-service.ts index 99e9dbeb0de..9a8841f6da1 100644 --- a/src/app/community-list-page/community-list-service.ts +++ b/src/app/community-list-page/community-list-service.ts @@ -280,9 +280,7 @@ export class CommunityListService { * @param community Community being checked whether it is expandable (if it has subcommunities or collections) */ public getIsExpandable(community: Community): Observable { - let hasSubcoms$: Observable; - let hasColls$: Observable; - hasSubcoms$ = this.communityDataService.findByParent(community.uuid, this.configOnePage) + const hasSubcoms$ = this.communityDataService.findByParent(community.uuid, this.configOnePage) .pipe( map((rd: RemoteData>) => { 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( map((rd: RemoteData>) => { if (hasValue(rd) && hasValue(rd.payload)) { @@ -304,12 +302,9 @@ export class CommunityListService { }), ); - let hasChildren$: Observable; - hasChildren$ = observableCombineLatest(hasSubcoms$, hasColls$).pipe( + return observableCombineLatest(hasSubcoms$, hasColls$).pipe( map(([hasSubcoms, hasColls]: [boolean, boolean]) => hasSubcoms || hasColls) ); - - return hasChildren$; } } diff --git a/src/app/core/auth/auth.service.ts b/src/app/core/auth/auth.service.ts index 6604936cde1..c1537792f55 100644 --- a/src/app/core/auth/auth.service.ts +++ b/src/app/core/auth/auth.service.ts @@ -260,9 +260,8 @@ export class AuthService { select(getAuthenticationToken), take(1), map((authTokenInfo: AuthTokenInfo) => { - let token: AuthTokenInfo; // 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)) { return token; } else { diff --git a/src/app/core/data/base/find-all-data.ts b/src/app/core/data/base/find-all-data.ts index 57884e537e5..7c17fa75d08 100644 --- a/src/app/core/data/base/find-all-data.ts +++ b/src/app/core/data/base/find-all-data.ts @@ -87,10 +87,9 @@ export class FindAllDataImpl extends BaseDataService< * @param linksToFollow List of {@link FollowLinkConfig} that indicate which {@link HALLink}s should be automatically resolved */ getFindAllHref(options: FindListOptions = {}, linkPath?: string, ...linksToFollow: FollowLinkConfig[]): Observable { - let endpoint$: Observable; const args = []; - endpoint$ = this.getBrowseEndpoint(options).pipe( + const endpoint$ = this.getBrowseEndpoint(options).pipe( filter((href: string) => isNotEmpty(href)), map((href: string) => isNotEmpty(linkPath) ? `${href}/${linkPath}` : href), distinctUntilChanged(), diff --git a/src/app/core/data/base/search-data.ts b/src/app/core/data/base/search-data.ts index 536d6d6e254..e9dfc92d65e 100644 --- a/src/app/core/data/base/search-data.ts +++ b/src/app/core/data/base/search-data.ts @@ -112,10 +112,9 @@ export class SearchDataImpl extends BaseDataService[]): Observable { - let result$: Observable; const args = []; - result$ = this.getSearchEndpoint(searchMethod); + const result$ = this.getSearchEndpoint(searchMethod); return result$.pipe(map((result: string) => this.buildHrefFromFindOptions(result, options, args, ...linksToFollow))); } diff --git a/src/app/core/data/dso-redirect.service.ts b/src/app/core/data/dso-redirect.service.ts index a27d1fb11f3..35aecac2bd0 100644 --- a/src/app/core/data/dso-redirect.service.ts +++ b/src/app/core/data/dso-redirect.service.ts @@ -95,7 +95,7 @@ export class DsoRedirectService { if (response.hasSucceeded) { const dso = response.payload; if (hasValue(dso.uuid)) { - let newRoute = getDSORoute(dso); + const newRoute = getDSORoute(dso); if (hasValue(newRoute)) { // Use a "301 Moved Permanently" redirect for SEO purposes this.hardRedirectService.redirect(newRoute, 301); diff --git a/src/app/core/data/relationship-data.service.ts b/src/app/core/data/relationship-data.service.ts index 46a51a2d010..29198c48787 100644 --- a/src/app/core/data/relationship-data.service.ts +++ b/src/app/core/data/relationship-data.service.ts @@ -264,7 +264,7 @@ export class RelationshipDataService extends IdentifiableDataService>> { - let linksToFollow: FollowLinkConfig[] = itemLinksToFollow(options.fetchThumbnail); + const linksToFollow: FollowLinkConfig[] = itemLinksToFollow(options.fetchThumbnail); linksToFollow.push(followLink('relationshipType')); return this.getItemRelationshipsByLabel(item, label, options, true, true, ...linksToFollow).pipe(this.paginatedRelationsToItems(item.uuid)); diff --git a/src/app/item-page/edit-item-page/item-authorizations/item-authorizations.component.ts b/src/app/item-page/edit-item-page/item-authorizations/item-authorizations.component.ts index 635cf455b55..08a58de3821 100644 --- a/src/app/item-page/edit-item-page/item-authorizations/item-authorizations.component.ts +++ b/src/app/item-page/edit-item-page/item-authorizations/item-authorizations.component.ts @@ -184,7 +184,7 @@ export class ItemAuthorizationsComponent implements OnInit, OnDestroy { mergeMap((list: PaginatedList) => list.page), map((bundle: Bundle) => ({ id: bundle.id, bitstreams: this.getBundleBitstreams(bundle) })) ).subscribe((entry: BundleBitstreamsMapEntry) => { - let bitstreamMapValues: BitstreamMapValue = { + const bitstreamMapValues: BitstreamMapValue = { isCollapsed: true, allBitstreamsLoaded: false, bitstreams: null @@ -239,14 +239,14 @@ export class ItemAuthorizationsComponent implements OnInit, OnDestroy { */ onBitstreamsLoad(bundle: Bundle) { return this.getBundleBitstreams(bundle).subscribe((res: PaginatedList) => { - let nextBitstreams = res?.page.slice(this.bitstreamPageSize, this.bitstreamPageSize + this.bitstreamSize); - let bitstreamsToShow = this.bundleBitstreamsMap.get(bundle.id).bitstreams.pipe( + const nextBitstreams = res?.page.slice(this.bitstreamPageSize, this.bitstreamPageSize + this.bitstreamSize); + const bitstreamsToShow = this.bundleBitstreamsMap.get(bundle.id).bitstreams.pipe( map((existingBits: Bitstream[])=> { return [... existingBits, ...nextBitstreams]; }) ); this.bitstreamPageSize = this.bitstreamPageSize + this.bitstreamSize; - let bitstreamMapValues: BitstreamMapValue = { + const bitstreamMapValues: BitstreamMapValue = { bitstreams: bitstreamsToShow , isCollapsed: this.bundleBitstreamsMap.get(bundle.id).isCollapsed, allBitstreamsLoaded: res?.page.length <= this.bitstreamPageSize diff --git a/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts b/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts index b8542f5806f..4f7ece790f2 100644 --- a/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts +++ b/src/app/item-page/edit-item-page/item-relationships/edit-relationship-list/edit-relationship-list.component.ts @@ -493,7 +493,7 @@ export class EditRelationshipListComponent implements OnInit, OnDestroy { ); // this adds thumbnail images when required by configuration - let linksToFollow: FollowLinkConfig[] = itemLinksToFollow(this.fetchThumbnail); + const linksToFollow: FollowLinkConfig[] = itemLinksToFollow(this.fetchThumbnail); this.subs.push( observableCombineLatest([ diff --git a/src/app/item-page/edit-item-page/item-status/item-status.component.ts b/src/app/item-page/edit-item-page/item-status/item-status.component.ts index 828f8d74391..be7e6bc9075 100644 --- a/src/app/item-page/edit-item-page/item-status/item-status.component.ts +++ b/src/app/item-page/edit-item-page/item-status/item-status.component.ts @@ -103,7 +103,7 @@ export class ItemStatusComponent implements OnInit { ); // Observable for configuration determining whether the Register DOI feature is enabled - let registerConfigEnabled$: Observable = this.configurationService.findByPropertyName('identifiers.item-status.register-doi').pipe( + const registerConfigEnabled$: Observable = this.configurationService.findByPropertyName('identifiers.item-status.register-doi').pipe( getFirstCompletedRemoteData(), map((rd: RemoteData) => { // 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(), getRemoteDataPayload(), mergeMap((data: IdentifierData) => { - let identifiers = data.identifiers; + const identifiers = data.identifiers; let no_doi = true; let pending = false; 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 switchMap((showDoi: boolean) => { - let ops = [...operations]; + const ops = [...operations]; if (showDoi) { ops.push(new ItemOperation('register-doi', this.getCurrentUrl(item) + '/register-doi', FeatureID.CanRegisterDOI, true)); } diff --git a/src/app/item-page/field-components/metadata-values/metadata-values.component.ts b/src/app/item-page/field-components/metadata-values/metadata-values.component.ts index cbbae9006da..d06facfe47c 100644 --- a/src/app/item-page/field-components/metadata-values/metadata-values.component.ts +++ b/src/app/item-page/field-components/metadata-values/metadata-values.component.ts @@ -84,7 +84,7 @@ export class MetadataValuesComponent implements OnChanges { * @param value the specific metadata value being linked */ getQueryParams(value) { - let queryParams = {startsWith: value}; + const queryParams = {startsWith: value}; if (this.browseDefinition.getRenderType() === VALUE_LIST_BROWSE_DEFINITION.value) { return {value: value}; } diff --git a/src/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.ts b/src/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.ts index 52cd3cac34e..ff2f1f4f615 100644 --- a/src/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.ts +++ b/src/app/item-page/media-viewer/media-viewer-video/media-viewer-video.component.ts @@ -48,7 +48,7 @@ export class MediaViewerVideoComponent { .filter((media: Bitstream) => media.name.substring(0, (media.name.length - 7)).toLowerCase() === name.toLowerCase()); 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( media._links.content.href, srclang, diff --git a/src/app/register-email-form/register-email-form.component.ts b/src/app/register-email-form/register-email-form.component.ts index ddb77b669cb..37cae4cf9f5 100644 --- a/src/app/register-email-form/register-email-form.component.ts +++ b/src/app/register-email-form/register-email-form.component.ts @@ -183,7 +183,7 @@ export class RegisterEmailFormComponent implements OnDestroy, OnInit { * Registration of an email address */ registration(captchaToken = null) { - let registerEmail$ = captchaToken ? + const registerEmail$ = captchaToken ? this.epersonRegistrationService.registerEmail(this.email.value, captchaToken, this.typeRequest) : this.epersonRegistrationService.registerEmail(this.email.value, null, this.typeRequest); this.subscriptions.push(registerEmail$.subscribe((response: RemoteData) => { diff --git a/src/app/shared/access-control-form-container/bulk-access-control.service.ts b/src/app/shared/access-control-form-container/bulk-access-control.service.ts index 6fb6b625325..b0409529330 100644 --- a/src/app/shared/access-control-form-container/bulk-access-control.service.ts +++ b/src/app/shared/access-control-form-container/bulk-access-control.service.ts @@ -96,7 +96,7 @@ export class BulkAccessControlService { * @param payload */ export const convertToBulkAccessControlFileModel = (payload: { state: AccessControlFormState, bitstreamAccess: AccessCondition[], itemAccess: AccessCondition[] }): BulkAccessControlFileModel => { - let finalPayload: BulkAccessControlFileModel = {}; + const finalPayload: BulkAccessControlFileModel = {}; const itemEnabled = payload.state.item.toggleStatus; const bitstreamEnabled = payload.state.bitstream.toggleStatus; diff --git a/src/app/shared/cookies/browser-klaro.service.ts b/src/app/shared/cookies/browser-klaro.service.ts index 2b09c0bf155..445b86863b3 100644 --- a/src/app/shared/cookies/browser-klaro.service.ts +++ b/src/app/shared/cookies/browser-klaro.service.ts @@ -108,7 +108,7 @@ export class BrowserKlaroService extends KlaroService { const servicesToHide$: Observable = observableCombineLatest([hideGoogleAnalytics$, hideRegistrationVerification$]).pipe( map(([hideGoogleAnalytics, hideRegistrationVerification]) => { - let servicesToHideArray: string[] = []; + const servicesToHideArray: string[] = []; if (hideGoogleAnalytics) { servicesToHideArray.push(this.GOOGLE_ANALYTICS_SERVICE_NAME); } diff --git a/src/app/shared/dso-selector/dso-selector/dso-selector.component.ts b/src/app/shared/dso-selector/dso-selector/dso-selector.component.ts index 503e4c44129..decf68354f0 100644 --- a/src/app/shared/dso-selector/dso-selector/dso-selector.component.ts +++ b/src/app/shared/dso-selector/dso-selector/dso-selector.component.ts @@ -228,7 +228,7 @@ export class DSOSelectorComponent implements OnInit, OnDestroy { */ search(query: string, page: number, useCache: boolean = true): Observable>>> { // 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( new PaginatedSearchOptions({ query: query, diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-concat.model.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-concat.model.ts index dc7c7966485..98a53bc6579 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-concat.model.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-concat.model.ts @@ -86,7 +86,6 @@ export class DynamicConcatModel extends DynamicFormGroupModel { } set value(value: string | FormFieldMetadataValueObject) { - let values; let tempValue: string; if (typeof value === 'string') { @@ -97,15 +96,19 @@ export class DynamicConcatModel extends DynamicFormGroupModel { if (hasNoValue(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 })); if (values[0].value) { + // @ts-ignore (this.get(0) as DsDynamicInputModel).value = values[0]; } else { (this.get(0) as DsDynamicInputModel).value = undefined; } if (values[1].value) { + // @ts-ignore (this.get(1) as DsDynamicInputModel).value = values[1]; } else { (this.get(1) as DsDynamicInputModel).value = undefined; diff --git a/src/app/shared/form/builder/parsers/concat-field-parser.ts b/src/app/shared/form/builder/parsers/concat-field-parser.ts index e86de70c816..07b63352c4a 100644 --- a/src/app/shared/form/builder/parsers/concat-field-parser.ts +++ b/src/app/shared/form/builder/parsers/concat-field-parser.ts @@ -1,7 +1,6 @@ import {Inject} from '@angular/core'; import { FormFieldModel } from '../models/form-field.model'; import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model'; -import { DynamicFormControlLayout, } from '@ng-dynamic-forms/core'; import { CONCAT_FIRST_INPUT_SUFFIX, CONCAT_GROUP_SUFFIX, @@ -38,12 +37,9 @@ export class ConcatFieldParser extends FieldParser { } public modelFactory(fieldValue?: FormFieldMetadataValueObject | any, label?: boolean): any { - - let clsGroup: DynamicFormControlLayout; - let clsInput: DynamicFormControlLayout; const id: string = this.configData.selectableMetadata[0].metadata; - clsInput = { + const clsInput = { grid: { host: 'col-sm-6' } @@ -105,7 +101,7 @@ export class ConcatFieldParser extends FieldParser { concatGroup.group.push(model1); concatGroup.group.push(model2); - clsGroup = { + const clsGroup = { element: { control: 'form-row', } diff --git a/src/app/shared/form/builder/parsers/textarea-field-parser.ts b/src/app/shared/form/builder/parsers/textarea-field-parser.ts index 548ce567c3e..691d47289f4 100644 --- a/src/app/shared/form/builder/parsers/textarea-field-parser.ts +++ b/src/app/shared/form/builder/parsers/textarea-field-parser.ts @@ -1,5 +1,4 @@ import { FieldParser } from './field-parser'; -import { DynamicFormControlLayout } from '@ng-dynamic-forms/core'; import { FormFieldMetadataValueObject } from '../models/form-field-metadata-value.model'; import { DsDynamicTextAreaModel, @@ -12,9 +11,7 @@ export class TextareaFieldParser extends FieldParser { public modelFactory(fieldValue?: FormFieldMetadataValueObject | any, label?: boolean): any { const textAreaModelConfig: DsDynamicTextAreaModelConfig = this.initModel(null, label); - let layout: DynamicFormControlLayout; - - layout = { + const layout = { element: { label: 'col-form-label' } diff --git a/src/app/shared/form/chips/models/chips.model.ts b/src/app/shared/form/chips/models/chips.model.ts index daeb363d827..1148d40e717 100644 --- a/src/app/shared/form/chips/models/chips.model.ts +++ b/src/app/shared/form/chips/models/chips.model.ts @@ -2,7 +2,7 @@ import findIndex from 'lodash/findIndex'; import isEqual from 'lodash/isEqual'; import isObject from 'lodash/isObject'; import { BehaviorSubject } from 'rxjs'; -import { ChipsItem, ChipsItemIcon } from './chips-item.model'; +import { ChipsItem } from './chips-item.model'; import { hasValue, isNotEmpty } from '../../../empty.util'; import { MetadataIconConfig } from '../../../../../config/submission-config.interface'; import { FormFieldMetadataValueObject } from '../../builder/models/form-field-metadata-value.model'; @@ -123,12 +123,10 @@ export class Chips { config = (configIndex !== -1) ? this.iconsConfig[configIndex] : defaultConfig; if (hasValue(value) && isNotEmpty(config) && !this.hasPlaceholder(value)) { - - let icon: ChipsItemIcon; const visibleWhenAuthorityEmpty = this.displayObj !== metadata; // Set icon - icon = { + const icon = { metadata, visibleWhenAuthorityEmpty, style: config.style diff --git a/src/app/shared/notifications/notifications.service.ts b/src/app/shared/notifications/notifications.service.ts index d37d6a349b6..cbdad55203c 100644 --- a/src/app/shared/notifications/notifications.service.ts +++ b/src/app/shared/notifications/notifications.service.ts @@ -21,8 +21,7 @@ export class NotificationsService { } private add(notification: Notification) { - let notificationAction; - notificationAction = new NewNotificationAction(notification); + const notificationAction = new NewNotificationAction(notification); this.store.dispatch(notificationAction); } diff --git a/src/app/shared/object-list/metadata-representation-list-element/browse-link/browse-link-metadata-list-element.component.ts b/src/app/shared/object-list/metadata-representation-list-element/browse-link/browse-link-metadata-list-element.component.ts index 80155837673..b31e0b847bd 100644 --- a/src/app/shared/object-list/metadata-representation-list-element/browse-link/browse-link-metadata-list-element.component.ts +++ b/src/app/shared/object-list/metadata-representation-list-element/browse-link/browse-link-metadata-list-element.component.ts @@ -21,7 +21,7 @@ export class BrowseLinkMetadataListElementComponent extends MetadataRepresentati * expects 'startsWith' (eg browse by date) or 'value' (eg browse by title) */ getQueryParams() { - let queryParams = {startsWith: this.mdRepresentation.getValue()}; + const queryParams = {startsWith: this.mdRepresentation.getValue()}; if (this.mdRepresentation.browseDefinition.getRenderType() === VALUE_LIST_BROWSE_DEFINITION.value) { return {value: this.mdRepresentation.getValue()}; } diff --git a/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.ts b/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.ts index 8a3e1d51a6f..7ee0ca42141 100644 --- a/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.ts +++ b/src/app/shared/object-list/metadata-representation-list-element/plain-text/plain-text-metadata-list-element.component.ts @@ -21,7 +21,7 @@ export class PlainTextMetadataListElementComponent extends MetadataRepresentatio * expects 'startsWith' (eg browse by date) or 'value' (eg browse by title) */ getQueryParams() { - let queryParams = {startsWith: this.mdRepresentation.getValue()}; + const queryParams = {startsWith: this.mdRepresentation.getValue()}; if (this.mdRepresentation.browseDefinition.getRenderType() === VALUE_LIST_BROWSE_DEFINITION.value) { return {value: this.mdRepresentation.getValue()}; } diff --git a/src/app/shared/pagination/pagination.component.ts b/src/app/shared/pagination/pagination.component.ts index 6da813cbc7d..aa6f727c50d 100644 --- a/src/app/shared/pagination/pagination.component.ts +++ b/src/app/shared/pagination/pagination.component.ts @@ -333,11 +333,10 @@ export class PaginationComponent implements OnDestroy, OnInit { if (collectionSize) { showingDetails = this.paginationService.getCurrentPagination(this.id, this.paginationOptions).pipe( map((currentPaginationOptions) => { - let firstItem; let lastItem; const pageMax = currentPaginationOptions.pageSize * currentPaginationOptions.currentPage; - firstItem = currentPaginationOptions.pageSize * (currentPaginationOptions.currentPage - 1) + 1; + const firstItem = currentPaginationOptions.pageSize * (currentPaginationOptions.currentPage - 1) + 1; if (collectionSize > pageMax) { lastItem = pageMax; } else { diff --git a/src/app/shared/search/search.component.ts b/src/app/shared/search/search.component.ts index 61f3a119c87..2ec702bafb1 100644 --- a/src/app/shared/search/search.component.ts +++ b/src/app/shared/search/search.component.ts @@ -432,7 +432,7 @@ export class SearchComponent implements OnInit { private retrieveSearchResults(searchOptions: PaginatedSearchOptions) { this.resultsRD$.next(null); this.lastSearchOptions = searchOptions; - let followLinks = [ + const followLinks = [ followLink('thumbnail', { isOptional: true }), followLink('item', { isOptional: true }, followLink('thumbnail', { isOptional: true })) as any, followLink('accessStatus', { isOptional: true, shouldEmbed: environment.item.showAccessStatuses }), diff --git a/src/app/shared/subscriptions/subscription-modal/subscription-modal.component.ts b/src/app/shared/subscriptions/subscription-modal/subscription-modal.component.ts index 2413aad36ed..9b28f49ee06 100644 --- a/src/app/shared/subscriptions/subscription-modal/subscription-modal.component.ts +++ b/src/app/shared/subscriptions/subscription-modal/subscription-modal.component.ts @@ -115,7 +115,7 @@ export class SubscriptionModalComponent implements OnInit { this.subscriptionForm.valueChanges.subscribe((newValue) => { let anyFrequencySelected = false; - for (let f of this.frequencyDefaultValues) { + for (const f of this.frequencyDefaultValues) { anyFrequencySelected = anyFrequencySelected || newValue.content.frequencies[f]; } this.isValid = anyFrequencySelected; @@ -124,11 +124,11 @@ export class SubscriptionModalComponent implements OnInit { initFormByAllSubscriptions(): void { this.subscriptionForm = new UntypedFormGroup({}); - for (let t of this.subscriptionDefaultTypes) { + for (const t of this.subscriptionDefaultTypes) { const formGroup = new UntypedFormGroup({}); formGroup.addControl('subscriptionId', this.formBuilder.control('')); 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)); } 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('frequencies', this.formBuilder.group({})); (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; (formGroup.controls.frequencies as UntypedFormGroup).addControl(f, this.formBuilder.control(value)); } @@ -167,12 +167,12 @@ export class SubscriptionModalComponent implements OnInit { next: (res: PaginatedList) => { if (res.pageInfo.totalElements > 0) { this.showDeleteInfo$.next(true); - for (let subscription of res.page) { + for (const subscription of res.page) { const type = subscription.subscriptionType; const subscriptionGroup: UntypedFormGroup = this.subscriptionForm.get(type) as UntypedFormGroup; if (isNotEmpty(subscriptionGroup)) { 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); } } @@ -266,7 +266,7 @@ export class SubscriptionModalComponent implements OnInit { subscriptionParameterList: [] }; - for (let frequency of this.frequencyDefaultValues) { + for (const frequency of this.frequencyDefaultValues) { if (frequencies.value[frequency]) { body.subscriptionParameterList.push( { From f1a8920d860226d60477d257e89acbfe119e0105 Mon Sep 17 00:00:00 2001 From: Yury Bondarenko Date: Mon, 8 May 2023 16:45:46 +0200 Subject: [PATCH 03/33] ESLint: enforce no-case-declarations https://eslint.org/docs/latest/rules/no-case-declarations --- .eslintrc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index 7361034a438..61c05827526 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -105,13 +105,13 @@ } ], "prefer-const": "error", + "no-case-declarations": "error", "prefer-spread": "off", "no-underscore-dangle": "off", // todo: disabled rules from eslint:recommended, consider re-enabling & fixing "no-prototype-builtins": "off", "no-useless-escape": "off", - "no-case-declarations": "off", "no-extra-boolean-cast": "off", "@angular-eslint/directive-selector": [ From 0f1ebfba62e8e9bc287b438ccf4ffb7cec147047 Mon Sep 17 00:00:00 2001 From: Yury Bondarenko Date: Mon, 8 May 2023 16:51:45 +0200 Subject: [PATCH 04/33] ESLint: fix no-case-declaration violations --- src/app/core/submission/submission-object-data.service.ts | 3 ++- .../ds-dynamic-form-control-container.component.ts | 4 +--- src/app/shared/testing/auth-request-service.stub.ts | 6 ++++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/app/core/submission/submission-object-data.service.ts b/src/app/core/submission/submission-object-data.service.ts index 18816fbfd20..59188cb3d70 100644 --- a/src/app/core/submission/submission-object-data.service.ts +++ b/src/app/core/submission/submission-object-data.service.ts @@ -57,7 +57,7 @@ export class SubmissionObjectDataService { return this.workspaceitemDataService.findById(id, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow); case SubmissionScopeType.WorkflowItem: return this.workflowItemDataService.findById(id, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow); - default: + default: { const now = new Date().getTime(); return observableOf(new RemoteData( now, @@ -68,6 +68,7 @@ export class SubmissionObjectDataService { undefined, 400 )); + } } } } diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts index ff5a119b6fc..958644aa0aa 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts @@ -133,9 +133,7 @@ export function dsDynamicFormControlMapFn(model: DynamicFormControlModel): Type< return (model instanceof DynamicListCheckboxGroupModel) ? DsDynamicListComponent : DynamicNGBootstrapCheckboxGroupComponent; case DYNAMIC_FORM_CONTROL_TYPE_DATEPICKER: - const datepickerModel = model as DynamicDatePickerModel; - - return datepickerModel.inline ? DynamicNGBootstrapCalendarComponent : DsDatePickerInlineComponent; + return (model as DynamicDatePickerModel).inline ? DynamicNGBootstrapCalendarComponent : DsDatePickerInlineComponent; case DYNAMIC_FORM_CONTROL_TYPE_GROUP: return DsDynamicFormGroupComponent; diff --git a/src/app/shared/testing/auth-request-service.stub.ts b/src/app/shared/testing/auth-request-service.stub.ts index 00943245180..6349ec40d1c 100644 --- a/src/app/shared/testing/auth-request-service.stub.ts +++ b/src/app/shared/testing/auth-request-service.stub.ts @@ -51,10 +51,11 @@ export class AuthRequestServiceStub { public getRequest(method: string, options?: HttpOptions): Observable { const authStatusStub: AuthStatus = new AuthStatus(); switch (method) { - case 'logout': + case 'logout': { authStatusStub.authenticated = false; break; - case 'status': + } + case 'status': { const token = ((options.headers as any).lazyUpdate[1]) ? (options.headers as any).lazyUpdate[1].value : null; if (this.validateToken(token)) { authStatusStub.authenticated = true; @@ -74,6 +75,7 @@ export class AuthRequestServiceStub { authStatusStub.authenticated = false; } break; + } } return createSuccessfulRemoteDataObject$(authStatusStub); } From ad4205073c7e74bb44fb7f1405f5861860f20d78 Mon Sep 17 00:00:00 2001 From: Yury Bondarenko Date: Mon, 8 May 2023 17:04:05 +0200 Subject: [PATCH 05/33] ESLint: enforce no-extra-boolean-cast https://eslint.org/docs/latest/rules/no-extra-boolean-cast --- .eslintrc.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 61c05827526..9279c61b901 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -106,13 +106,11 @@ ], "prefer-const": "error", "no-case-declarations": "error", + "no-extra-boolean-cast": "error", "prefer-spread": "off", "no-underscore-dangle": "off", - - // todo: disabled rules from eslint:recommended, consider re-enabling & fixing "no-prototype-builtins": "off", "no-useless-escape": "off", - "no-extra-boolean-cast": "off", "@angular-eslint/directive-selector": [ "error", From 6f0c1e003d44aac9ac3dc25d22fb6157d91b928e Mon Sep 17 00:00:00 2001 From: Yury Bondarenko Date: Mon, 8 May 2023 17:09:13 +0200 Subject: [PATCH 06/33] ESLint: fix no-extra-boolean-cast violations --- .../eperson-form/validators/email-taken.validator.ts | 2 +- .../group-registry/group-form/group-form.component.ts | 2 +- .../info/feedback/feedback-form/feedback-form.component.ts | 2 +- .../dynamic-lookup-relation-modal.component.ts | 2 +- src/app/shared/form/form.component.ts | 6 +++--- .../browse-entry-list-element.component.ts | 2 +- .../cc-license/submission-section-cc-licenses.component.ts | 4 ++-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/app/access-control/epeople-registry/eperson-form/validators/email-taken.validator.ts b/src/app/access-control/epeople-registry/eperson-form/validators/email-taken.validator.ts index 5153abae7c5..c3c5e60a0f9 100644 --- a/src/app/access-control/epeople-registry/eperson-form/validators/email-taken.validator.ts +++ b/src/app/access-control/epeople-registry/eperson-form/validators/email-taken.validator.ts @@ -17,7 +17,7 @@ export class ValidateEmailNotTaken { .pipe( getFirstSucceededRemoteData(), map(res => { - return !!res.payload ? { emailTaken: true } : null; + return res.payload ? { emailTaken: true } : null; }) ); }; diff --git a/src/app/access-control/group-registry/group-form/group-form.component.ts b/src/app/access-control/group-registry/group-form/group-form.component.ts index 3c0547cca50..4f85f13b1c0 100644 --- a/src/app/access-control/group-registry/group-form/group-form.component.ts +++ b/src/app/access-control/group-registry/group-form/group-form.component.ts @@ -207,7 +207,7 @@ export class GroupFormComponent implements OnInit, OnDestroy { ]; this.formGroup = this.formBuilderService.createFormGroup(this.formModel); - if (!!this.formGroup.controls.groupName) { + if (this.formGroup.controls.groupName) { this.formGroup.controls.groupName.setAsyncValidators(ValidateGroupExists.createValidator(this.groupDataService)); this.groupNameValueChangeSubscribe = this.groupName.valueChanges.pipe(debounceTime(300)).subscribe(() => { this.changeDetectorRef.detectChanges(); diff --git a/src/app/info/feedback/feedback-form/feedback-form.component.ts b/src/app/info/feedback/feedback-form/feedback-form.component.ts index 684f974701b..2f7d3879dd2 100644 --- a/src/app/info/feedback/feedback-form/feedback-form.component.ts +++ b/src/app/info/feedback/feedback-form/feedback-form.component.ts @@ -51,7 +51,7 @@ export class FeedbackFormComponent implements OnInit { ngOnInit() { this.authService.getAuthenticatedUserFromStore().pipe(take(1)).subscribe((user: EPerson) => { - if (!!user) { + if (user) { this.feedbackForm.patchValue({ email: user.email }); } }); diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.ts index 446497a74fc..ab58884bfb9 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.ts @@ -170,7 +170,7 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy } ngOnInit(): void { - if (!!this.currentItemIsLeftItem$) { + if (this.currentItemIsLeftItem$) { this.currentItemIsLeftItem$.subscribe((isLeft) => { this.isLeft = isLeft; }); diff --git a/src/app/shared/form/form.component.ts b/src/app/shared/form/form.component.ts index 79cf8ad2c7b..21887f5fcaf 100644 --- a/src/app/shared/form/form.component.ts +++ b/src/app/shared/form/form.component.ts @@ -123,7 +123,7 @@ export class FormComponent implements OnDestroy, OnInit { }*/ private getFormGroup(): UntypedFormGroup { - if (!!this.parentFormModel) { + if (this.parentFormModel) { return this.formGroup.parent as UntypedFormGroup; } @@ -183,7 +183,7 @@ export class FormComponent implements OnDestroy, OnInit { const { fieldId } = error; const { fieldIndex } = error; let field: AbstractControl; - if (!!this.parentFormModel) { + if (this.parentFormModel) { field = this.formBuilderService.getFormControlById(fieldId, formGroup.parent as UntypedFormGroup, formModel, fieldIndex); } else { field = this.formBuilderService.getFormControlById(fieldId, formGroup, formModel, fieldIndex); @@ -206,7 +206,7 @@ export class FormComponent implements OnDestroy, OnInit { const { fieldId } = error; const { fieldIndex } = error; let field: AbstractControl; - if (!!this.parentFormModel) { + if (this.parentFormModel) { field = this.formBuilderService.getFormControlById(fieldId, formGroup.parent as UntypedFormGroup, formModel, fieldIndex); } else { field = this.formBuilderService.getFormControlById(fieldId, formGroup, formModel, fieldIndex); diff --git a/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.ts b/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.ts index e67dd4489e7..ff3fdace20c 100644 --- a/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.ts +++ b/src/app/shared/object-list/browse-entry-list-element/browse-entry-list-element.component.ts @@ -49,7 +49,7 @@ export class BrowseEntryListElementComponent extends AbstractListableElementComp map((currentPage) => { return { value: this.object.value, - authority: !!this.object.authority ? this.object.authority : undefined, + authority: this.object.authority ? this.object.authority : undefined, startsWith: undefined, [pageParamName]: null, [BBM_PAGINATION_ID + '.return']: currentPage diff --git a/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.ts b/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.ts index c8cd898f966..ec28530f896 100644 --- a/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.ts +++ b/src/app/submission/sections/cc-license/submission-section-cc-licenses.component.ts @@ -188,7 +188,7 @@ export class SubmissionSectionCcLicensesComponent extends SectionModelComponent */ getCcLicenseLink$(): Observable { - if (!!this.storedCcLicenseLink) { + if (this.storedCcLicenseLink) { return observableOf(this.storedCcLicenseLink); } if (!this.getSelectedCcLicense() || this.getSelectedCcLicense().fields.some( @@ -257,7 +257,7 @@ export class SubmissionSectionCcLicensesComponent extends SectionModelComponent ).subscribe((link) => { this.operationsBuilder.add(path, link.toString(), false, true); }); - } else if (!!this.data.uri) { + } else if (this.data.uri) { this.operationsBuilder.remove(path); } } From 80c9dae41714180ce6bdb5bf9052086ca95280c5 Mon Sep 17 00:00:00 2001 From: Yury Bondarenko Date: Mon, 8 May 2023 17:10:00 +0200 Subject: [PATCH 07/33] ESLint: enforce ban-types https://typescript-eslint.io/rules/ban-types/ --- .eslintrc.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index 9279c61b901..84a7cc4bfa5 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -181,7 +181,7 @@ ], "@typescript-eslint/type-annotation-spacing": "error", "@typescript-eslint/unified-signatures": "error", - "@typescript-eslint/ban-types": "warn", // todo: deal with {} type issues & re-enable + "@typescript-eslint/ban-types": "error", "@typescript-eslint/no-floating-promises": "warn", "@typescript-eslint/no-misused-promises": "warn", "@typescript-eslint/restrict-plus-operands": "warn", From 74e9e5fa14031919c1984c4ab2eb859dd3e54c4a Mon Sep 17 00:00:00 2001 From: Yury Bondarenko Date: Mon, 8 May 2023 17:24:11 +0200 Subject: [PATCH 08/33] ESLint: fix ban-types violations --- src/app/core/data/base/put-data.ts | 2 +- .../pagination-route-params.interface.ts | 15 +++++++++++ src/app/core/pagination/pagination.service.ts | 26 +++++-------------- .../recent-item-list.component.ts | 2 +- .../related-items/related-items-component.ts | 2 +- .../menu/menu-item/models/onclick.model.ts | 2 +- src/app/shared/mocks/action.mock.ts | 2 +- src/app/shared/mocks/active-router.mock.ts | 2 +- .../object-collection.component.ts | 2 +- .../shared/pagination/pagination.component.ts | 13 +++++----- src/app/shared/testing/action.mock.ts | 2 +- src/app/shared/testing/active-router.stub.ts | 4 +-- .../system-wide-alert-banner.component.ts | 2 +- 13 files changed, 39 insertions(+), 37 deletions(-) create mode 100644 src/app/core/pagination/pagination-route-params.interface.ts diff --git a/src/app/core/data/base/put-data.ts b/src/app/core/data/base/put-data.ts index bd2a8d29299..6cd61791e72 100644 --- a/src/app/core/data/base/put-data.ts +++ b/src/app/core/data/base/put-data.ts @@ -55,7 +55,7 @@ export class PutDataImpl extends BaseDataService i */ put(object: T): Observable> { const requestId = this.requestService.generateRequestId(); - const serializedObject = new DSpaceSerializer(object.constructor as GenericConstructor<{}>).serialize(object); + const serializedObject = new DSpaceSerializer(object.constructor as GenericConstructor).serialize(object); const request = new PutRequest(requestId, object._links.self.href, serializedObject); if (hasValue(this.responseMsToLive)) { diff --git a/src/app/core/pagination/pagination-route-params.interface.ts b/src/app/core/pagination/pagination-route-params.interface.ts new file mode 100644 index 00000000000..029b27f2559 --- /dev/null +++ b/src/app/core/pagination/pagination-route-params.interface.ts @@ -0,0 +1,15 @@ +/** + * The contents of this file are subject to the license and copyright + * detailed in the LICENSE and NOTICE files at the root of the source + * tree and available online at + * + * http://www.dspace.org/license/ + */ +import { SortDirection } from '../cache/models/sort-options.model'; + +export interface PaginationRouteParams { + page?: number + pageSize?: number + sortField?: string + sortDirection?: SortDirection +} diff --git a/src/app/core/pagination/pagination.service.ts b/src/app/core/pagination/pagination.service.ts index ce4c3adc3c8..90d307ff4fd 100644 --- a/src/app/core/pagination/pagination.service.ts +++ b/src/app/core/pagination/pagination.service.ts @@ -9,6 +9,7 @@ import { hasValue, isEmpty, isNotEmpty } from '../../shared/empty.util'; import { difference } from '../../shared/object.util'; import { FindListOptions } from '../data/find-list-options.model'; import { isNumeric } from '../../shared/numeric.util'; +import { PaginationRouteParams } from './pagination-route-params.interface'; @Injectable({ providedIn: 'root', @@ -121,13 +122,8 @@ export class PaginationService { */ updateRoute( paginationId: string, - params: { - page?: number - pageSize?: number - sortField?: string - sortDirection?: SortDirection - }, - extraParams?, + params: PaginationRouteParams, + extraParams?: Record, retainScrollPosition?: boolean, navigationExtras?: NavigationExtras, ) { @@ -147,13 +143,8 @@ export class PaginationService { updateRouteWithUrl( paginationId: string, url: string[], - params: { - page?: number - pageSize?: number - sortField?: string - sortDirection?: SortDirection - }, - extraParams?, + params: PaginationRouteParams, + extraParams?: Record, retainScrollPosition?: boolean, navigationExtras?: NavigationExtras, ) { @@ -219,12 +210,7 @@ export class PaginationService { ); } - private getParametersWithIdName(paginationId: string, params: { - page?: number - pageSize?: number - sortField?: string - sortDirection?: SortDirection - }) { + private getParametersWithIdName(paginationId: string, params: PaginationRouteParams) { const paramsWithIdName = {}; if (hasValue(params.page)) { paramsWithIdName[`${paginationId}.page`] = `${params.page}`; diff --git a/src/app/home-page/recent-item-list/recent-item-list.component.ts b/src/app/home-page/recent-item-list/recent-item-list.component.ts index 9a8535d970a..93bf4a6abf4 100644 --- a/src/app/home-page/recent-item-list/recent-item-list.component.ts +++ b/src/app/home-page/recent-item-list/recent-item-list.component.ts @@ -48,7 +48,7 @@ export class RecentItemListComponent implements OnInit { public searchConfigurationService: SearchConfigurationService, protected elementRef: ElementRef, @Inject(APP_CONFIG) private appConfig: AppConfig, - @Inject(PLATFORM_ID) private platformId: Object, + @Inject(PLATFORM_ID) private platformId: any, ) { this.paginationConfig = Object.assign(new PaginationComponentOptions(), { diff --git a/src/app/item-page/simple/related-items/related-items-component.ts b/src/app/item-page/simple/related-items/related-items-component.ts index 2746670abe2..29b74253142 100644 --- a/src/app/item-page/simple/related-items/related-items-component.ts +++ b/src/app/item-page/simple/related-items/related-items-component.ts @@ -65,7 +65,7 @@ export class RelatedItemsComponent extends AbstractIncrementalListComponent {}; + function: () => void; } diff --git a/src/app/shared/mocks/action.mock.ts b/src/app/shared/mocks/action.mock.ts index e227946f644..f5c7c683b02 100644 --- a/src/app/shared/mocks/action.mock.ts +++ b/src/app/shared/mocks/action.mock.ts @@ -2,5 +2,5 @@ import { Action } from '@ngrx/store'; export class ActionMock implements Action { type = null; - payload: {}; + payload: any; } diff --git a/src/app/shared/mocks/active-router.mock.ts b/src/app/shared/mocks/active-router.mock.ts index 672cdcd8f6c..12fb45df6b5 100644 --- a/src/app/shared/mocks/active-router.mock.ts +++ b/src/app/shared/mocks/active-router.mock.ts @@ -22,7 +22,7 @@ export class MockActivatedRoute { // Test parameters get testParams() { return this._testParams; } - set testParams(params: {}) { + set testParams(params: any) { this._testParams = params; this.subject.next(params); } diff --git a/src/app/shared/object-collection/object-collection.component.ts b/src/app/shared/object-collection/object-collection.component.ts index e1f9182562a..d16b57af28a 100644 --- a/src/app/shared/object-collection/object-collection.component.ts +++ b/src/app/shared/object-collection/object-collection.component.ts @@ -189,7 +189,7 @@ export class ObjectCollectionComponent implements OnInit { private route: ActivatedRoute, private router: Router, private elementRef: ElementRef, - @Inject(PLATFORM_ID) private platformId: Object) { + @Inject(PLATFORM_ID) private platformId: any) { } ngOnInit(): void { diff --git a/src/app/shared/pagination/pagination.component.ts b/src/app/shared/pagination/pagination.component.ts index aa6f727c50d..3938ca2446a 100644 --- a/src/app/shared/pagination/pagination.component.ts +++ b/src/app/shared/pagination/pagination.component.ts @@ -24,6 +24,7 @@ import { RemoteData } from '../../core/data/remote-data'; import { PaginatedList } from '../../core/data/paginated-list.model'; import { ListableObject } from '../object-collection/shared/listable-object.model'; import { ViewMode } from '../../core/shared/view-mode.model'; +import { PaginationRouteParams } from '../../core/pagination/pagination-route-params.interface'; /** * The default pagination controls component. @@ -273,7 +274,7 @@ export class PaginationComponent implements OnDestroy, OnInit { * The page being navigated to. */ public doPageChange(page: number) { - this.updateParams({page: page.toString()}); + this.updateParams({page: page}); this.emitPaginationChange(); } @@ -284,7 +285,7 @@ export class PaginationComponent implements OnDestroy, OnInit { * The page size being navigated to. */ public doPageSizeChange(pageSize: number) { - this.updateParams({ pageId: this.id, page: 1, pageSize: pageSize }); + this.updateParams({ page: 1, pageSize: pageSize }); this.emitPaginationChange(); } @@ -295,7 +296,7 @@ export class PaginationComponent implements OnDestroy, OnInit { * The sort direction being navigated to. */ public doSortDirectionChange(sortDirection: SortDirection) { - this.updateParams({ pageId: this.id, page: 1, sortDirection: sortDirection }); + this.updateParams({ page: 1, sortDirection: sortDirection }); this.emitPaginationChange(); } @@ -306,7 +307,7 @@ export class PaginationComponent implements OnDestroy, OnInit { * The sort field being navigated to. */ public doSortFieldChange(field: string) { - this.updateParams({ pageId: this.id, page: 1, sortField: field }); + this.updateParams({ page: 1, sortField: field }); this.emitPaginationChange(); } @@ -321,7 +322,7 @@ export class PaginationComponent implements OnDestroy, OnInit { * Update the current query params and optionally update the route * @param params */ - private updateParams(params: {}) { + private updateParams(params: PaginationRouteParams) { this.paginationService.updateRoute(this.id, params, {}, this.retainScrollPosition); } @@ -407,7 +408,7 @@ export class PaginationComponent implements OnDestroy, OnInit { */ updatePagination(value: number) { this.paginationService.getCurrentPagination(this.id, this.paginationOptions).pipe(take(1)).subscribe((currentPaginationOptions) => { - this.updateParams({page: (currentPaginationOptions.currentPage + value).toString()}); + this.updateParams({ page: (currentPaginationOptions.currentPage + value) }); }); } diff --git a/src/app/shared/testing/action.mock.ts b/src/app/shared/testing/action.mock.ts index e227946f644..fc1e741c206 100644 --- a/src/app/shared/testing/action.mock.ts +++ b/src/app/shared/testing/action.mock.ts @@ -2,5 +2,5 @@ import { Action } from '@ngrx/store'; export class ActionMock implements Action { type = null; - payload: {}; + payload: unknown; } diff --git a/src/app/shared/testing/active-router.stub.ts b/src/app/shared/testing/active-router.stub.ts index 495920555b3..28993a9a040 100644 --- a/src/app/shared/testing/active-router.stub.ts +++ b/src/app/shared/testing/active-router.stub.ts @@ -35,7 +35,7 @@ export class ActivatedRouteStub { return this._testParams; } - set testParams(params: {}) { + set testParams(params: unknown) { this._testParams = params; this.subject.next(params); } @@ -45,7 +45,7 @@ export class ActivatedRouteStub { return this._testParams; } - set testData(data: {}) { + set testData(data: unknown) { this._testData = data; this.dataSubject.next(data); } diff --git a/src/app/system-wide-alert/alert-banner/system-wide-alert-banner.component.ts b/src/app/system-wide-alert/alert-banner/system-wide-alert-banner.component.ts index 27bdb14f1d7..c564663044b 100644 --- a/src/app/system-wide-alert/alert-banner/system-wide-alert-banner.component.ts +++ b/src/app/system-wide-alert/alert-banner/system-wide-alert-banner.component.ts @@ -48,7 +48,7 @@ export class SystemWideAlertBannerComponent implements OnInit, OnDestroy { subscriptions: Subscription[] = []; constructor( - @Inject(PLATFORM_ID) protected platformId: Object, + @Inject(PLATFORM_ID) protected platformId: any, protected systemWideAlertDataService: SystemWideAlertDataService, protected notificationsService: NotificationsService, ) { From fa2c22d2404b7da3edb3071ada5733c454c8429d Mon Sep 17 00:00:00 2001 From: Yury Bondarenko Date: Tue, 27 Jun 2023 14:06:21 +0200 Subject: [PATCH 09/33] ESLint: enforce Angular HTML no-negated-async https://github.com/angular-eslint/angular-eslint/blob/main/packages/eslint-plugin-template/docs/rules/no-negated-async.md Prevents us from writing conditions that may pass/fail before an observable has emitted (this is likely to cause unexpected behaviour) --- .eslintrc.json | 1 - 1 file changed, 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index 84a7cc4bfa5..faebd7a92da 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -235,7 +235,6 @@ ], "rules": { // todo: re-enable & fix errors - "@angular-eslint/template/no-negated-async": "off", "@angular-eslint/template/eqeqeq": "off" } }, From 741c6009f4e6c917d729f4ef57e0c687a333a438 Mon Sep 17 00:00:00 2001 From: Yury Bondarenko Date: Tue, 27 Jun 2023 14:06:36 +0200 Subject: [PATCH 10/33] ESLint: fix no-negated-async violations --- .../epeople-registry.component.html | 2 +- .../eperson-form/eperson-form.component.html | 18 +++++++++--------- .../eperson-form/eperson-form.component.ts | 18 ++++++++++++++---- .../group-form/group-form.component.html | 4 ++-- .../subgroups-list.component.html | 6 +++--- .../subgroup-list/subgroups-list.component.ts | 6 ++++++ .../groups-registry.component.html | 2 +- .../admin-sidebar/admin-sidebar.component.html | 6 +++--- .../delete-collection-page.component.html | 2 +- .../collection-source-controls.component.html | 6 +++--- .../collection-source.component.html | 14 +++++++------- .../delete-community-page.component.html | 2 +- .../header-navbar-wrapper.component.html | 2 +- src/app/health-page/health-page.component.html | 2 +- .../edit-item-page.component.html | 2 +- .../item-bitstreams.component.html | 12 ++++++------ ...drag-and-drop-bitstream-list.component.html | 2 +- .../edit-relationship-list.component.html | 2 +- .../item-relationships.component.html | 12 ++++++------ .../collections/collections.component.html | 2 +- .../orcid-auth/orcid-auth.component.html | 6 +++--- .../orcid-page/orcid-page.component.html | 6 +++--- .../orcid-queue/orcid-queue.component.html | 4 ++-- .../item-versions-summary-modal.component.html | 2 +- ...dspace-new-external-dropdown.component.html | 6 +++--- ...pace-new-submission-dropdown.component.html | 6 +++--- src/app/navbar/navbar.component.html | 4 ++-- .../detail/process-detail.component.html | 4 ++-- .../new/new-process.component.html | 2 +- .../overview/process-overview.component.html | 2 +- ...profile-page-researcher-form.component.html | 4 ++-- .../register-email-form.component.html | 2 +- src/app/root/root.component.html | 2 +- .../auth-nav-menu/auth-nav-menu.component.html | 6 +++--- .../user-menu/user-menu.component.html | 2 +- .../collection-dropdown.component.html | 2 +- .../comcol-role/comcol-role.component.html | 2 +- .../entity-dropdown.component.html | 2 +- .../file-download-link.component.html | 2 +- ...isting-metadata-list-element.component.html | 2 +- ...isting-relation-list-element.component.html | 2 +- .../onebox/dynamic-onebox.component.html | 2 +- .../dynamic-relation-group.component.html | 6 +++--- ...c-lookup-relation-search-tab.component.html | 2 +- src/app/shared/form/form.component.html | 2 +- .../vocabulary-treeview.component.html | 2 +- src/app/shared/log-in/log-in.component.html | 2 +- ...claimed-task-actions-approve.component.html | 2 +- ...ed-task-actions-decline-task.component.html | 2 +- .../claimed-task-actions-reject.component.html | 4 ++-- ...-task-actions-return-to-pool.component.html | 2 +- .../pool-task/pool-task-actions.component.html | 2 +- .../workspaceitem-actions.component.html | 2 +- ...m-search-result-list-element.component.html | 2 +- ...tem-search-result-list-element.component.ts | 18 +++++++++--------- ...m-search-result-list-element.component.html | 2 +- ...tem-search-result-list-element.component.ts | 18 +++++++++--------- .../item-select/item-select.component.html | 2 +- .../form/resource-policy-form.component.html | 4 ++-- .../resource-policies.component.html | 4 ++-- .../search-authority-filter.component.html | 2 +- .../search-boolean-filter.component.html | 2 +- .../search-hierarchy-filter.component.html | 2 +- .../search-text-filter.component.html | 2 +- src/app/shared/search/search.component.html | 4 ++-- .../subscription-modal.component.html | 2 +- .../statistics-page.component.html | 2 +- .../submission-form-collection.component.html | 4 ++-- .../submission-form-footer.component.html | 8 ++++---- .../submission-form-section-add.component.html | 4 ++-- .../form/submission-form.component.html | 4 ++-- ...on-import-external-searchbar.component.html | 4 ++-- .../submission-import-external.component.html | 6 +++--- .../container/section-container.component.html | 4 ++-- .../file/section-upload-file.component.html | 2 +- .../subscriptions-page.component.html | 4 ++-- .../header-navbar-wrapper.component.html | 2 +- .../dspace/app/navbar/navbar.component.html | 4 ++-- 78 files changed, 175 insertions(+), 159 deletions(-) diff --git a/src/app/access-control/epeople-registry/epeople-registry.component.html b/src/app/access-control/epeople-registry/epeople-registry.component.html index e3a8e2c590f..8fff24e3b40 100644 --- a/src/app/access-control/epeople-registry/epeople-registry.component.html +++ b/src/app/access-control/epeople-registry/epeople-registry.component.html @@ -47,7 +47,7 @@ class="btn btn-outline-secondary"> {{messagePrefix + '.return' | translate}}
-
-
- @@ -42,13 +42,13 @@

{{messagePrefix + '.edit' | translate}}

{{messagePrefix + '.groupsEPersonIsMemberOf' | translate}}
- + @@ -63,7 +63,7 @@
{{messagePrefix + '.groupsEPersonIsMemberOf' | translate}}
- + {{group.id}} {{messagePrefix + '.groupsEPersonIsMemberOf' | translate}}
- - - -
diff --git a/src/app/community-page/delete-community-page/delete-community-page.component.html b/src/app/community-page/delete-community-page/delete-community-page.component.html index 6bb8460bc95..2c40f4f9698 100644 --- a/src/app/community-page/delete-community-page/delete-community-page.component.html +++ b/src/app/community-page/delete-community-page/delete-community-page.component.html @@ -11,7 +11,7 @@

{{'item.edit.head' | translate}}

{{'item.edit.tabs.' + page.page + '.head' | translate}} - diff --git a/src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.html b/src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.html index 4cb9577fcb5..d2de98fdd4f 100644 --- a/src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.html +++ b/src/app/item-page/edit-item-page/item-bitstreams/item-bitstreams.component.html @@ -10,13 +10,13 @@ class="fas fa-undo-alt">  {{"item.edit.bitstreams.reinstate-button" | translate}} - - - - - +
- - -
{{'person.orcid.registry.auth' | translate}}
{{ 'person.page.orcid.missing-authorizations'| translate }}
- + {{'person.page.orcid.no-missing-authorizations-message' | translate}} @@ -41,7 +41,7 @@

{{'person.orcid.registry.auth' | translate}}

- {{ 'person.page.orcid.remove-orcid-message' | translate}} @@ -49,7 +49,7 @@

{{'person.orcid.registry.auth' | translate}}

@@ -7,7 +7,7 @@ ngbDropdown *ngIf="(moreThanOne$ | async)"> @@ -30,7 +30,7 @@ {{'researcher.profile.action.processing' | translate}} - +  {{'researcher.profile.delete' | translate}} diff --git a/src/app/register-email-form/register-email-form.component.html b/src/app/register-email-form/register-email-form.component.html index ed79b1d2d17..e87724df038 100644 --- a/src/app/register-email-form/register-email-form.component.html +++ b/src/app/register-email-form/register-email-form.component.html @@ -47,7 +47,7 @@

{{MESSAGE_PREFIX + '.header'|translate}}

(showNotification)="showNotification($event)"> - + diff --git a/src/app/root/root.component.html b/src/app/root/root.component.html index bf49e507c0b..ae05220df29 100644 --- a/src/app/root/root.component.html +++ b/src/app/root/root.component.html @@ -1,5 +1,5 @@
diff --git a/src/app/shared/auth-nav-menu/auth-nav-menu.component.html b/src/app/shared/auth-nav-menu/auth-nav-menu.component.html index 05f502afa1b..22720133a4e 100644 --- a/src/app/shared/auth-nav-menu/auth-nav-menu.component.html +++ b/src/app/shared/auth-nav-menu/auth-nav-menu.component.html @@ -1,5 +1,5 @@ -
+
@@ -16,7 +16,7 @@
-
+
-
+
diff --git a/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.html b/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.html index fb7d1620082..6a4da99fd04 100644 --- a/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.html +++ b/src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.html @@ -16,7 +16,7 @@
-

+

{{'vocabulary-treeview.search.no-result' | translate}}

diff --git a/src/app/shared/log-in/log-in.component.html b/src/app/shared/log-in/log-in.component.html index 6b1fdb9ff66..1aaba13e7d8 100644 --- a/src/app/shared/log-in/log-in.component.html +++ b/src/app/shared/log-in/log-in.component.html @@ -1,5 +1,5 @@ - diff --git a/src/app/shared/object-list/my-dspace-result-list-element/workspace-item-search-result/workspace-item-search-result-list-element.component.ts b/src/app/shared/object-list/my-dspace-result-list-element/workspace-item-search-result/workspace-item-search-result-list-element.component.ts index 7ff9a2ef3df..8e9dffbd093 100644 --- a/src/app/shared/object-list/my-dspace-result-list-element/workspace-item-search-result/workspace-item-search-result-list-element.component.ts +++ b/src/app/shared/object-list/my-dspace-result-list-element/workspace-item-search-result/workspace-item-search-result-list-element.component.ts @@ -1,6 +1,6 @@ import { Component, Inject } from '@angular/core'; -import { Observable } from 'rxjs'; +import { BehaviorSubject } from 'rxjs'; import { LinkService } from '../../../../core/cache/builders/link.service'; import { Item } from '../../../../core/shared/item.model'; @@ -13,7 +13,6 @@ import { SearchResultListElementComponent } from '../../search-result-list-eleme import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service'; import { APP_CONFIG, AppConfig } from '../../../../../config/app-config.interface'; import { ItemSearchResult } from '../../../object-collection/shared/item-search-result.model'; -import { map } from 'rxjs/operators'; import { getFirstSucceededRemoteDataPayload } from '../../../../core/shared/operators'; import { CollectionElementLinkType } from '../../../object-collection/collection-element-link.type'; import { followLink } from '../../../utils/follow-link-config.model'; @@ -37,7 +36,7 @@ export class WorkspaceItemSearchResultListElementComponent extends SearchResult /** * The item search result derived from the WorkspaceItemSearchResult */ - derivedSearchResult$: Observable; + derivedSearchResult$: BehaviorSubject = new BehaviorSubject(undefined); /** * Represents the badge context @@ -69,13 +68,14 @@ export class WorkspaceItemSearchResultListElementComponent extends SearchResult private deriveSearchResult() { this.linkService.resolveLink(this.object.indexableObject, followLink('item')); - this.derivedSearchResult$ = this.object.indexableObject.item.pipe( + this.object.indexableObject.item.pipe( getFirstSucceededRemoteDataPayload(), - map((item: Item) => { + ).subscribe((item: Item) => { const result = new ItemSearchResult(); - result.indexableObject = item; - result.hitHighlights = this.object.hitHighlights; - return result; - })); + this.derivedSearchResult$.next(Object.assign(new ItemSearchResult(), { + indexableObject: item, + hitHighlights: this.object.hitHighlights, + })); + }); } } diff --git a/src/app/shared/object-select/item-select/item-select.component.html b/src/app/shared/object-select/item-select/item-select.component.html index 7f8ff943a37..97bddc29692 100644 --- a/src/app/shared/object-select/item-select/item-select.component.html +++ b/src/app/shared/object-select/item-select/item-select.component.html @@ -19,7 +19,7 @@ - + diff --git a/src/app/shared/resource-policies/form/resource-policy-form.component.html b/src/app/shared/resource-policies/form/resource-policy-form.component.html index 66c1fc400e9..c17987306e1 100644 --- a/src/app/shared/resource-policies/form/resource-policy-form.component.html +++ b/src/app/shared/resource-policies/form/resource-policy-form.component.html @@ -35,12 +35,12 @@ (click)="onReset()">{{'form.cancel' | translate}} diff --git a/src/app/shared/resource-policies/resource-policies.component.html b/src/app/shared/resource-policies/resource-policies.component.html index 277f6e49988..83897900f4c 100644 --- a/src/app/shared/resource-policies/resource-policies.component.html +++ b/src/app/shared/resource-policies/resource-policies.component.html @@ -13,13 +13,13 @@
- {{"search.filters.filter.show-more" | translate}} diff --git a/src/app/shared/search/search-filters/search-filter/search-boolean-filter/search-boolean-filter.component.html b/src/app/shared/search/search-filters/search-filter/search-boolean-filter/search-boolean-filter.component.html index 7d0ad899142..147a0260f1d 100644 --- a/src/app/shared/search/search-filters/search-filter/search-boolean-filter/search-boolean-filter.component.html +++ b/src/app/shared/search/search-filters/search-filter/search-boolean-filter/search-boolean-filter.component.html @@ -7,7 +7,7 @@
- {{"search.filters.filter.show-more" | translate}} diff --git a/src/app/shared/search/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.html b/src/app/shared/search/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.html index eb49235641f..9bfab9bd065 100644 --- a/src/app/shared/search/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.html +++ b/src/app/shared/search/search-filters/search-filter/search-hierarchy-filter/search-hierarchy-filter.component.html @@ -7,7 +7,7 @@
- {{"search.filters.filter.show-more" | translate}} diff --git a/src/app/shared/search/search-filters/search-filter/search-text-filter/search-text-filter.component.html b/src/app/shared/search/search-filters/search-filter/search-text-filter/search-text-filter.component.html index fdf154bc045..28cf3cb514e 100644 --- a/src/app/shared/search/search-filters/search-filter/search-text-filter/search-text-filter.component.html +++ b/src/app/shared/search/search-filters/search-filter/search-text-filter/search-text-filter.component.html @@ -7,7 +7,7 @@
- {{"search.filters.filter.show-more" | translate}} diff --git a/src/app/shared/search/search.component.html b/src/app/shared/search/search.component.html index d43f506866f..9cfe8545536 100644 --- a/src/app/shared/search/search.component.html +++ b/src/app/shared/search/search.component.html @@ -16,7 +16,7 @@
-
+
@@ -47,7 +47,7 @@ - {{'subscriptions.modal.title' | translate}} {{'subscriptions.modal.new-subscription-form.processing' | translate}} - + {{'subscriptions.modal.new-subscription-form.submit' | translate}} diff --git a/src/app/statistics-page/statistics-page/statistics-page.component.html b/src/app/statistics-page/statistics-page/statistics-page.component.html index c6938c7582b..481aa5280ef 100644 --- a/src/app/statistics-page/statistics-page/statistics-page.component.html +++ b/src/app/statistics-page/statistics-page/statistics-page.component.html @@ -19,7 +19,7 @@ [report]="report" class="m-2 {{ report.id }}"> -
+
{{ 'statistics.page.no-data' | translate }}
diff --git a/src/app/submission/form/collection/submission-form-collection.component.html b/src/app/submission/form/collection/submission-form-collection.component.html index a78d737640c..79be0a8585e 100644 --- a/src/app/submission/form/collection/submission-form-collection.component.html +++ b/src/app/submission/form/collection/submission-form-collection.component.html @@ -1,6 +1,6 @@
{{ 'submission.sections.general.collection' | translate }} @@ -28,7 +28,7 @@ [disabled]="(processingChange$ | async) || collectionModifiable == false || isReadonly" ngbDropdownToggle> - {{ selectedCollectionName$ | async }} + {{ selectedCollectionName$ | async }}
- + {{'submission.general.info.saved' | translate}} - + {{'submission.general.info.pending-changes' | translate}}
@@ -28,12 +28,12 @@ class="btn btn-secondary" id="save" [attr.data-test]="'save' | dsBrowserOnly" - [disabled]="(processingSaveStatus | async) || !(hasUnsavedModification | async)" + [disabled]="(processingSaveStatus | async) || (hasUnsavedModification | async) === false" (click)="save($event)"> {{'submission.general.save' | translate}}