Merge branch 'master' of code-repo.d4science.org:MaDgIK/openaire-library
commit
1475fb754b
@ -1,50 +0,0 @@
|
||||
/*
|
||||
import { Pipe, PipeTransform} from '@angular/core'
|
||||
|
||||
|
||||
@Pipe({
|
||||
name: 'claimsDatatable'
|
||||
})
|
||||
export class ClaimsDatatablePipe implements PipeTransform {
|
||||
|
||||
transform(array: any[], args: any[]): any {
|
||||
let query: string = args[0];
|
||||
let counter:any = args[1];
|
||||
let active: any = args[2];
|
||||
|
||||
active.page = 1;
|
||||
|
||||
if (query) {
|
||||
var result = array.filter(row=>this.filterAll(row, query));
|
||||
counter.count = result.length;
|
||||
return result;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
filterAll(row: any, query: string) {
|
||||
if(row.userMail.indexOf(query) > -1) {
|
||||
return true;
|
||||
}
|
||||
if(row.targetType != 'project' && row.target.title.indexOf(query) > -1) {
|
||||
return true;
|
||||
}
|
||||
if(row.sourceType != 'project' && row.source.title.indexOf(query) > -1) {
|
||||
return true;
|
||||
}
|
||||
if(row.date.indexOf(query) > -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(row.curatedBy != null && row.curatedBy.indexOf(query) > -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(row.curationDate != null && row.curationDate.indexOf(query) > -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
*/
|
@ -1,113 +0,0 @@
|
||||
// import { Pipe, PipeTransform} from '@angular/core';
|
||||
// import { Filter, Value} from '../../searchPages/searchUtils/searchHelperClasses.class';
|
||||
// import { SearchUtilsClass } from '../../searchPages/searchUtils/searchUtils.class';
|
||||
// import { ErrorCodes} from '../properties/openaireProperties';
|
||||
//
|
||||
// @Pipe({
|
||||
// name: 'contentProvidersDatatable'
|
||||
// })
|
||||
// export class ContentProvidersDatatablePipe implements PipeTransform {
|
||||
//
|
||||
// transform(array: any[], args: any[]): any {
|
||||
// if(array.length > 0) {
|
||||
// let searchUtils: SearchUtilsClass = args[0];
|
||||
// let filters:Filter[] = args[1];
|
||||
//
|
||||
//
|
||||
// var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
// searchUtils.status = errorCodes.LOADING;
|
||||
//
|
||||
// var result = array.filter(row=>this.filterAll(row, searchUtils.keyword.toLowerCase(), filters));
|
||||
//
|
||||
// let oldTotal = searchUtils.totalResults;
|
||||
//
|
||||
// searchUtils.totalResults = result.length;
|
||||
//
|
||||
// var errorCodes:ErrorCodes = new ErrorCodes();
|
||||
// searchUtils.status = errorCodes.DONE;
|
||||
// if(searchUtils.totalResults == 0 ){
|
||||
// searchUtils.status = errorCodes.NONE;
|
||||
// }
|
||||
//
|
||||
// if(oldTotal != searchUtils.totalResults) {
|
||||
// args[3].detectChanges();
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
// return [];
|
||||
// }
|
||||
//
|
||||
// filterAll(row: any, query: string, filters:Filter[]) {
|
||||
// let returnValue: boolean = false;
|
||||
//
|
||||
// if(query) {
|
||||
// if(row.title.name.toLowerCase().indexOf(query) > -1) {
|
||||
// returnValue = true;
|
||||
// }
|
||||
//
|
||||
// if(row.type.toLowerCase().indexOf(query) > -1) {
|
||||
// returnValue = true;
|
||||
// }
|
||||
//
|
||||
// if(row.countries && row.countries.length > 0) {
|
||||
// for(let country of row.countries) {
|
||||
// if(country.toLowerCase().indexOf(query) > -1) {
|
||||
// returnValue = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if(row.compatibility && row.compatibility.toLowerCase().indexOf(query) > -1) {
|
||||
// returnValue = true;
|
||||
// }
|
||||
//
|
||||
// if(row.organizations && row.organizations.length > 0) {
|
||||
// for(let organization of row.organizations) {
|
||||
// if(organization.name.toLowerCase().indexOf(query) > -1) {
|
||||
// returnValue = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if(!returnValue) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for (let filter of filters){
|
||||
// if(filter.countSelectedValues > 0){
|
||||
// for (let value of filter.values){
|
||||
// if(value.selected == true){
|
||||
//
|
||||
// // make it generic in future commit
|
||||
// let field:string = "";
|
||||
// if(filter.title == "Type") {
|
||||
// field = "type";
|
||||
// } else if(filter.title == "Compatibility Level") {
|
||||
// field = "compatibility";
|
||||
// }
|
||||
//
|
||||
// if(row[field] == value.name) {
|
||||
// returnValue = true;
|
||||
// if(filter.filterOperator == "or") {
|
||||
// break;
|
||||
// }
|
||||
// } else {
|
||||
// if(filter.filterOperator == "and") {
|
||||
// return false;
|
||||
// }
|
||||
// returnValue = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if(!returnValue) {
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
// }
|
@ -0,0 +1,14 @@
|
||||
import {Pipe, PipeTransform} from '@angular/core'
|
||||
import {Stakeholder} from "../../monitor/entities/stakeholder";
|
||||
import {CommunityInfo} from "../../connect/community/communityInfo";
|
||||
import {StringUtils} from "../string-utils.class";
|
||||
|
||||
@Pipe({ name: 'logoUrl'})
|
||||
export class LogoUrlPipe implements PipeTransform {
|
||||
|
||||
constructor() {}
|
||||
|
||||
transform(value: Stakeholder | CommunityInfo): string {
|
||||
return StringUtils.getLogoUrl(value);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import {NgModule} from '@angular/core';
|
||||
import {LogoUrlPipe} from "./logoUrl.pipe";
|
||||
|
||||
@NgModule({
|
||||
imports: [],
|
||||
declarations: [
|
||||
LogoUrlPipe
|
||||
],
|
||||
providers: [],
|
||||
exports: [
|
||||
LogoUrlPipe
|
||||
]
|
||||
})
|
||||
export class LogoUrlPipeModule {
|
||||
|
||||
}
|
Loading…
Reference in New Issue