From 4d670e416d8726f369c7af8fa48e3bb99dbd3272 Mon Sep 17 00:00:00 2001 From: argirok Date: Fri, 1 Nov 2024 12:28:31 +0200 Subject: [PATCH 1/7] [develop | FIXED | DONE] in display claims - fix project title for unidentified --- .../projectTitleFormatter.component.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/claims/claim-utils/entityFormatter/projectTitleFormatter.component.ts b/claims/claim-utils/entityFormatter/projectTitleFormatter.component.ts index 35690c2a..d21aaecb 100644 --- a/claims/claim-utils/entityFormatter/projectTitleFormatter.component.ts +++ b/claims/claim-utils/entityFormatter/projectTitleFormatter.component.ts @@ -7,21 +7,19 @@ import {properties} from "../../../../../environments/environment"; @Component({ selector: 'project-title', template: ` -

- {{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}} - {{project['funderName']}} + {{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}} + {{project['funderName']}} - {{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}} - {{project['funderName']}} + {{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}} + {{project['funderName']}}

-
- + Funder: {{project['funderName']}} ` @@ -40,5 +38,6 @@ export class ProjectTitleFormatter { ngOnInit() { this.url = this.searchLink + "?projectId=" + this.project["openaireId"]; + console.log(this.project) } } From e5ff78224eec468479dfc25c42a00f7ae685760e Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 4 Nov 2024 10:04:20 +0200 Subject: [PATCH 2/7] [develop | DONE | FIXED ] fix initialization from template for PluginCardInfo / ParagraphInfo --- dashboard/plugins/plugins-form/pluginsForm.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dashboard/plugins/plugins-form/pluginsForm.component.ts b/dashboard/plugins/plugins-form/pluginsForm.component.ts index 4dbb41db..f915981e 100644 --- a/dashboard/plugins/plugins-form/pluginsForm.component.ts +++ b/dashboard/plugins/plugins-form/pluginsForm.component.ts @@ -118,7 +118,7 @@ export class PluginsFormComponent implements OnInit { }else{ this.selectedPlugin = new Plugin(this.page._id,this.selectedCommunityPid, template); // this.selectedPlugin.order = this.pluginsByPlacement.get(this.selectedPlacementView).length; - this.selectedPlugin.object = PluginUtils.initializeObjectAndCompare(template.code,null); + this.selectedPlugin.object = PluginUtils.initializeObjectAndCompare(template.code,this.selectedPlugin.object); this.edit(this.selectedPlugin, this.selectedTemplate); } From 8083e7a53193de85f3e12764558bbf7736a9f1f0 Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 4 Nov 2024 10:46:46 +0200 Subject: [PATCH 3/7] [develop | DONE | ADDED ] ADD clear cache component in plugins for admins --- dashboard/plugins/plugins.component.html | 1 + dashboard/plugins/plugins.component.ts | 26 ++++++++-- dashboard/plugins/plugins.module.ts | 3 +- .../sharedComponents/clearCache.component.ts | 47 +++++++++++++++++++ 4 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 dashboard/sharedComponents/clearCache.component.ts diff --git a/dashboard/plugins/plugins.component.html b/dashboard/plugins/plugins.component.html index ee0a4b50..e466a3cb 100644 --- a/dashboard/plugins/plugins.component.html +++ b/dashboard/plugins/plugins.component.html @@ -68,6 +68,7 @@ class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
No plugins found
+ diff --git a/dashboard/plugins/plugins.component.ts b/dashboard/plugins/plugins.component.ts index 592e8f1c..7369c6cf 100644 --- a/dashboard/plugins/plugins.component.ts +++ b/dashboard/plugins/plugins.component.ts @@ -1,7 +1,7 @@ import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; import {ActivatedRoute, Router} from "@angular/router"; import {HelpContentService} from "../../services/help-content.service"; -import {FormArray, UntypedFormArray, UntypedFormBuilder, UntypedFormGroup, ValidatorFn} from "@angular/forms"; +import {UntypedFormBuilder, ValidatorFn} from "@angular/forms"; import {Page} from "../../utils/entities/adminTool/page"; import {EnvProperties} from '../../utils/properties/env-properties'; import {HelperFunctions} from "../../utils/HelperFunctions.class"; @@ -21,6 +21,8 @@ import {PluginUtils} from "./utils/pluginUtils"; import {CommunityService} from "../../connect/community/community.service"; import {CommunityInfo} from "../../connect/community/communityInfo"; import {AlertModal} from "../../utils/modal/alert"; +import {Session} from "../../login/utils/helper.class"; +import {UserManagementService} from "../../services/user-management.service"; @Component({ selector: 'plugins', @@ -62,12 +64,13 @@ export class PluginsComponent implements OnInit { // editSubmenuOpen = false; filterActive = false; @ViewChild('deleteModal') deleteModal: AlertModal; - + clearCacheRequests = []; + user; constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router, private communityService: CommunityService, private title: Title, private _helpContentService: HelpContentService, private _pluginsService: PluginsService, private _fb: UntypedFormBuilder, - private _clearCacheService: ClearCacheService) { + private _clearCacheService: ClearCacheService, private _userManagementService:UserManagementService) { } ngOnInit() { @@ -76,11 +79,24 @@ export class PluginsComponent implements OnInit { community => { this.communityInfo = community; })); + this.subscriptions.push(this._userManagementService.getUserInfo().subscribe( user =>{ + this.user = user; + })) this.subscriptions.push(this.route.params.subscribe(params => { this.portal = (this.route.snapshot.data.portal) ? this.route.snapshot.data.portal : this.route.snapshot.params[this.route.snapshot.data.param]; this.selectedCommunityPid = params.community; + //initiate requests for clear cache prompt + this.clearCacheRequests = []; + if (properties.deleteBrowserCacheUrl) { + this.clearCacheRequests.push(properties.deleteBrowserCacheUrl + "/" + this.selectedCommunityPid) + } + if (this.properties.deleteCacheUrl) { + this.clearCacheRequests.push(properties.deleteCacheUrl + "?url=" + encodeURIComponent(properties.utilsService + + "/portals/countResults?field=communityId&value=" + encodeURIComponent(this.selectedCommunityPid))); + } + console.log(this.clearCacheRequests) this.subscriptions.push(this.route.queryParams.subscribe(params => { HelperFunctions.scroll(); this.selectedPageId = params['pageId']; @@ -370,4 +386,8 @@ export class PluginsComponent implements OnInit { )); this.showLoading = false; } + + showClearCache(){ + return this.user && (Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user)); + } } diff --git a/dashboard/plugins/plugins.module.ts b/dashboard/plugins/plugins.module.ts index 063aaa85..9d555fd2 100644 --- a/dashboard/plugins/plugins.module.ts +++ b/dashboard/plugins/plugins.module.ts @@ -27,6 +27,7 @@ import {PluginWrapperModule} from "./wrapper/plugin-wrapper.module"; import {SideBarModule} from "../sharedComponents/sidebar/sideBar.module"; import {PluginEditWrapperModule} from "./wrapper/plugin-edit-wrapper.module"; import {TransitionGroupModule} from "../../utils/transition-group/transition-group.module"; +import {ClearCacheComponent} from "../sharedComponents/clearCache.component"; @NgModule({ @@ -34,7 +35,7 @@ import {TransitionGroupModule} from "../../utils/transition-group/transition-gro CommonModule, RouterModule, FormsModule, AlertModalModule, ReactiveFormsModule, AdminToolServiceModule, InputModule, MatAutocompleteModule, MatFormFieldModule, MatChipsModule, MatCheckboxModule, AdminTabsModule, PageContentModule, PluginsRoutingModule, SearchInputModule, IconsModule, LoadingModule, CKEditorModule, - MatSlideToggleModule, PluginWrapperModule, SideBarModule, PluginEditWrapperModule, TransitionGroupModule + MatSlideToggleModule, PluginWrapperModule, SideBarModule, PluginEditWrapperModule, TransitionGroupModule, ClearCacheComponent ], providers:[PluginsService], declarations: [PluginsComponent], diff --git a/dashboard/sharedComponents/clearCache.component.ts b/dashboard/sharedComponents/clearCache.component.ts new file mode 100644 index 00000000..dd442bc1 --- /dev/null +++ b/dashboard/sharedComponents/clearCache.component.ts @@ -0,0 +1,47 @@ +import {Component, Input, ViewChild} from "@angular/core"; +import {HttpClient} from "@angular/common/http"; +import {AlertModal} from "../../utils/modal/alert"; +import {AlertModalModule} from "../../utils/modal/alertModal.module"; +import {CommonModule} from "@angular/common"; + +@Component({ + standalone: true, + selector: 'clear-cache', + imports: [AlertModalModule, CommonModule], + template: ` + +
+ Made changes but can't see them? + Try to clear the cache to resolve the issue. +
+ + + +
+ `, +}) +export class ClearCacheComponent { + @Input() requests:string[] ; + @ViewChild('deleteCacheModal') deleteCacheModal: AlertModal; + + constructor(private http: HttpClient ) { + } + promtToClear(){ + this.deleteCacheModal.alertTitle = 'Confirm Cache Clear'; + this.deleteCacheModal.message = 'Are you sure you want to clear the service cache?'; + this.deleteCacheModal.okButtonText = 'Yes'; + this.deleteCacheModal.open(); + + } + + clear(){ + for( let request of this.requests){ + this.http.get(request).subscribe( res => { + console.log( res); + }); + } + } + + +} From 54624cd5dd63a92a2da32a8f3b718562feb45ea1 Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 4 Nov 2024 13:12:10 +0200 Subject: [PATCH 4/7] [develop | CHANGED | DONE] Plugins: add pluginUrl Component, replace code in plugin-card, plugin-graph-info, plugin search/link/deposit --- .../card-info/plugin-card-info.component.html | 11 +++--- .../card-info/plugin-card-info.module.ts | 3 +- .../plugin-graph-info.component.html | 6 ++-- .../plugin-graph-info.module.ts | 3 +- .../plugin-search-deposit-link.component.html | 7 ++-- .../plugin-search-deposit-link.module.ts | 3 +- .../plugins/utils/pluginUrl.component.ts | 35 +++++++++++++++++++ 7 files changed, 53 insertions(+), 15 deletions(-) create mode 100644 dashboard/plugins/utils/pluginUrl.component.ts diff --git a/dashboard/plugins/components/card-info/plugin-card-info.component.html b/dashboard/plugins/components/card-info/plugin-card-info.component.html index cef8227f..eff369d9 100644 --- a/dashboard/plugins/components/card-info/plugin-card-info.component.html +++ b/dashboard/plugins/components/card-info/plugin-card-info.component.html @@ -18,11 +18,14 @@
{{card.description}}
- + + + + +
diff --git a/dashboard/plugins/components/card-info/plugin-card-info.module.ts b/dashboard/plugins/components/card-info/plugin-card-info.module.ts index 19c04b43..51556275 100644 --- a/dashboard/plugins/components/card-info/plugin-card-info.module.ts +++ b/dashboard/plugins/components/card-info/plugin-card-info.module.ts @@ -9,10 +9,11 @@ import {IconsService} from "../../../../utils/icons/icons.service"; import {SearchResearchResultsServiceModule} from "../../../../services/searchResearchResultsService.module"; import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module"; import {PluginCardInfoComponent} from "./plugin-card-info.component"; +import {PluginUrlComponent} from "../../utils/pluginUrl.component"; @NgModule({ imports: [ - CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule + CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule, PluginUrlComponent ], providers:[PluginsService], declarations: [PluginCardInfoComponent], diff --git a/dashboard/plugins/components/paragraph-info/plugin-graph-info.component.html b/dashboard/plugins/components/paragraph-info/plugin-graph-info.component.html index 8d8f17bf..426002e3 100644 --- a/dashboard/plugins/components/paragraph-info/plugin-graph-info.component.html +++ b/dashboard/plugins/components/paragraph-info/plugin-graph-info.component.html @@ -23,10 +23,8 @@
diff --git a/dashboard/plugins/components/paragraph-info/plugin-graph-info.module.ts b/dashboard/plugins/components/paragraph-info/plugin-graph-info.module.ts index 6670d184..35fbc773 100644 --- a/dashboard/plugins/components/paragraph-info/plugin-graph-info.module.ts +++ b/dashboard/plugins/components/paragraph-info/plugin-graph-info.module.ts @@ -6,10 +6,11 @@ import {PluginsService} from "../../../../services/plugins.service"; import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module"; import {InputModule} from "../../../../sharedComponents/input/input.module"; import {PluginGraphInfoComponent} from "./plugin-graph-info.component"; +import {PluginUrlComponent} from "../../utils/pluginUrl.component"; @NgModule({ imports: [ - CommonModule, RouterModule, FormsModule, PluginFieldEditModule, InputModule + CommonModule, RouterModule, FormsModule, PluginFieldEditModule, InputModule, PluginUrlComponent ], providers: [ PluginsService diff --git a/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.component.html b/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.component.html index 7c844e1b..a16b268c 100644 --- a/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.component.html +++ b/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.component.html @@ -16,10 +16,9 @@ {{card.title}}
{{card.description}}
- - {{url.linkText}} - + + + diff --git a/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.module.ts b/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.module.ts index edcce0db..77a07704 100644 --- a/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.module.ts +++ b/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.module.ts @@ -10,11 +10,12 @@ import {SearchResearchResultsServiceModule} from "../../../../services/searchRes import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module"; import {PluginSearchDepositLinkComponent} from './plugin-search-deposit-link.component'; import {SliderUtilsModule} from "../../../../sharedComponents/slider-utils/slider-utils.module"; +import {PluginUrlComponent} from "../../utils/pluginUrl.component"; @NgModule({ imports: [ CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, - PluginFieldEditModule, SliderUtilsModule + PluginFieldEditModule, SliderUtilsModule, PluginUrlComponent ], providers:[PluginsService], declarations: [PluginSearchDepositLinkComponent], diff --git a/dashboard/plugins/utils/pluginUrl.component.ts b/dashboard/plugins/utils/pluginUrl.component.ts new file mode 100644 index 00000000..2cfefcad --- /dev/null +++ b/dashboard/plugins/utils/pluginUrl.component.ts @@ -0,0 +1,35 @@ +import {Component, Input} from '@angular/core'; +import {PluginURL} from "./base-plugin.component"; +import {CommonModule} from "@angular/common"; +import {RouterModule} from "@angular/router"; + + +@Component({ + imports:[CommonModule, RouterModule], + selector: 'plugin-url', + template: ` + + + {{url.linkText}} + + + {{url.linkText}} + + `, + + standalone :true + +}) +export class PluginUrlComponent { + + @Input() url:PluginURL; + @Input() previewInAdmin:boolean; + @Input() classAttribute; + htmlEditorView = false; + + +} From 44452ac9eec35a29566ab9604a030a74179b6719 Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 4 Nov 2024 13:20:17 +0200 Subject: [PATCH 5/7] [develop | DONE | CHANGED ] disable links in plugin form. Add a tooltip when disabled --- dashboard/plugins/plugins-form/pluginsForm.component.html | 2 +- dashboard/plugins/utils/pluginUrl.component.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dashboard/plugins/plugins-form/pluginsForm.component.html b/dashboard/plugins/plugins-form/pluginsForm.component.html index 676af549..ce470244 100644 --- a/dashboard/plugins/plugins-form/pluginsForm.component.html +++ b/dashboard/plugins/plugins-form/pluginsForm.component.html @@ -96,7 +96,7 @@ + class="uk-width-1-1" [previewInAdmin]="true"> diff --git a/dashboard/plugins/utils/pluginUrl.component.ts b/dashboard/plugins/utils/pluginUrl.component.ts index 2cfefcad..eae2a8b0 100644 --- a/dashboard/plugins/utils/pluginUrl.component.ts +++ b/dashboard/plugins/utils/pluginUrl.component.ts @@ -8,7 +8,7 @@ import {RouterModule} from "@angular/router"; imports:[CommonModule, RouterModule], selector: 'plugin-url', template: ` - + @@ -19,6 +19,7 @@ import {RouterModule} from "@angular/router"; [target]="url.target" [class.uk-disabled]=previewInAdmin> {{url.linkText}} + `, standalone :true From b044383f332e36adbdb647b416dd1fcbee25639a Mon Sep 17 00:00:00 2001 From: argirok Date: Mon, 4 Nov 2024 13:51:42 +0200 Subject: [PATCH 6/7] [develop | DONE | CHANGED ] update catalogue services Ids --- .../plugin-openaire-products.component.ts | 2 +- .../plugin-openaire-products.form.component.ts | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/dashboard/plugins/components/openaireProducts/plugin-openaire-products.component.ts b/dashboard/plugins/components/openaireProducts/plugin-openaire-products.component.ts index 42bfe15c..df3d827f 100644 --- a/dashboard/plugins/components/openaireProducts/plugin-openaire-products.component.ts +++ b/dashboard/plugins/components/openaireProducts/plugin-openaire-products.component.ts @@ -4,7 +4,7 @@ import {HttpClient} from "@angular/common/http"; export class PluginOpenAIREProducts extends PluginBaseInfo{ title:string ="OpenAIRE services for your community"; - serviceIdsArray = ["argos","zenodo","amnesia"]; + serviceIdsArray = ["openaire.argos","cern.zenodo","athenarc.amnesia"]; compare(oldObject): any { return super.compare(oldObject); } diff --git a/dashboard/plugins/components/openaireProducts/plugin-openaire-products.form.component.ts b/dashboard/plugins/components/openaireProducts/plugin-openaire-products.form.component.ts index 7dfc5292..0e7cf380 100644 --- a/dashboard/plugins/components/openaireProducts/plugin-openaire-products.form.component.ts +++ b/dashboard/plugins/components/openaireProducts/plugin-openaire-products.form.component.ts @@ -38,17 +38,13 @@ import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin. export class PluginOpenaireProductsFormComponent extends PluginBaseFormComponent{ default = new PluginOpenAIREProducts(); services = []; - excludedServiceIds = ["openaire_login","research_community_dashboard"] + excludedServiceIds = ["openaire.aai","openaire.connect"] api= "https://catalogue.openaire.eu/api/catalogue-resources?from=0&quantity=100&order=asc&orderField=name"; showErrorMessage = false; constructor(http:HttpClient) { super() this.subscriptions.push(http.get( this.properties.cacheUrl + encodeURIComponent(this.api)).subscribe(res =>{ - this.services = res["results"].map( x=> { - x.id = x.id.split("openaire.")[1] - return x; - }); - this.services = this.services.filter(x=> this.excludedServiceIds.indexOf(x.id) ==-1); + this.services = res["results"].filter(x=> this.excludedServiceIds.indexOf(x.id) ==-1); }, error => { this.showErrorMessage = true; })) From 503ab40616c53a071cd74fb2802cd3de130923f6 Mon Sep 17 00:00:00 2001 From: argirok Date: Tue, 5 Nov 2024 15:04:04 +0200 Subject: [PATCH 7/7] [develop | DONE | CHANGED ] update material icons link --- .../components/card-info/plugin-card-info-form.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dashboard/plugins/components/card-info/plugin-card-info-form.component.ts b/dashboard/plugins/components/card-info/plugin-card-info-form.component.ts index 7a5001e4..7715de7e 100644 --- a/dashboard/plugins/components/card-info/plugin-card-info-form.component.ts +++ b/dashboard/plugins/components/card-info/plugin-card-info-form.component.ts @@ -67,7 +67,7 @@ import {PluginCardInfo} from "./plugin-card-info.component";