fix backend dmp user and dashboard ui fixes

This commit is contained in:
amentis 2024-03-12 18:47:57 +02:00
parent cfbd3233ec
commit a45dec7a5f
10 changed files with 95 additions and 47 deletions

View File

@ -193,15 +193,31 @@ public class DmpServiceImpl implements DmpService {
this.sendNotification(data);
this.elasticService.persistDmp(data);
if (!this.conventionService.isListNullOrEmpty(model.getUsers())){
this.inviteUsers(data.getId(), model.getUsers());
}else{
this.assignUsers(data.getId(), new ArrayList<>(), null);
this.addOwner(data);
}
this.elasticService.persistDmp(data);
return this.builderFactory.builder(DmpBuilder.class).authorize(AuthorizationFlags.OwnerOrDmpAssociatedOrPermission).build(BaseFieldSet.build(fields, Dmp._id, Dmp._hash), data);
}
private void addOwner(DmpEntity dmpEntity) throws InvalidApplicationException {
DmpUserEntity data = new DmpUserEntity();
data.setId(UUID.randomUUID());
data.setIsActive(IsActive.Active);
data.setCreatedAt(Instant.now());
data.setUpdatedAt(Instant.now());
data.setRole(DmpUserRole.Owner);
data.setUserId(userScope.getUserId());
data.setDmpId(dmpEntity.getId());
this.entityManager.persist(data);
}
private void sendNotification(DmpEntity dmp) throws InvalidApplicationException {
List<DmpUserEntity> existingUsers = this.queryFactory.query(DmpUserQuery.class)
.dmpIds(dmp.getId())
@ -539,7 +555,6 @@ public class DmpServiceImpl implements DmpService {
Boolean isUpdate = this.conventionService.isValidGuid(model.getId());
DmpEntity data;
DmpUserEntity dmpUserEntity = new DmpUserEntity();
if (isUpdate) {
data = this.entityManager.find(DmpEntity.class, model.getId());
if (data == null) throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), Dmp.class.getSimpleName()}, LocaleContextHolder.getLocale()));
@ -560,14 +575,6 @@ public class DmpServiceImpl implements DmpService {
data.setBlueprintId(model.getBlueprint());
data.setIsActive(IsActive.Active);
data.setCreatedAt(Instant.now());
dmpUserEntity.setId(UUID.randomUUID());
dmpUserEntity.setDmpId(data.getId());
dmpUserEntity.setUserId(userScope.getUserId());
dmpUserEntity.setRole(DmpUserRole.Owner);
dmpUserEntity.setCreatedAt(Instant.now());
dmpUserEntity.setUpdatedAt(Instant.now());
dmpUserEntity.setIsActive(IsActive.Active);
}
data.setLabel(model.getLabel());
@ -580,7 +587,6 @@ public class DmpServiceImpl implements DmpService {
this.entityManager.merge(data);
else {
this.entityManager.persist(data);
this.entityManager.persist(dmpUserEntity);
}
this.entityManager.flush();
@ -804,6 +810,7 @@ public class DmpServiceImpl implements DmpService {
throw new InvalidApplicationException("Dmp does not exist!");
}
List<DmpUserPersist> usersToAssign = new ArrayList<>();
for (DmpUserPersist user :users) {
UUID userId = null;
if (user.getUser() != null){
@ -816,7 +823,7 @@ public class DmpServiceImpl implements DmpService {
}
if (userId != null){
user.setUser(userId);
this.assignUsers(id, List.of(user), null);
usersToAssign.add(user);
if (this.userScope.getUserId() != userId){
this.sendDmpInvitationExistingUser(user.getUser(), dmp, user.getRole());
}
@ -825,6 +832,7 @@ public class DmpServiceImpl implements DmpService {
}
}
if(!usersToAssign.isEmpty()) this.assignUsers(id, usersToAssign, null);
}
private void sendDmpInvitationExistingUser(UUID userId, DmpEntity dmp, DmpUserRole role) throws InvalidApplicationException {
@ -908,10 +916,17 @@ public class DmpServiceImpl implements DmpService {
}
DmpInvitationEntity dmpInvitation = this.xmlHandlingService.fromXmlSafe(DmpInvitationEntity.class, action.getData());
DmpUserPersist model = new DmpUserPersist();
model.setUser(this.userScope.getUserIdSafe());
model.setRole(dmpInvitation.getRole());
this.assignUsers(dmpInvitation.getDmpId(), List.of(model), null);
DmpUserEntity data = new DmpUserEntity();
data.setId(UUID.randomUUID());
data.setIsActive(IsActive.Active);
data.setCreatedAt(Instant.now());
data.setUpdatedAt(Instant.now());
data.setRole(dmpInvitation.getRole());
data.setUserId(this.userScope.getUserIdSafe());
data.setDmpId(dmpInvitation.getDmpId());
this.entityManager.persist(data);
action.setStatus(ActionConfirmationStatus.Accepted);
this.entityManager.merge(action);
}

View File

@ -184,6 +184,9 @@ export class PrefillingSourceEditorComponent extends BaseEditor<PrefillingSource
definition.buildGetConfiguration(this.formGroup.get('definition') as UntypedFormGroup, "definition.");
this.submitFields();
}else{
const definition = this.formGroup.get('definition') as UntypedFormGroup;
if (definition.get('getConfiguration')) definition.removeControl('getConfiguration');
}
}

