Adds the missing information to User Dashboard (Ticket #83)

This commit is contained in:
gkolokythas 2019-05-17 11:42:30 +03:00
parent 151656386a
commit 6b13f191b0
4 changed files with 51 additions and 26 deletions

View File

@ -274,7 +274,7 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
if (this.dynamicFields != null)
dataManagementPlanEntity.setDmpProperties(JSONObject.toJSONString(this.dynamicFields.stream().filter(item -> item.getValue() != null).collect(Collectors.toMap(DynamicFieldWithValue::getId, DynamicFieldWithValue::getValue))));
if (this.associatedUsers != null && !this.associatedUsers.isEmpty()) {
/*if (this.associatedUsers != null && !this.associatedUsers.isEmpty()) {
List<UserDMP> userDMPList = new LinkedList<>();
for(UserListingModel userListingModel: this.associatedUsers) {
UserDMP userDMP = new UserDMP();
@ -282,7 +282,7 @@ public class DataManagementPlan implements DataModel<DMP, DataManagementPlan> {
userDMPList.add(userDMP);
}
dataManagementPlanEntity.setUsers((Set<UserDMP>) userDMPList);
}
}*/
return dataManagementPlanEntity;
}

View File

@ -1,38 +1,28 @@
package eu.eudat.models.data.userinfo;
import eu.eudat.data.entities.UserInfo;
import eu.eudat.data.entities.UserRole;
import eu.eudat.models.DataModel;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import java.util.*;
import java.util.stream.Collectors;
public class UserListingModel implements DataModel<eu.eudat.data.entities.UserInfo, UserListingModel> {
private UUID id;
private String email;
private Short usertype;
private Boolean verified_email;
private String name;
private Date created;
private Date lastloggedin;
private String additionalinfo;
private List<Integer> appRoles;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
@ -40,7 +30,6 @@ public class UserListingModel implements DataModel<eu.eudat.data.entities.UserIn
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@ -48,7 +37,6 @@ public class UserListingModel implements DataModel<eu.eudat.data.entities.UserIn
public Short getUsertype() {
return usertype;
}
public void setUsertype(Short usertype) {
this.usertype = usertype;
}
@ -56,7 +44,6 @@ public class UserListingModel implements DataModel<eu.eudat.data.entities.UserIn
public Boolean getVerified_email() {
return verified_email;
}
public void setVerified_email(Boolean verified_email) {
this.verified_email = verified_email;
}
@ -64,7 +51,6 @@ public class UserListingModel implements DataModel<eu.eudat.data.entities.UserIn
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@ -72,7 +58,6 @@ public class UserListingModel implements DataModel<eu.eudat.data.entities.UserIn
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
@ -80,7 +65,6 @@ public class UserListingModel implements DataModel<eu.eudat.data.entities.UserIn
public Date getLastloggedin() {
return lastloggedin;
}
public void setLastloggedin(Date lastloggedin) {
this.lastloggedin = lastloggedin;
}
@ -88,7 +72,6 @@ public class UserListingModel implements DataModel<eu.eudat.data.entities.UserIn
public String getAdditionalinfo() {
return additionalinfo;
}
public void setAdditionalinfo(String additionalinfo) {
this.additionalinfo = additionalinfo;
}
@ -96,7 +79,6 @@ public class UserListingModel implements DataModel<eu.eudat.data.entities.UserIn
public List<Integer> getAppRoles() {
return appRoles;
}
public void setAppRoles(List<Integer> appRoles) {
this.appRoles = appRoles;
}
@ -117,7 +99,17 @@ public class UserListingModel implements DataModel<eu.eudat.data.entities.UserIn
@Override
public UserInfo toDataModel() throws Exception {
return null;
UserInfo userInfo = new UserInfo();
userInfo.setId(this.id);
userInfo.setEmail(this.email);
userInfo.setUsertype(this.usertype);
userInfo.setVerified_email(this.verified_email);
userInfo.setName(this.name);
userInfo.setCreated(this.created);
userInfo.setLastloggedin(this.lastloggedin);
userInfo.setAdditionalinfo(this.additionalinfo);
return userInfo;
}
@Override

View File

@ -29,11 +29,11 @@
<td>{{ activity.label }}</td>
<td>
<div class="template-name">
--
{{ dmpProfileDisplay(activity.profile) }}
</div>
</td>
<td>{{ activity.project }}</td>
<td>Role Name</td>
<td>{{roleDisplay(activity.users)}}</td>
<td>{{ activity.organisations }}</td>
<td *ngIf="activity.status === 1">
<div class="is-public">

View File

@ -7,6 +7,8 @@ import { DmpCriteria } from '../../../core/query/dmp/dmp-criteria';
import { DmpService } from '../../../core/services/dmp/dmp.service';
import { RecentActivityType } from '../../../core/common/enum/recent-activity-type';
import { Router } from '@angular/router';
import { Principal } from '../../../core/model/auth/Principal';
import { TranslateService } from '@ngx-translate/core';
@Component({
selector: 'app-recent-edited-activity',
@ -21,7 +23,8 @@ export class RecentEditedActivityComponent implements OnInit {
private router: Router,
public enumUtils: EnumUtils,
private authentication: AuthService,
private dmpService: DmpService
private dmpService: DmpService,
private language: TranslateService
) { }
ngOnInit() {
@ -62,4 +65,34 @@ export class RecentEditedActivityComponent implements OnInit {
}
navigateToUrl() { }
roleDisplay(value: any) {
const principal: Principal = this.authentication.current();
let role: number;
if (principal) {
value.forEach(element => {
if (principal.id === element.id) {
role = element.role;
}
});
}
if (role === 0) {
return this.language.instant('DMP-LISTING.OWNER');
}
else if (role === 1) {
return this.language.instant('DMP-LISTING.MEMBER');
}
else {
return this.language.instant('DMP-LISTING.OWNER');
}
}
dmpProfileDisplay(value: any) {
if (value != null) {
return value;
}
else {
return "--";
}
}
}