[DURACOM-235] fix refactored after merge

This commit is contained in:
Giuseppe Digilio
2024-05-14 18:44:54 +02:00
parent 78e8fabc7f
commit b7d454ffc1

View File

@@ -7,16 +7,18 @@ import { TranslateService } from '@ngx-translate/core';
import { import {
BehaviorSubject, BehaviorSubject,
Observable, Observable,
of,
} from 'rxjs'; } from 'rxjs';
import { import {
map,
mergeMap, mergeMap,
take, take,
tap,
} from 'rxjs/operators'; } from 'rxjs/operators';
import { getHomePageRoute } from '../../../../app-routing-paths';
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service'; import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
import { RequestParam } from '../../../../core/cache/models/request-param.model'; import { RequestParam } from '../../../../core/cache/models/request-param.model';
import { Observable } from 'rxjs';
import { map, mergeMap, take, tap } from 'rxjs/operators';
import { ComColDataService } from '../../../../core/data/comcol-data.service'; import { ComColDataService } from '../../../../core/data/comcol-data.service';
import { CommunityDataService } from '../../../../core/data/community-data.service'; import { CommunityDataService } from '../../../../core/data/community-data.service';
import { RemoteData } from '../../../../core/data/remote-data'; import { RemoteData } from '../../../../core/data/remote-data';
@@ -32,12 +34,6 @@ import {
isNotUndefined, isNotUndefined,
} from '../../../empty.util'; } from '../../../empty.util';
import { NotificationsService } from '../../../notifications/notifications.service'; import { NotificationsService } from '../../../notifications/notifications.service';
import { RequestParam } from '../../../../core/cache/models/request-param.model';
import { RequestService } from '../../../../core/data/request.service';
import { Collection } from '../../../../core/shared/collection.model';
import { DSONameService } from '../../../../core/breadcrumbs/dso-name.service';
import { of } from 'rxjs/internal/observable/of';
import { getHomePageRoute } from '../../../../app-routing-paths';
/** /**
* Component representing the create page for communities and collections * Component representing the create page for communities and collections
@@ -118,7 +114,6 @@ export class CreateComColPageComponent<TDomain extends Collection | Community> i
); );
}), }),
mergeMap((dsoRD: TDomain) => { mergeMap((dsoRD: TDomain) => {
this.isLoading$.next(false);
if (isNotUndefined(dsoRD)) { if (isNotUndefined(dsoRD)) {
this.newUUID = dsoRD.uuid; this.newUUID = dsoRD.uuid;
if (uploader.queue.length > 0) { if (uploader.queue.length > 0) {
@@ -127,21 +122,23 @@ export class CreateComColPageComponent<TDomain extends Collection | Community> i
tap((href: string) => { tap((href: string) => {
uploader.options.url = href; uploader.options.url = href;
uploader.onCompleteAll = () => { uploader.onCompleteAll = () => {
this.isLoading$.next(false);
this.navigateToNewPage(); this.navigateToNewPage();
this.notificationsService.success(null, this.translate.get(this.type.value + '.create.notifications.success')); this.notificationsService.success(null, this.translate.get(this.type.value + '.create.notifications.success'));
}; };
uploader.uploadAll(); uploader.uploadAll();
}), }),
map(() => false) map(() => false),
); );
} else { } else {
this.dsoDataService.refreshCache(dsoRD); this.dsoDataService.refreshCache(dsoRD);
return of(true); return of(true);
} }
} }
}) }),
).subscribe((notify: boolean) => { ).subscribe((notify: boolean) => {
if (notify) { if (notify) {
this.isLoading$.next(false);
this.navigateToNewPage(); this.navigateToNewPage();
this.notificationsService.success(null, this.translate.get(this.type.value + '.create.notifications.success')); this.notificationsService.success(null, this.translate.get(this.type.value + '.create.notifications.success'));
} }