ui changes on dmp listing
This commit is contained in:
parent
986d83df49
commit
fb715463d4
|
@ -118,6 +118,7 @@ public class PlanBuilder extends BaseBuilder<Plan, PlanEntity> {
|
|||
for (PlanEntity d : data) {
|
||||
Plan m = new Plan();
|
||||
if (fields.hasField(this.asIndexer(Plan._id))) m.setId(d.getId());
|
||||
if (fields.hasField(this.asIndexer(Plan._tenantId))) m.setTenantId(d.getTenantId());
|
||||
if (fields.hasField(this.asIndexer(Plan._label))) m.setLabel(d.getLabel());
|
||||
if (fields.hasField(this.asIndexer(Plan._version))) m.setVersion(d.getVersion());
|
||||
if (fields.hasField(this.asIndexer(Plan._status))) m.setStatus(d.getStatus());
|
||||
|
|
|
@ -19,6 +19,9 @@ public class Plan {
|
|||
private UUID id;
|
||||
public static final String _id = "id";
|
||||
|
||||
private UUID tenantId;
|
||||
public static final String _tenantId = "tenantId";
|
||||
|
||||
private String label;
|
||||
public static final String _label = "label";
|
||||
|
||||
|
@ -102,9 +105,11 @@ public class Plan {
|
|||
return id;
|
||||
}
|
||||
|
||||
public void setId(UUID id) {
|
||||
this.id = id;
|
||||
}
|
||||
public void setId(UUID id) { this.id = id; }
|
||||
|
||||
public UUID getTenantId() { return tenantId; }
|
||||
|
||||
public void setTenantId(UUID tenantId) { this.tenantId = tenantId; }
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
|
|
|
@ -220,6 +220,7 @@ export interface PublicEntityDoi {
|
|||
}
|
||||
|
||||
export interface BasePlan extends BaseEntity {
|
||||
tenantId?: Guid;
|
||||
status?: PlanStatus;
|
||||
descriptions?: BaseDescription[];
|
||||
}
|
||||
|
|
|
@ -2,16 +2,29 @@
|
|||
<a [routerLink]="isPublic ? this.routerUtils.generateUrl(['/explore-plans/overview/public/', plan.id]) : this.routerUtils.generateUrl(['/plans/overview/', plan.id])" class="pointer">
|
||||
<div class="d-flex flex-direction-row">
|
||||
<div class="col-auto plan-label">{{ 'PLAN-LISTING.PLAN' | translate }}</div>
|
||||
<div *ngIf="!isPublic" class="col-auto ml-auto edited-date">{{ 'PLAN-LISTING.EDITED' | translate }}: {{ plan.updatedAt | dateTimeFormatter: "d MMMM y" }}</div>
|
||||
<div *ngIf="isPublic" class="col-auto ml-auto edited-date">{{ 'PLAN-LISTING.PUBLISHED' | translate }}: {{ plan.finalizedAt | dateTimeFormatter: "d MMMM y" }}</div>
|
||||
<div class="col-auto ml-auto">
|
||||
<div class="row align-items-center">
|
||||
<ng-container *ngIf="plan.tenantId">
|
||||
<div class="col-auto edited-date">{{getTenantName(plan.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">{{ 'PLAN-LISTING.EDITED' | translate }}: {{ plan.updatedAt | dateTimeFormatter: "d MMMM y" }}</div>
|
||||
<div *ngIf="isPublic" class="col-auto edited-date">{{ 'PLAN-LISTING.PUBLISHED' | translate }}: {{ plan.finalizedAt | dateTimeFormatter: "d MMMM y" }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto" [ngClass]="{'plan-title': !isDraft, 'plan-title-draft': isDraft}">{{plan.label}}</div>
|
||||
<div class="plan-subtitle">
|
||||
<span *ngIf="isUserPlanRelated()" class="col-auto">{{ enumUtils.toPlanUserRolesString(planService.getCurrentUserRolesInPlan(plan?.planUsers)) }}</span>
|
||||
<span *ngIf="isUserPlanRelated()">.</span>
|
||||
<span class="col-auto" *ngIf="plan.status === planStatusEnum.Finalized && isPublic"><span class="material-icons icon-align">public</span>{{'TYPES.PLAN-VISIBILITY.PUBLIC' | translate}}</span>
|
||||
<span *ngIf="plan.status === planStatusEnum.Finalized && !isPublic" class="col-auto"><span class="material-icons icon-align">done</span>{{ enumUtils.toPlanStatusString(plan.status) }}</span>
|
||||
<span *ngIf="plan.status === planStatusEnum.Draft" class=" col-auto draft"><span class="material-icons icon-align">create</span>{{ enumUtils.toPlanStatusString(plan.status) }}</span>
|
||||
<span *ngIf="plan.status === planStatusEnum.Finalized && !isPublic; else draft" class="col-auto"><span class="material-icons icon-align">done</span>{{ enumUtils.toPlanStatusString(plan.status) }}</span>
|
||||
<ng-template #draft>
|
||||
<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>
|
||||
</ng-template>
|
||||
<span>.</span>
|
||||
<span class="col-auto">{{'PLAN-LISTING.VERSION' | translate}} {{plan.version}}</span>
|
||||
<span>.</span>
|
||||
|
|
|
@ -31,6 +31,12 @@ import { PlanDeleteDialogComponent } from '../../plan-delete-dialog/plan-delete-
|
|||
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 { Observable } from 'rxjs';
|
||||
import { Tenant } from '@app/core/model/tenant/tenant';
|
||||
import { InterceptorType } from '@common/http/interceptors/interceptor-type';
|
||||
import { BaseHttpParams } from '@common/http/base-http-params';
|
||||
import { TenantHandlingService } from '@app/core/services/tenant/tenant-handling.service';
|
||||
import { PrincipalService } from '@app/core/services/http/principal.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-plan-listing-item-component',
|
||||
|
@ -49,6 +55,7 @@ export class PlanListingItemComponent extends BaseComponent implements OnInit {
|
|||
isPublished: boolean;
|
||||
planStatusEnum = PlanStatus;
|
||||
fileTransformerEntityTypeEnum = FileTransformerEntityType;
|
||||
tenants: Tenant[] = [];
|
||||
|
||||
constructor(
|
||||
public routerUtils: RouterUtilsService,
|
||||
|
@ -69,6 +76,7 @@ export class PlanListingItemComponent extends BaseComponent implements OnInit {
|
|||
private fileUtils: FileUtils,
|
||||
private analyticsService: AnalyticsService,
|
||||
private httpErrorHandlingService: HttpErrorHandlingService,
|
||||
private principalService: PrincipalService,
|
||||
) {
|
||||
super();
|
||||
}
|
||||
|
@ -86,12 +94,22 @@ export class PlanListingItemComponent extends BaseComponent implements OnInit {
|
|||
this.isPublished = false;
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
||||
public isAuthenticated(): boolean {
|
||||
return this.authentication.currentAccountIsAuthenticated();
|
||||
}
|
||||
|
||||
|
||||
public getTenantName(id: Guid): string {
|
||||
return this.tenants?.find(t => t?.id == id)?.name;
|
||||
}
|
||||
|
||||
inviteToPlan() {
|
||||
const dialogRef = this.dialog.open(PlanInvitationDialogComponent, {
|
||||
// height: '250px',
|
||||
|
@ -231,7 +249,7 @@ export class PlanListingItemComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
canEditPlan(): boolean {
|
||||
return (this.plan.authorizationFlags?.some(x => x === AppPermission.EditPlan) || this.authentication.hasPermission(AppPermission.EditPlan)) && this.isPublic == false && this.plan.belongsToCurrentTenant != false;
|
||||
return (this.isDraft) && (this.plan.authorizationFlags?.some(x => x === AppPermission.EditPlan) || this.authentication.hasPermission(AppPermission.EditPlan)) && this.isPublic == false && this.plan.belongsToCurrentTenant != false;
|
||||
}
|
||||
|
||||
canCreateNewVersion(): boolean {
|
||||
|
@ -261,4 +279,13 @@ export class PlanListingItemComponent extends BaseComponent implements OnInit {
|
|||
canAssignPlanUsers(): boolean {
|
||||
return (this.plan.authorizationFlags?.some(x => x === AppPermission.AssignPlanUsers) || this.authentication.hasPermission(AppPermission.AssignPlanUsers)) && this.isPublic == false && this.plan.belongsToCurrentTenant != false;
|
||||
}
|
||||
|
||||
loadUserTenants(): Observable<Array<Tenant>> {
|
||||
const params = new BaseHttpParams();
|
||||
params.interceptorContext = {
|
||||
excludedInterceptors: [InterceptorType.TenantHeaderInterceptor]
|
||||
};
|
||||
return this.principalService.myTenants({ params: params });
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -437,6 +437,7 @@ export class PlanListingComponent extends BaseListingComponent<BasePlan, PlanLoo
|
|||
nameof<Plan>(x => x.belongsToCurrentTenant),
|
||||
nameof<Plan>(x => x.finalizedAt),
|
||||
nameof<Plan>(x => x.hash),
|
||||
nameof<Plan>(x => x.tenantId),
|
||||
[nameof<Plan>(x => x.authorizationFlags), AppPermission.CreateNewVersionPlan].join('.'),
|
||||
[nameof<Plan>(x => x.authorizationFlags), AppPermission.DeletePlan].join('.'),
|
||||
[nameof<Plan>(x => x.authorizationFlags), AppPermission.ClonePlan].join('.'),
|
||||
|
|
|
@ -30,7 +30,7 @@ export class TenantSwitchComponent extends BaseComponent implements OnInit {
|
|||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.tenants = this.loadUserTenants(); //TODO
|
||||
this.tenants = this.loadUserTenants();
|
||||
}
|
||||
|
||||
loadUserTenants(): Observable<Array<Tenant>> {
|
||||
|
|
Loading…
Reference in New Issue