View File

@ -45,8 +45,8 @@
<app-recent-edited-dmp-activity (totalCountDmps)="onCountDmps($event)" [isActive]="currentType == 'dmps'"></app-recent-edited-dmp-activity>
<div *ngIf="totalDmps === 0" class="empty-list">{{'DASHBOARD.EMPTY-LIST' | translate}}</div>
</mat-tab>
<mat-tab aria-label="datasets" label="{{'DASHBOARD.DESCRIPTIONS' | translate}}">
<app-recent-edited-dataset-activity (totalCountDatasets)="onCountDatasets($event)" [isActive]="currentType == 'datasets'"></app-recent-edited-dataset-activity>
<mat-tab aria-label="descriptions" label="{{'DASHBOARD.DESCRIPTIONS' | translate}}">
<app-recent-edited-description-activity (totalCountDatasets)="onCountDatasets($event)" [isActive]="currentType == 'descriptions'"></app-recent-edited-description-activity>
<div *ngIf="totalDatasets === 0" class="empty-list">{{'DASHBOARD.EMPTY-LIST' | translate}}</div>
<div *ngIf="totalDatasets === 0" class="col-auto d-flex justify-content-center">
<button mat-raised-button class="add-dataset" (click)="addNewDataset()">
@ -126,7 +126,7 @@
<div *ngIf="totalDmps === 0" class="empty-list">{{'DASHBOARD.EMPTY-LIST' | translate}}</div>
</mat-tab>
<mat-tab aria-label="datasets" label="{{'DASHBOARD.PUBLIC-DATASETS' | translate}}">
<app-recent-edited-dataset-activity (totalCountDatasets)="onCountDatasets($event)" [isActive]="currentType == 'datasets'"></app-recent-edited-dataset-activity>
<app-recent-edited-description-activity (totalCountDatasets)="onCountDatasets($event)" [isActive]="currentType == 'datasets'"></app-recent-edited-description-activity>
<div *ngIf="totalDatasets === 0" class="empty-list">{{'DASHBOARD.EMPTY-LIST' | translate}}</div>
</mat-tab>
</mat-tab-group>

View File

@ -7,8 +7,8 @@
<span class="d-flex align-items-center">{{'DMP-LISTING.SORT-BY' | translate}}:</span>
<mat-form-field appearance="outline" class="sort-form col-auto">
<mat-select placeholder="{{'CRITERIA.LIKE'| translate}}" [formControl]="formGroup.get('order')">
<mat-option [value]="order.MODIFIED">{{enumUtils.toRecentActivityOrderString(order.MODIFIED)}}</mat-option>
<mat-option [value]="order.LABEL">{{enumUtils.toRecentActivityOrderString(order.LABEL)}}</mat-option>
<mat-option [value]="order.UpdatedAt">{{enumUtils.toRecentActivityOrderString(order.UpdatedAt)}}</mat-option>
<mat-option [value]="order.Label">{{enumUtils.toRecentActivityOrderString(order.Label)}}</mat-option>
</mat-select>
</mat-form-field>
<!-- End of Sort by -->

