zenodo communities:

fix table issues
	set proper messages (loading, error)
	show the id when master exists but not in zenodo
FAB: change uk-icon-button to uk-button -> avoid chrome losing svg when there is padding
CSS: Menu items color : get the proper color if it is fixed or sticky


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@53925 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2018-11-22 15:10:41 +00:00
parent cf5909241e
commit b8e5ea1d4c
6 changed files with 163 additions and 276 deletions

View File

@ -1,7 +1,37 @@
<div id="manage-zenodo-communities" class="uk-padding">
<div id="manage-zenodo-communities" class="uk-padding uk-padding-remove-top">
<div *ngIf="masterCommunity" class="uk-animation-fade uk-alert uk-alert-primary uk-padding-small uk-margin-large-bottom">
<div class="uk-text-large uk-margin-bottom" >Master Zenodo community</div>
<div class="uk-comment-header uk-grid-medium uk-flex-middle" uk-grid>
<div class="uk-width-auto">
<a target="_blank" [href]="masterCommunity.link">
<img *ngIf="masterCommunity.logoUrl" class="uk-comment-avatar" src="{{masterCommunity.logoUrl}}" width="80" height="80" alt="">
</a>
</div>
<div class="uk-width-expand">
<h4 class="uk-comment-title uk-margin-remove">
<a *ngIf="masterCommunity.link" class="custom-external" target="_blank" href="{{masterCommunity.link}}">
<span *ngIf="masterCommunity.title">{{masterCommunity.title}}</span>
<span *ngIf="!masterCommunity.title">[no name available]</span>
</a>
<div *ngIf="!masterCommunity.link">
<span *ngIf="masterCommunity.title">{{masterCommunity.title}}</span>
<span *ngIf="!masterCommunity.title">[no name available]</span>
</div>
</h4>
<div *ngIf="masterCommunity.date" class="uk-comment-meta " >
last update: {{masterCommunity.date | date:'yyyy/MM/dd'}}
</div>
</div>
</div>
<div class="uk-comment-body uk-text-meta">
<p *ngIf="masterCommunity.description">{{masterCommunity.description}}</p>
</div>
</div>
<form class="uk-text-center uk-animation uk-card uk-card-default uk-padding">
<div>
<input type="text" class="uk-input uk-width-1-2" placeholder="Search zenodo communities" aria-describedby="sizing-addon2" [(ngModel)]="zenodoCommunitySearchUtils.keyword" name="keyword" >
<input type="text" class="uk-input uk-width-1-2" placeholder="Search zenodo communities" aria-describedby="sizing-addon2" [(ngModel)]="searchUtils.keyword" name="keyword" >
<button (click)="goTo(1)" type="submit" class=" uk-button">
<span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg>
@ -10,46 +40,14 @@
</div>
</form>
<div *ngIf="masterCommunity" class="uk-animation-fade uk-margin-top uk-background-muted uk-padding-small">
<div class="uk-text-large" >Master Zenodo community</div>
<div class="uk-comment-header uk-grid-medium uk-flex-middle" uk-grid>
<div class="uk-width-auto">
<a target="_blank" [href]="masterCommunity.link">
<img *ngIf="masterCommunity.logoUrl" class="uk-comment-avatar" src="{{masterCommunity.logoUrl}}" width="80" height="80" alt="">
</a>
</div>
<div class="uk-width-expand">
<h4 class="uk-comment-title uk-margin-remove"><a class="custom-external" target="_blank" href="{{masterCommunity.link}}">
<span *ngIf="masterCommunity.title">{{masterCommunity.title}}</span>
<span *ngIf="!masterCommunity.title">[no name available]</span>
</a>
<!-- <span *ngIf=" masterCommunity && item.id==masterCommunity.id" class="uk-label uk-label-warning">Master zenodo community</span> -->
<!-- <span class="uk-width-1-6 uk-text-center">
<a *ngIf="!inCommunity(item) && !(masterCommunity && item.id==masterCommunity.id)" (click)="addCommunity(item)" class="uk-icon-button add green_background_color green_color" uk-icon="plus" title="Add"></a>
<span *ngIf="inCommunity(item)" class="uk-label uk-label-success">Added</span>
<a *ngIf="inCommunity(item)" (click)="removeCommunity(item.id)" class="uk-icon-button remove red_background_color red_color" uk-icon="close" title="Undo"></a>
</span> -->
</h4>
<div class="uk-comment-meta ">
last update: {{masterCommunity.date | date:'yyyy/MM/dd'}}
</div>
</div>
</div>
<div class="uk-comment-body uk-text-meta">
<p *ngIf="masterCommunity.description">{{masterCommunity.description}}</p>
</div>
</div>
<div *ngIf="zenodoCommunitySearchUtils.totalResults > 0" class="uk-align-center uk-margin-remove-bottom">
<div *ngIf="searchUtils.totalResults > 0" class="uk-align-center uk-margin-remove-bottom">
<div class="searchPaging uk-panel uk-margin-top uk-grid uk-margin-bottom">
<span class="uk-h6 uk-width-1-1@s uk-width-1-2@m">
{{zenodoCommunitySearchUtils.totalResults | number}} projects, page {{zenodoCommunitySearchUtils.page | number}} of {{(totalPages()) | number}}
{{searchUtils.totalResults | number}} zenodo communities, page {{searchUtils.page | number}} of {{(totalPages()) | number}}
</span>
<span class="float-children-right-at-medium margin-small-top-at-small uk-width-1-1@s uk-width-1-2@m">
<paging-no-load [currentPage]="zenodoCommunitySearchUtils.page" [totalResults]="zenodoCommunitySearchUtils.totalResults" [size]="10" (pageChange)="goTo($event.value, false)"></paging-no-load>
<paging-no-load [currentPage]="searchUtils.page" [totalResults]="searchUtils.totalResults" [size]="10" (pageChange)="goTo($event.value, false)"></paging-no-load>
</span>
</div>
</div>

