Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import { Observable } from 'rxjs';
import { Injectable, inject } from '@angular/core';
import { ActivatedRouteSnapshot, Resolve } from '@angular/router';

import { take } from 'rxjs/operators';
import { take, tap } from 'rxjs/operators';

import { DotApp } from '@dotcms/dotcms-models';
import { GlobalStore } from '@dotcms/store';

import { DotAppsService } from '../../../api/services/dot-apps/dot-apps.service';

Expand All @@ -19,10 +20,20 @@ import { DotAppsService } from '../../../api/services/dot-apps/dot-apps.service'
@Injectable()
export class DotAppsConfigurationResolver implements Resolve<Observable<DotApp>> {
private dotAppsService = inject(DotAppsService);
readonly #globalStore = inject(GlobalStore);

resolve(route: ActivatedRouteSnapshot): Observable<DotApp> {
const appsKey = route.paramMap.get('appKey');

return this.dotAppsService.getConfigurationList(appsKey).pipe(take(1));
return this.dotAppsService.getConfigurationList(appsKey).pipe(
take(1),
tap((apps) => {
this.#globalStore.addNewBreadcrumb({
label: apps.name,
target: '_self',
url: `/dotAdmin/#/apps/${apps.key}`
});
})
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { HttpErrorResponse } from '@angular/common/http';
import { Injectable, inject } from '@angular/core';
import { ActivatedRouteSnapshot, Resolve } from '@angular/router';

import { catchError, map, take } from 'rxjs/operators';
import { catchError, map, take, tap } from 'rxjs/operators';

import {
DotContentTypesInfoService,
Expand All @@ -15,6 +15,7 @@ import {
} from '@dotcms/data-access';
import { LoginService } from '@dotcms/dotcms-js';
import { DotCMSContentType } from '@dotcms/dotcms-models';
import { GlobalStore } from '@dotcms/store';

/**
* With the url return a content type by id or a default content type
Expand All @@ -30,14 +31,31 @@ export class DotContentTypeEditResolver implements Resolve<DotCMSContentType> {
private dotHttpErrorManagerService = inject(DotHttpErrorManagerService);
private dotRouterService = inject(DotRouterService);
private loginService = inject(LoginService);
readonly #globalStore = inject(GlobalStore);

resolve(route: ActivatedRouteSnapshot): Observable<DotCMSContentType> {
if (route.paramMap.get('id')) {
return this.getContentType(route.paramMap.get('id'));
return this.getContentType(route.paramMap.get('id')).pipe(
tap((contentType) => {
this.#globalStore.addNewBreadcrumb({
label: contentType.name,
target: '_self',
url: `/dotAdmin/#/content-types-angular/edit/${contentType.id}`
});
})
);
} else {
const contentType = this.getFilterByParam(route) || route.paramMap.get('type');

return this.getDefaultContentType(contentType);
return this.getDefaultContentType(contentType).pipe(
tap((contentType) => {
this.#globalStore.addNewBreadcrumb({
label: contentType.name,
target: '_self',
url: `/dotAdmin/#/content-types-angular/create/${contentType.variable}`
});
})
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@if (lastBreadcrumb) {
<div
data-testid="breadcrumb-title"
class="text-black text-2xl font-extrabold tracking-tight leading-tight">
class="text-black text-2xl font-extrabold tracking-tight leading-tight truncate-text">
{{ lastBreadcrumb }}
</div>
}
Expand Down
Loading