Add updateSubjects and advanced criteria in community service. Add margin-top in actions of users and subscribers.
This commit is contained in:
parent
1d2a0effa8
commit
978d9f0269
|
@ -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,47 @@ export class CommunityService {
|
|||
return this.http.post(url, community, options);
|
||||
}
|
||||
|
||||
public updateSubjects(subjects: string[], fos: string[], sgd: 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>();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
community.subjects = Array.isArray(resData.subjects)?resData.subjects:[resData.subjects];
|
||||
}
|
||||
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">
|
||||
|
|
Loading…
Reference in New Issue