From 4a9bfb03463037ff750398514611c70a7fad6763 Mon Sep 17 00:00:00 2001 From: Mattia Vianelli Date: Mon, 20 Nov 2023 15:39:17 +0100 Subject: [PATCH 1/2] CST-12498 rollback --- .../ldn-service-form-edit.component.spec.ts | 1 + .../ldn-service-form/ldn-service-form.component.spec.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.spec.ts b/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.spec.ts index a2fa801e6d..2fa27ac743 100644 --- a/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.spec.ts +++ b/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.spec.ts @@ -28,6 +28,7 @@ describe('LdnServiceFormEditComponent', () => { const translateServiceStub = { get: () => of('translated-text'), + instant: () => 'translated-text', onLangChange: new EventEmitter(), onTranslationChange: new EventEmitter(), onDefaultLangChange: new EventEmitter() diff --git a/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.spec.ts b/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.spec.ts index 70a4b76ed3..5db8e66c33 100644 --- a/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.spec.ts +++ b/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.spec.ts @@ -25,12 +25,14 @@ describe('LdnServiceFormComponent', () => { let notificationsService: any; const itemFiltersRdPL$ = createSuccessfulRemoteDataObject$(createPaginatedList([new Itemfilter()])); + const translateServiceStub = { get: () => of('translated-text'), + instant: () => 'translated-text', onLangChange: new EventEmitter(), onTranslationChange: new EventEmitter(), onDefaultLangChange: new EventEmitter() - }; +}; beforeEach(async () => { ldnItemfiltersService = jasmine.createSpyObj('ldnItemfiltersService', { From 53599491e12bb1063600234cca28f3511eb19ca8 Mon Sep 17 00:00:00 2001 From: Mattia Vianelli Date: Mon, 20 Nov 2023 15:43:29 +0100 Subject: [PATCH 2/2] CST-12498 lint fix --- .../ldn-service-form-edit.component.ts | 36 +++++++++---------- .../ldn-service-form.component.ts | 20 +++++------ .../ldnServicesRD$-mock.ts | 18 +++++----- .../ldn-services-directory.component.spec.ts | 14 ++++---- src/app/core/data/data.service.ts | 1 - src/app/shared/mocks/suggestion.mock.ts | 1 - .../suggestions-page-routing.module.ts | 1 - src/assets/i18n/en.json5 | 8 ++--- 8 files changed, 48 insertions(+), 51 deletions(-) diff --git a/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.ts b/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.ts index b4ec221d5b..408d0b6ecd 100644 --- a/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.ts +++ b/src/app/admin/admin-ldn-services/ldn-service-form-edit/ldn-service-form-edit.component.ts @@ -19,7 +19,7 @@ import {Observable} from 'rxjs'; import {PaginationService} from '../../../core/pagination/pagination.service'; import {FindListOptions} from '../../../core/data/find-list-options.model'; import {PaginationComponentOptions} from '../../../shared/pagination/pagination-component-options.model'; -import {NotifyServicePattern} from "../ldn-services-model/ldn-service-patterns.model"; +import {NotifyServicePattern} from '../ldn-services-model/ldn-service-patterns.model'; /** @@ -142,8 +142,8 @@ export class LdnServiceFormEditComponent implements OnInit { type: this.service.type, enabled: this.service.enabled }); - this.filterPatternObjectsAndPickLabel('notifyServiceInboundPatterns', false) - this.filterPatternObjectsAndPickLabel('notifyServiceOutboundPatterns', true) + this.filterPatternObjectsAndPickLabel('notifyServiceInboundPatterns', false); + this.filterPatternObjectsAndPickLabel('notifyServiceOutboundPatterns', true); } }, ); @@ -159,9 +159,9 @@ export class LdnServiceFormEditComponent implements OnInit { PatternsArray.clear(); let servicesToUse; if (isOutbound) { - servicesToUse = this.service.notifyServiceOutboundPatterns + servicesToUse = this.service.notifyServiceOutboundPatterns; } else { - servicesToUse = this.service.notifyServiceInboundPatterns + servicesToUse = this.service.notifyServiceInboundPatterns; } servicesToUse.forEach((patternObj: NotifyServicePattern) => { @@ -174,12 +174,12 @@ export class LdnServiceFormEditComponent implements OnInit { const newPatternObjWithLabel = Object.assign(new NotifyServicePattern(), { ...patternObj, patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternObj?.pattern + '.label') - }) + }); patternFormGroup.patchValue(newPatternObjWithLabel); PatternsArray.push(patternFormGroup); this.cdRef.detectChanges(); - }) + }); } @@ -249,9 +249,9 @@ export class LdnServiceFormEditComponent implements OnInit { * @param index - The index of the outbound pattern in the array */ selectOutboundPattern(patternValue: string, index: number): void { - const patternArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray) - patternArray.controls[index].patchValue({pattern: patternValue}) - patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')}) + const patternArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray); + patternArray.controls[index].patchValue({pattern: patternValue}); + patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')}); } @@ -261,8 +261,8 @@ export class LdnServiceFormEditComponent implements OnInit { * @param index - The index of the inbound pattern in the array */ selectOutboundItemFilter(filterValue: string, index: number) { - const filterArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray) - filterArray.controls[index].patchValue({constraint: filterValue}) + const filterArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray); + filterArray.controls[index].patchValue({constraint: filterValue}); } /** @@ -271,9 +271,9 @@ export class LdnServiceFormEditComponent implements OnInit { * @param index - The index of the inbound pattern in the array */ selectInboundPattern(patternValue: string, index: number): void { - const patternArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray) - patternArray.controls[index].patchValue({pattern: patternValue}) - patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')}) + const patternArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray); + patternArray.controls[index].patchValue({pattern: patternValue}); + patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')}); } /** @@ -282,8 +282,8 @@ export class LdnServiceFormEditComponent implements OnInit { * @param index - The index of the inbound pattern in the array */ selectInboundItemFilter(filterValue: string, index: number): void { - const filterArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray) - filterArray.controls[index].patchValue({constraint: filterValue}) + const filterArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray); + filterArray.controls[index].patchValue({constraint: filterValue}); } /** @@ -488,7 +488,7 @@ export class LdnServiceFormEditComponent implements OnInit { * @param formArrayName - The name of the form array */ private handlePatterns(patchOperations: any[], formArrayName: string): void { - const patternsArray = this.formModel.get(formArrayName) as FormArray + const patternsArray = this.formModel.get(formArrayName) as FormArray; for (let i = 0; i < patternsArray.length; i++) { diff --git a/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts b/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts index d903fec63e..be2d117650 100644 --- a/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts +++ b/src/app/admin/admin-ldn-services/ldn-service-form/ldn-service-form.component.ts @@ -287,9 +287,9 @@ export class LdnServiceFormComponent implements OnInit { * @param {number} index - The index of the outbound pattern in the form array. */ selectOutboundPattern(patternValue: string, index: number): void { - const patternArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray) - patternArray.controls[index].patchValue({pattern: patternValue}) - patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')}) + const patternArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray); + patternArray.controls[index].patchValue({pattern: patternValue}); + patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')}); } @@ -300,9 +300,9 @@ export class LdnServiceFormComponent implements OnInit { * @param {number} index - The index of the inbound pattern in the form array. */ selectInboundPattern(patternValue: string, index: number): void { - const patternArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray) - patternArray.controls[index].patchValue({pattern: patternValue}) - patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')}) + const patternArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray); + patternArray.controls[index].patchValue({pattern: patternValue}); + patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')}); } @@ -313,8 +313,8 @@ export class LdnServiceFormComponent implements OnInit { * @param {number} index - The index of the inbound item filter in the form array. */ selectInboundItemFilter(filterValue: string, index: number): void { - const filterArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray) - filterArray.controls[index].patchValue({constraint: filterValue}) + const filterArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray); + filterArray.controls[index].patchValue({constraint: filterValue}); } /** @@ -324,8 +324,8 @@ export class LdnServiceFormComponent implements OnInit { * @param {number} index - The index of the outbound item filter in the form array. */ selectOutboundItemFilter(filterValue: string, index: number) { - const filterArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray) - filterArray.controls[index].patchValue({constraint: filterValue}) + const filterArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray); + filterArray.controls[index].patchValue({constraint: filterValue}); } /** diff --git a/src/app/admin/admin-ldn-services/ldn-service-serviceMock/ldnServicesRD$-mock.ts b/src/app/admin/admin-ldn-services/ldn-service-serviceMock/ldnServicesRD$-mock.ts index bf40c34efe..02090b1602 100644 --- a/src/app/admin/admin-ldn-services/ldn-service-serviceMock/ldnServicesRD$-mock.ts +++ b/src/app/admin/admin-ldn-services/ldn-service-serviceMock/ldnServicesRD$-mock.ts @@ -2,11 +2,11 @@ import {LdnService} from '../ldn-services-model/ldn-services.model'; import {LDN_SERVICE} from '../ldn-services-model/ldn-service.resource-type'; import {RemoteData} from '../../../core/data/remote-data'; import {PaginatedList} from '../../../core/data/paginated-list.model'; -import {Observable, of} from "rxjs"; -import {createSuccessfulRemoteDataObject$} from "../../../shared/remote-data.utils"; +import {Observable, of} from 'rxjs'; +import {createSuccessfulRemoteDataObject$} from '../../../shared/remote-data.utils'; export const mockLdnService: LdnService = { - uuid: "1", + uuid: '1', enabled: false, score: 0, id: 1, @@ -40,7 +40,7 @@ export const mockLdnService: LdnService = { }, }, get self(): string { - return ""; + return ''; }, }; @@ -48,7 +48,7 @@ export const mockLdnServiceRD$ = createSuccessfulRemoteDataObject$(mockLdnServic export const mockLdnServices: LdnService[] = [{ - uuid: "1", + uuid: '1', enabled: false, score: 0, id: 1, @@ -82,10 +82,10 @@ export const mockLdnServices: LdnService[] = [{ }, }, get self(): string { - return ""; + return ''; }, }, { - uuid: "2", + uuid: '2', enabled: false, score: 0, id: 2, @@ -119,8 +119,8 @@ export const mockLdnServices: LdnService[] = [{ }, }, get self(): string { - return ""; + return ''; }, } -] +]; export const mockLdnServicesRD$: Observable>> = of((mockLdnServices as unknown) as RemoteData>); diff --git a/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.spec.ts b/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.spec.ts index 35bf3d598c..664edcb27d 100644 --- a/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.spec.ts +++ b/src/app/admin/admin-ldn-services/ldn-services-directory/ldn-services-directory.component.spec.ts @@ -8,12 +8,12 @@ import {LdnServicesService} from '../ldn-services-data/ldn-services-data.service import {PaginationService} from '../../../core/pagination/pagination.service'; import {PaginationServiceStub} from '../../../shared/testing/pagination-service.stub'; import {of} from 'rxjs'; -import {LdnService} from "../ldn-services-model/ldn-services.model"; -import {PaginatedList} from "../../../core/data/paginated-list.model"; -import {RemoteData} from "../../../core/data/remote-data"; +import {LdnService} from '../ldn-services-model/ldn-services.model'; +import {PaginatedList} from '../../../core/data/paginated-list.model'; +import {RemoteData} from '../../../core/data/remote-data'; import {LdnServicesOverviewComponent} from './ldn-services-directory.component'; -import {createSuccessfulRemoteDataObject$} from "../../../shared/remote-data.utils"; -import {createPaginatedList} from "../../../shared/testing/utils.test"; +import {createSuccessfulRemoteDataObject$} from '../../../shared/remote-data.utils'; +import {createPaginatedList} from '../../../shared/testing/utils.test'; describe('LdnServicesOverviewComponent', () => { let component: LdnServicesOverviewComponent; @@ -33,7 +33,7 @@ describe('LdnServicesOverviewComponent', () => { beforeEach(async () => { paginationService = new PaginationServiceStub(); - ldnServicesService = jasmine.createSpyObj('LdnServicesService', ['findAll', 'delete', 'patch']) + ldnServicesService = jasmine.createSpyObj('LdnServicesService', ['findAll', 'delete', 'patch']); await TestBed.configureTestingModule({ imports: [TranslateModule.forRoot()], declarations: [LdnServicesOverviewComponent], @@ -89,7 +89,7 @@ describe('LdnServicesOverviewComponent', () => { {id: 2, name: 'Service 2', description: 'Description 2', enabled: false}, {id: 3, name: 'Service 3', description: 'Description 3', enabled: true}]); - const mockLdnServicesRD = createPaginatedList(testData) + const mockLdnServicesRD = createPaginatedList(testData); component.ldnServicesRD$ = createSuccessfulRemoteDataObject$(mockLdnServicesRD); fixture.detectChanges(); diff --git a/src/app/core/data/data.service.ts b/src/app/core/data/data.service.ts index 1433ebacce..43b60f874d 100644 --- a/src/app/core/data/data.service.ts +++ b/src/app/core/data/data.service.ts @@ -25,7 +25,6 @@ import { RequestParam } from '../cache/models/request-param.model'; import { ObjectCacheEntry } from '../cache/object-cache.reducer'; import { ObjectCacheService } from '../cache/object-cache.service'; import { DSpaceSerializer } from '../dspace-rest/dspace.serializer'; -import { DSpaceObject } from '../shared/dspace-object.model'; import { HALEndpointService } from '../shared/hal-endpoint.service'; import { getFirstCompletedRemoteData, getFirstSucceededRemoteData, getRemoteDataPayload } from '../shared/operators'; import { URLCombiner } from '../url-combiner/url-combiner'; diff --git a/src/app/shared/mocks/suggestion.mock.ts b/src/app/shared/mocks/suggestion.mock.ts index fd1a7c41f1..8b1ab7acd5 100644 --- a/src/app/shared/mocks/suggestion.mock.ts +++ b/src/app/shared/mocks/suggestion.mock.ts @@ -1,7 +1,6 @@ import { DSpaceObject } from '../../core/shared/dspace-object.model'; import { Item } from '../../core/shared/item.model'; import { SearchResult } from '../search/models/search-result.model'; -import { SuggestionsService } from '../../suggestion-notifications/reciter-suggestions/suggestions.service'; // REST Mock --------------------------------------------------------------------- // ------------------------------------------------------------------------------- diff --git a/src/app/suggestions-page/suggestions-page-routing.module.ts b/src/app/suggestions-page/suggestions-page-routing.module.ts index 20ed658707..05dc6321b7 100644 --- a/src/app/suggestions-page/suggestions-page-routing.module.ts +++ b/src/app/suggestions-page/suggestions-page-routing.module.ts @@ -5,7 +5,6 @@ import { SuggestionsPageResolver } from './suggestions-page.resolver'; import { SuggestionsPageComponent } from './suggestions-page.component'; import { AuthenticatedGuard } from '../core/auth/authenticated.guard'; import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver'; -import { SiteAdministratorGuard } from '../core/data/feature-authorization/feature-authorization-guard/site-administrator.guard'; @NgModule({ imports: [ diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index e01964a4fb..10e490d915 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -892,7 +892,7 @@ "coar-notify-support.title": "COAR Notify Protocol", - "coar-notify-support-title.content":"Here, we fully support the COAR Notify protocol, which is designed to enhance the communication between repositories. To learn more about the COAR Notify protocol, you can visit their official website here.", + "coar-notify-support-title.content": "Here, we fully support the COAR Notify protocol, which is designed to enhance the communication between repositories. To learn more about the COAR Notify protocol, you can visit their official website here.", "coar-notify-support.ldn-inbox.title": "LDN InBox", @@ -905,7 +905,7 @@ "service.overview.delete.header": "Delete Service", "ldn-registered-services.title": "Registered Services", - "ldn-registered-services.table.name":"Name", + "ldn-registered-services.table.name": "Name", "ldn-registered-services.table.description": "Description", "ldn-registered-services.table.status": "Status", "ldn-registered-services.table.action": "Action", @@ -1012,7 +1012,7 @@ "service.detail.return": "Cancel", "service.overview.reset-form.body": "Are you sure you want to discard those changes and leave?", "service.overview.reset-form.modal": "Discard Service Changes", - "service.overview.reset-form.reset-confirm":"Discard", + "service.overview.reset-form.reset-confirm": "Discard", "admin.registries.services-formats.modify.success.head": "Successful Edit", "admin.registries.services-formats.modify.success.content": "The service has been edited", "admin.registries.services-formats.modify.failure.head": "Failed Edit", @@ -2043,7 +2043,7 @@ "info.feedback.breadcrumbs": "Feedback", - "info.coar-notify-support.title":"Notify Support", + "info.coar-notify-support.title": "Notify Support", "info.coar-notify.breadcrumbs": "Notify Support",