Parse new field status in communities | add new field in communityInfo class
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@51912 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
a1c223bd78
commit
0ea6e5f774
|
@ -26,7 +26,9 @@ export class CommunitiesService {
|
||||||
let resData = Array.isArray(data) ? data[i] : data;
|
let resData = Array.isArray(data) ? data[i] : data;
|
||||||
|
|
||||||
var result: CommunityInfo = new CommunityInfo();
|
var result: CommunityInfo = new CommunityInfo();
|
||||||
|
//TODO @Sofia remove this if/else
|
||||||
|
// if there is case to be array do with resData what you do with data ( let resData = Array.isArray(data) ? data[i] : data;)
|
||||||
|
//don;t repeat the same code
|
||||||
if(Array.isArray(resData)) {
|
if(Array.isArray(resData)) {
|
||||||
result['title'] = resData[0].name;
|
result['title'] = resData[0].name;
|
||||||
result['shortTitle'] = resData[0].shortName;
|
result['shortTitle'] = resData[0].shortName;
|
||||||
|
@ -35,6 +37,14 @@ export class CommunitiesService {
|
||||||
result['logoUrl'] = resData[0].logoUrl;
|
result['logoUrl'] = resData[0].logoUrl;
|
||||||
result['description'] = resData[0].description;
|
result['description'] = resData[0].description;
|
||||||
result['date'] = resData[0].creationDate;
|
result['date'] = resData[0].creationDate;
|
||||||
|
result['status'] = "all";
|
||||||
|
if(resData[0].hasOwnProperty('status')){
|
||||||
|
result['status'] = resData[0].status;
|
||||||
|
var status = ["all","hidden","manager"];
|
||||||
|
if(status.indexOf(result['status']) ==-1){
|
||||||
|
result['status'] = "hidden";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (resData[0].type != null) {
|
if (resData[0].type != null) {
|
||||||
result['type'] = resData[0].type;
|
result['type'] = resData[0].type;
|
||||||
|
@ -76,7 +86,14 @@ export class CommunitiesService {
|
||||||
result['logoUrl'] = resData.logoUrl;
|
result['logoUrl'] = resData.logoUrl;
|
||||||
result['description'] = resData.description;
|
result['description'] = resData.description;
|
||||||
result['date'] = resData.creationDate;
|
result['date'] = resData.creationDate;
|
||||||
|
result['status'] = "all";
|
||||||
|
if(resData.hasOwnProperty('status')){
|
||||||
|
result['status'] = resData.status;
|
||||||
|
var status = ["all","hidden","manager"];
|
||||||
|
if(status.indexOf(result['status']) ==-1){
|
||||||
|
result['status'] = "hidden";
|
||||||
|
}
|
||||||
|
}
|
||||||
if (resData.type != null) {
|
if (resData.type != null) {
|
||||||
result['type'] = resData.type;
|
result['type'] = resData.type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,14 @@ export class CommunityService {
|
||||||
community['logoUrl'] = resData[0].logoUrl;
|
community['logoUrl'] = resData[0].logoUrl;
|
||||||
community['description'] = resData[0].description;
|
community['description'] = resData[0].description;
|
||||||
community['date'] = resData[0].creationDate;
|
community['date'] = resData[0].creationDate;
|
||||||
|
community['status'] = "all";
|
||||||
|
if(resData[0].hasOwnProperty('status')){
|
||||||
|
community['status'] = resData[0].status;
|
||||||
|
var status = ["all","hidden","manager"];
|
||||||
|
if(status.indexOf(community['status']) ==-1){
|
||||||
|
community['status'] = "hidden";
|
||||||
|
}
|
||||||
|
}
|
||||||
if (resData[0].type != null) {
|
if (resData[0].type != null) {
|
||||||
community['type'] = resData[0].type;
|
community['type'] = resData[0].type;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +123,14 @@ export class CommunityService {
|
||||||
community['logoUrl'] = resData.logoUrl;
|
community['logoUrl'] = resData.logoUrl;
|
||||||
community['description'] = resData.description;
|
community['description'] = resData.description;
|
||||||
community['date'] = resData.creationDate;
|
community['date'] = resData.creationDate;
|
||||||
|
community['status'] = "all";
|
||||||
|
if(resData.hasOwnProperty('status')){
|
||||||
|
community['status'] = resData.status;
|
||||||
|
var status = ["all","hidden","manager"];
|
||||||
|
if(status.indexOf(community['status']) ==-1){
|
||||||
|
community['status'] = "hidden";
|
||||||
|
}
|
||||||
|
}
|
||||||
if (resData.type != null) {
|
if (resData.type != null) {
|
||||||
community['type'] = resData.type;
|
community['type'] = resData.type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,4 +9,5 @@ export class CommunityInfo {
|
||||||
managers: string[];
|
managers: string[];
|
||||||
date:Date;
|
date:Date;
|
||||||
subjects: string[];
|
subjects: string[];
|
||||||
|
status:string;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue