[develop | DONE | ADDED] Add Organization refine field in results for Connect

This commit is contained in:
argirok 2024-07-17 13:25:44 +03:00
parent 355889dc92
commit edf7491c26
3 changed files with 109 additions and 2 deletions

View File

@ -34,6 +34,12 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"fileReplacements": [
{
"replace": "src/app/openaireLibrary/utils/properties/searchFields.ts",
"with": "src/app/shared/searchFields.community.ts"
}
],
"outputPath": "dist/connect/browser",
"index": "src/index.html",
"main": "src/main.ts",
@ -74,6 +80,12 @@
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/app/openaireLibrary/utils/properties/searchFields.ts",
"with": "src/app/shared/searchFields.community.ts"
}
],
"styles": [
"src/assets/common-assets/library-css/material.scss"
],
@ -98,6 +110,10 @@
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.beta.ts"
},
{
"replace": "src/app/openaireLibrary/utils/properties/searchFields.ts",
"with": "src/app/shared/searchFields.community.ts"
}
],
"optimization": {
@ -138,6 +154,10 @@
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
},
{
"replace": "src/app/openaireLibrary/utils/properties/searchFields.ts",
"with": "src/app/shared/searchFields.community.ts"
}
],
"optimization": {
@ -221,7 +241,13 @@
"sourceMap": false,
"optimization": true,
"vendorChunk": true,
"buildOptimizer": true
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/app/openaireLibrary/utils/properties/searchFields.ts",
"with": "src/app/shared/searchFields.community.ts"
}
]
},
"beta": {
"outputHashing": "media",
@ -229,6 +255,10 @@
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.beta.ts"
},
{
"replace": "src/app/openaireLibrary/utils/properties/searchFields.ts",
"with": "src/app/shared/searchFields.community.ts"
}
],
"sourceMap": false,
@ -241,6 +271,10 @@
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
},
{
"replace": "src/app/openaireLibrary/utils/properties/searchFields.ts",
"with": "src/app/shared/searchFields.community.ts"
}
],
"sourceMap": false,

View File

@ -309,11 +309,13 @@ export class AppComponent implements OnInit, OnDestroy {
initAdminToolCommunity(communityId) {
if (communityId) {
this.properties.adminToolsPortalType = "community";
this.properties.plan = communityId == 'covid-19'?'Premium':this.community.plan;
if (this.document) {
this.initLayout(communityId);
}
} else {
this.properties.adminToolsPortalType = "connect";
this.properties.plan = null;
if (this.document) {
this.initLayout(this.communityId?this.communityId:'connect');
}
@ -409,7 +411,7 @@ export class AppComponent implements OnInit, OnDestroy {
new MenuItem("search", "Search", "", "/search/find", false, [], ["/search/find"], {},
null, null, null, null, "_blank", "internal", false,
[
new MenuItem("", OpenaireEntities.RESULTS, "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {resultbestaccessright: '"' + encodeURIComponent("Open Access") + '"'}),
new MenuItem("", OpenaireEntities.RESULTS, "", "/search/find/research-outcomes", false, [], ["/search/find/research-outcomes"], {}),
new MenuItem("", OpenaireEntities.PROJECTS, "", "/search/find/projects/", false, ["project"], ["/search/find/projects"], {}),
new MenuItem("", OpenaireEntities.DATASOURCES, "", "/search/find/dataproviders", false, ["datasource"], ["/search/find/dataproviders"], {}),
]

View File

@ -0,0 +1,71 @@
import {SearchFieldsBase} from "src/app/openaireLibrary/utils/properties/searchFields.base";
import {properties} from "src/environments/environment";
export class SearchFields extends SearchFieldsBase {
constructor() {
super();
if(properties.plan == "Premium" && properties.environment != 'production'){
this.RESULT_REFINE_FIELDS.push("relorganization");
this.RESULT_FIELDS_ORDERED[3].values.push("relorganization")
}
}
public static getParameterOrder(fieldId: string, params): number {
let fields = [];
let searchFields = new SearchFields();
if (searchFields.RESULT_REFINE_FIELDS.indexOf(fieldId) != -1) {
fields = searchFields.RESULT_REFINE_FIELDS;
} else if (searchFields.PROJECT_REFINE_FIELDS.indexOf(fieldId) != -1) {
fields = searchFields.PROJECT_REFINE_FIELDS
} else if (searchFields.ORGANIZATION_REFINE_FIELDS.indexOf(fieldId) != -1) {
fields = searchFields.ORGANIZATION_REFINE_FIELDS;
} else if (searchFields.DATASOURCE_REFINE_FIELDS.indexOf(fieldId) != -1) {
fields = searchFields.DATASOURCE_REFINE_FIELDS;
}
let index = fields.indexOf(fieldId);
let paramIndex = 0;
if (index != -1) {
for (let keyValue of params) {
if (fields.indexOf(keyValue[0]) > index) {
break;
}
paramIndex++
}
}
return paramIndex;
}
}
export enum OpenaireEntities {
RESULTS = "Research products",
PUBLICATIONS = "Publications",
DATASETS = "Research data",
SOFTWARE = "Research software",
OTHER = "Other research products",
PROJECTS = "Projects",
ORGANIZATIONS = "Organizations",
DATASOURCES = "Data sources",
SERVICES = "Services",
COMMUNITIES = "Research communities",
RESULT = "Research product",
PUBLICATION = "Publication",
DATASET = "Research data",
SOFTWARE_SINGULAR = "Research software",
OTHER_SINGULAR = "Other research product",
PROJECT = "Project",
ORGANIZATION = "Organization",
DATASOURCE = "Data source",
SERVICE = "Service",
COMMUNITY = "Research community",
RESULTS_FILE = "research-products",
PUBLICATIONS_FILE = "publications",
DATASETS_FILE = "research-data",
SOFTWARE_FILE = "research-software",
OTHER_FILE = "other-research-products",
PROJECTS_FILE = "projects",
ORGANIZATIONS_FILE = "organizations",
DATASOURCES_FILE = "data-sources",
SERVICES_FILE = "services",
}