[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),
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,
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 { RouterModule, Routes } from '@angular/router';
import { CorrectionSuggestionComponent } from './correction-suggestion.component';
import { I18nBreadcrumbResolver } from '../../core/breadcrumbs/i18n-breadcrumb.resolver';
const routes: Routes = [
{
path: ':correctionType',
component: CorrectionSuggestionComponent,
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)],
exports: [RouterModule],
providers: [
ItemBreadcrumbResolver
I18nBreadcrumbResolver
]
})
export class CorrectionSuggestionRoutingModule { }

View File

@@ -1,6 +1,6 @@
import { getRemoteDataPayload } from './../../core/shared/operators';
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 { GenericConstructor } from '../../core/shared/generic-constructor';
import { getCorrectionComponent } from './correction-suggestion-page.decorator';
@@ -40,6 +40,7 @@ export class CorrectionSuggestionComponent implements OnInit {
private aroute: ActivatedRoute,
private correctionTypeDataService: CorrectionTypeDataService,
private injector: Injector,
private chd: ChangeDetectorRef,
) {
this.correctionTypeId = this.aroute.snapshot.params.correctionType;
}
@@ -65,6 +66,7 @@ export class CorrectionSuggestionComponent implements OnInit {
this.creationForm = correctionType.creationForm;
this.componentFactoryResolver.resolveComponentFactory(this.getComponent());
this.injectData();
this.chd.detectChanges();
}
});
}

View File

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