View File

@ -19,6 +19,7 @@ import { BaseComponent } from '@common/base/base.component';
import { debounceTime, takeUntil } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof';
import { AuthService } from '../../../core/services/auth/auth.service';
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
@Component({
selector: 'app-drafts',
@ -89,6 +90,8 @@ export class DraftsComponent extends BaseComponent implements OnInit {
this.updateUrl();
}
});
this.refresh();
}
ngOnChanges() {
@ -98,7 +101,7 @@ export class DraftsComponent extends BaseComponent implements OnInit {
}
updateUrl() {
let parameters = "?type=dmps" +
let parameters = "?type=drafts" +
(this.page != 1 ? "&page=" + this.page : "") +
//TODO refactor
//(((this.formGroup.get("order").value != this.order.MODIFIED && !this.publicMode) || (this.formGroup.get("order").value != this.order.PUBLISHED && this.publicMode)) ? "&order=" + this.formGroup.get("order").value : "") +
@ -133,6 +136,12 @@ export class DraftsComponent extends BaseComponent implements OnInit {
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.user.id)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.role)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.isActive)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type), nameof<ReferenceType>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.isActive)].join('.'),
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.label)].join('.'),
@ -147,11 +156,13 @@ export class DraftsComponent extends BaseComponent implements OnInit {
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.user.id)].join('.'),
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.role)].join('.'),
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.isActive)].join('.'),
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'),
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type)].join('.'),
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type), nameof<ReferenceType>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.reference)].join('.'),
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.isActive)].join('.'),
]
};

View File

@ -9,6 +9,7 @@ import { Description } from '@app/core/model/description/description';
import { Dmp, DmpUser } from '@app/core/model/dmp/dmp';
import { DmpReference } from '@app/core/model/dmp/dmp-reference';
import { FileFormat } from '@app/core/model/file/file-format.model';
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
import { Reference } from '@app/core/model/reference/reference';
import { RecentActivityItemLookup } from '@app/core/query/recent-activity-item-lookup.lookup';
import { AuthService } from '@app/core/services/auth/auth.service';
@ -135,6 +136,12 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.user.id)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.role)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.isActive)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type), nameof<ReferenceType>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.isActive)].join('.'),
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.label)].join('.'),
@ -152,8 +159,9 @@ export class RecentEditedActivityComponent extends BaseComponent implements OnIn
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'),
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type)].join('.'),
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type), nameof<ReferenceType>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.reference)].join('.'),
[nameof<RecentActivityItem>(x => x.description), nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.isActive)].join('.'),
]
};

View File

@ -6,7 +6,7 @@
<mat-select placeholder="{{'CRITERIA.LIKE'| translate}}" [formControl]="formGroup.get('order')">
<mat-option *ngIf="!publicMode" [value]="order.UpdatedAt">{{enumUtils.toRecentActivityOrderString(order.UpdatedAt)}}</mat-option>
<!-- <mat-option *ngIf="publicMode" [value]="order.DATASETPUBLISHED">{{enumUtils.toRecentActivityOrderString(order.DATASETPUBLISHED)}}</mat-option> -->
<mat-option [value]="order.LABEL">{{enumUtils.toRecentActivityOrderString(order.Label)}}</mat-option>
<mat-option [value]="order.Label">{{enumUtils.toRecentActivityOrderString(order.Label)}}</mat-option>
<mat-option *ngIf="!publicMode" [value]="order.Status">{{enumUtils.toRecentActivityOrderString(order.Status)}}</mat-option>
<!-- <mat-option [value]="order.CREATED">{{enumUtils.toRecentActivityOrderString(order.CREATED)}}</mat-option> -->
</mat-select>
@ -24,7 +24,7 @@
<button type="button" class="btn-load-more" (click)="loadNextOrPrevious(false)">{{'GENERAL.ACTIONS.LOAD-LESS' | translate}}</button>
</div>
<div *ngFor="let item of listingItems; let i = index">
<app-description-listing-item-component [showDivider]="i != (listingItems.length - 1)" [description]="item" [isPublic]="isPublic" ></app-description-listing-item-component>
<app-description-listing-item-component *ngIf="item" [showDivider]="i != (listingItems.length - 1)" [description]="item" [isPublic]="isPublic" ></app-description-listing-item-component>
</div>
<div class="text-muted d-flex justify-content-center mt-5" *ngIf="!hasMoreResults && listingItems && listingItems.length > 0">
{{'GENERAL.ACTIONS.NO-MORE-AVAILABLE' | translate}}

