Skip to content

Commit a525b06

Browse files
author
Mattia Vianelli
committed
DURACOM-235 Lint fix
1 parent 57563dd commit a525b06

6 files changed

Lines changed: 58 additions & 42 deletions

File tree

src/app/collection-page/collection-form/collection-form.component.ts

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,54 @@
1-
import { AsyncPipe, NgClass, NgIf, } from '@angular/common';
2-
import { ChangeDetectorRef, Component, Input, OnChanges, OnInit, SimpleChange, SimpleChanges, } from '@angular/core';
1+
import {
2+
AsyncPipe,
3+
NgClass,
4+
NgIf,
5+
} from '@angular/common';
6+
import {
7+
ChangeDetectorRef,
8+
Component,
9+
Input,
10+
OnChanges,
11+
OnInit,
12+
SimpleChange,
13+
SimpleChanges,
14+
} from '@angular/core';
15+
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
316
import {
417
DynamicFormControlModel,
518
DynamicFormOptionConfig,
619
DynamicFormService,
720
DynamicSelectModel,
821
} from '@ng-dynamic-forms/core';
9-
import { TranslateModule, TranslateService, } from '@ngx-translate/core';
22+
import {
23+
TranslateModule,
24+
TranslateService,
25+
} from '@ngx-translate/core';
1026
import { Observable } from 'rxjs';
11-
import { hasNoValue, isNotNull, } from 'src/app/shared/empty.util';
27+
import {
28+
hasNoValue,
29+
isNotNull,
30+
} from 'src/app/shared/empty.util';
1231

13-
import { Collection } from '../../core/shared/collection.model';
14-
import { ComColFormComponent } from '../../shared/comcol/comcol-forms/comcol-form/comcol-form.component';
15-
import { NotificationsService } from '../../shared/notifications/notifications.service';
16-
import { CollectionDataService } from '../../core/data/collection-data.service';
1732
import { AuthService } from '../../core/auth/auth.service';
1833
import { ObjectCacheService } from '../../core/cache/object-cache.service';
34+
import { CollectionDataService } from '../../core/data/collection-data.service';
1935
import { EntityTypeDataService } from '../../core/data/entity-type-data.service';
2036
import { RequestService } from '../../core/data/request.service';
37+
import { Collection } from '../../core/shared/collection.model';
2138
import { ItemType } from '../../core/shared/item-relationships/item-type.model';
2239
import { NONE_ENTITY_TYPE } from '../../core/shared/item-relationships/item-type.resource-type';
2340
import { MetadataValue } from '../../core/shared/metadata.models';
2441
import { getFirstSucceededRemoteListPayload } from '../../core/shared/operators';
25-
import { collectionFormEntityTypeSelectionConfig, collectionFormModels, } from './collection-form.models';
26-
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
42+
import { ComColFormComponent } from '../../shared/comcol/comcol-forms/comcol-form/comcol-form.component';
2743
import { ComcolPageLogoComponent } from '../../shared/comcol/comcol-page-logo/comcol-page-logo.component';
2844
import { FormComponent } from '../../shared/form/form.component';
45+
import { NotificationsService } from '../../shared/notifications/notifications.service';
2946
import { UploaderComponent } from '../../shared/upload/uploader/uploader.component';
3047
import { VarDirective } from '../../shared/utils/var.directive';
48+
import {
49+
collectionFormEntityTypeSelectionConfig,
50+
collectionFormModels,
51+
} from './collection-form.models';
3152

3253
/**
3354
* Form used for creating and editing collections

src/app/community-page/community-form/community-form.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
SimpleChange,
1111
SimpleChanges,
1212
} from '@angular/core';
13+
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
1314
import {
1415
DynamicFormControlModel,
1516
DynamicFormService,
@@ -33,7 +34,6 @@ import { FormComponent } from '../../shared/form/form.component';
3334
import { NotificationsService } from '../../shared/notifications/notifications.service';
3435
import { UploaderComponent } from '../../shared/upload/uploader/uploader.component';
3536
import { VarDirective } from '../../shared/utils/var.directive';
36-
import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
3737

3838
/**
3939
* Form used for creating and editing communities

src/app/shared/comcol/comcol-forms/comcol-form/comcol-form.component.spec.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,12 @@ import { hasValue } from '../../../empty.util';
2929
import { FormComponent } from '../../../form/form.component';
3030
import { AuthServiceMock } from '../../../mocks/auth.service.mock';
3131
import { NotificationsService } from '../../../notifications/notifications.service';
32-
import {
33-
createFailedRemoteDataObject$,
34-
createSuccessfulRemoteDataObject$,
35-
} from '../../../remote-data.utils';
32+
import { createSuccessfulRemoteDataObject$ } from '../../../remote-data.utils';
3633
import { NotificationsServiceStub } from '../../../testing/notifications-service.stub';
3734
import { UploaderComponent } from '../../../upload/uploader/uploader.component';
3835
import { VarDirective } from '../../../utils/var.directive';
3936
import { ComcolPageLogoComponent } from '../../comcol-page-logo/comcol-page-logo.component';
4037
import { ComColFormComponent } from './comcol-form.component';
41-
import { Operation } from 'fast-json-patch';
42-
import { createSuccessfulRemoteDataObject$ } from '../../../remote-data.utils';
4338

4439
describe('ComColFormComponent', () => {
4540
let comp: ComColFormComponent<any>;
@@ -82,7 +77,7 @@ describe('ComColFormComponent', () => {
8277
const dsoService = Object.assign({
8378
getLogoEndpoint: () => observableOf(logoEndpoint),
8479
deleteLogo: () => createSuccessfulRemoteDataObject$({}),
85-
findById: () => createSuccessfulRemoteDataObject$({})
80+
findById: () => createSuccessfulRemoteDataObject$({}),
8681
});
8782
const notificationsService = new NotificationsServiceStub();
8883

@@ -92,7 +87,7 @@ describe('ComColFormComponent', () => {
9287

9388
const requestServiceStub = jasmine.createSpyObj('requestService', {
9489
removeByHrefSubstring: {},
95-
setStaleByHrefSubstring: {}
90+
setStaleByHrefSubstring: {},
9691
});
9792
const objectCacheStub = jasmine.createSpyObj('objectCache', {
9893
remove: {},

src/app/shared/comcol/comcol-forms/comcol-form/comcol-form.component.ts

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ import {
1313
ViewChild,
1414
} from '@angular/core';
1515
import { UntypedFormGroup } from '@angular/forms';
16+
import {
17+
NgbModal,
18+
NgbModalRef,
19+
} from '@ng-bootstrap/ng-bootstrap';
1620
import {
1721
DynamicFormControlModel,
1822
DynamicFormService,
@@ -27,10 +31,15 @@ import { FileUploader } from 'ng2-file-upload';
2731
import {
2832
BehaviorSubject,
2933
combineLatest as observableCombineLatest,
34+
Observable,
3035
Subscription,
36+
switchMap,
3137
} from 'rxjs';
38+
import {
39+
filter,
40+
take,
41+
} from 'rxjs/operators';
3242

33-
import { BehaviorSubject, combineLatest as observableCombineLatest, Observable, Subscription, switchMap } from 'rxjs';
3443
import { AuthService } from '../../../../core/auth/auth.service';
3544
import { ObjectCacheService } from '../../../../core/cache/object-cache.service';
3645
import { ComColDataService } from '../../../../core/data/comcol-data.service';
@@ -46,6 +55,7 @@ import {
4655
import { NoContent } from '../../../../core/shared/NoContent.model';
4756
import { getFirstCompletedRemoteData } from '../../../../core/shared/operators';
4857
import { ResourceType } from '../../../../core/shared/resource-type';
58+
import { ConfirmationModalComponent } from '../../../confirmation-modal/confirmation-modal.component';
4959
import {
5060
hasValue,
5161
isNotEmpty,
@@ -54,12 +64,9 @@ import { FormComponent } from '../../../form/form.component';
5464
import { NotificationsService } from '../../../notifications/notifications.service';
5565
import { UploaderComponent } from '../../../upload/uploader/uploader.component';
5666
import { UploaderOptions } from '../../../upload/uploader/uploader-options.model';
67+
import { followLink } from '../../../utils/follow-link-config.model';
5768
import { VarDirective } from '../../../utils/var.directive';
5869
import { ComcolPageLogoComponent } from '../../comcol-page-logo/comcol-page-logo.component';
59-
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
60-
import { followLink } from '../../../utils/follow-link-config.model';
61-
import { ConfirmationModalComponent } from '../../../confirmation-modal/confirmation-modal.component';
62-
import { filter, take } from 'rxjs/operators';
6370

6471
/**
6572
* A form for creating and editing Communities or Collections
@@ -220,7 +227,7 @@ export class ComColFormComponent<T extends Collection | Community> implements On
220227
this.refreshDSO$.pipe(
221228
switchMap(() => this.refreshDsoCache()),
222229
filter(rd => rd.hasSucceeded),
223-
).subscribe(({ payload }) => this.dso = payload)
230+
).subscribe(({ payload }) => this.dso = payload),
224231
);
225232

226233
}
@@ -324,7 +331,7 @@ export class ComColFormComponent<T extends Collection | Community> implements On
324331
*/
325332
subscribeToConfirmationResponse(modalRef: NgbModalRef): void {
326333
modalRef.componentInstance.response.pipe(
327-
take(1)
334+
take(1),
328335
).subscribe((confirmed: boolean) => {
329336
if (confirmed) {
330337
this.handleLogoDeletion();
@@ -338,7 +345,7 @@ export class ComColFormComponent<T extends Collection | Community> implements On
338345
handleLogoDeletion(): void {
339346
if (hasValue(this.dso.id) && hasValue(this.dso._links.logo)) {
340347
this.dsoService.deleteLogo(this.dso).pipe(
341-
getFirstCompletedRemoteData()
348+
getFirstCompletedRemoteData(),
342349
).subscribe((response: RemoteData<NoContent>) => {
343350
const successMessageKey = `${this.type.value}.edit.logo.notifications.delete.success`;
344351
const errorMessageKey = `${this.type.value}.edit.logo.notifications.delete.error`;
@@ -362,7 +369,7 @@ export class ComColFormComponent<T extends Collection | Community> implements On
362369
this.refreshDSO$.next();
363370
this.notificationsService.success(
364371
this.translate.get(`${successMessageKey}.title`),
365-
this.translate.get(`${successMessageKey}.content`)
372+
this.translate.get(`${successMessageKey}.content`),
366373
);
367374
}
368375

@@ -374,7 +381,7 @@ export class ComColFormComponent<T extends Collection | Community> implements On
374381
private handleFailedDeletion(errorMessageKey: string, errorMessage: string): void {
375382
this.notificationsService.error(
376383
this.translate.get(`${errorMessageKey}.title`),
377-
errorMessage
384+
errorMessage,
378385
);
379386
}
380387

@@ -399,7 +406,7 @@ export class ComColFormComponent<T extends Collection | Community> implements On
399406
*/
400407
private fetchUpdatedDso(): Observable<RemoteData<T>> {
401408
return this.dsoService.findById(this.dso.id, false, true, followLink('logo')).pipe(
402-
getFirstCompletedRemoteData()
409+
getFirstCompletedRemoteData(),
403410
) as Observable<RemoteData<T>>;
404411
}
405412

src/app/shared/comcol/comcol-forms/edit-comcol-page/comcol-metadata/comcol-metadata.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,12 @@ describe('ComColMetadataComponent', () => {
195195
dso: new Community(),
196196
uploader: {
197197
options: {
198-
url: ''
198+
url: '',
199199
},
200200
queue: [],
201201
/* eslint-disable no-empty,@typescript-eslint/no-empty-function */
202202
uploadAll: () => {
203-
}
203+
},
204204
/* eslint-enable no-empty,@typescript-eslint/no-empty-function */
205205
},
206206
};

src/app/shared/comcol/comcol-forms/edit-comcol-page/comcol-metadata/comcol-metadata.component.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ import {
1515

1616
import { ComColDataService } from '../../../../../core/data/comcol-data.service';
1717
import { RemoteData } from '../../../../../core/data/remote-data';
18-
import { ActivatedRoute, Router } from '@angular/router';
19-
import { map, take } from 'rxjs/operators';
20-
import { getFirstCompletedRemoteData, getFirstSucceededRemoteData } from '../../../../../core/shared/operators';
21-
import { isEmpty } from '../../../../empty.util';
2218
import { Collection } from '../../../../../core/shared/collection.model';
2319
import { Community } from '../../../../../core/shared/community.model';
2420
import { DSpaceObject } from '../../../../../core/shared/dspace-object.model';
@@ -27,10 +23,7 @@ import {
2723
getFirstSucceededRemoteData,
2824
} from '../../../../../core/shared/operators';
2925
import { ResourceType } from '../../../../../core/shared/resource-type';
30-
import {
31-
hasValue,
32-
isEmpty,
33-
} from '../../../../empty.util';
26+
import { isEmpty } from '../../../../empty.util';
3427
import { NotificationsService } from '../../../../notifications/notifications.service';
3528

3629
@Component({
@@ -72,9 +65,9 @@ export class ComcolMetadataComponent<TDomain extends Community | Collection> imp
7265
onSubmit(event) {
7366
if (!isEmpty(event.operations)) {
7467
this.dsoDataService.patch(event.dso, event.operations).pipe(getFirstCompletedRemoteData())
75-
.subscribe(async (response: RemoteData<DSpaceObject>) => {
68+
.subscribe( (response: RemoteData<DSpaceObject>) => {
7669
if (response.hasSucceeded) {
77-
await this.router.navigate([this.frontendURL, event.dso.uuid]); // todo: ok not to await this?
70+
this.router.navigate([this.frontendURL, event.dso.uuid]); // todo: ok not to await this?
7871
this.notificationsService.success(null, this.translate.get(`${this.type.value}.edit.notifications.success`));
7972
} else if (response.statusCode === 403) {
8073
this.notificationsService.error(null, this.translate.get(`${this.type.value}.edit.notifications.unauthorized`));

0 commit comments

Comments
 (0)