View File

@ -1,4 +1,4 @@
import {Component, OnInit, Input, ViewChild} from '@angular/core';
import {Component, OnInit, Input, ViewChild, ViewEncapsulation} from '@angular/core';
import {SimpleChanges, OnChanges} from '@angular/core';
import {FormGroup, FormArray, FormBuilder, Validators} from '@angular/forms';
import {ActivatedRoute, Router} from '@angular/router';
@ -26,14 +26,15 @@ import{ManageZenodoCommunitiesService} from '../../services/manageZenodoCommunit
display: none;
}
`]
`],
encapsulation: ViewEncapsulation.None // this used in order styles to work
})
export class ManageZenodoCommunitiesComponent implements OnInit {
@Input() properties:EnvProperties = null;
@Input() communityId = null;
public zenodoCommunitySearchUtils:SearchUtilsClass = new SearchUtilsClass();
@Input() searchUtils:SearchUtilsClass = null;
private errorCodes: ErrorCodes;
public rowsOnPage = 10;
@ -55,37 +56,13 @@ export class ManageZenodoCommunitiesComponent implements OnInit {
private _manageZenodoCommunitiesService: ManageZenodoCommunitiesService) {
this.errorCodes = new ErrorCodes();
this.zenodoCommunitySearchUtils.status = this.errorCodes.LOADING;
this.zenodoCommunitySearchUtils.totalResults = this.selectedCommunities.length;
}
ngOnInit() {
// this.route.queryParams.subscribe(
// communityId => {
// this.communityId = communityId['communityId'];
// if(!Session.isLoggedIn()){
// console.info(this._router.url);
// this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
// } else {
// if (this.communityId != null && this.communityId != '') {
// this._ΖenodoCommunitieService.getZenodoCommunities(this.properties, this.properties.zenodoCommunities+"?page="+this.zenodoCommunitySearchUtils.page+"&size="+this.rowsOnPage).subscribe(
// zenodoCommunities => {
// this.zenodoCommunities = zenodoCommunities;
// console.log(zenodoCommunities);
// console.log(this.zenodoCommunitySearchUtils.page);
// });
// this._ΖenodoCommunitieService.getTotalZenodoCommunities(this.properties, this.properties.zenodoCommunities).subscribe(
// totalZenodoCommunities => {
// this.totalZenodoCommunities = totalZenodoCommunities;
// this.zenodoCommunitySearchUtils.totalResults = totalZenodoCommunities;
// console.log(totalZenodoCommunities);
// });
// }
// }
// });
this.zenodoCommunitySearchUtils.keyword = "";
this.searchUtils.keyword = "";
this.dtOptions = {
// "paging": true,
// "searching": true,
@ -94,7 +71,7 @@ export class ManageZenodoCommunitiesComponent implements OnInit {
"language": {
"search": "",
"searchPlaceholder": "Search projects..."
}
}
};
if(!this.triggered) {
@ -106,7 +83,7 @@ export class ManageZenodoCommunitiesComponent implements OnInit {
this.rerender();
}
this.searchUtils.totalResults = this.selectedCommunities.length;
}
public ngOnDestroy() {
@ -114,25 +91,29 @@ export class ManageZenodoCommunitiesComponent implements OnInit {
$.fn['dataTable'].ext.search.pop();
}
rerender(): void {
this.datatableElement.dtInstance.then((dtInstance: DataTables.Api) => {
// Destroy the table first
dtInstance.destroy();
if(this.datatableElement.dtInstance){
this.datatableElement.dtInstance.then((dtInstance: DataTables.Api) => {
// Destroy the table first
dtInstance.destroy();
// Call the dtTrigger to rerender again
this.dtTrigger.next();
});
// Call the dtTrigger to rerender again
this.dtTrigger.next();
});
}
}
ngAfterViewInit(): void {
$.fn['dataTable'].ext.search.push((settings, data, dataIndex) => {
if (this.filterData(data, this.zenodoCommunitySearchUtils.keyword )) {
if (this.filterData(data, this.searchUtils.keyword )) {
return true;
}
return false;
});
console.info("ngAfterViewInit");
this.searchUtils.totalResults = this.selectedCommunities.length;
}
filterData(row: any, query: string) {
@ -178,43 +159,18 @@ export class ManageZenodoCommunitiesComponent implements OnInit {
}
goTo(page:number = 1){
this.zenodoCommunitySearchUtils.page=page;
this.searchUtils.page=page;
var table = $('#dpTable').DataTable();
table.page( page - 1 ).draw( false );
var info = table.page.info();
console.info("records: "+info.recordsDisplay);
this.zenodoCommunitySearchUtils.totalResults = info.recordsDisplay;
this.searchUtils.totalResults = info.recordsDisplay;
}
public confirmedDeleteCommunity(data : any) {
// if(!Session.isLoggedIn()){
// console.info(this._router.url);
// this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
// } else {
// console.info("REMOVE: "+ this.selectedCommunityProject.id);
// this.subRemove = this._manageCommunityProjectsService.removeProject(this.properties, this.community, this.selectedCommunityProject.id).subscribe(
// data => {
// console.info("data REMOVE");
// console.info(data);
// },
// err => {
// console.info("error REMOVE");
// console.log(err);
// },
// () => {
// console.info("completed REMOVE");
// let index = this.communityProjects.indexOf(this.selectedCommunityProject);
// this.communityProjects.splice(index, 1);
//
// this.communitySearchUtils.totalResults--;
// this.communitySearchUtils.page=1;
//
// this.rerender();
// }
// )
// }
if(!Session.isLoggedIn()){
console.info(this._router.url);
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
@ -231,11 +187,11 @@ export class ManageZenodoCommunitiesComponent implements OnInit {
}
if(pos != -1){
this.selectedCommunities.splice(pos, 1);
this.searchUtils.totalResults = this.selectedCommunities.length;
}
this.searchUtils.totalResults = this.selectedCommunities.length;
var table = $('#dpTable').DataTable();
table.clear();
this.rerender();
},
@ -275,35 +231,14 @@ export class ManageZenodoCommunitiesComponent implements OnInit {
}
}
// public removeCommunity( comm) {
// if(!Session.isLoggedIn()){
// console.info(this._router.url);
// this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
// } else {
// console.info("REMOVE: "+ this.communityId + " "+comm.openaireId);
// this._manageZenodoCommunitiesService.removeZCommunity(this.properties, this.communityId,comm.openaireId ).subscribe(
// data => {
// var pos = -1;
// for(var i=0; i< this.selectedCommunities.length;i++) {
// if( this.selectedCommunities[i].id == comm.id) {
// pos= i;
// break;
// }
// }
// if(pos != -1){
// this.selectedCommunities.splice(pos, 1);
// }
//
// },
// err => {
// console.info("error remove");
// console.log(err.status);
// },
// () => {
// console.info("completed remove");
// }
// )
// }
// }
totalPages(): number {
let totalPages:any = this.searchUtils.totalResults/(this.rowsOnPage);
if(!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
return totalPages;
}
}

View File

@ -1,94 +0,0 @@
<div class="uk-child-width-expand@s uk-text-center uk-margin-bottom" uk-grid>
<div>
<form class=" uk-animation uk-card uk-card-default uk-padding" >
<div>
<select class="uk-select" [(ngModel)]="selectedFunder" name="select_funder" >
<option value="" (click)="goTo(1)">Select funder:</option>
<option *ngFor="let funder of funders" [value]="funder" (click)="goTo(1)">{{funder}}</option>
</select>
</div>
</form>
</div>
<div>
<form class="uk-text-center uk-animation uk-card uk-card-default uk-padding">
<div>
<input type="text" class="uk-input uk-width-1-2" placeholder="Search community projects..." aria-describedby="sizing-addon2" [(ngModel)]="communitySearchUtils.keyword" name="keyword" >
<button (click)="goTo(1)" type="submit" class=" uk-button">
<span class="uk-icon">
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg>
</span>Search
</button>
</div>
</form>
</div>
</div>
<errorMessages [status]="[communitySearchUtils.status]" [type]="'community projects'"></errorMessages>
<div *ngIf="communitySearchUtils.totalResults > 0" class="uk-align-center uk-margin-remove-bottom">
<div class="searchPaging uk-panel uk-margin-top uk-grid uk-margin-bottom">
<span class="uk-h6 uk-width-1-1@s uk-width-1-2@m">
{{communitySearchUtils.totalResults | number}} projects, page {{communitySearchUtils.page | number}} of {{(totalPages()) | number}}
</span>
<span class="float-children-right-at-medium margin-small-top-at-small uk-width-1-1@s uk-width-1-2@m">
<paging-no-load [currentPage]="communitySearchUtils.page" [totalResults]="communitySearchUtils.totalResults" [size]="10" (pageChange)="goTo($event.value, false)"></paging-no-load>
</span>
</div>
</div>
<!-- uk-first-column uk-width-expand -->
<div class="custom-dataTable-content">
<div class="uk-overflow-container">
<table datatable class="uk-table uk-table-striped divider-table" [dtOptions]="dtOptions" id="dpTable" [dtTrigger]="dtTrigger" dtInstance="dtInstanceCallback">
<thead>
<tr>
<th class="uk-text-center">Project</th>
<th class="uk-text-center">Grant Id</th>
<th class="uk-text-center">Funder</th>
<th class="uk-text-center">Action</th>
</tr>
</thead>
<tbody>
<tr class="uk-table-middle" *ngFor="let result of communityProjects">
<td class="uk-text-center uk-width-1-4">
<a class="custom-external" target="_blank"
[href]="communityUrl+'/search/project?' + ((result.openaireId) ? 'projectId='+result.openaireId : 'grantId='+result.grantId+'&funder='+result.funder)">
<span *ngIf="result.name">{{result.name}}</span>
<span *ngIf="result.name && result.acronym">(</span><span *ngIf="result.acronym">{{result.acronym}}</span><span *ngIf="result.name && result.acronym">)</span>
<span *ngIf="!result.name && !result.acronym">[no title available]</span>
</a>
</td>
<td class="uk-text-center uk-width-1-4">
<span *ngIf="result.grantId">{{result.grantId}}</span>
<span *ngIf="!result.grantId">-</span>
</td>
<td class="uk-text-center uk-width-1-4">
<span *ngIf="result.funder">{{result.funder}}</span>
<span *ngIf="!result.funder">-</span>
</td>
<td class="uk-text-center uk-width-1-4">
<a (click)="removeProject(result)" class="uk-icon-button remove red_background_color red_color" uk-icon="icon: close; ratio: 1" title="Remove"></a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div *ngIf="communitySearchUtils.totalResults > 0" class="uk-align-center uk-margin-remove-bottom">
<div class="searchPaging uk-panel uk-margin-top uk-grid uk-margin-bottom">
<span class="uk-h6 uk-width-1-1@s uk-width-1-2@m">
{{communitySearchUtils.totalResults | number}} projects, page {{communitySearchUtils.page | number}} of {{(totalPages()) | number}}
</span>
<span class="float-children-right-at-medium margin-small-top-at-small uk-width-1-1@s uk-width-1-2@m">
<paging-no-load [currentPage]="communitySearchUtils.page" [totalResults]="communitySearchUtils.totalResults" [size]="10" (pageChange)="goTo($event.value, false)"></paging-no-load>
</span>
</div>
</div>
<modal-alert #AlertModalDeleteCommunity (alertOutput)="confirmedDeleteProject($event)"></modal-alert>
<!-- <delete-confirmation-dialog #deleteConfirmationModal [isModalShown]="isModalShown" (emmitObject)="confirmedDeleteProject($event)">
Are you sure you want to remove the selected project from your community?
</delete-confirmation-dialog> -->
<!-- </div> -->

View File

@ -11,29 +11,40 @@ import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoComm
import { SearchZenodoCommunitiesService } from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
import {CommunityService} from "../../openaireLibrary/connect/community/community.service";
import {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo';
import {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo';
import {ZenodoCommunityInfo} from '../../openaireLibrary/connect/zenodoCommunities/zenodoCommunityInfo';
import {SearchUtilsClass} from '../../openaireLibrary/searchPages/searchUtils/searchUtils.class';
import {ErrorCodes} from '../../openaireLibrary/utils/properties/errorCodes';
@Component({
selector: 'zenodo-communities',
template: `
<div id="manage-communities">
<div class="menubar uk-margin-bottom ">
<a *ngIf="!toggle" (click)="updateCommunityProjects()" uk-toggle="target: .toggle-usage" class="uk-button uk-button-primary uk-float-right">{{toggleLinkMessage}}</a>
<a *ngIf="!toggle" (click)="toggleAction()" class="uk-button uk-button-primary uk-float-right">{{toggleLinkMessage}}</a>
<div class="manage-projects-title uk-text-large">{{pageTitle}}</div>
</div>
<div class="toggle-usage">
<div *ngIf="toggle" >
<div *ngIf="zenodoSearchUtils.status == errorCodes.LOADING "
class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert">
<span class="loading-gif uk-align-center" ></span>
</div>
<div *ngIf="zenodoSearchUtils.status == errorCodes.ERROR "
class="uk-animation-fade uk-margin-top uk-width-1-1 uk-alert uk-alert-warning" role="alert">
No zenodo communities found
</div>
<manage-zenodo-communities [masterCommunity]=masterZenodoCommunity [(selectedCommunities)]=selectedCommunities [properties]=properties [communityId]=communityId ></manage-zenodo-communities>
<fab (clicked)="updateCommunityProjects()" uk-toggle="target: .toggle-usage"></fab>
<manage-zenodo-communities *ngIf="zenodoSearchUtils.status != errorCodes.LOADING && zenodoSearchUtils.status != errorCodes.ERROR" [masterCommunity]=masterZenodoCommunity [(selectedCommunities)]=selectedCommunities [properties]=properties [communityId]=communityId [(searchUtils)]=zenodoSearchUtils></manage-zenodo-communities>
<fab *ngIf="zenodoSearchUtils.status != errorCodes.LOADING && zenodoSearchUtils.status != errorCodes.ERROR" (clicked)="toggleAction()" ></fab>
</div>
<div class="toggle-usage" hidden>
<div *ngIf="!toggle" >
<add-zenodo-communities [masterCommunity]=masterZenodoCommunity [(selectedCommunities)]=selectedCommunities [properties]=properties [communityId]=communityId ></add-zenodo-communities>
</div>
</div>
`
})
//
export class ZenodoCommunitiesComponent implements OnInit {
private communityId: string = null;
private community:CommunityInfo = null;
@ -56,8 +67,14 @@ export class ZenodoCommunitiesComponent implements OnInit {
selectedCommunityIds = null;//["ecfunded", "zenodo", "lory_hslu", "cs19", "","hbp","dighl", "wind_energy", "lory", "fp7-bmc","fp7postgrantoapilotoutputs","cernopenlab"];
selectedCommunities = [];
zenodocommunitiesloadedCount = 0;
zenodoSearchUtils:SearchUtilsClass = new SearchUtilsClass();
private errorCodes: ErrorCodes = new ErrorCodes();;
constructor(private route: ActivatedRoute, private _router: Router, private _ΖenodoCommunitieService: ZenodoCommunitiesService,private _communityService: CommunityService,private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) {}
ngOnInit() {
this.zenodoSearchUtils.status = this.errorCodes.LOADING;;
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
this.properties = data.envSpecific;
this.route.queryParams.subscribe(params => {
@ -68,44 +85,54 @@ export class ZenodoCommunitiesComponent implements OnInit {
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
if (this.communityId != null && this.communityId != '') {
//TODO
// this.showLoading = true;
// this.updateErrorMessage = "";
// this.errorMessage = "";
this._communityService.getCommunity(this.properties, this.properties.communityAPI+this.communityId).subscribe (
community => {
this.community = community;
this.masterZenodoCommunityId = this.community.zenodoCommunity;
console.log
if(this.masterZenodoCommunityId){
this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities+this.masterZenodoCommunityId, null).subscribe(
result => {
this.masterZenodoCommunity = result;
});
},
error => {
var emptyCommunity:ZenodoCommunityInfo = new ZenodoCommunityInfo();
emptyCommunity.id = this.masterZenodoCommunityId;
emptyCommunity.title = this.masterZenodoCommunityId;
this.masterZenodoCommunity = emptyCommunity;
console.log("Master Zenodo community'"+this.masterZenodoCommunityId+"' couldn't be loaded");
}
);
}
// this.showLoading = false;
},
error => {} //this.handleError('System error retrieving community profile', error)
this.zenodoSearchUtils.status = this.errorCodes.LOADING;;
this._searchZenodoCommunitiesService.searchZCommunities(this.properties,this.communityId).subscribe (
result => {
this.selectedCommunityIds = result;
this.zenodoSearchUtils.totalResults = this.selectedCommunityIds.length;
if(this.selectedCommunityIds.length == 0){
this.zenodoSearchUtils.status = this.errorCodes.NONE;
}
for(let i=0; i< this.selectedCommunityIds.length; i++){
this.getZenodoCommunityById(this.selectedCommunityIds[i]["zenodoid"], this.selectedCommunityIds[i]["id"]);
}
},
error => {
console.log("list of zenodo communities couldn't be loaded");
this.zenodoSearchUtils.status = this.errorCodes.ERROR;
} //this.handleError('System error retrieving community profile', error)
);
},
error => {
console.log("Community couldn't be loaded");
this.zenodoSearchUtils.status = this.errorCodes.ERROR;
}
);
this._searchZenodoCommunitiesService.searchZCommunities(this.properties,this.communityId).subscribe (
result => {
this.selectedCommunityIds = result;
for(let i=0; i< this.selectedCommunityIds.length; i++){
this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities+this.selectedCommunityIds[i]["zenodoid"], this.selectedCommunityIds[i]["id"]).subscribe(
result => {
this.selectedCommunities.push(result);
});
}
// this.showLoading = false;
},
error => {} //this.handleError('System error retrieving community profile', error)
);
//https://dev-openaire.d4science.org/openaire/community/dh-ch/zenodocommunities
}
}
@ -120,7 +147,7 @@ export class ZenodoCommunitiesComponent implements OnInit {
public ngOnDestroy() {}
public updateCommunityProjects() {
public toggleAction() {
if(!Session.isLoggedIn()){
console.info(this._router.url);
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
@ -128,23 +155,39 @@ export class ZenodoCommunitiesComponent implements OnInit {
this.toggle = !this.toggle;
if(this.toggle) {
this.pageTitle = "Manage zenodo communities";
//TODO
// this.manageProjectsComponent._getCommunityProjects();
// this.addProjectsComponent.undo = {};
} else {
this.updateCommunityProjectsOnToggle = false;
this.pageTitle = "Search zenodo communities";
//this.toggleLinkMessage = "Manage projects";
}
}
}
//TODO
// public communityProjectsChanged($event) {
// this.communityProjects = $event.value;
// }
getZenodoCommunityById(zenodoid, openaireId){
this._ΖenodoCommunitieService.getZenodoCommunityById(this.properties, this.properties.zenodoCommunities+zenodoid, openaireId).subscribe(
result => {
this.selectedCommunities.push(result);
this.zenodocommunitiesloadedCount++;
if(this.zenodocommunitiesloadedCount >= this.selectedCommunityIds.length){
this.zenodoSearchUtils.status = this.errorCodes.DONE;
}
},
error => {
var emptyCommunity:ZenodoCommunityInfo = new ZenodoCommunityInfo();
emptyCommunity.id = zenodoid;
emptyCommunity.openaireId = openaireId;
emptyCommunity.title = zenodoid;
this.selectedCommunities.push(emptyCommunity);
this.zenodocommunitiesloadedCount++;
if(this.zenodocommunitiesloadedCount >= this.selectedCommunityIds.length){
this.zenodoSearchUtils.status = this.errorCodes.DONE;
}
console.log("Zenodo community'"+zenodoid+"' couldn't be loaded");
}
);
}
// public updateCommunityProjects($event) {
// this.updateCommunityProjectsOnToggle = true;
// }
}

View File

@ -4,8 +4,13 @@ import { Component, EventEmitter, Output } from '@angular/core';
selector: 'fab',
template: `
<div (click)="onClick()" class=" uk-float-right " style="z-index: 100; bottom: 45px; position: fixed; right: 45px;">
<a style="padding: 30px;" class=" uk-icon-button uk-button-danger ">
<span class="uk-icon" uk-icon="icon: plus; ratio: 1.5">
<a style="padding: 14px;" class=" uk-button uk-button-danger ">
<!--span class="uk-icon" uk-icon="icon: plus; ratio: 1.5">
</span-->
<span class="uk-icon">
<svg width="30" height="30" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" fill="currentColor" icon="plus" ratio="1.5">
<rect x="9" y="1" width="1" height="17" fill="currentColor"></rect>
<rect x="1" y="9" width="17" height="1" fill="currentColor"></rect></svg>
</span>
</a>
</div>

View File

@ -73,7 +73,7 @@
background-color: var(--portal-main-color); !important;
}
.connect-admin-menu .uk-navbar-nav > li > a{
.connect-admin-menu.uk-navbar-transparent .uk-navbar-nav > li > a{
color: white !important;
}