View File

@ -7,10 +7,11 @@ import { DescriptionTemplate } from '@app/core/model/description-template/descri
import { Description } from '@app/core/model/description/description';
import { Dmp, DmpUser } from '@app/core/model/dmp/dmp';
import { DmpReference } from '@app/core/model/dmp/dmp-reference';
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
import { Reference } from '@app/core/model/reference/reference';
import { DescriptionLookup } from '@app/core/query/description.lookup';
import { RecentActivityItemLookup } from '@app/core/query/recent-activity-item-lookup.lookup';
import { AuthService } from '@app/core/services/auth/auth.service';
import { DescriptionService } from '@app/core/services/description/description.service';
import { DashboardService } from '@app/core/services/dashboard/dashboard.service';
import { MatomoService } from '@app/core/services/matomo/matomo-service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { BaseComponent } from '@common/base/base.component';
@ -24,7 +25,7 @@ import { nameof } from 'ts-simple-nameof';
})
export class RecentEditedDescriptionActivityComponent extends BaseComponent implements OnInit {
lookup: DescriptionLookup = new DescriptionLookup();
lookup: RecentActivityItemLookup = new RecentActivityItemLookup();
pageSize: number = 5;
listingItems: Description[];
@ -48,7 +49,7 @@ export class RecentEditedDescriptionActivityComponent extends BaseComponent impl
private router: Router,
public enumUtils: EnumUtils,
private authentication: AuthService,
private descriptionService: DescriptionService,
private dashboardService: DashboardService,
private location: Location,
private matomoService: MatomoService
) {
@ -98,7 +99,7 @@ export class RecentEditedDescriptionActivityComponent extends BaseComponent impl
}
updateUrl() {
let parameters = "?type=dmps" +
let parameters = "?type=descriptions" +
(this.page != 1 ? "&page=" + this.page : "") +
//TODO refactor
//(((this.formGroup.get("order").value != this.order.MODIFIED && !this.publicMode) || (this.formGroup.get("order").value != this.order.PUBLISHED && this.publicMode)) ? "&order=" + this.formGroup.get("order").value : "") +
@ -115,7 +116,7 @@ export class RecentEditedDescriptionActivityComponent extends BaseComponent impl
this.formGroup.get('order').setValue(this.order.UpdatedAt);
}
this.lookup.page = { size: this.pageSize, offset: 0 };
this.lookup.order = { items: ['-' + this.formGroup.get('order').value] };
this.lookup.orderField = this.formGroup.get('order').value;
this.lookup.like = this.formGroup.get('like').value;
this.lookup.project = {
@ -136,17 +137,18 @@ export class RecentEditedDescriptionActivityComponent extends BaseComponent impl
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type), nameof<ReferenceType>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.reference)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.isActive)].join('.'),
]
};
this.descriptionService
.query(this.lookup)
this.dashboardService
.getMyRecentActivityItems(this.lookup)
.pipe(takeUntil(this._destroyed))
.subscribe(response => {
this.listingItems = response.items;
this.totalCount = response.count;
this.listingItems = response.map(x => x.description);
// this.totalCount = response.count;
//this.totalCountDmps.emit(this.dmpActivities.length);

View File

@ -4,10 +4,10 @@
<span class="d-flex align-items-center">{{'DMP-LISTING.SORT-BY' | translate}}:</span>
<mat-form-field appearance="outline" class="sort-form col-auto">
<mat-select placeholder="{{'CRITERIA.LIKE'| translate}}" [formControl]="formGroup.get('order')">
<mat-option *ngIf="!publicMode" [value]="order.MODIFIED">{{enumUtils.toRecentActivityOrderString(order.MODIFIED)}}</mat-option>
<mat-option *ngIf="publicMode" [value]="order.PUBLISHED">{{enumUtils.toRecentActivityOrderString(order.PUBLISHED)}}</mat-option>
<mat-option [value]="order.LABEL">{{enumUtils.toRecentActivityOrderString(order.LABEL)}}</mat-option>
<mat-option *ngIf="!publicMode" [value]="order.STATUS">{{enumUtils.toRecentActivityOrderString(order.STATUS)}}</mat-option>
<mat-option *ngIf="!publicMode" [value]="order.UpdatedAt">{{enumUtils.toRecentActivityOrderString(order.UpdatedAt)}}</mat-option>
<!-- <mat-option *ngIf="publicMode" [value]="order.PUBLISHED">{{enumUtils.toRecentActivityOrderString(order.PUBLISHED)}}</mat-option> -->
<mat-option [value]="order.Label">{{enumUtils.toRecentActivityOrderString(order.Label)}}</mat-option>
<mat-option *ngIf="!publicMode" [value]="order.Status">{{enumUtils.toRecentActivityOrderString(order.Status)}}</mat-option>
<!-- <mat-option [value]="order.CREATED">{{enumUtils.toRecentActivityOrderString(order.CREATED)}}</mat-option> -->
</mat-select>
</mat-form-field>
@ -24,7 +24,7 @@
<button type="button" class="btn-load-more" (click)="loadNextOrPrevious(false)">{{'GENERAL.ACTIONS.LOAD-LESS' | translate}}</button>
</div>
<div *ngFor="let item of listingItems; let i = index">
<app-dmp-listing-item-component [showDivider]="i != (listingItems.length - 1)" [dmp]="item" [isPublic]="isPublic"></app-dmp-listing-item-component>
<app-dmp-listing-item-component *ngIf="item" [showDivider]="i != (listingItems.length - 1)" [dmp]="item" [isPublic]="isPublic"></app-dmp-listing-item-component>
</div>
<!-- <div *ngFor="let activity of listingItems">
<div class="dmp-card">

View File

@ -6,11 +6,13 @@ import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order
import { RecentActivityItem } from '@app/core/model/dashboard/recent-activity-item';
import { Description } from '@app/core/model/description/description';
import { Dmp, DmpUser } from '@app/core/model/dmp/dmp';
import { DmpReference } from '@app/core/model/dmp/dmp-reference';
import { FileFormat } from '@app/core/model/file/file-format.model';
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
import { Reference } from '@app/core/model/reference/reference';
import { RecentActivityItemLookup } from '@app/core/query/recent-activity-item-lookup.lookup';
import { AuthService } from '@app/core/services/auth/auth.service';
import { DashboardService } from '@app/core/services/dashboard/dashboard.service';
import { DmpService } from '@app/core/services/dmp/dmp.service';
import { MatomoService } from '@app/core/services/matomo/matomo-service';
import { EnumUtils } from '@app/core/services/utilities/enum-utils.service';
import { BaseComponent } from '@common/base/base.component';
@ -31,7 +33,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
@ViewChild("dmps") resultsContainer;
listingItems: RecentActivityItem[];
listingItems: Dmp[];
isDraft: boolean;
totalCount: number;
@ -58,7 +60,6 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
private dashboardService: DashboardService,
private location: Location,
private matomoService: MatomoService,
private dmpService: DmpService
) {
super();
}
@ -95,6 +96,8 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
this.updateUrl();
}
});
this.refresh();
}
ngOnChanges() {
@ -137,6 +140,12 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.user.id)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.role)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpUsers), nameof<DmpUser>(x => x.isActive)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type), nameof<ReferenceType>(x => x.id)].join('.'),
[nameof<RecentActivityItem>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.isActive)].join('.'),
]
};
@ -144,7 +153,7 @@ export class RecentEditedDmpActivityComponent extends BaseComponent implements O
.getMyRecentActivityItems(this.lookup)
.pipe(takeUntil(this._destroyed))
.subscribe(response => {
this.listingItems = response;
this.listingItems = response.map(x => x.dmp);
//this.totalCount = response.totalCount;