fix routerLinks for multi tenancy
This commit is contained in:
parent
00d55e470f
commit
5c24018d12
@ -21,6 +21,7 @@ import { CircleButtonComponent, IconButtonComponent } from '../buttons';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { EmptyStateComponent } from '../empty-state';
|
||||
import { InputWithActionComponent, RoundCheckboxComponent } from '../inputs';
|
||||
import { TenantPipe } from '../tenants/tenant.pipe';
|
||||
|
||||
const matModules = [MatTooltipModule, MatIconModule];
|
||||
const components = [
|
||||
@ -50,6 +51,7 @@ const modules = [DragDropModule, TranslateModule, IqserFiltersModule, ScrollingM
|
||||
RoundCheckboxComponent,
|
||||
InputWithActionComponent,
|
||||
SyncWidthDirective,
|
||||
TenantPipe,
|
||||
],
|
||||
})
|
||||
export class IqserListingModule {}
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
[class.help-mode]="helpModeService?.isHelpModeActive$ | async"
|
||||
[id]="'item-' + entity.id"
|
||||
[ngClass]="getTableItemClasses(entity)"
|
||||
[routerLink]="entity.routerLink"
|
||||
[routerLink]="entity.routerLink | tenant"
|
||||
>
|
||||
<iqser-table-item
|
||||
(click)="multiSelect(entity, $event)"
|
||||
@ -31,7 +31,7 @@
|
||||
[class.help-mode]="helpModeService?.isHelpModeActive$ | async"
|
||||
[id]="'item-' + entity.id"
|
||||
[ngClass]="getTableItemClasses(entity)"
|
||||
[routerLink]="entity.routerLink"
|
||||
[routerLink]="entity.routerLink | tenant"
|
||||
>
|
||||
<iqser-table-item
|
||||
(click)="multiSelect(entity, $event)"
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
export * from './services';
|
||||
export * from './tenant.pipe';
|
||||
export * from './tenants.module';
|
||||
export * from './tenant-resolve/tenant-resolve.component';
|
||||
|
||||
16
src/lib/tenants/tenant.pipe.ts
Normal file
16
src/lib/tenants/tenant.pipe.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { inject, Pipe, PipeTransform } from '@angular/core';
|
||||
import { TenantContextHolder } from './services';
|
||||
|
||||
@Pipe({
|
||||
name: 'tenant',
|
||||
pure: true,
|
||||
standalone: true,
|
||||
})
|
||||
export class TenantPipe implements PipeTransform {
|
||||
readonly #tenant = inject(TenantContextHolder);
|
||||
|
||||
transform(value: string | string[]): string {
|
||||
const _value = Array.isArray(value) ? value.join('/') : value;
|
||||
return '/' + this.#tenant.currentTenant + _value;
|
||||
}
|
||||
}
|
||||
@ -12,6 +12,8 @@ export const BASE_HREF = new InjectionToken<string>('BASE_HREF', {
|
||||
return baseUrl.substring(0, baseUrl.length - 1);
|
||||
}
|
||||
|
||||
console.log('Base URL:', baseUrl);
|
||||
|
||||
return baseUrl;
|
||||
},
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user