[CST-11179] Fixed breadcrumb & refresh & labels & redirection from /full page

This commit is contained in:
Mykhaylo
2023-10-30 12:28:40 +01:00
parent ac7cf5b4ba
commit 1a525dfbe7
4 changed files with 29 additions and 16 deletions

View File

@@ -48,6 +48,12 @@ import { DSOEditMenuResolver } from '../shared/dso-page/dso-edit-menu.resolver';
.then((m) => m.CorrectionSuggestionModule), .then((m) => m.CorrectionSuggestionModule),
canActivate: [AuthenticatedGuard] canActivate: [AuthenticatedGuard]
}, },
{
path: `full/${CORRECTION_TYPE_PATH}` ,
loadChildren: () => import('../shared/correction-suggestion/correction-suggestion.module')
.then((m) => m.CorrectionSuggestionModule),
canActivate: [AuthenticatedGuard]
},
{ {
path: ITEM_EDIT_PATH, path: ITEM_EDIT_PATH,
loadChildren: () => import('./edit-item-page/edit-item-page.module') loadChildren: () => import('./edit-item-page/edit-item-page.module')

View File

@@ -1,15 +1,16 @@
import { ItemBreadcrumbResolver } from './../../core/breadcrumbs/item-breadcrumb.resolver';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router'; import { RouterModule, Routes } from '@angular/router';
import { CorrectionSuggestionComponent } from './correction-suggestion.component'; import { CorrectionSuggestionComponent } from './correction-suggestion.component';
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
const routes: Routes = [ const routes: Routes = [
{ {
path: ':correctionType', path: ':correctionType',
component: CorrectionSuggestionComponent, component: CorrectionSuggestionComponent,
resolve: { resolve: {
breadcrumb: ItemBreadcrumbResolver, breadcrumb: I18nBreadcrumbResolver
} },
data: { title: 'item-correction-suggestion.correction-type', breadcrumbKey: 'item-correction-suggestion.correction-type' },
} }
]; ];
@@ -17,7 +18,7 @@ const routes: Routes = [
imports: [RouterModule.forChild(routes)], imports: [RouterModule.forChild(routes)],
exports: [RouterModule], exports: [RouterModule],
providers: [ providers: [
ItemBreadcrumbResolver I18nBreadcrumbResolver
] ]
}) })
export class CorrectionSuggestionRoutingModule { } export class CorrectionSuggestionRoutingModule { }

View File

@@ -1,6 +1,6 @@
import { getRemoteDataPayload } from './../../core/shared/operators'; import { getRemoteDataPayload } from './../../core/shared/operators';
import { CorrectionTypeDataService } from './../../core/submission/correctiontype-data.service'; import { CorrectionTypeDataService } from './../../core/submission/correctiontype-data.service';
import { Component, ComponentFactoryResolver, Injector, OnInit } from '@angular/core'; import { ChangeDetectorRef, Component, ComponentFactoryResolver, Injector, OnInit } from '@angular/core';
import { CorrectionType } from '../../core/submission/models/correction-type-mode.model'; import { CorrectionType } from '../../core/submission/models/correction-type-mode.model';
import { GenericConstructor } from '../../core/shared/generic-constructor'; import { GenericConstructor } from '../../core/shared/generic-constructor';
import { getCorrectionComponent } from './correction-suggestion-page.decorator'; import { getCorrectionComponent } from './correction-suggestion-page.decorator';
@@ -40,6 +40,7 @@ export class CorrectionSuggestionComponent implements OnInit {
private aroute: ActivatedRoute, private aroute: ActivatedRoute,
private correctionTypeDataService: CorrectionTypeDataService, private correctionTypeDataService: CorrectionTypeDataService,
private injector: Injector, private injector: Injector,
private chd: ChangeDetectorRef,
) { ) {
this.correctionTypeId = this.aroute.snapshot.params.correctionType; this.correctionTypeId = this.aroute.snapshot.params.correctionType;
} }
@@ -65,6 +66,7 @@ export class CorrectionSuggestionComponent implements OnInit {
this.creationForm = correctionType.creationForm; this.creationForm = correctionType.creationForm;
this.componentFactoryResolver.resolveComponentFactory(this.getComponent()); this.componentFactoryResolver.resolveComponentFactory(this.getComponent());
this.injectData(); this.injectData();
this.chd.detectChanges();
} }
}); });
} }

View File

@@ -55,12 +55,11 @@ export class ManageRelationCorrectionTypeComponent implements OnInit, OnDestroy
/** /**
* Pagination options * Pagination options
*/ */
pagination: PaginationComponentOptions; pagination: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
id: 'csmr',
/** pageSize: 3,
* The number of results per page currentPage: 1
*/ });
pageSize = 3;
/** /**
* Entities to show in the list * Entities to show in the list
@@ -125,7 +124,7 @@ export class ManageRelationCorrectionTypeComponent implements OnInit, OnDestroy
private itemService: ItemDataService, private itemService: ItemDataService,
private notificationsService: NotificationsService, private notificationsService: NotificationsService,
private router: Router, private router: Router,
private translateService: TranslateService private translateService: TranslateService,
) { ) {
this.correctionType = correctionTypeObject; this.correctionType = correctionTypeObject;
this.itemUuid = this.aroute.snapshot.params.id; this.itemUuid = this.aroute.snapshot.params.id;
@@ -135,7 +134,6 @@ export class ManageRelationCorrectionTypeComponent implements OnInit, OnDestroy
* Get the search results * Get the search results
*/ */
ngOnInit(): void { ngOnInit(): void {
this.pagination = Object.assign(new PaginationComponentOptions(), { id: 'correction-suggestion-manage-relation', pageSize: this.pageSize });
this.searchOptions = Object.assign(new PaginatedSearchOptions( this.searchOptions = Object.assign(new PaginatedSearchOptions(
{ {
configuration: this.correctionType.discoveryConfiguration, configuration: this.correctionType.discoveryConfiguration,
@@ -146,8 +144,12 @@ export class ManageRelationCorrectionTypeComponent implements OnInit, OnDestroy
this.localEntitiesRD$ = this.searchService.search(this.searchOptions); this.localEntitiesRD$ = this.searchService.search(this.searchOptions);
this.subs.push( this.subs.push(
this.localEntitiesRD$.subscribe( this.localEntitiesRD$.pipe(
() => this.isLoading$ = observableOf(false) getFirstCompletedRemoteData(),
).subscribe(
() => {
this.isLoading$ = observableOf(false);
}
) )
); );
} }
@@ -169,7 +171,9 @@ export class ManageRelationCorrectionTypeComponent implements OnInit, OnDestroy
)); ));
this.localEntitiesRD$ = this.searchService.search(this.searchOptions); this.localEntitiesRD$ = this.searchService.search(this.searchOptions);
this.subs.push( this.subs.push(
this.localEntitiesRD$.subscribe( this.localEntitiesRD$.pipe(
getFirstCompletedRemoteData(),
).subscribe(
() => this.isLoading$ = observableOf(false) () => this.isLoading$ = observableOf(false)
) )
); );