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) {
|
for (PlanEntity d : data) {
|
||||||
Plan m = new Plan();
|
Plan m = new Plan();
|
||||||
if (fields.hasField(this.asIndexer(Plan._id))) m.setId(d.getId());
|
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._label))) m.setLabel(d.getLabel());
|
||||||
if (fields.hasField(this.asIndexer(Plan._version))) m.setVersion(d.getVersion());
|
if (fields.hasField(this.asIndexer(Plan._version))) m.setVersion(d.getVersion());
|
||||||
if (fields.hasField(this.asIndexer(Plan._status))) m.setStatus(d.getStatus());
|
if (fields.hasField(this.asIndexer(Plan._status))) m.setStatus(d.getStatus());
|
||||||
|
|
|
@ -19,6 +19,9 @@ public class Plan {
|
||||||
private UUID id;
|
private UUID id;
|
||||||
public static final String _id = "id";
|
public static final String _id = "id";
|
||||||
|
|
||||||
|
private UUID tenantId;
|
||||||
|
public static final String _tenantId = "tenantId";
|
||||||
|
|
||||||
private String label;
|
private String label;
|
||||||
public static final String _label = "label";
|
public static final String _label = "label";
|
||||||
|
|
||||||
|
@ -102,9 +105,11 @@ public class Plan {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(UUID id) {
|
public void setId(UUID id) { this.id = id; }
|
||||||
this.id = id;
|
|
||||||
}
|
public UUID getTenantId() { return tenantId; }
|
||||||
|
|
||||||
|
public void setTenantId(UUID tenantId) { this.tenantId = tenantId; }
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return label;
|
return label;
|
||||||
|
|
|
@ -220,6 +220,7 @@ export interface PublicEntityDoi {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface BasePlan extends BaseEntity {
|
export interface BasePlan extends BaseEntity {
|
||||||
|
tenantId?: Guid;
|
||||||
status?: PlanStatus;
|
status?: PlanStatus;
|
||||||
descriptions?: BaseDescription[];
|
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">
|
<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="d-flex flex-direction-row">
|
||||||
<div class="col-auto plan-label">{{ 'PLAN-LISTING.PLAN' | translate }}</div>
|
<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 class="col-auto ml-auto">
|
||||||
<div *ngIf="isPublic" class="col-auto ml-auto edited-date">{{ 'PLAN-LISTING.PUBLISHED' | translate }}: {{ plan.finalizedAt | dateTimeFormatter: "d MMMM y" }}</div>
|
<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>
|
||||||
<div class="col-auto" [ngClass]="{'plan-title': !isDraft, 'plan-title-draft': isDraft}">{{plan.label}}</div>
|
<div class="col-auto" [ngClass]="{'plan-title': !isDraft, 'plan-title-draft': isDraft}">{{plan.label}}</div>
|
||||||
<div class="plan-subtitle">
|
<div class="plan-subtitle">
|
||||||
<span *ngIf="isUserPlanRelated()" class="col-auto">{{ enumUtils.toPlanUserRolesString(planService.getCurrentUserRolesInPlan(plan?.planUsers)) }}</span>
|
<span *ngIf="isUserPlanRelated()" class="col-auto">{{ enumUtils.toPlanUserRolesString(planService.getCurrentUserRolesInPlan(plan?.planUsers)) }}</span>
|
||||||
<span *ngIf="isUserPlanRelated()">.</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 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.Finalized && !isPublic; else draft" 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>
|
<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>.</span>
|
||||||
<span class="col-auto">{{'PLAN-LISTING.VERSION' | translate}} {{plan.version}}</span>
|
<span class="col-auto">{{'PLAN-LISTING.VERSION' | translate}} {{plan.version}}</span>
|
||||||
<span>.</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 { AnalyticsService } from '@app/core/services/matomo/analytics-service';
|
||||||
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
import { HttpErrorHandlingService } from '@common/modules/errors/error-handling/http-error-handling.service';
|
||||||
import { RouterUtilsService } from '@app/core/services/router/router-utils.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({
|
@Component({
|
||||||
selector: 'app-plan-listing-item-component',
|
selector: 'app-plan-listing-item-component',
|
||||||
|
@ -49,6 +55,7 @@ export class PlanListingItemComponent extends BaseComponent implements OnInit {
|
||||||
isPublished: boolean;
|
isPublished: boolean;
|
||||||
planStatusEnum = PlanStatus;
|
planStatusEnum = PlanStatus;
|
||||||
fileTransformerEntityTypeEnum = FileTransformerEntityType;
|
fileTransformerEntityTypeEnum = FileTransformerEntityType;
|
||||||
|
tenants: Tenant[] = [];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public routerUtils: RouterUtilsService,
|
public routerUtils: RouterUtilsService,
|
||||||
|
@ -69,6 +76,7 @@ export class PlanListingItemComponent extends BaseComponent implements OnInit {
|
||||||
private fileUtils: FileUtils,
|
private fileUtils: FileUtils,
|
||||||
private analyticsService: AnalyticsService,
|
private analyticsService: AnalyticsService,
|
||||||
private httpErrorHandlingService: HttpErrorHandlingService,
|
private httpErrorHandlingService: HttpErrorHandlingService,
|
||||||
|
private principalService: PrincipalService,
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
@ -86,12 +94,22 @@ export class PlanListingItemComponent extends BaseComponent implements OnInit {
|
||||||
this.isPublished = false;
|
this.isPublished = false;
|
||||||
if (this.plan.status === PlanStatus.Finalized && this.plan.accessType === PlanAccessType.Public) { this.isPublished = true }
|
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 {
|
public isAuthenticated(): boolean {
|
||||||
return this.authentication.currentAccountIsAuthenticated();
|
return this.authentication.currentAccountIsAuthenticated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public getTenantName(id: Guid): string {
|
||||||
|
return this.tenants?.find(t => t?.id == id)?.name;
|
||||||
|
}
|
||||||
|
|
||||||
inviteToPlan() {
|
inviteToPlan() {
|
||||||
const dialogRef = this.dialog.open(PlanInvitationDialogComponent, {
|
const dialogRef = this.dialog.open(PlanInvitationDialogComponent, {
|
||||||
// height: '250px',
|
// height: '250px',
|
||||||
|
@ -231,7 +249,7 @@ export class PlanListingItemComponent extends BaseComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
canEditPlan(): boolean {
|
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 {
|
canCreateNewVersion(): boolean {
|
||||||
|
@ -261,4 +279,13 @@ export class PlanListingItemComponent extends BaseComponent implements OnInit {
|
||||||
canAssignPlanUsers(): boolean {
|
canAssignPlanUsers(): boolean {
|
||||||
return (this.plan.authorizationFlags?.some(x => x === AppPermission.AssignPlanUsers) || this.authentication.hasPermission(AppPermission.AssignPlanUsers)) && this.isPublic == false && this.plan.belongsToCurrentTenant != false;
|
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.belongsToCurrentTenant),
|
||||||
nameof<Plan>(x => x.finalizedAt),
|
nameof<Plan>(x => x.finalizedAt),
|
||||||
nameof<Plan>(x => x.hash),
|
nameof<Plan>(x => x.hash),
|
||||||
|
nameof<Plan>(x => x.tenantId),
|
||||||
[nameof<Plan>(x => x.authorizationFlags), AppPermission.CreateNewVersionPlan].join('.'),
|
[nameof<Plan>(x => x.authorizationFlags), AppPermission.CreateNewVersionPlan].join('.'),
|
||||||
[nameof<Plan>(x => x.authorizationFlags), AppPermission.DeletePlan].join('.'),
|
[nameof<Plan>(x => x.authorizationFlags), AppPermission.DeletePlan].join('.'),
|
||||||
[nameof<Plan>(x => x.authorizationFlags), AppPermission.ClonePlan].join('.'),
|
[nameof<Plan>(x => x.authorizationFlags), AppPermission.ClonePlan].join('.'),
|
||||||
|
|
|
@ -30,7 +30,7 @@ export class TenantSwitchComponent extends BaseComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.tenants = this.loadUserTenants(); //TODO
|
this.tenants = this.loadUserTenants();
|
||||||
}
|
}
|
||||||
|
|
||||||
loadUserTenants(): Observable<Array<Tenant>> {
|
loadUserTenants(): Observable<Array<Tenant>> {
|
||||||
|
|
Loading…
Reference in New Issue