Merge remote-tracking branch 'origin/master' into new-theme

This commit is contained in:
Konstantinos Triantafyllou 2022-02-21 16:33:33 +02:00
commit 5c60c42063
8 changed files with 76 additions and 55 deletions

View File

@ -3,7 +3,7 @@ import {SearchCrossrefService} from '../../claim-utils/service/searchCrossref.se
import {SearchDataciteService} from '../../claim-utils/service/searchDatacite.service';
import {ModalLoading} from '../../../utils/modal/loading.component';
import {Dates, DOI} from '../../../utils/string-utils.class';
import {Dates, DOI, Identifier} from '../../../utils/string-utils.class';
import {EnvProperties} from '../../../utils/properties/env-properties';
import {ClaimEntity} from "../../claim-utils/claimHelper.class";
import {Subscriber} from "rxjs";
@ -165,8 +165,9 @@ export class BulkClaimComponent {
if (rows[i] && rows[i] != null && rows[i]!="") {
const values = rows[i].split(',');
const id = BulkClaimComponent.removeDoubleQuotes(values[0]);
let id = BulkClaimComponent.removeDoubleQuotes(values[0]);
if (DOI.isValidDOI(id)) {
id = Identifier.getRawDOIValue(id);
let accessMode = (values[1] != undefined) ? BulkClaimComponent.removeDoubleQuotes(values[1]) : "OPEN";
accessMode = (BulkClaimComponent.validateAccessMode(accessMode) ? accessMode : "OPEN");
let embargoDate = (values[2] != undefined) ? Dates.getDateFromString(BulkClaimComponent.removeDoubleQuotes(values[2])) : Dates.getDateToday();

View File

@ -9,6 +9,9 @@ export class ConnectHelper {
// domain = "aginfra.openaire.eu"; //for testing
}
domain = domain.indexOf("//") != -1? domain.split("//")[1]:domain; //remove https:// prefix
if (domain.indexOf('eosc-portal.eu') != -1) {
return "eosc";
}
if (domain.indexOf('openaire.eu') === -1) {
return null;
}

View File

@ -38,12 +38,11 @@ import {properties} from "../../../environments/environment";
[entitiesSelection]="type=='all'" [showSwitchSearchLink]="showSwitchSearchLink"
[filters]="filters"
[simpleView]="simpleView" formPlaceholderText="Search by name, description, subject..."
[showResultCount]="(type=='all' || type == 'deposit')" [showIndexInfo]="type!='deposit'"
[showResultCount]="true" [showIndexInfo]="type!='deposit'"
[tableViewLink]="tableViewLink"
[sort]="false" [showBreadcrumb]="showBreadcrumb" [basicMetaDescription]="metaDescription">
</new-search-page>
<!-- [filters]="filters"-->
`
})
@ -140,13 +139,9 @@ export class SearchDataProvidersComponent {
this.searchPage.keywordFields = this.searchFields.DEPOSIT_DATASOURCE_KEYWORD_FIELDS;
this.searchPage.usedBy = "deposit";
}
// console.log(this.refineFields)
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap,this.customFilter,params, "dataprovider");
if(refine && (this.type == "all" || this.type == "deposit")) {
if(refine) {
this._getFilters(this.searchPage.getSearchAPIQueryForAdvancedSearhFields(), this.searchUtils.page, 0, true, this.searchPage.getSearchAPIQueryForRefineFields(params, firstLoad));
} else if(refine) { // static filters
this.searchUtils.refineStatus = this.errorCodes.LOADING;
this.filters = DatasourcesHelperClass.createFilters(this.type);
} else {
this.searchUtils.refineStatus = this.errorCodes.DONE;
}
@ -173,7 +168,7 @@ export class SearchDataProvidersComponent {
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
let datasourceQueryPrefix = DatasourcesHelperClass.getQueryPrefix(this.type);
this.searchFiltersSub = this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''), page, size, this.properties, (refine && (this.type=="all" || this.type == "deposit")) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, (this.type == "deposit"))
this.searchFiltersSub = this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''), page, size, this.properties, (refine /*&& (this.type=="all" || this.type == "deposit")*/) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, (this.type == "deposit"))
//.switchMap(
.subscribe(
data => {
@ -198,7 +193,6 @@ export class SearchDataProvidersComponent {
if (refine) {
this.filters = this.searchPage.prepareFiltersToShow(filters, totalResults);
}
this.searchUtils.refineStatus = this.errorCodes.DONE;
if(totalResults == 0) {
this.searchUtils.refineStatus = this.errorCodes.NONE;
@ -232,35 +226,22 @@ export class SearchDataProvidersComponent {
size=0;
}
if(page <= this.pagingLimit || this.searchUtils.status == this.errorCodes.LOADING) {
// if(parameters!= null && parameters != '' ) {
// this.csvParams ="&fq=( "+this.resourcesQuery + "and (" + parameters + "))";
// }else{
// this.csvParams ="&fq="+this.resourcesQuery;
// }
// this.csvParams += (refineFieldsFilterQuery?refineFieldsFilterQuery:'');
this.csvParams = (parameters ? ("&fq=("+parameters) : "") + (parameters ? ")" : "");
this.csvParams += (refineFieldsFilterQuery ? refineFieldsFilterQuery : "");
//var errorCodes:ErrorCodes = new ErrorCodes();
this.searchUtils.status = this.errorCodes.LOADING;
//this.searchPage.openLoading();
this.disableForms = true;
this.searchPageUpdates.emit({disableForms: this.disableForms, disableRefineForms: this.disableRefineForms, searchUtils: this.searchUtils});
this.results = [];
this.searchUtils.totalResults = 0;
//console.info("Advanced Search for Content Providers: Execute search query "+parameters);
let datasourceQueryPrefix = DatasourcesHelperClass.getQueryPrefix(this.type);
//this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''), page, size, this.properties, (refine && (this.type=="all" || this.type == "deposit")) ? this.searchPage.getRefineFieldsQuery() : null, this.searchPage.getFields(), refineFieldsFilterQuery, (this.type == "deposit")).subscribe(
this.searchResultsSub = this._searchDataProvidersService.advancedSearchDataproviders( datasourceQueryPrefix +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' and (':'') + parameters +(datasourceQueryPrefix.length > 0 && parameters.length > 0 ?' ) ':''), page, size, this.properties, null, this.searchPage.getFields(), refineFieldsFilterQuery, (this.type == "deposit")).subscribe(
data => {
let totalResults = data[0];
let results = data[1];
if(refine && !(this.type == "all" || this.type == "deposit")){
this.filtersReturned(refine, this.filters, totalResults, page);
}
this.resultsReturned(refine, results, totalResults, page);
},
err => {

View File

@ -1,5 +1,6 @@
import {Filter, Value} from "./searchHelperClasses.class";
import {SearchFields} from "../../utils/properties/searchFields";
import {properties} from "../../../../environments/environment";
export class DatasourcesHelperClass {
@ -42,8 +43,11 @@ export class DatasourcesHelperClass {
}
}
public static getQueryPrefix(type: "all" | "registries" | "journals" | "compatible" | "deposit"): string {
if(properties.environment == "production") {
if (type == "registries") {
return ' datasourcetypeuiid = other ';
return ' (datasourcetypeuiid = "entityregistry" or datasourcetypeuiid = "entityregistry::products" or datasourcetypeuiid = "entityregistry::repositories" ' +
'or datasourcetypeuiid = "entityregistry::organizations" or datasourcetypeuiid = "entityregistry::researchers" ) ';
} else if (type == "journals") {
// return ' not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ) ';
return 'oaftype exact datasource not datasourcecompatibilityid = notCompatible and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ) ';
@ -55,6 +59,21 @@ export class DatasourcesHelperClass {
} else {
return "";
}
}else{
if (type == "registries") {
return 'datasourcetypeuiname exact "Registry"';
} else if (type == "journals") {
// return ' not(datasourcecompatibilityid = UNKNOWN) not(datasourcecompatibilityid = notCompatible) and (datasourcetypeuiid exact "pubsrepository::journal" or datasourcetypeuiid exact "aggregator::pubsrepository::journals" ) ';
return 'oaftype exact datasource not datasourcecompatibilityid = notCompatible and datasourcetypeuiname exact "Journal archive" ';
} else if (type == "compatible") {
return ' oaftype exact datasource and datasourcecompatibilityid <> notCompatible and datasourcetypeuiname exact "Repository" ';
}else if (type == "deposit") {
return ' oaftype exact datasource and (datasourcetypeuiname exact "Journal archive" or datasourcetypeuiname exact "Repository")';
} else {
return "";
}
}
}
public static createFilters(type: "all" | "registries" | "journals" | "compatible" | "deposit"): Filter[] {
@ -62,8 +81,8 @@ export class DatasourcesHelperClass {
return this.createRegistriesFilters();
} else if (type == "journals") {
return this.createJournalFilters();
} else if (type == "compatible") {
return this.createCompatibleFilters();
/* } else if (type == "compatible") {
return this.createCompatibleFilters();*/
} else {
return [];
}

View File

@ -176,18 +176,23 @@
alt="BETA" style="height: 102px; width: 102px">
</div>
<div class="uk-container uk-container-expand">
<nav class="uk-navbar" uk-navbar="{&quot;align&quot;:&quot;left&quot;}">
<nav class="uk-navbar" uk-navbar="{&quot;align&quot;:&quot;center&quot;}">
<div *ngIf="showLogo && header.position== 'left'" class="uk-navbar-left uk-visible@l">
<ng-container *ngTemplateOutlet="header_template; context: {mobile: false}"></ng-container>
</div>
<div *ngIf="showLogo && header.position == 'left'" class="uk-navbar-left uk-visible@m uk-hidden@l">
<ng-container *ngTemplateOutlet="header_template; context: {mobile: false}"></ng-container>
</div>
<div *ngIf="showLogo && header.position == 'center'" class="uk-margin-auto uk-visible@m">
<div *ngIf="showLogo && header.position == 'center' && header.menuPosition != 'center' " class="uk-margin-auto uk-visible@m">
<ng-container *ngTemplateOutlet="header_template; context: {mobile: false}"></ng-container>
</div>
<!-- <div *ngIf="!onlyTop" class="uk-navbar-center"> -->
<div *ngIf="!onlyTop" class="uk-navbar-right uk-position-top-right">
<div *ngIf="!onlyTop" [class.uk-navbar-right]="header.menuPosition != 'center'"
[class.uk-navbar-center]="header.menuPosition == 'center'">
<div *ngIf="showLogo && header.position == 'center' && header.menuPosition == 'center' "
class="uk-margin-large-right uk-visible@m">
<ng-container *ngTemplateOutlet="header_template; context: {mobile: false}"></ng-container>
</div>
<ul [class]="'uk-navbar-nav'+(!userMenu?' uk-margin-right':'')">
<li class="uk-parent" *ngIf="showHomeMenuItem && currentRoute.route !== '/'">
<a routerLinkActive="uk-link" routerLink="/">Home</a>

View File

@ -16,6 +16,7 @@ export interface Header {
position: 'left' | 'center' | 'right',
badge: boolean
stickyAnimation?: boolean
menuPosition?: 'center' | 'right'
}
@Component({
@ -49,9 +50,9 @@ export class NavigationBarComponent implements OnInit, OnDestroy {
showEntity = {};
showPage = {};
specialAnnouncementContent: string = null;
public customMenuItems: MenuItem[] = [];
constructor(private router: Router,
private route: ActivatedRoute,
private config: ConfigurationService,
@ -61,13 +62,13 @@ export class NavigationBarComponent implements OnInit, OnDestroy {
ngOnInit() {
this.initialize();
}
ngOnDestroy() {
for (let sub of this.subs) {
sub.unsubscribe();
}
}
initialize() {
if ((['provide', 'develop']).indexOf(this.portal) != -1) {
this.header = {
@ -77,6 +78,7 @@ export class NavigationBarComponent implements OnInit, OnDestroy {
logoUrl: this.logoPath + 'logo-large-' + this.portal + '.png',
logoSmallUrl: this.logoPath + 'logo-small-' + this.portal + '.png',
position: 'left',
menuPosition: 'right',
badge: true
};
}
@ -87,14 +89,14 @@ export class NavigationBarComponent implements OnInit, OnDestroy {
if (data) {
if (data['entities']) {
for (var i = 0; i < data['entities'].length; i++) {
this.showEntity['' + data['entities'][i]['pid'] + ''] = data['entities'][i]['isEnabled'];
}
}
if (data['pages']) {
for (var i = 0; i < data['pages'].length; i++) {
this.showPage[data['pages'][i]['route']] = data['pages'][i]['isEnabled'];
}
}
}
@ -114,14 +116,14 @@ export class NavigationBarComponent implements OnInit, OnDestroy {
);
}
}
isEnabled(required, enabled) {
if (!required) {
return true;
}
for (let requiredEntity of required) {
if (typeof enabled[requiredEntity] === 'undefined' || enabled[requiredEntity] == false) {
return false;
@ -129,12 +131,12 @@ export class NavigationBarComponent implements OnInit, OnDestroy {
}
return true;
}
isAtleastOneEnabled(required, enabled) {
if (!required || required.length == 0) {
return true;
}
var count = required.length;
for (let requiredEntity of required) {
if (typeof enabled[requiredEntity] === 'undefined' || enabled[requiredEntity] == false) {
@ -143,18 +145,18 @@ export class NavigationBarComponent implements OnInit, OnDestroy {
}
return (count > 0) ? true : false;
}
private handleError(message: string, error) {
console.error('NavigationBar (component): ' + message, error);
}
get currentRoute() {
return {
route: this.router.url.split('?')[0].split('#')[0],
fragment: this.route.snapshot.fragment
}
}
isTheActiveMenu(menu: RootMenuItem): boolean {
if (!menu.rootItem.markAsActive) {
return false;
@ -170,7 +172,7 @@ export class NavigationBarComponent implements OnInit, OnDestroy {
}
return false;
}
isTheActiveMenuItem(menuItem: MenuItem): boolean {
let currentRoute = this.currentRoute;
return (menuItem.route == currentRoute.route || menuItem.route == (currentRoute.route + "/")) &&

View File

@ -426,7 +426,7 @@ export class SearchFields {
param: "type",
operator: "tp",
equalityOperator: " exact ",
filterType: "checkbox"
filterType: "radio"
},
["datasourcetypename"]: {
name: "Type",
@ -434,7 +434,7 @@ export class SearchFields {
param: "type",
operator: "tp",
equalityOperator: " exact ",
filterType: null
filterType: "radio"
},
["datasourceodlanguages"]: {
name: "Language",
@ -511,7 +511,7 @@ export class SearchFields {
{"name": "country", "equalityOperator": " exact "},
{"name": "datasourcesubject", "equalityOperator": " all "}
];
public DEPOSIT_DATASOURCE_REFINE_FIELDS: string[] = ["datasourcetypeuiname", "country", "datasourceodsubjects", "datasourceodcontenttypes", "datasourcecompatibilityname"];
public DEPOSIT_DATASOURCE_REFINE_FIELDS: string[] = ["datasourcetypename", "country", "datasourceodsubjects", "datasourceodcontenttypes", "datasourcecompatibilityname"];
public DEPOSIT_DATASOURCE_FIELDS: { [key: string]: FieldDetails } = {
["datasourcetypeuiname"]: {
@ -556,9 +556,9 @@ export class SearchFields {
},
};
public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypeuiid", "datasourcecompatibilityname"];
public COMPATIBLE_DATAPROVIDER_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
public ENTITY_REGISTRIES_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
public JOURNAL_FIELDS: string[] = ["datasourcetypeuiid", "datasourcecompatibilityname"];
public JOURNAL_FIELDS: string[] = ["datasourcetypename", "datasourcecompatibilityname"];
//ORGANIZATION

View File

@ -157,13 +157,22 @@ export class Identifier {
var words: string[] = str.split(" ");
for (var i = 0; i < words.length; i++) {
if (DOI.isValidDOI(words[i]) && DOIs.indexOf(words[i]) == -1) {
DOIs.push(words[i]);
let id = words[i];
if (DOI.isValidDOI(id) ) {
id = Identifier.getRawDOIValue(id);
if( DOIs.indexOf(id) == -1){
DOIs.push(id);
}
}
}
return DOIs;
}
public static getRawDOIValue(id: string): string {
if(id.indexOf("doi.org")!=-1 && id.split("doi.org/").length > 1){
id = id.split("doi.org/")[1];
}
return id;
}
public static getIdentifiersFromString(str: string): Identifier[] {
let identifiers: Identifier[] = [];
let words: string[] = str.split(" ");
@ -181,6 +190,7 @@ export class Identifier {
public static getIdentifierFromString(pid: string,strict:boolean = true): Identifier {
if (Identifier.isValidDOI(pid)) {
pid = Identifier.getRawDOIValue(pid);
return {"class": "doi", "id": pid};
} else if (Identifier.isValidORCID(pid)) {
return {"class": "ORCID", "id": pid};