ui changes on description listing
This commit is contained in:
parent
fb715463d4
commit
2f718954eb
|
@ -114,6 +114,7 @@ public class DescriptionBuilder extends BaseBuilder<Description, DescriptionEnti
|
|||
for (DescriptionEntity d : data) {
|
||||
Description m = new Description();
|
||||
if (fields.hasField(this.asIndexer(Description._id))) m.setId(d.getId());
|
||||
if (fields.hasField(this.asIndexer(Description._tenantId))) m.setTenantId(d.getTenantId());
|
||||
if (fields.hasField(this.asIndexer(Description._label))) m.setLabel(d.getLabel());
|
||||
if (fields.hasField(this.asIndexer(Description._status))) m.setStatus(d.getStatus());
|
||||
if (fields.hasField(this.asIndexer(Description._description))) m.setDescription(d.getDescription());
|
||||
|
|
|
@ -18,6 +18,10 @@ public class Description {
|
|||
|
||||
public static final String _id = "id";
|
||||
|
||||
private UUID tenantId;
|
||||
|
||||
public static final String _tenantId = "tenantId";
|
||||
|
||||
private String label;
|
||||
|
||||
public static final String _label = "label";
|
||||
|
@ -93,6 +97,11 @@ public class Description {
|
|||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public UUID getTenantId() { return tenantId; }
|
||||
|
||||
public void setTenantId(UUID tenantId) { this.tenantId = tenantId; }
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
|
|
@ -160,5 +160,6 @@ export interface UpdateDescriptionTemplatePersist {
|
|||
}
|
||||
|
||||
export interface BaseDescription extends BaseEntity {
|
||||
tenantId?: Guid;
|
||||
status?: DescriptionStatus;
|
||||
}
|
||||
|
|
|
@ -457,6 +457,7 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
|
|||
private get _lookupFields(): string[] {
|
||||
return [
|
||||
nameof<Description>(x => x.id),
|
||||
nameof<Description>(x => x.tenantId),
|
||||
nameof<Description>(x => x.label),
|
||||
nameof<Description>(x => x.status),
|
||||
nameof<Description>(x => x.updatedAt),
|
||||
|
|
|
@ -2,8 +2,16 @@
|
|||
<a [routerLink]="getItemLink()" class="pointer">
|
||||
<div class="d-flex flex-direction-row">
|
||||
<div class="col-auto description-label">{{'DESCRIPTION-LISTING.DESCRIPTION' | translate}}</div>
|
||||
<div *ngIf="!isPublic" class="col-auto ml-auto edited-date">{{'DESCRIPTION-LISTING.STATES.EDITED' | translate}}: {{description.updatedAt | dateTimeFormatter: "d MMMM y"}}</div>
|
||||
<div *ngIf="isPublic" class="col-auto ml-auto edited-date">{{'DESCRIPTION-LISTING.STATES.PUBLISHED' | translate}}: {{description.plan?.finalizedAt | dateTimeFormatter: "d MMMM y"}}</div>
|
||||
<div class="col-auto ml-auto">
|
||||
<div class="row align-items-center">
|
||||
<ng-container *ngIf="description.tenantId">
|
||||
<div class="col-auto edited-date">{{getTenantName(description.tenantId)}}</div>
|
||||
<div class="col-auto edited-date p-0 mb-2" style="font-weight: 700;">.</div>
|
||||
</ng-container>
|
||||
<div *ngIf="!isPublic" class="col-auto edited-date">{{'DESCRIPTION-LISTING.STATES.EDITED' | translate}}: {{description.updatedAt | dateTimeFormatter: "d MMMM y"}}</div>
|
||||
<div *ngIf="isPublic" class="col-auto edited-date">{{'DESCRIPTION-LISTING.STATES.PUBLISHED' | translate}}: {{description.plan?.finalizedAt | dateTimeFormatter: "d MMMM y"}}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="description.status === descriptionStatusEnum.Finalized" class="col-auto description-title">{{description.label}}</div>
|
||||
<div *ngIf="description.status === descriptionStatusEnum.Draft" class="col-auto description-title-draft">{{description.label}}</div>
|
||||
|
@ -11,8 +19,9 @@
|
|||
<span *ngIf="isUserPlanRelated()" class="col-auto">{{ enumUtils.toPlanUserRolesString(planService.getCurrentUserRolesInPlan(description?.plan?.planUsers)) }}</span>
|
||||
<span *ngIf="isUserPlanRelated()">.</span>
|
||||
<span class="col-auto" *ngIf="description.status === descriptionStatusEnum.Finalized && description.plan.accessType === planAccessTypeEnum.Public"><span class="material-icons icon-align">public</span>{{'DESCRIPTION-LISTING.STATES.PUBLIC' | translate}}</span>
|
||||
<span *ngIf="description.status === descriptionStatusEnum.Finalized && description.plan.accessType != planAccessTypeEnum.Public" class="col-auto"><span class="material-icons icon-align">done</span>{{ enumUtils.toDescriptionStatusString(description.status) }}</span>
|
||||
<span *ngIf="description.status === descriptionStatusEnum.Draft" class=" col-auto draft"><span class="material-icons icon-align">create</span>{{ enumUtils.toDescriptionStatusString(description.status) }}</span>
|
||||
<span *ngIf="description.status === descriptionStatusEnum.Finalized && description.plan.accessType != planAccessTypeEnum.Public; else draft" class="col-auto"><span class="material-icons icon-align">done</span>{{ enumUtils.toDescriptionStatusString(description.status) }}</span>
|
||||
<ng-template #draft><span *ngIf="description.status === descriptionStatusEnum.Draft && canEditDescription(); else preview" class=" col-auto draft"><span class="material-icons icon-align">create</span>{{ enumUtils.toDescriptionStatusString(description.status) }}</span></ng-template>
|
||||
<ng-template #preview><span *ngIf="description.status === descriptionStatusEnum.Draft && !canEditDescription()" class=" col-auto draft"><span class="material-icons-outlined mr-1 icon-align">visibility</span>{{ enumUtils.toDescriptionStatusString(description.status) }}</span></ng-template>
|
||||
<span>.</span>
|
||||
<span class="col">{{'DESCRIPTION-LISTING.GRANT' | translate}}: {{referenceService.getReferencesForTypesFirstSafe(description?.plan?.planReferences, [this.referenceTypeService.getGrantReferenceType()])?.reference?.label}}</span>
|
||||
</div>
|
||||
|
|
|
@ -29,6 +29,11 @@ import { FileTransformerEntityType } from '@app/core/common/enum/file-transforme
|
|||
import { AnalyticsService } from '@app/core/services/matomo/analytics-service';
|
||||
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
||||
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
|
||||
import { Tenant } from '@app/core/model/tenant/tenant';
|
||||
import { PrincipalService } from '@app/core/services/http/principal.service';
|
||||
import { Observable } from 'rxjs';
|
||||
import { BaseHttpParams } from '@common/http/base-http-params';
|
||||
import { InterceptorType } from '@common/http/interceptors/interceptor-type';
|
||||
|
||||
@Component({
|
||||
selector: 'app-description-listing-item-component',
|
||||
|
@ -51,11 +56,12 @@ export class DescriptionListingItemComponent extends BaseComponent implements On
|
|||
canDelete: boolean = false;
|
||||
canEdit: boolean = false;
|
||||
canInvitePlanUsers: boolean = false;
|
||||
|
||||
tenants: Tenant[] = [];
|
||||
|
||||
constructor(
|
||||
public routerUtils: RouterUtilsService,
|
||||
private router: Router,
|
||||
private authentication: AuthService,
|
||||
public enumUtils: EnumUtils,
|
||||
private descriptionService: DescriptionService,
|
||||
public dialog: MatDialog,
|
||||
|
@ -71,7 +77,8 @@ export class DescriptionListingItemComponent extends BaseComponent implements On
|
|||
public fileTransformerService: FileTransformerService,
|
||||
private fb: UntypedFormBuilder,
|
||||
private analyticsService: AnalyticsService,
|
||||
private httpErrorHandlingService: HttpErrorHandlingService
|
||||
private httpErrorHandlingService: HttpErrorHandlingService,
|
||||
private principalService: PrincipalService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
@ -99,6 +106,13 @@ export class DescriptionListingItemComponent extends BaseComponent implements On
|
|||
this.canInvitePlanUsers = (this.authService.hasPermission(AppPermission.InvitePlanUsers) ||
|
||||
this.description.authorizationFlags?.some(x => x === AppPermission.InvitePlanUsers)) && this.description.belongsToCurrentTenant != false;
|
||||
|
||||
this.loadUserTenants().pipe(takeUntil(this._destroyed)).subscribe( tenants => {
|
||||
this.tenants = tenants;
|
||||
});
|
||||
}
|
||||
|
||||
public getTenantName(id: Guid): string {
|
||||
return this.tenants?.find(t => t?.id == id)?.name;
|
||||
}
|
||||
|
||||
setIsUserOwner() {
|
||||
|
@ -230,4 +244,16 @@ export class DescriptionListingItemComponent extends BaseComponent implements On
|
|||
onDeleteCallbackError(error) {
|
||||
this.uiNotificationService.snackBarNotification(error.error.message ? error.error.message : this.language.instant('GENERAL.SNACK-BAR.UNSUCCESSFUL-DELETE'), SnackBarNotificationLevel.Error);
|
||||
}
|
||||
|
||||
canEditDescription(): boolean {
|
||||
return (this.isDraft) && (this.description.authorizationFlags?.some(x => x === AppPermission.EditDescription) || this.authentication.hasPermission(AppPermission.EditDescription)) && this.isPublic == false && this.description.belongsToCurrentTenant != false;
|
||||
}
|
||||
|
||||
loadUserTenants(): Observable<Array<Tenant>> {
|
||||
const params = new BaseHttpParams();
|
||||
params.interceptorContext = {
|
||||
excludedInterceptors: [InterceptorType.TenantHeaderInterceptor]
|
||||
};
|
||||
return this.principalService.myTenants({ params: params });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<span *ngIf="plan.status === planStatusEnum.Draft && canEditPlan(); else preview" class=" col-auto draft"><span class="material-icons icon-align">create</span>{{ enumUtils.toPlanStatusString(plan.status) }}</span>
|
||||
</ng-template>
|
||||
<ng-template #preview>
|
||||
<span *ngIf="plan.status === planStatusEnum.Draft && !canEditPlan()" class=" col-auto draft"><span class="material-icons-outlined icon-align">visibility</span>{{ enumUtils.toPlanStatusString(plan.status) }}</span>
|
||||
<span *ngIf="plan.status === planStatusEnum.Draft && !canEditPlan()" class=" col-auto draft"><span class="material-icons-outlined mr-1 icon-align">visibility</span>{{ enumUtils.toPlanStatusString(plan.status) }}</span>
|
||||
</ng-template>
|
||||
<span>.</span>
|
||||
<span class="col-auto">{{'PLAN-LISTING.VERSION' | translate}} {{plan.version}}</span>
|
||||
|
|
|
@ -95,7 +95,6 @@ export class PlanListingItemComponent extends BaseComponent implements OnInit {
|
|||
if (this.plan.status === PlanStatus.Finalized && this.plan.accessType === PlanAccessType.Public) { this.isPublished = true }
|
||||
}
|
||||
|
||||
|
||||
this.loadUserTenants().pipe(takeUntil(this._destroyed)).subscribe( tenants => {
|
||||
this.tenants = tenants;
|
||||
});
|
||||
|
@ -287,5 +286,4 @@ export class PlanListingItemComponent extends BaseComponent implements OnInit {
|
|||
};
|
||||
return this.principalService.myTenants({ params: params });
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue