diff --git a/dashboard/plugins/components/how-to-use/plugin-how-to-use.form.component.ts b/dashboard/plugins/components/card-info/plugin-card-info-form.component.ts similarity index 84% rename from dashboard/plugins/components/how-to-use/plugin-how-to-use.form.component.ts rename to dashboard/plugins/components/card-info/plugin-card-info-form.component.ts index e2111fee..1c5c8f56 100644 --- a/dashboard/plugins/components/how-to-use/plugin-how-to-use.form.component.ts +++ b/dashboard/plugins/components/card-info/plugin-card-info-form.component.ts @@ -1,15 +1,17 @@ import {Component, Input, SimpleChanges} from '@angular/core'; -import {PluginHowToUse} from "./plugin-how-to-use.component"; import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.form.component"; +import {PluginCardInfo} from "./plugin-card-info.component"; @Component({ - selector: 'plugin-how-to-use-form', + selector: 'plugin-card-info-form', template: `
- + +
Cards:
@@ -59,7 +61,14 @@ import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.
+
+
+
+ Check icons +
@@ -82,7 +91,7 @@ import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin. }) -export class PluginHowToUseFormComponent extends PluginBaseFormComponent { +export class PluginCardInfoFormComponent extends PluginBaseFormComponent { selectedIndex = -1; @Input() editSubmenuOpen; diff --git a/dashboard/plugins/components/how-to-use/plugin-how-to-use.component.html b/dashboard/plugins/components/card-info/plugin-card-info.component.html similarity index 73% rename from dashboard/plugins/components/how-to-use/plugin-how-to-use.component.html rename to dashboard/plugins/components/card-info/plugin-card-info.component.html index c2e37fd4..76a43380 100644 --- a/dashboard/plugins/components/how-to-use/plugin-how-to-use.component.html +++ b/dashboard/plugins/components/card-info/plugin-card-info.component.html @@ -1,15 +1,16 @@ -
+

{{pluginObject.title}}

+

{{pluginObject.description}}

-
- +
+
{{card.title}} diff --git a/dashboard/plugins/components/card-info/plugin-card-info.component.ts b/dashboard/plugins/components/card-info/plugin-card-info.component.ts new file mode 100644 index 00000000..016c08e7 --- /dev/null +++ b/dashboard/plugins/components/card-info/plugin-card-info.component.ts @@ -0,0 +1,24 @@ +import {Component} from '@angular/core'; +import {PluginBaseComponent, PluginBaseInfo, PluginInfoCards, PluginURL} from "../../utils/base-plugin.component"; +export class PluginCardInfo extends PluginBaseInfo{ + title:string ="Lorem ipsum"; + description:string = "Lorem ipsum"; + cardInfoArray: PluginInfoCards[] = [ + {title: "Card 1", description: "Lorem ipsum", icon:"description", urlsArray:[ new PluginURL("https://exapmle.com","View all")], show:true}, + {title: "Card 2", description: "Lorem ipsum", icon:"description", urlsArray:[ new PluginURL("https://exapmle.com","")/*, new PluginURL("","Guide for the managers")*/], show:true}, + {title: "Card 3", description: "Lorem ipsum", icon:"description", urlsArray:[ new PluginURL("https://exapmle.com","View all")], show:true} + ]; + compare(oldObject){ + oldObject = super.compare(oldObject) + return oldObject; + } +} +@Component({ + selector: 'plugin-card-info', + templateUrl: 'plugin-card-info.component.html' +}) +export class PluginCardInfoComponent extends PluginBaseComponent{ + constructor() { + super() + } +} diff --git a/dashboard/plugins/components/how-to-use/plugin-how-to-use.module.ts b/dashboard/plugins/components/card-info/plugin-card-info.module.ts similarity index 83% rename from dashboard/plugins/components/how-to-use/plugin-how-to-use.module.ts rename to dashboard/plugins/components/card-info/plugin-card-info.module.ts index b7a35e6c..19c04b43 100644 --- a/dashboard/plugins/components/how-to-use/plugin-how-to-use.module.ts +++ b/dashboard/plugins/components/card-info/plugin-card-info.module.ts @@ -8,17 +8,17 @@ import {NumberRoundModule} from "../../../../utils/pipes/number-round.module"; import {IconsService} from "../../../../utils/icons/icons.service"; import {SearchResearchResultsServiceModule} from "../../../../services/searchResearchResultsService.module"; import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module"; -import {PluginHowToUseComponent} from './plugin-how-to-use.component'; +import {PluginCardInfoComponent} from "./plugin-card-info.component"; @NgModule({ imports: [ CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule ], providers:[PluginsService], - declarations: [PluginHowToUseComponent], - exports: [PluginHowToUseComponent] + declarations: [PluginCardInfoComponent], + exports: [PluginCardInfoComponent] }) -export class PluginHowToUseModule { +export class PluginCardInfoModule { constructor(private iconsService: IconsService) { this.iconsService.registerIcons([]) } diff --git a/dashboard/plugins/components/how-to-use/plugin-how-to-use.component.ts b/dashboard/plugins/components/how-to-use/plugin-how-to-use.component.ts deleted file mode 100644 index c150e2c2..00000000 --- a/dashboard/plugins/components/how-to-use/plugin-how-to-use.component.ts +++ /dev/null @@ -1,27 +0,0 @@ -import {Component} from '@angular/core'; -import {PluginBaseComponent, PluginBaseInfo, PluginInfoCards, PluginURL} from "../../utils/base-plugin.component"; -export class PluginHowToUse extends PluginBaseInfo{ - title:string ="How to use the gateway?"; - cardInfoArray: PluginInfoCards[] = [ - {title: "Tutorials", description: "Mini-video tutorials for gateway managers", urlsArray:[ new PluginURL("https://www.youtube.com/playlist?list=PL0c4IRNUxuKcyRUQ_J9BH_EE1amXU6kgp","View all")], show:true}, - {title: "Guides", description: "Textual guides on gateway functionalities.", urlsArray:[ new PluginURL("https://www.openaire.eu/research-community-gateway-guide","Guide for the users")/*, new PluginURL("","Guide for the managers")*/], show:true}, - {title: "Webinars", description: "Recordings and slides of webinars on different aspects of Open Science.", urlsArray:[ new PluginURL("","View all")], show:true} - ]; - compare(oldObject){ - oldObject = super.compare(oldObject) - - for(let card of this.cardInfoArray){ - - } - return oldObject; - } -} -@Component({ - selector: 'plugin-how-to-use', - templateUrl: 'plugin-how-to-use.component.html' -}) -export class PluginHowToUseComponent extends PluginBaseComponent{ - constructor() { - super() - } -} diff --git a/dashboard/plugins/components/learn-and-connect/plugin-learn-and-connect.component.html b/dashboard/plugins/components/learn-and-connect/plugin-learn-and-connect.component.html deleted file mode 100644 index ec7e8050..00000000 --- a/dashboard/plugins/components/learn-and-connect/plugin-learn-and-connect.component.html +++ /dev/null @@ -1,33 +0,0 @@ -
-

- {{pluginObject.title}} -

-
-
- - -
-
- -
-
- {{card.title}} -
-
- {{card.description}} -
- - {{url.linkText}} - -
-
-
-
- - - -
-
diff --git a/dashboard/plugins/components/learn-and-connect/plugin-learn-and-connect.component.ts b/dashboard/plugins/components/learn-and-connect/plugin-learn-and-connect.component.ts deleted file mode 100644 index 826ffcf5..00000000 --- a/dashboard/plugins/components/learn-and-connect/plugin-learn-and-connect.component.ts +++ /dev/null @@ -1,20 +0,0 @@ -import {Component} from '@angular/core'; -import {PluginBaseComponent, PluginBaseInfo, PluginInfoCards, PluginURL} from "../../utils/base-plugin.component"; -export class PluginLearnAndConnect extends PluginBaseInfo{ - title:string ="Learn & Connect with Open Science"; - cardInfoArray:PluginInfoCards[] = [ - {title: "OS Practices", description: "Open Science best practices for your community, policies and mandates.", - urlsArray:[ new PluginURL("","")], show:true}, - {title: "OS Guides for beginners", description: "New to Open Science? Learn the basics!",urlsArray:[ new PluginURL("https://www.openaire.eu/guides","Learn more")], show:true}, - {title: "Webinars", description: "Recordings and slides of webinars on different aspects of Open Science.",urlsArray:[ new PluginURL("https://www.openaire.eu/support/webinars","Learn more")], show:true} - ]; -} -@Component({ - selector: 'plugin-learn-and-connect', - templateUrl: 'plugin-learn-and-connect.component.html' -}) -export class PluginLearnAndConnectComponent extends PluginBaseComponent{ - constructor() { - super() - } -} diff --git a/dashboard/plugins/components/learn-and-connect/plugin-learn-and-connect.form.component.ts b/dashboard/plugins/components/learn-and-connect/plugin-learn-and-connect.form.component.ts deleted file mode 100644 index fbe9e8d2..00000000 --- a/dashboard/plugins/components/learn-and-connect/plugin-learn-and-connect.form.component.ts +++ /dev/null @@ -1,124 +0,0 @@ -import {Component, Input, SimpleChanges} from '@angular/core'; -import {PluginLearnAndConnect} from "./plugin-learn-and-connect.component"; -import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.form.component"; - -@Component({ - selector: 'plugin-learn-and-connect-form', - template: ` -
- - - -
- Cards: -
- - -
-
- - {{card.title}} -
- -
- -
-
- -
-
- - -
- -
-
- -
- -
Link #{{j + 1}}
-
- -
-
- -
-
-
-
- - `, - - -}) -export class PluginLearnAndConnectFormComponent extends PluginBaseFormComponent { - selectedIndex = -1; - @Input() editSubmenuOpen; - - constructor() { - super() - } - - - ngOnChanges(changes: SimpleChanges) { - if (this.editSubmenuOpen == false && this.selectedIndex > -1) { - this.close(); - } - } - - cardShowChanged(i, $event: PluginEditEvent) { - this.pluginObject.cardInfoArray[i].show = $event.value; - $event.value = this.pluginObject.cardInfoArray; - this.valuesChanged.emit({field: $event.field, value: $event.value, type: 'parent'}) - } - - cardValueChanged(i, $event: PluginEditEvent) { - this.pluginObject.cardInfoArray[i][$event.field] = $event.value; - $event.value = this.pluginObject.cardInfoArray; - this.valuesChanged.emit({field: "cardInfoArray", value: $event.value, type: 'parent'}) - } - cardUrlValueChanged(i, j, $event: PluginEditEvent) { - if (this.editTemplate) { - this.pluginObject.cardInfoArray[i].urlsArray[j][$event.field] = $event.value; - $event.value = this.pluginObject.cardInfoArray; - } else { - this.pluginObject.cardInfoArray[i].urlsArray[j][$event.field] = $event.value; - $event.value = this.pluginObject.cardInfoArray; - } - - this.valuesChanged.emit({field: "cardInfoArray", value: $event.value, type: 'parent'}) - } - - edit(i) { - this.selectedIndex = i; - this.toggleSubMenu(true); - } - - close() { - this.selectedIndex = -1; - this.toggleSubMenu(false); - } -} diff --git a/dashboard/plugins/components/learn-and-connect/plugin-learn-and-connect.module.ts b/dashboard/plugins/components/learn-and-connect/plugin-learn-and-connect.module.ts deleted file mode 100644 index 3fdaebb2..00000000 --- a/dashboard/plugins/components/learn-and-connect/plugin-learn-and-connect.module.ts +++ /dev/null @@ -1,25 +0,0 @@ -import {NgModule} from '@angular/core'; -import {RouterModule} from '@angular/router'; -import {CommonModule} from '@angular/common'; -import {FormsModule} from '@angular/forms'; -import {PluginsService} from "../../../../services/plugins.service"; -import {IconsModule} from "../../../../utils/icons/icons.module"; -import {NumberRoundModule} from "../../../../utils/pipes/number-round.module"; -import {IconsService} from "../../../../utils/icons/icons.service"; -import {SearchResearchResultsServiceModule} from "../../../../services/searchResearchResultsService.module"; -import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module"; -import {PluginLearnAndConnectComponent} from './plugin-learn-and-connect.component'; - -@NgModule({ - imports: [ - CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule - ], - providers:[PluginsService], - declarations: [PluginLearnAndConnectComponent], - exports: [PluginLearnAndConnectComponent] -}) -export class PluginLearnAndConnectModule { - constructor(private iconsService: IconsService) { - this.iconsService.registerIcons([]) - } -} diff --git a/dashboard/plugins/components/search-bar/plugin-search-bar.component.ts b/dashboard/plugins/components/search-bar/plugin-search-bar.component.ts new file mode 100644 index 00000000..98609466 --- /dev/null +++ b/dashboard/plugins/components/search-bar/plugin-search-bar.component.ts @@ -0,0 +1,139 @@ +import {ChangeDetectorRef, Component} from '@angular/core'; +import {PluginBaseComponent, PluginBaseInfo, PluginInfoCards, PluginURL} from "../../utils/base-plugin.component"; +import {OpenaireEntities} from "../../../../utils/properties/searchFields"; +import {properties} from "../../../../../../environments/environment"; +import {CustomizationService} from "../../../../services/customization.service"; +import {CommunityService} from "../../../../connect/community/community.service"; +import {Filter} from "../../../../searchPages/searchUtils/searchHelperClasses.class"; +import {Router} from "@angular/router"; +import {RouterHelper} from "../../../../utils/routerHelper.class"; +export class PluginSearchBar extends PluginBaseInfo{ + alternativeTitle:string =""; + showTitle:boolean = true; + showShortTitle:boolean = false; + + compare(oldObject): any { + let newObj= super.compare(oldObject); + return newObj; + } +} +@Component({ + selector: 'plugin-search-bar', + template: ` +
+ No community info available +
+
+ +
+
+

+ {{community.shortTitle}} +

+

+ {{pluginObject.alternativeTitle}} +

+
+ {{community.title}} +
+ +
+ + +
+
+
+
+ +
+
+
+
+
+
+ + ` +}) +export class PluginSearchBarComponent extends PluginBaseComponent{ + disableSelect: boolean = true; + openaireEntities= OpenaireEntities; + + selectedEntity = 'result'; + selectedEntitySimpleUrl; + selectedEntityAdvancedUrl; + keyword: string = ""; + // customFilter; + placeholderText = "Search by title, author, abstract, DOI, orcid... "; + resultTypes: Filter = { + values: [], + filterId: "type", + countSelectedValues: 0, + filterType: 'checkbox', + originalFilterId: "", + valueIsExact: true, + title: "Type", + filterOperator: "or" + }; + community = null; + + public routerHelper: RouterHelper = new RouterHelper(); + + constructor(private communityService: CommunityService, protected layoutService: CustomizationService, private cdr: ChangeDetectorRef, private _router: Router,) { + super() + + this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe( + community => { + this.community = community; + this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe( + community => { + this.getLayout(community.communityId); + + })); + } + )); + } + ngOnInit() { + this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe( + community => { + this.getLayout(community.communityId); + + })); + } + + goTo(simple: boolean) { + let url = (simple) ? this.selectedEntitySimpleUrl : this.selectedEntityAdvancedUrl; + let parameterNames = []; + let parameterValues = []; + + + if (this.keyword.length > 0) { + parameterNames.push("fv0"); + parameterValues.push(this.keyword); + parameterNames.push("f0"); + parameterValues.push("q"); + } + this._router.navigate([url], {queryParams: this.routerHelper.createQueryParams(parameterNames, parameterValues)}); + } + disableSelectChange(event: boolean) { + this.disableSelect = event; + this.cdr.detectChanges(); + } + entityChanged($event) { + this.selectedEntity = $event.entity; + this.selectedEntitySimpleUrl = $event.simpleUrl; + this.selectedEntityAdvancedUrl = $event.advancedUrl; + if (this.selectedEntity == 'result') { + this.placeholderText = "Search by title, author, abstract, DOI, orcid... "; + } else if (this.selectedEntity == 'project') { + this.placeholderText = "Search by project title, grant id, funder..."; + } else if (this.selectedEntity == 'dataprovider') { + this.placeholderText = "Search by name..."; + } else { + this.placeholderText = "Search community content"; + } + } +} diff --git a/dashboard/plugins/components/search-bar/plugin-search-bar.form.component.ts b/dashboard/plugins/components/search-bar/plugin-search-bar.form.component.ts new file mode 100644 index 00000000..fc196e8e --- /dev/null +++ b/dashboard/plugins/components/search-bar/plugin-search-bar.form.component.ts @@ -0,0 +1,47 @@ +import {Component} from '@angular/core'; +import {OpenaireEntities} from "../../../../utils/properties/searchFields"; +import {PluginBaseFormComponent} from "../../utils/base-plugin.form.component"; +import {PluginSearchBar} from "./plugin-search-bar.component"; + +@Component({ + selector: 'plugin-search-bar-form', + template: ` +
+ +
+ Show or hide the following information: +
+
+
+ + + Title + +
+
+ + + Short title + +
+ +
Manage community info here.
+
+
+ `, + + +}) +export class PluginSearchBarFormComponent extends PluginBaseFormComponent { + openaireEntities= OpenaireEntities; + constructor() { + super() + + } + +} diff --git a/dashboard/plugins/components/search-bar/plugin-search-bar.module.ts b/dashboard/plugins/components/search-bar/plugin-search-bar.module.ts new file mode 100644 index 00000000..ca9a5a4c --- /dev/null +++ b/dashboard/plugins/components/search-bar/plugin-search-bar.module.ts @@ -0,0 +1,30 @@ +import {NgModule} from '@angular/core'; +import {RouterModule} from '@angular/router'; +import {CommonModule} from '@angular/common'; +import {FormsModule} from '@angular/forms'; +import {PluginsService} from "../../../../services/plugins.service"; +import {IconsModule} from "../../../../utils/icons/icons.module"; +import {NumberRoundModule} from "../../../../utils/pipes/number-round.module"; +import {SearchResearchResultsServiceModule} from "../../../../services/searchResearchResultsService.module"; +import {PluginFieldEditModule} from "../../utils/plugin-field-edit.module"; +import {CuratorsModule} from '../../../../connect/components/curators/curators.module'; +import {AdvancedSearchInputModule} from "../../../../sharedComponents/advanced-search-input/advanced-search-input.module"; +import {EntitiesSelectionModule} from "../../../../searchPages/searchUtils/entitiesSelection.module"; +import {QuickSelectionsModule} from "../../../../searchPages/searchUtils/quick-selections.module"; +import {InputModule} from "../../../../sharedComponents/input/input.module"; +import {PluginSearchBarComponent} from "./plugin-search-bar.component"; + +@NgModule({ + imports: [ + CommonModule, RouterModule, FormsModule, IconsModule, NumberRoundModule, SearchResearchResultsServiceModule, PluginFieldEditModule, + CuratorsModule, AdvancedSearchInputModule, EntitiesSelectionModule, QuickSelectionsModule, InputModule, + ], + providers: [ + PluginsService + ], + declarations: [PluginSearchBarComponent], + exports: [PluginSearchBarComponent] +}) +export class PluginSearchBarModule { + +} diff --git a/dashboard/plugins/plugins.component.html b/dashboard/plugins/plugins.component.html index d94a1afc..3e7be5b7 100644 --- a/dashboard/plugins/plugins.component.html +++ b/dashboard/plugins/plugins.component.html @@ -244,6 +244,8 @@ [plugin]="this.templateForm.getRawValue()" [pluginObject]="this.selectedPlugin.object" class="uk-width-1-1" [previewInAdmin]="true"> + +
Reload!
diff --git a/dashboard/plugins/plugins.component.ts b/dashboard/plugins/plugins.component.ts index 73f39ca4..c87ad2d1 100644 --- a/dashboard/plugins/plugins.component.ts +++ b/dashboard/plugins/plugins.component.ts @@ -432,5 +432,6 @@ export class PluginsComponent implements OnInit { } clearCache(){ this._clearCacheService.clearCacheInRoute(null, this.selectedCommunityPid, this.getPageById(this.selectedPageId).route) + this._clearCacheService.purgeBrowserCache(null, this.selectedCommunityPid) } } diff --git a/dashboard/plugins/utils/base-plugin.component.ts b/dashboard/plugins/utils/base-plugin.component.ts index beeef58f..a56b8232 100644 --- a/dashboard/plugins/utils/base-plugin.component.ts +++ b/dashboard/plugins/utils/base-plugin.component.ts @@ -52,6 +52,7 @@ export class PluginInfoCards { description: string; urlsArray: PluginURL[]; image?: string; + icon?:string; show: boolean; } diff --git a/dashboard/plugins/utils/plugin-field-edit.component.ts b/dashboard/plugins/utils/plugin-field-edit.component.ts index 57171aa9..8051cc1c 100644 --- a/dashboard/plugins/utils/plugin-field-edit.component.ts +++ b/dashboard/plugins/utils/plugin-field-edit.component.ts @@ -19,7 +19,7 @@ import {PluginEditEvent} from "./base-plugin.form.component"; [ngModel]="getSelectedPages().length ==checkboxes.length"/>-->
-
+