tenant user listing > remove tenantUserSubquery from lookup, instead add it to query during loadListing, small ui fixes

This commit is contained in:
mchouliara 2024-09-10 15:02:07 +03:00
parent 26f8c9014e
commit e4af1c1458
3 changed files with 17 additions and 15 deletions

View File

@ -132,8 +132,10 @@
</div>
</div>
</div>
<div class="row d-flex gap-half-rem">
<button mat-button class="rounded-btn secondary" type="button" (click)="addField()" [disabled]="formGroup.disabled">{{'PREFILLING-SOURCE-EDITOR.ACTIONS.ADD-FIELD' | translate}}</button>
<button mat-button class="rounded-btn secondary" *ngIf="formGroup.get('definition').get('fields').value != ''" type="button" (click)="submitFields()" [disabled]="!formGroup.get('definition').get('fields').valid">{{'PREFILLING-SOURCE-EDITOR.ACTIONS.SUBMIT-FIELDS' | translate}}</button>
</div>
</div>
</mat-card-content>
</mat-card>

View File

@ -24,7 +24,6 @@ import * as FileSaver from 'file-saver';
import { Observable } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof';
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
import { UserInviteToTenantDialogComponent } from './user-invite-to-tenant-dialog/user-invite-to-tenant-dialog.component';
import { AppPermission } from '@app/core/common/enum/permission.enum';
import { TenantUserLookup } from '@app/core/query/tenant-user.lookup';
@ -100,13 +99,6 @@ export class UserListingComponent extends BaseListingComponent<User, UserLookup>
lookup.order = { items: [this.toDescSortField(nameof<User>(x => x.createdAt))] };
this.updateOrderUiFields(lookup.order);
const tenantUserLookup: TenantUserLookup = new TenantUserLookup();
if (this.authService.getSelectedTenantId() != null && this.isTenantAdminMode && this.authService.hasPermission(AppPermission.ViewTenantUserPage)){
tenantUserLookup.tenantIds = [this.authService.getSelectedTenantId()];
tenantUserLookup.isActive = [IsActive.Active]
lookup.tenantUserSubQuery = tenantUserLookup;
}
lookup.project = {
fields: this.lookupFields
};
@ -177,7 +169,15 @@ export class UserListingComponent extends BaseListingComponent<User, UserLookup>
}
protected loadListing(): Observable<QueryResult<User>> {
return this.userService.query(this.lookup);
let lookup = this.lookup;
//TenantUserSubquery removed from lookup and added here so it is not part of the url params > removes bug of wrong tenantId in the subQuery when changing tenant
if (this.authService.getSelectedTenantId() != null && this.isTenantAdminMode && this.authService.hasPermission(AppPermission.ViewTenantUserPage)){
const tenantUserLookup: TenantUserLookup = new TenantUserLookup();
tenantUserLookup.tenantIds = [this.authService.getSelectedTenantId()];
tenantUserLookup.isActive = [IsActive.Active];
lookup = {...this.lookup, tenantUserSubQuery: tenantUserLookup}
}
return this.userService.query(lookup);
}
public deleteType(id: Guid) {

View File

@ -20,7 +20,7 @@
</div>
<!-- Description field -->
<div class="row">
<div class="col-12 pb-4">
<div class="col-12 pb-2">
<div class="heading">{{'PLAN-CLONE-DIALOG.FIELDS.DESCRIPTION' | translate}}</div>
</div>
<div class="col-12 hint">{{'PLAN-CLONE-DIALOG.FIELDS.DESCRIPTION-HINT' | translate}}</div>
@ -30,11 +30,11 @@
</div>
</div>
<div class="row">
<div class="col-12">
<div class="col-12 pt-3 pb-2">
<div class="heading">{{'PLAN-CLONE-DIALOG.FIELDS.DESCRIPTIONS' | translate}}</div>
</div>
<div class="col-12" *ngIf="hasDescriptions()">
<h5>{{'PLAN-CLONE-DIALOG.FIELDS.DESCRIPTIONS-HINT' | translate}}</h5>
<div class="col-12 hint" *ngIf="hasDescriptions()">
{{'PLAN-CLONE-DIALOG.FIELDS.DESCRIPTIONS-HINT' | translate}}
</div>
<div class="col-12" *ngIf="hasDescriptions()">
<mat-card class="mat-card">