From c64b1213ac321fbff937cb89e9c0c7839fffa73d Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Wed, 6 Dec 2023 13:57:49 +0200 Subject: [PATCH] [master]: 1. Change search-form class in advnanced search pages and implement hook in styles. 2. Add searchField.irish.ts and replace the default on in angular.json. 3. Replace Research Products with OpenAIREEntities.RESULTS (dynamic). 4. Update library and assets. --- angular.json | 6 ++ src/app/national/national.component.ts | 4 +- src/app/openaireLibrary | 2 +- src/app/repository/repository.component.ts | 4 +- src/app/rfo/rfo.component.ts | 5 +- src/app/rpo/rpo.component.ts | 5 +- .../advanced/searchDataproviders.component.ts | 2 +- .../advanced/searchOrganizations.component.ts | 6 +- .../advanced/searchProjects.component.ts | 2 +- .../searchResearchResults.component.ts | 10 +-- .../simple/searchResearchResults.component.ts | 6 +- src/app/shared/searchFields.irish.ts | 63 +++++++++++++++++++ src/assets/common-assets | 2 +- src/assets/common.less | 14 +++++ src/assets/irish-monitor.less | 36 +++-------- src/assets/openaire-theme | 2 +- src/styles.less | 4 +- 17 files changed, 116 insertions(+), 57 deletions(-) create mode 100644 src/app/shared/searchFields.irish.ts create mode 100644 src/assets/common.less diff --git a/angular.json b/angular.json index 83a836d..07099ab 100644 --- a/angular.json +++ b/angular.json @@ -35,6 +35,12 @@ "build": { "builder": "@angular-devkit/build-angular:browser", "options": { + "fileReplacements": [ + { + "replace": "src/app/openaireLibrary/utils/properties/searchFields.ts", + "with": "src/app/shared/searchFields.irish.ts" + } + ], "outputPath": "dist/irish-monitor/browser", "index": "src/index.html", "main": "src/main.ts", diff --git a/src/app/national/national.component.ts b/src/app/national/national.component.ts index 6428a8c..c253bf1 100644 --- a/src/app/national/national.component.ts +++ b/src/app/national/national.component.ts @@ -10,6 +10,7 @@ import {LinksResolver} from "../search/links-resolver"; import {CustomFilterService} from "../shared/customFilter.service"; import {StakeholderBaseComponent} from "../openaireLibrary/monitor-admin/utils/stakeholder-base.component"; import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service"; +import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields"; @Component({ selector: 'national', @@ -30,7 +31,7 @@ import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sideb {{entities.stakeholder}}
  • - Browse Research Outputs + Browse {{openaireEntities.RESULTS}}
  • @@ -51,6 +52,7 @@ export class NationalComponent extends StakeholderBaseComponent implements OnIni stakeholder: Stakeholder; loading: boolean = true; isSearch: boolean = false; + openaireEntities = OpenaireEntities; constructor(private stakeholderService: StakeholderService, private layoutService: LayoutService, diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary index 0b90448..736546c 160000 --- a/src/app/openaireLibrary +++ b/src/app/openaireLibrary @@ -1 +1 @@ -Subproject commit 0b90448e01f1d0a1f4b5eb2546d3b8437ccf21e7 +Subproject commit 736546c0ebd31d75035f78e72b833982f9f9e205 diff --git a/src/app/repository/repository.component.ts b/src/app/repository/repository.component.ts index bec32bc..19db66e 100644 --- a/src/app/repository/repository.component.ts +++ b/src/app/repository/repository.component.ts @@ -10,6 +10,7 @@ import {CustomFilterService} from "../shared/customFilter.service"; import {LinksResolver} from "../search/links-resolver"; import {SearchCustomFilter} from "../openaireLibrary/searchPages/searchUtils/searchUtils.class"; import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service"; +import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields"; @Component({ selector: 'repository', @@ -33,7 +34,7 @@ import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sideb
  • - Browse Research Outputs + Browse {{openaireEntities.RESULTS}}
  • @@ -52,6 +53,7 @@ export class RepositoryComponent extends StakeholderBaseComponent implements OnI alias: string; isSearch: boolean = false; loading: boolean = false; + openaireEntities = OpenaireEntities; constructor(private stakeholderService: StakeholderService, private layoutService: LayoutService, diff --git a/src/app/rfo/rfo.component.ts b/src/app/rfo/rfo.component.ts index 74506e1..949bf03 100644 --- a/src/app/rfo/rfo.component.ts +++ b/src/app/rfo/rfo.component.ts @@ -10,6 +10,7 @@ import {LinksResolver} from "../search/links-resolver"; import {CustomFilterService} from "../shared/customFilter.service"; import {StakeholderBaseComponent} from "../openaireLibrary/monitor-admin/utils/stakeholder-base.component"; import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service"; +import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields"; @Component({ selector: 'rfo', @@ -31,8 +32,7 @@ import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sideb (click)="isSearch = false">{{entities.stakeholder}}
  • - Browse - Research Outputs + Browse {{openaireEntities.RESULTS}}
  • @@ -50,6 +50,7 @@ export class RfoComponent extends StakeholderBaseComponent implements OnInit { alias: string; isSearch: boolean = false; loading: boolean = false; + openaireEntities = OpenaireEntities; constructor(private stakeholderService: StakeholderService, private layoutService: LayoutService, diff --git a/src/app/rpo/rpo.component.ts b/src/app/rpo/rpo.component.ts index 0eb98f6..8b6c389 100644 --- a/src/app/rpo/rpo.component.ts +++ b/src/app/rpo/rpo.component.ts @@ -10,6 +10,7 @@ import {LinksResolver} from "../search/links-resolver"; import {CustomFilterService} from "../shared/customFilter.service"; import {StakeholderBaseComponent} from "../openaireLibrary/monitor-admin/utils/stakeholder-base.component"; import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service"; +import {OpenaireEntities} from "../openaireLibrary/utils/properties/searchFields"; @Component({ selector: 'rpo', @@ -31,8 +32,7 @@ import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sideb (click)="isSearch = false">{{entities.stakeholder}}
  • - Browse - Research Outputs + Browse {{openaireEntities.RESULTS}}
  • @@ -51,6 +51,7 @@ export class RpoComponent extends StakeholderBaseComponent implements OnInit { alias: string; isSearch: boolean = false; loading: boolean = false; + openaireEntities = OpenaireEntities; constructor(private stakeholderService: StakeholderService, private _customFilterService: CustomFilterService, diff --git a/src/app/search/searchPages/advanced/searchDataproviders.component.ts b/src/app/search/searchPages/advanced/searchDataproviders.component.ts index 19a36da..007afa4 100644 --- a/src/app/search/searchPages/advanced/searchDataproviders.component.ts +++ b/src/app/search/searchPages/advanced/searchDataproviders.component.ts @@ -11,7 +11,7 @@ import {CustomFilterService} from "../../../shared/customFilter.service"; [hasPrefix]="false" [showBreadcrumb]="false" [showSwitchSearchLink]="true" - [searchForm]="{dark: false, class: 'irish-advanced-search-form'}" + [searchForm]="{dark: false, class: 'search-form'}" [openaireLink]="'https://'+(properties.environment != 'production'?'beta.':'')+'explore.openaire.eu/search/simple/projects'"> ` diff --git a/src/app/search/searchPages/advanced/searchOrganizations.component.ts b/src/app/search/searchPages/advanced/searchOrganizations.component.ts index 0ca9bab..e2478f6 100644 --- a/src/app/search/searchPages/advanced/searchOrganizations.component.ts +++ b/src/app/search/searchPages/advanced/searchOrganizations.component.ts @@ -7,10 +7,8 @@ import {CustomFilterService} from "../../../shared/customFilter.service"; selector: 'monitor-advanced-search-organizations', template: ` ` diff --git a/src/app/search/searchPages/advanced/searchProjects.component.ts b/src/app/search/searchPages/advanced/searchProjects.component.ts index b2b3bcb..cfc6884 100644 --- a/src/app/search/searchPages/advanced/searchProjects.component.ts +++ b/src/app/search/searchPages/advanced/searchProjects.component.ts @@ -11,7 +11,7 @@ import {CustomFilterService} from "../../../shared/customFilter.service"; [hasPrefix]="false" [showBreadcrumb]="false" [showSwitchSearchLink]="true" - [searchForm]="{dark: false, class: 'irish-advanced-search-form'}" + [searchForm]="{dark: false, class: 'search-form'}" [openaireLink]="'https://'+(properties.environment != 'production'?'beta.':'')+'explore.openaire.eu/search/simple/projects'" > diff --git a/src/app/search/searchPages/advanced/searchResearchResults.component.ts b/src/app/search/searchPages/advanced/searchResearchResults.component.ts index fce891a..c3d226e 100644 --- a/src/app/search/searchPages/advanced/searchResearchResults.component.ts +++ b/src/app/search/searchPages/advanced/searchResearchResults.component.ts @@ -10,17 +10,11 @@ import {CustomFilterService} from "../../../shared/customFilter.service"; [customFilters]=customFilters [hasPrefix]="false" [showBreadcrumb]="false" [showSwitchSearchLink]="true" - [searchForm]="{dark: false, class: 'irish-advanced-search-form'}" + [searchForm]="{dark: false, class: 'search-form'}" [openaireLink]="'https://'+(properties.environment != 'production'?'beta.':'')+'explore.openaire.eu/search/advanced/research-outcomes'" > - `,styles:[` - .irish-advanced-search-form #searchForm{ - margin-top:0px; - padding-top:0px; - } - `] - + ` }) export class MonitorAdvancedSearchResearchResultsComponent extends SearchBaseComponent implements OnInit{ constructor(protected route: ActivatedRoute, diff --git a/src/app/search/searchPages/simple/searchResearchResults.component.ts b/src/app/search/searchPages/simple/searchResearchResults.component.ts index ddc1331..43b9208 100644 --- a/src/app/search/searchPages/simple/searchResearchResults.component.ts +++ b/src/app/search/searchPages/simple/searchResearchResults.component.ts @@ -2,6 +2,7 @@ import {Component} from '@angular/core'; import {ActivatedRoute, Router} from "@angular/router"; import {CustomFilterService} from "../../../shared/customFilter.service"; import {SearchBaseComponent} from "../searchBaseComponent"; +import {OpenaireEntities} from "../../../openaireLibrary/utils/properties/searchFields"; @Component({ selector: 'monitor-search-results', @@ -11,7 +12,7 @@ import {SearchBaseComponent} from "../searchBaseComponent";
    Advanced search
    -
    @@ -23,7 +24,8 @@ import {SearchBaseComponent} from "../searchBaseComponent"; [searchForm]="{dark: false, class: 'search-form'}"> `, }) -export class MonitorSearchResearchResultsComponent extends SearchBaseComponent{ +export class MonitorSearchResearchResultsComponent extends SearchBaseComponent { + openaireEntities = OpenaireEntities; constructor(protected route: ActivatedRoute, protected router: Router, diff --git a/src/app/shared/searchFields.irish.ts b/src/app/shared/searchFields.irish.ts new file mode 100644 index 0000000..48d719b --- /dev/null +++ b/src/app/shared/searchFields.irish.ts @@ -0,0 +1,63 @@ +import {SearchFieldsBase} from "src/app/openaireLibrary/utils/properties/searchFields.base"; + +export class SearchFields extends SearchFieldsBase { + + 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", +} diff --git a/src/assets/common-assets b/src/assets/common-assets index b68f375..3bd0419 160000 --- a/src/assets/common-assets +++ b/src/assets/common-assets @@ -1 +1 @@ -Subproject commit b68f375714b679743e586bb2fb4721e633e43fc1 +Subproject commit 3bd0419facb2699e30b743b4a8ea2a2a9a8aa2bc diff --git a/src/assets/common.less b/src/assets/common.less new file mode 100644 index 0000000..bed07fe --- /dev/null +++ b/src/assets/common.less @@ -0,0 +1,14 @@ +@import "~src/assets/extend-theme/less/_import"; +@import "~src/assets/common-assets/less/general"; +@import "~src/assets/common-assets/less/landing"; +@import "~src/assets/common-assets/less/dashboard"; +@import "~src/assets/common-assets/less/indicators"; + +@general-search-form-background: none; + +.hook-general-search-form() { + & #searchForm { + margin-top: 0 !important; + padding-top: 0 !important; + } +} diff --git a/src/assets/irish-monitor.less b/src/assets/irish-monitor.less index 6829441..c8f7908 100644 --- a/src/assets/irish-monitor.less +++ b/src/assets/irish-monitor.less @@ -1,24 +1,14 @@ -@general-search-form-background: none; - .country { - @import (multiple) "~src/assets/extend-theme/less/_import"; - @import (multiple) "~src/assets/common-assets/less/general"; - @import (multiple) "~src/assets/common-assets/less/landing"; - @import (multiple) "~src/assets/common-assets/less/dashboard"; - @import (multiple) "~src/assets/common-assets/less/indicators"; + @import (multiple) "~src/assets/common"; - @banner-mode: light; - @banner-background: @global-primary-gradient; @primary-color: @primary-dark-color; @secondary-color: @irish-global-primary-color; + @banner-mode: light; + @banner-background: @global-primary-gradient; } .funder { - @import (multiple) "~src/assets/extend-theme/less/_import"; - @import (multiple) "~src/assets/common-assets/less/general"; - @import (multiple) "~src/assets/common-assets/less/landing"; - @import (multiple) "~src/assets/common-assets/less/dashboard"; - @import (multiple) "~src/assets/common-assets/less/indicators"; + @import (multiple) "~src/assets/common"; @primary-color: @funder-color; @secondary-color: #9A4DDD; @@ -30,11 +20,7 @@ } .organization { - @import (multiple) "~src/assets/extend-theme/less/_import"; - @import (multiple) "~src/assets/common-assets/less/general"; - @import (multiple) "~src/assets/common-assets/less/landing"; - @import (multiple) "~src/assets/common-assets/less/dashboard"; - @import (multiple) "~src/assets/common-assets/less/indicators"; + @import (multiple) "~src/assets/common"; @primary-color: @organization-color; @secondary-color: #EB4386; @@ -46,11 +32,7 @@ } .datasource { - @import (multiple) "~src/assets/extend-theme/less/_import"; - @import (multiple) "~src/assets/common-assets/less/general"; - @import (multiple) "~src/assets/common-assets/less/landing"; - @import (multiple) "~src/assets/common-assets/less/dashboard"; - @import (multiple) "~src/assets/common-assets/less/indicators"; + @import (multiple) "~src/assets/common"; @primary-color: @datasource-color; @secondary-color: #CB4C99; @@ -62,11 +44,7 @@ } .researcher { - @import (multiple) "~src/assets/extend-theme/less/_import"; - @import (multiple) "~src/assets/common-assets/less/general"; - @import (multiple) "~src/assets/common-assets/less/landing"; - @import (multiple) "~src/assets/common-assets/less/dashboard"; - @import (multiple) "~src/assets/common-assets/less/indicators"; + @import (multiple) "~src/assets/common"; @primary-color: @researcher-color; @secondary-color: #3086ED; diff --git a/src/assets/openaire-theme b/src/assets/openaire-theme index b64262c..074205f 160000 --- a/src/assets/openaire-theme +++ b/src/assets/openaire-theme @@ -1 +1 @@ -Subproject commit b64262cb3bb5a5f326054771dcc03237b0957409 +Subproject commit 074205f9dc1d40a26c6bf90dcc2fcd5ecf0733f3 diff --git a/src/styles.less b/src/styles.less index b6252bc..36fde13 100644 --- a/src/styles.less +++ b/src/styles.less @@ -1,9 +1,7 @@ /* You can add global styles to this file, and also import other style files */ /* Import Irish theme*/ -@import "~src/assets/extend-theme/less/_import"; -@import "~src/assets/common-assets/less/general"; +@import "~src/assets/common"; @import "~src/assets/common-assets/less/user"; @import "~src/assets/common-assets/less/linking"; -@import "~src/assets/common-assets/less/dashboard"; @import "~src/assets/common-assets/less/ckeditor"; @import "~src/assets/irish-monitor";