Merge remote-tracking branch 'origin/develop' into new-search-json
This commit is contained in:
commit
5335e9a247
|
@ -7,21 +7,19 @@ import {properties} from "../../../../../environments/environment";
|
|||
@Component({
|
||||
selector: 'project-title',
|
||||
template: `
|
||||
<ng-container>
|
||||
<h6 class="uk-margin-remove multi-line-ellipsis lines-2">
|
||||
<p class="uk-margin-remove">
|
||||
<a *ngIf="externalPortalUrl" [href]="externalPortalUrl + projectUrl + '?projectId='+project['openaireId']" class="uk-link uk-link-heading" [class.uk-disabled]="project.name == 'unidentified'">
|
||||
<span *ngIf="project['code'] != 'unidentified'">{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}</span>
|
||||
<span *ngIf="project['code'] == 'unidentified'">{{project['funderName']}}</span>
|
||||
<span *ngIf="project['name'] != 'unidentified'">{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}</span>
|
||||
<span *ngIf="project['name'] == 'unidentified'">{{project['funderName']}}</span>
|
||||
</a>
|
||||
<a *ngIf="!externalPortalUrl" [routerLink]="projectUrl" [queryParams]="routerHelper.createQueryParam('projectId',project['openaireId'])" class="uk-link uk-link-heading" [class.uk-disabled]="project.name == 'unidentified'">
|
||||
<span *ngIf="project['code'] != 'unidentified'">{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}</span>
|
||||
<span *ngIf="project['code'] == 'unidentified'">{{project['funderName']}} </span>
|
||||
<span *ngIf="project['name'] != 'unidentified'">{{(project['acronym'] ? ('[' + project['acronym'] + '] ') : '')}}{{project['name']}}</span>
|
||||
<span *ngIf="project['name'] == 'unidentified'">{{project['funderName']}} </span>
|
||||
</a>
|
||||
</p>
|
||||
</h6>
|
||||
</ng-container>
|
||||
<span *ngIf="project['funderName'] && project['code'] != 'unidentified'" class="uk-margin-small-top">
|
||||
<span *ngIf="project['funderName'] && project['name'] != 'unidentified'" class="uk-margin-small-top">
|
||||
<span class="uk-text-meta">Funder: </span>{{project['funderName']}}
|
||||
</span>
|
||||
`
|
||||
|
@ -40,5 +38,6 @@ export class ProjectTitleFormatter {
|
|||
|
||||
ngOnInit() {
|
||||
this.url = this.searchLink + "?projectId=" + this.project["openaireId"];
|
||||
console.log(this.project)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ import {PluginCardInfo} from "./plugin-card-info.component";
|
|||
<hr class="uk-margin-left">
|
||||
<div class="uk-margin-top" title="Use material icons to update the card icon">
|
||||
<div class="uk-width-1-1 uk-text-right">
|
||||
<a href="https://fonts.google.com/icons" target="_blank" class="uk-text-xsmall uk-text-right custom-external">More options</a>
|
||||
<a href="https://fonts.google.com/icons?icon.set=Material+Icons" target="_blank" class="uk-text-xsmall uk-text-right custom-external">More options</a>
|
||||
</div>
|
||||
<plugin-field-edit [value]=" pluginObject.cardInfoArray[selectedIndex].icon"
|
||||
type="text" field="icon" placeholder="Material icon"
|
||||
|
|
|
@ -18,11 +18,14 @@
|
|||
<div class="uk-text-center uk-margin-bottom description">
|
||||
{{card.description}}
|
||||
</div>
|
||||
<a *ngFor="let url of card.urlsArray" [href]="card.url" [class.uk-hidden]="!(url.url && url.url.length > 0)"
|
||||
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default"
|
||||
[target]="url.target" [routerLink]="url.route?url.url:null" [class.uk-disabled] =previewInAdmin>
|
||||
<ng-container *ngFor="let url of card.urlsArray">
|
||||
<plugin-url [url]="url" [previewInAdmin]="previewInAdmin" classAttribute="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default"></plugin-url>
|
||||
</ng-container>
|
||||
|
||||
<!--<a *ngFor="let url of card.urlsArray" [route]="url.url" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default" [target]="url.target"
|
||||
[class.uk-hidden]="!(url.url && url.url.length > 0)" [routerLink]="url.route?url.url:null" [class.uk-disabled] =previewInAdmin>
|
||||
{{url.linkText}}
|
||||
</a>
|
||||
</a>-->
|
||||
</div>
|
||||
</ng-container>
|
||||
</ng-container>
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -38,17 +38,13 @@ import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.
|
|||
export class PluginOpenaireProductsFormComponent extends PluginBaseFormComponent<PluginOpenAIREProducts>{
|
||||
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;
|
||||
}))
|
||||
|
|
|
@ -23,10 +23,8 @@
|
|||
<div [innerHTML]="pluginObject.paragraph2"></div>
|
||||
|
||||
<div class="uk-margin-top">
|
||||
<a [href]="pluginObject.url.url" [target]="pluginObject.url.target"
|
||||
class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text">
|
||||
{{pluginObject.url.linkText}}
|
||||
</a>
|
||||
<plugin-url [url]="pluginObject.url" [previewInAdmin]="previewInAdmin" classAttribute="uk-display-inline-block uk-text-uppercase uk-button uk-button-text"></plugin-url>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -16,10 +16,9 @@
|
|||
{{card.title}}
|
||||
</div>
|
||||
<div class="uk-text-small">{{card.description}}</div>
|
||||
<a *ngFor="let url of card.urlsArray" [route]="url.url" class="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default" [target]="url.target"
|
||||
[class.uk-hidden]="!(url.url && url.url.length > 0)" [routerLink]="url.route?url.url:null" [class.uk-disabled] =previewInAdmin>
|
||||
{{url.linkText}}
|
||||
</a>
|
||||
<ng-container *ngFor="let url of card.urlsArray">
|
||||
<plugin-url [url]="url" [previewInAdmin]="previewInAdmin" classAttribute="uk-display-inline-block uk-text-uppercase uk-button uk-button-text uk-text-default"></plugin-url>
|
||||
</ng-container>
|
||||
</slider-nav-item>
|
||||
</ng-container>
|
||||
</slider-column>
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
<plugin-wrapper *ngIf="this.templateForm" [pluginTemplate]="selectedTemplate"
|
||||
[plugin]="this.templateForm.getRawValue()"
|
||||
[pluginObject]="this.selectedPlugin.object"
|
||||
class="uk-width-1-1"></plugin-wrapper>
|
||||
class="uk-width-1-1" [previewInAdmin]="true"></plugin-wrapper>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
|
||||
<div>No plugins found</div>
|
||||
</div>
|
||||
<clear-cache *ngIf="clearCacheRequests && showClearCache()" [requests]="clearCacheRequests"></clear-cache>
|
||||
<ng-container *ngFor="let placement of pluginUtils.placementsOptions">
|
||||
|
||||
<ng-container *ngIf="selectedPlacementView == placement.value || selectedPlacementView == 'all'">
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
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: `
|
||||
<span title="{{previewInAdmin?'Note: links are disabled in administration dashboard':''}}">
|
||||
<a *ngIf="url.route"
|
||||
[class]="classAttribute"
|
||||
[routerLink]="url.url" [class.uk-disabled]=previewInAdmin>
|
||||
{{url.linkText}}
|
||||
</a>
|
||||
<a *ngIf="!url.route" [href]="url.url" [class.uk-hidden]="!(url.url && url.url.length > 0)"
|
||||
[class]="classAttribute"
|
||||
[target]="url.target" [class.uk-disabled]=previewInAdmin>
|
||||
{{url.linkText}}
|
||||
</a>
|
||||
</span>
|
||||
`,
|
||||
|
||||
standalone :true
|
||||
|
||||
})
|
||||
export class PluginUrlComponent {
|
||||
|
||||
@Input() url:PluginURL;
|
||||
@Input() previewInAdmin:boolean;
|
||||
@Input() classAttribute;
|
||||
htmlEditorView = false;
|
||||
|
||||
|
||||
}
|
|
@ -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: `
|
||||
<ng-container *ngIf="requests && requests.length > 0">
|
||||
<div class="uk-alert uk-padding-xsmall uk-text-small uk-text-center">
|
||||
Made changes but can't see them?
|
||||
<a (click)="promtToClear()">Try to clear the cache</a> to resolve the issue.
|
||||
</div>
|
||||
|
||||
<modal-alert #deleteCacheModal [overflowBody]="false" (alertOutput)="clear()"
|
||||
classTitle="uk-background-primary uk-light"></modal-alert>
|
||||
|
||||
</ng-container>
|
||||
`,
|
||||
})
|
||||
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue