Merge branch 'develop' into data-transfer-v2
This commit is contained in:
commit
3e8dce7947
|
@ -5,6 +5,7 @@ import {map} from "rxjs/operators";
|
|||
import {BehaviorSubject, from, Observable, Subscriber} from "rxjs";
|
||||
import {properties} from "../../../../environments/environment";
|
||||
import {StringUtils} from "../../utils/string-utils.class";
|
||||
import {SelectionCriteria} from "../../utils/entities/contentProvider";
|
||||
|
||||
@Injectable({providedIn: 'root'})
|
||||
export class CommunityService {
|
||||
|
@ -72,57 +73,59 @@ export class CommunityService {
|
|||
return this.http.post(url, community, options);
|
||||
}
|
||||
|
||||
public updateSubjects(subjects: string[], fos: string[], sdg: string[]) {
|
||||
let communityInfo: CommunityInfo = this.community.value;
|
||||
communityInfo.subjects = subjects;
|
||||
communityInfo.fos = fos;
|
||||
communityInfo.sdg = sdg;
|
||||
this.community.next(communityInfo);
|
||||
}
|
||||
|
||||
public updateAdvancedCriteria(selectionCriteria: SelectionCriteria) {
|
||||
let communityInfo: CommunityInfo = this.community.value;
|
||||
communityInfo.selectionCriteria = selectionCriteria;
|
||||
this.community.next(communityInfo);
|
||||
}
|
||||
|
||||
public parseCommunity(data: any): CommunityInfo {
|
||||
|
||||
const resData = Array.isArray(data) ? data[0] : data;
|
||||
|
||||
const community: CommunityInfo = new CommunityInfo();
|
||||
community['title'] = resData.name;
|
||||
community['shortTitle'] = resData.shortName;
|
||||
community['communityId'] = resData.id;
|
||||
community['queryId'] = resData.queryId;
|
||||
community['logoUrl'] = resData.logoUrl;
|
||||
community['description'] = resData.description;
|
||||
community['date'] = resData.creationDate;
|
||||
community['zenodoCommunity'] = resData.zenodoCommunity;
|
||||
community['status'] = 'all';
|
||||
community.title = resData.name;
|
||||
community.shortTitle = resData.shortName;
|
||||
community.communityId = resData.id;
|
||||
community.queryId = resData.queryId;
|
||||
community.logoUrl = resData.logoUrl;
|
||||
community.description = resData.description;
|
||||
community.date = resData.creationDate;
|
||||
community.zenodoCommunity = resData.zenodoCommunity;
|
||||
community.status = 'all';
|
||||
community.type = resData.type;
|
||||
if (resData.hasOwnProperty('status')) {
|
||||
community['status'] = resData.status;
|
||||
community.status = resData.status;
|
||||
const status = ['all', 'hidden', 'manager'];
|
||||
if (status.indexOf(community['status']) === -1) {
|
||||
community['status'] = 'hidden';
|
||||
community.status = 'hidden';
|
||||
}
|
||||
}
|
||||
if (resData.type != null) {
|
||||
community['type'] = resData.type;
|
||||
}
|
||||
|
||||
if (resData.managers != null) {
|
||||
if (community['managers'] === undefined) {
|
||||
community['managers'] = new Array<string>();
|
||||
}
|
||||
|
||||
const managers = resData.managers;
|
||||
const length = Array.isArray(managers) ? managers.length : 1;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
const manager = Array.isArray(managers) ? managers[i] : managers;
|
||||
community.managers[i] = manager;
|
||||
}
|
||||
}
|
||||
|
||||
if (resData.subjects != null) {
|
||||
if (community['subjects'] === undefined) {
|
||||
community['subjects'] = new Array<string>();
|
||||
community.subjects = Array.isArray(resData.subjects)?resData.subjects:[resData.subjects];
|
||||
} else {
|
||||
community.subjects = [];
|
||||
}
|
||||
|
||||
const subjects = resData.subjects;
|
||||
const length = Array.isArray(subjects) ? subjects.length : 1;
|
||||
|
||||
for (let i = 0; i < length; i++) {
|
||||
const subject = Array.isArray(subjects) ? subjects[i] : subjects;
|
||||
community.subjects[i] = subject;
|
||||
if (resData.sdg != null) {
|
||||
community.sdg = Array.isArray(resData.sdg)?resData.sdg:[resData.sdg];
|
||||
} else {
|
||||
community.sdg = [];
|
||||
}
|
||||
if (resData.fos != null) {
|
||||
community.fos = Array.isArray(resData.fos)?resData.fos:[resData.fos];
|
||||
} else {
|
||||
community.fos = [];
|
||||
}
|
||||
if (resData.advancedConstraint != null) {
|
||||
community.selectionCriteria = resData.advancedConstraint;
|
||||
} else {
|
||||
community.selectionCriteria = new SelectionCriteria();
|
||||
}
|
||||
return CommunityInfo.checkIsUpload(community);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import {StringUtils} from "../../utils/string-utils.class";
|
||||
import {properties} from "../../../../environments/environment";
|
||||
import {SelectionCriteria} from "../../utils/entities/contentProvider";
|
||||
|
||||
export class CommunityInfo {
|
||||
title: string;
|
||||
|
@ -18,6 +19,9 @@ export class CommunityInfo {
|
|||
isUpload: boolean;
|
||||
isSubscribed: boolean;
|
||||
isManager: boolean;
|
||||
fos: string[] = [];
|
||||
sdg: string[] = []
|
||||
selectionCriteria: SelectionCriteria;
|
||||
|
||||
public static checkIsUpload(response: CommunityInfo | CommunityInfo[]): any | any[] {
|
||||
if (Array.isArray(response)) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<ng-content></ng-content>
|
||||
</div>
|
||||
<div actions>
|
||||
<div class="uk-section-xsmall">
|
||||
<div class="uk-section-xsmall uk-margin-top">
|
||||
<div class="uk-grid" uk-grid>
|
||||
<div class="uk-flex uk-flex-left@m uk-flex-center uk-width-expand">
|
||||
<ul class="uk-subnav uk-subnav-pill">
|
||||
|
|
|
@ -77,7 +77,6 @@ export class RoleUsersComponent implements OnInit, OnDestroy, OnChanges {
|
|||
this.updateLists();
|
||||
this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.user = user;
|
||||
console.log(this.canDelete)
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<ng-content></ng-content>
|
||||
</div>
|
||||
<div actions>
|
||||
<div class="uk-section-xsmall">
|
||||
<div class="uk-section-xsmall uk-margin-top">
|
||||
<div class="uk-grid uk-flex-right@m uk-flex-center uk-flex-middle" uk-grid>
|
||||
<div search-input [searchControl]="filterForm.get('keyword')" placeholder="Search members"
|
||||
[expandable]="true" [disabled]="loading || !subscriberInvite || subscriberInvite.loading" searchInputClass="outer" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1">
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<label [class.uk-text-bolder]="subjects?.includes(item.id)">
|
||||
<input [(ngModel)]="item.checked"
|
||||
type="checkbox" class="uk-checkbox uk-margin-small-right">
|
||||
<span class="uk-text-uppercase uk-margin-xsmall-right">Goal</span>
|
||||
<span *ngIf="isFeedback" class="uk-text-uppercase uk-margin-xsmall-right">Goal</span>
|
||||
<span>{{item.id}}</span>
|
||||
</label>
|
||||
</div>
|
||||
|
@ -20,7 +20,7 @@
|
|||
<label [class.uk-text-bolder]="subjects?.includes(item.id)">
|
||||
<input [(ngModel)]="item.checked"
|
||||
type="checkbox" class="uk-checkbox uk-margin-small-right">
|
||||
<span *ngIf="i !== secondColumn.length - 1"
|
||||
<span *ngIf="i !== secondColumn.length - 1 && isFeedback"
|
||||
class="uk-text-uppercase uk-margin-xsmall-right">Goal</span>
|
||||
<span>{{item.id}}</span>
|
||||
</label>
|
||||
|
|
|
@ -13,6 +13,7 @@ export class SdgSelectionComponent {
|
|||
public properties: EnvProperties = properties;
|
||||
@Input() subjects: string[];
|
||||
@Input() entityType: string;
|
||||
@Input() isFeedback: boolean = true;
|
||||
|
||||
public loading: boolean;
|
||||
public sdgs: any = [];
|
||||
|
@ -27,17 +28,19 @@ export class SdgSelectionComponent {
|
|||
data['sdg'].forEach(element => {
|
||||
this.sdgs.push({code: element.code, id: element.id, label: element.label, html: element.html, checked: this.subjects?.includes(element.id)});
|
||||
});
|
||||
if(this.isFeedback) {
|
||||
this.sdgs.push({code: '18', id: 'No SDGs are relevant for this ' + this.getEntityName(this.entityType), label: 'Not relevant', html: 'Not relevant', checked: false});
|
||||
}
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
public get firstColumn() {
|
||||
return this.sdgs.slice(0, this.sdgs.length/2);
|
||||
return this.sdgs.slice(0, Math.ceil(this.sdgs.length/2));
|
||||
}
|
||||
|
||||
public get secondColumn() {
|
||||
return this.sdgs.slice(this.sdgs.length/2, this.sdgs.length);
|
||||
return this.sdgs.slice(Math.ceil(this.sdgs.length/2), this.sdgs.length);
|
||||
}
|
||||
|
||||
public getSelectedSubjects() {
|
||||
|
|
Loading…
Reference in New Issue