From c011c9b38c0a5885d306102195947ce491fbf8a2 Mon Sep 17 00:00:00 2001 From: argirok Date: Wed, 28 Feb 2024 13:07:31 +0200 Subject: [PATCH] [plugins-functionality | WIP] updates on plugins --- ...ugin-discover-by-subcommunity.component.ts | 1 - ...discover-by-subcommunity.form.component.ts | 10 +- .../plugin-featured-datasets.component.html | 4 +- .../plugin-featured-datasets.component.ts | 10 +- ...plugin-featured-datasets.form.component.ts | 30 +- .../plugin-gateway-information.component.ts | 4 +- ...ugin-gateway-information.form.component.ts | 91 ++-- .../plugin-how-to-use.component.html | 2 +- .../how-to-use/plugin-how-to-use.component.ts | 18 +- .../plugin-how-to-use.form.component.ts | 140 ++++++ .../plugin-learn-and-connect.component.ts | 10 +- ...plugin-learn-and-connect.form.component.ts | 188 ++++---- .../plugin-openaire-products.component.ts | 9 +- ...plugin-openaire-products.form.component.ts | 7 +- .../plugin-organizations.component.html | 7 + .../plugin-organizations.component.ts | 34 ++ .../plugin-organizations.form.component.ts | 23 + .../plugin-organizations.module.ts | 22 + .../plugin-search-deposit-link.component.html | 5 +- .../plugin-search-deposit-link.component.ts | 13 +- ...ugin-search-deposit-link.form.component.ts | 148 ++++-- ...plugin-suggested-repositories.component.ts | 4 +- dashboard/plugins/plugins.component.html | 448 ++++++++---------- dashboard/plugins/plugins.component.ts | 47 +- .../templates/pluginTemplates.component.html | 295 ++++++------ .../templates/pluginTemplates.component.ts | 72 +-- .../plugins/utils/base-plugin.component.ts | 49 +- .../utils/base-plugin.form.component.ts | 48 ++ .../utils/plugin-field-edit.component.ts | 9 +- dashboard/plugins/utils/pluginUtils.ts | 54 ++- .../wrapper/plugin-edit-wrapper.component.ts | 13 +- .../wrapper/plugin-edit-wrapper.module.ts | 7 +- .../wrapper/plugin-wrapper.component.ts | 7 +- .../plugins/wrapper/plugin-wrapper.module.ts | 3 +- 34 files changed, 1085 insertions(+), 747 deletions(-) create mode 100644 dashboard/plugins/components/how-to-use/plugin-how-to-use.form.component.ts create mode 100644 dashboard/plugins/components/organizations/plugin-organizations.component.html create mode 100644 dashboard/plugins/components/organizations/plugin-organizations.component.ts create mode 100644 dashboard/plugins/components/organizations/plugin-organizations.form.component.ts create mode 100644 dashboard/plugins/components/organizations/plugin-organizations.module.ts create mode 100644 dashboard/plugins/utils/base-plugin.form.component.ts diff --git a/dashboard/plugins/components/discover-by-subcommunity/plugin-discover-by-subcommunity.component.ts b/dashboard/plugins/components/discover-by-subcommunity/plugin-discover-by-subcommunity.component.ts index 6081dc89..3c41ee8d 100644 --- a/dashboard/plugins/components/discover-by-subcommunity/plugin-discover-by-subcommunity.component.ts +++ b/dashboard/plugins/components/discover-by-subcommunity/plugin-discover-by-subcommunity.component.ts @@ -10,7 +10,6 @@ export class PluginDiscoverBySubcommunity extends PluginBaseInfo{ templateUrl: 'plugin-discover-by-subcommunity.component.html' }) export class PluginDiscoverBySubcommunityComponent extends PluginBaseComponent{ - default = new PluginDiscoverBySubcommunity(); subcommunities = null; community; constructor(http:HttpClient, private communityService: CommunityService) { diff --git a/dashboard/plugins/components/discover-by-subcommunity/plugin-discover-by-subcommunity.form.component.ts b/dashboard/plugins/components/discover-by-subcommunity/plugin-discover-by-subcommunity.form.component.ts index 7d193040..eb4bb8de 100644 --- a/dashboard/plugins/components/discover-by-subcommunity/plugin-discover-by-subcommunity.form.component.ts +++ b/dashboard/plugins/components/discover-by-subcommunity/plugin-discover-by-subcommunity.form.component.ts @@ -1,7 +1,6 @@ import {Component} from '@angular/core'; -import {PluginBaseComponent} from "../../utils/base-plugin.component"; -import {HttpClient} from "@angular/common/http"; import {PluginDiscoverBySubcommunity} from "./plugin-discover-by-subcommunity.component"; +import {PluginBaseFormComponent} from "../../utils/base-plugin.form.component"; @Component({ selector: 'plugin-discover-by-subcommunity-form', @@ -15,11 +14,8 @@ import {PluginDiscoverBySubcommunity} from "./plugin-discover-by-subcommunity.co }) -export class PluginDiscoverBySubcommunityFormComponent extends PluginBaseComponent { - default = new PluginDiscoverBySubcommunity(); - selectedIndex = null; - constructor(http:HttpClient) { +export class PluginDiscoverBySubcommunityFormComponent extends PluginBaseFormComponent { + constructor() { super() - } } diff --git a/dashboard/plugins/components/featured-datasets/plugin-featured-datasets.component.html b/dashboard/plugins/components/featured-datasets/plugin-featured-datasets.component.html index 21db4b5d..7b31dcfe 100644 --- a/dashboard/plugins/components/featured-datasets/plugin-featured-datasets.component.html +++ b/dashboard/plugins/components/featured-datasets/plugin-featured-datasets.component.html @@ -12,11 +12,11 @@ {{pluginObject.textLine2}} - - + --> - - - +
+ + +
+
+ +
+
+ +
`, }) -export class PluginFeaturedDatasetsFormComponent extends PluginBaseComponent { - default = new PluginFeaturedDatasets(); +export class PluginFeaturedDatasetsFormComponent extends PluginBaseFormComponent { selectedIndex = null; - openaireEntities= OpenaireEntities; - constructor(http: HttpClient) { + openaireEntities = OpenaireEntities; + + constructor() { super() } diff --git a/dashboard/plugins/components/gateway-information/plugin-gateway-information.component.ts b/dashboard/plugins/components/gateway-information/plugin-gateway-information.component.ts index 9911b279..c36bab8b 100644 --- a/dashboard/plugins/components/gateway-information/plugin-gateway-information.component.ts +++ b/dashboard/plugins/components/gateway-information/plugin-gateway-information.component.ts @@ -1,5 +1,5 @@ import {Component} from '@angular/core'; -import {PluginBaseComponent} from "../../utils/base-plugin.component"; +import {PluginBaseComponent, PluginBaseInfo} from "../../utils/base-plugin.component"; import {ConfigurationService} from '../../../../../openaireLibrary/utils/configuration/configuration.service'; import {CommunityService} from '../../../../../openaireLibrary/connect/community/community.service'; import {SearchCommunityProjectsService} from '../../../../../openaireLibrary/connect/projects/searchProjects.service'; @@ -11,7 +11,7 @@ import {RouterHelper} from "../../../../utils/routerHelper.class"; import {OpenaireEntities} from "../../../../utils/properties/searchFields"; import {HttpClient} from "@angular/common/http"; -export class PluginGatewayInformation{ +export class PluginGatewayInformation extends PluginBaseInfo{ title:string ="Gateway Information"; curators:boolean = true; date:boolean = true; diff --git a/dashboard/plugins/components/gateway-information/plugin-gateway-information.form.component.ts b/dashboard/plugins/components/gateway-information/plugin-gateway-information.form.component.ts index 77f54c1f..d3c78b70 100644 --- a/dashboard/plugins/components/gateway-information/plugin-gateway-information.form.component.ts +++ b/dashboard/plugins/components/gateway-information/plugin-gateway-information.form.component.ts @@ -1,7 +1,7 @@ import {Component} from '@angular/core'; -import {PluginBaseComponent} from "../../utils/base-plugin.component"; import {PluginGatewayInformation} from "./plugin-gateway-information.component"; import {OpenaireEntities} from "../../../../utils/properties/searchFields"; +import {PluginBaseFormComponent} from "../../utils/base-plugin.form.component"; @Component({ selector: 'plugin-gateway-information-form', @@ -9,89 +9,106 @@ import {OpenaireEntities} from "../../../../utils/properties/searchFields";
-
+
Show or hide the following information:
-
-
- Curated by: +
+ Community info +
+
+
- + Curated by +
-
- Created: +
- + Created +
-
- {{openaireEntities.PROJECTS}}: +
+ - + + {{openaireEntities.PROJECTS}}
-
- Linked Zenodo communities: +
+ + Linked Zenodo communities
-
- {{openaireEntities.DATASOURCES}} +
+ + {{openaireEntities.DATASOURCES}}
-
- Subjects: +
+ + Subjects
-
- {{openaireEntities.PUBLICATIONS}}: +
+ Pages & menus +
+
+ + {{openaireEntities.PUBLICATIONS}}
-
- {{openaireEntities.DATASETS}}: +
+ + {{openaireEntities.DATASETS}}
-
- {{openaireEntities.SOFTWARE}}: +
+ + {{openaireEntities.SOFTWARE}}
-
- {{openaireEntities.OTHER}}: +
+ + {{openaireEntities.OTHER}}
+ +
If some information is enabled here, + but still not visible, please check related entity or page.
`, }) -export class PluginGatewayInformationFormComponent extends PluginBaseComponent { +export class PluginGatewayInformationFormComponent extends PluginBaseFormComponent { default = new PluginGatewayInformation(); selectedIndex = null; openaireEntities= OpenaireEntities; diff --git a/dashboard/plugins/components/how-to-use/plugin-how-to-use.component.html b/dashboard/plugins/components/how-to-use/plugin-how-to-use.component.html index acecd751..52b51774 100644 --- a/dashboard/plugins/components/how-to-use/plugin-how-to-use.component.html +++ b/dashboard/plugins/components/how-to-use/plugin-how-to-use.component.html @@ -17,7 +17,7 @@
{{card.description}}
- {{url.linkText}} 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 index 39638e20..c150e2c2 100644 --- 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 @@ -1,12 +1,20 @@ import {Component} from '@angular/core'; -import {PluginBaseComponent, PluginInfoCards, PluginURL} from "../../utils/base-plugin.component"; -export class PluginHowToUse{ +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: "The mini-video tutorials can help you find quick answers on specific gateway functionalities.", urls:[ new PluginURL("","View all")], show:true}, - {title: "Guides", description: "Textual guides to all gateway functionalities.", urls:[ new PluginURL("","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.", urls:[ new PluginURL("","View all")], show:true} + {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', diff --git a/dashboard/plugins/components/how-to-use/plugin-how-to-use.form.component.ts b/dashboard/plugins/components/how-to-use/plugin-how-to-use.form.component.ts new file mode 100644 index 00000000..d4dc33c3 --- /dev/null +++ b/dashboard/plugins/components/how-to-use/plugin-how-to-use.form.component.ts @@ -0,0 +1,140 @@ +import {Component, Input, SimpleChanges} from '@angular/core'; +import {PluginHowToUse} from "./plugin-how-to-use.component"; +import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.form.component"; + +@Component({ + selector: 'plugin-how-to-use-form', + template: ` + + + `, + + +}) +export class PluginHowToUseFormComponent extends PluginBaseFormComponent { + selectedIndex = -1; + @Input() editSubmenuOpen; + constructor() { + super() + } + ngOnChanges(changes: SimpleChanges) { + if (this.editSubmenuOpen == false && this.selectedIndex > -1) { + this.close(); + } + } + + cardShowChanged(i, $event: PluginEditEvent) { + if (this.editTemplate) { + this.pluginTemplate.object.cardInfoArray[i].show = $event.value; + $event.value = this.pluginTemplate.object.cardInfoArray; + } else { + this.plugin.object.cardInfoArray[i].show = $event.value; + $event.value = this.plugin.object.cardInfoArray; + } + + this.valuesChanged.emit({field: $event.field, value: $event.value, type: 'parent'}) + } + + cardValueChanged(i, $event: PluginEditEvent) { + if (this.editTemplate) { + this.pluginObject.cardInfoArray[i][$event.field] = $event.value; + $event.value = this.pluginObject.cardInfoArray + } else { + 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.component.ts b/dashboard/plugins/components/learn-and-connect/plugin-learn-and-connect.component.ts index 37327d2d..826ffcf5 100644 --- 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 @@ -1,12 +1,12 @@ import {Component} from '@angular/core'; -import {PluginBaseComponent, PluginInfoCards, PluginURL} from "../../utils/base-plugin.component"; -export class PluginLearnAndConnect{ +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.", - urls:[ new PluginURL("","Learn more")], show:true}, - {title: "OS Guides for beginners", description: "New to Open Science? Learn the basics!",urls:[ new PluginURL("","Learn more")], show:true}, - {title: "Webinars", description: "Recordings and slides of webinars on different aspects of Open Science.",urls:[ new PluginURL("","Learn more")], show:true} + 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({ 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 index 5d33e06d..5aca5fa3 100644 --- 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 @@ -1,115 +1,131 @@ -import {Component, EventEmitter, OnChanges, Output, SimpleChanges} from '@angular/core'; -import {PluginBaseComponent, PluginEditEvent} from "../../utils/base-plugin.component"; -import {HttpClient} from "@angular/common/http"; +import {Component, Input, SimpleChanges} from '@angular/core'; import {PluginLearnAndConnect} from "./plugin-learn-and-connect.component"; -import {PluginOpenAIREProducts} from "../openaireProducts/plugin-openaire-products.component"; +import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.form.component"; @Component({ selector: 'plugin-learn-and-connect-form', template: `
- - -
- Cards: -
- - -
-
{{card.title}}
-
- -
-
- - - -
-
- edit - hide -
-
- -
- -
-
- -
-
- -
- -
-
- - -
+ + + +
+ Cards: +
+ + +
+
+ + {{card.title}} +
+ +
+ +
+
+ +
+
+ + + +
+ +
+
+ +
+ +
- + `, }) -export class PluginLearnAndConnectFormComponent extends PluginBaseComponent /*implements OnChanges*/{ - selectedIndex = null; - default = new PluginLearnAndConnect(); - constructor(http:HttpClient) { +export class PluginLearnAndConnectFormComponent extends PluginBaseFormComponent { + selectedIndex = -1; + @Input() editSubmenuOpen; + + constructor() { super() - // this.default = new PluginLearnAndConnect(); } - /*ngOnInit(): void { - if(this.pluginTemplate && (!this.pluginDefaultObject || !this.pluginDefaultObject.title)){ - this.pluginTemplate.object = new PluginLearnAndConnect(); - } - }*/ - /*ngOnChanges(changes: SimpleChanges) { - console.log("changes") - if(changes.plugin){ - console.log("changes plugin", changes.plugin) - }else if (changes.pluginTemplate){ - console.log("changes pluginTemplate", changes.pluginTemplate) + + + ngOnChanges(changes: SimpleChanges) { + if (this.editSubmenuOpen == false && this.selectedIndex > -1) { + this.close(); } } -*/ - cardShowChanged(i,$event:PluginEditEvent){ - if(this.editTemplate){ - this.pluginTemplate.object.cardInfoArray[i].show=$event.value; - $event.value =this.pluginTemplate.object.cardInfoArray; - }else{ - this.plugin.object.cardInfoArray[i].show=$event.value; - $event.value =this.plugin.object.cardInfoArray; + cardShowChanged(i, $event: PluginEditEvent) { + if (this.editTemplate) { + this.pluginTemplate.object.cardInfoArray[i].show = $event.value; + $event.value = this.pluginTemplate.object.cardInfoArray; + } else { + this.plugin.object.cardInfoArray[i].show = $event.value; + $event.value = this.plugin.object.cardInfoArray; } - this.valuesChanged.emit({field:$event.field, value: $event.value, type: 'parent'}) + this.valuesChanged.emit({field: $event.field, value: $event.value, type: 'parent'}) } - cardValueChanged(i,$event:PluginEditEvent){ - if(this.editTemplate){ - this.pluginTemplate.object.cardInfoArray[i][$event.field]=$event.value; - $event.value =this.pluginTemplate.object.cardInfoArray; - }else{ - this.plugin.object.cardInfoArray[i][$event.field]=$event.value; - $event.value =this.plugin.object.cardInfoArray; + cardValueChanged(i, $event: PluginEditEvent) { + if (this.editTemplate) { + this.pluginTemplate.object.cardInfoArray[i][$event.field] = $event.value; + $event.value = this.pluginTemplate.object.cardInfoArray; + } else { + this.plugin.object.cardInfoArray[i][$event.field] = $event.value; + $event.value = this.plugin.object.cardInfoArray; } - this.valuesChanged.emit({field:"cardInfoArray", value: $event.value, type: 'parent'}) + this.valuesChanged.emit({field: "cardInfoArray", value: $event.value, type: 'parent'}) } - edit(i){ + edit(i) { this.selectedIndex = i; + this.toggleSubMenu(true); } + close() { + this.selectedIndex = -1; + this.toggleSubMenu(false); + } } diff --git a/dashboard/plugins/components/openaireProducts/plugin-openaire-products.component.ts b/dashboard/plugins/components/openaireProducts/plugin-openaire-products.component.ts index 2597fa5e..98b2bc97 100644 --- a/dashboard/plugins/components/openaireProducts/plugin-openaire-products.component.ts +++ b/dashboard/plugins/components/openaireProducts/plugin-openaire-products.component.ts @@ -1,18 +1,19 @@ import {Component} from '@angular/core'; -import {PluginBaseComponent, PluginBaseInfo, PluginEditEvent} from "../../utils/base-plugin.component"; +import {PluginBaseComponent, PluginBaseInfo} from "../../utils/base-plugin.component"; import {HttpClient} from "@angular/common/http"; export class PluginOpenAIREProducts extends PluginBaseInfo{ title:string ="OpenAIRE services for your community"; serviceIdsArray = ["zenodo","graph","explore"]; - + compare(oldObject): any { + return super.compare(oldObject); + } } @Component({ selector: 'plugin-openaire-products', template: `
-

- {{pluginObject.title}}

+

{{pluginObject.title}}

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 58f1e513..299d7f6d 100644 --- a/dashboard/plugins/components/openaireProducts/plugin-openaire-products.form.component.ts +++ b/dashboard/plugins/components/openaireProducts/plugin-openaire-products.form.component.ts @@ -1,7 +1,7 @@ -import {Component, EventEmitter, Output} from '@angular/core'; -import {PluginBaseComponent, PluginEditEvent} from "../../utils/base-plugin.component"; +import {Component} from '@angular/core'; import {HttpClient} from "@angular/common/http"; import {PluginOpenAIREProducts} from "./plugin-openaire-products.component"; +import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.form.component"; @Component({ selector: 'plugin-openaire-products-form', @@ -31,7 +31,8 @@ import {PluginOpenAIREProducts} from "./plugin-openaire-products.component"; }) -export class PluginOpenaireProductsFormComponent extends PluginBaseComponent{ +//TODO make it extend PluginOpenaireProductsComponent (to avoid call in constructor..) +export class PluginOpenaireProductsFormComponent extends PluginBaseFormComponent{ default = new PluginOpenAIREProducts(); services = []; excludedServiceIds = ["openaire_login","research_community_dashboard"] diff --git a/dashboard/plugins/components/organizations/plugin-organizations.component.html b/dashboard/plugins/components/organizations/plugin-organizations.component.html new file mode 100644 index 00000000..21ff4f7b --- /dev/null +++ b/dashboard/plugins/components/organizations/plugin-organizations.component.html @@ -0,0 +1,7 @@ + +
+ No community info available available +
diff --git a/dashboard/plugins/components/organizations/plugin-organizations.component.ts b/dashboard/plugins/components/organizations/plugin-organizations.component.ts new file mode 100644 index 00000000..307299b7 --- /dev/null +++ b/dashboard/plugins/components/organizations/plugin-organizations.component.ts @@ -0,0 +1,34 @@ +import {Component} from '@angular/core'; +import {PluginBaseComponent, PluginBaseInfo} from "../../utils/base-plugin.component"; +import {ConfigurationService} from "../../../../utils/configuration/configuration.service"; + +export class PluginOrganizations extends PluginBaseInfo{ + title: string = "Supporting Organizations"; + +} + +@Component({ + selector: 'plugin-organizations', + templateUrl: 'plugin-organizations.component.html' +}) + +export class PluginOrganizationsComponent extends PluginBaseComponent { + portal; + constructor(private config: ConfigurationService) { + super() + this.subscriptions.push(this.config.portalAsObservable.subscribe( + res => { + this.portal = res; + }, + error => { + console.log(error); + } + )); + } + + isRouteEnabled(route: string) { + return this.portal && this.portal.pages.some(x => x['route'] == route && x['isEnabled'] === true); + } + + +} diff --git a/dashboard/plugins/components/organizations/plugin-organizations.form.component.ts b/dashboard/plugins/components/organizations/plugin-organizations.form.component.ts new file mode 100644 index 00000000..ab3070d8 --- /dev/null +++ b/dashboard/plugins/components/organizations/plugin-organizations.form.component.ts @@ -0,0 +1,23 @@ +import {Component} from '@angular/core'; +import {PluginOrganizations} from "./plugin-organizations.component"; +import {PluginBaseFormComponent} from "../../utils/base-plugin.form.component"; + +@Component({ + selector: 'plugin-organizations-form', + template: ` +
+ + +
+ `, + + +}) +export class PluginOrganizationsFormComponent extends PluginBaseFormComponent { + constructor() { + super() + + } + +} diff --git a/dashboard/plugins/components/organizations/plugin-organizations.module.ts b/dashboard/plugins/components/organizations/plugin-organizations.module.ts new file mode 100644 index 00000000..00d0c084 --- /dev/null +++ b/dashboard/plugins/components/organizations/plugin-organizations.module.ts @@ -0,0 +1,22 @@ +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 {IconsService} from "../../../../utils/icons/icons.service"; +import {PluginOrganizationsComponent} from './plugin-organizations.component'; +import {AffiliationsModule} from "../../../../connect/affiliations/affiliations.module"; + +@NgModule({ + imports: [ + CommonModule, RouterModule, FormsModule, AffiliationsModule, + ], + providers:[PluginsService], + declarations: [PluginOrganizationsComponent], + exports: [PluginOrganizationsComponent] +}) +export class PluginOrganizationsModule { + constructor(private iconsService: IconsService) { + this.iconsService.registerIcons([]) + } +} 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 b55aa0d5..c6831da4 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 @@ -1,9 +1,8 @@
- -

- {{pluginObject.title}} +

+ {{pluginObject.title}}.

diff --git a/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.component.ts b/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.component.ts index 3c4607fd..7604de59 100644 --- a/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.component.ts +++ b/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.component.ts @@ -1,22 +1,21 @@ import {Component} from '@angular/core'; -import {PluginBaseComponent, PluginInfoCards, PluginURL} from "../../utils/base-plugin.component"; +import {PluginBaseComponent, PluginBaseInfo, PluginInfoCards, PluginURL} from "../../utils/base-plugin.component"; import {OpenaireEntities} from "../../../../utils/properties/searchFields"; import {properties} from "../../../../../../environments/environment"; -export class PluginSearchDepositLink{ - title:string ="Search, link and deposit your research in one place."; - // description: string = "Lorem ipsum"; +export class PluginSearchDepositLink extends PluginBaseInfo{ + title:string ="Search, link and deposit your research in one place"; cardInfoArray: PluginInfoCards[] = [ {tag: "SEARCH & BROWSE", title: "Discover research products in your community.", description: "A view of the OpenAIRE Graph, configured by experts of your research community, who want to help you out with the data and literature deluge.", - urls:[ new PluginURL("/search/find/research-outcomes","Start searching", null, true)], + urlsArray:[ new PluginURL("/search/find/research-outcomes","Start searching", null, true)], image:'https://' + (properties.environment == 'production'?'':'beta.') + 'connect.openaire.eu/assets/connect-assets/home/4.png',show:true}, {tag: "DEPOSIT YOUR RESEARCH OUTCOME", title: "Publish your research in Open Access.", description:"" - , urls:[ new PluginURL("/participate/deposit/learn-how","Start searching", null, true)], + , urlsArray:[ new PluginURL("/participate/deposit/learn-how","Start searching", null, true)], image:'https://' + (properties.environment == 'production'?'':'beta.') + 'connect.openaire.eu/assets/connect-assets/home/1.png',show:true}, {tag: "LINK YOUR RESEARCH", title: "Contribute to your community.", description:"" - , urls:[ new PluginURL("/participate/claim","Start searching", null, true)], + , urlsArray:[ new PluginURL("/participate/claim","Start searching", null, true)], image:'https://' + (properties.environment == 'production'?'':'beta.') + 'connect.openaire.eu/assets/connect-assets/home/2.png',show:true}, ]; diff --git a/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.form.component.ts b/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.form.component.ts index 9306264b..a99a5172 100644 --- a/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.form.component.ts +++ b/dashboard/plugins/components/search-deposit-link/plugin-search-deposit-link.form.component.ts @@ -1,54 +1,130 @@ -import {Component} from '@angular/core'; -import {PluginBaseComponent, PluginEditEvent} from "../../utils/base-plugin.component"; -import {HttpClient} from "@angular/common/http"; +import {Component, Input, SimpleChanges} from '@angular/core'; import {PluginSearchDepositLink} from "./plugin-search-deposit-link.component"; +import {PluginBaseFormComponent, PluginEditEvent} from "../../utils/base-plugin.form.component"; @Component({ selector: 'plugin-search-deposit-link-form', template: `
- - -
- Cards: -
- -
-
{{card.tag}}
- -
- - - -
- -
- - -
+ + + +
+ Cards: +
+ + +
+
+ + {{card.title}} +
+ +
+ +
+
+ +
+
+ + + +
+ +
+
+ +
+
+ +
+
+ +
+
- + `, }) -export class PluginSearchDepositLinkFormComponent extends PluginBaseComponent /*implements OnChanges*/{ - constructor(http:HttpClient) { +export class PluginSearchDepositLinkFormComponent extends PluginBaseFormComponent /*implements OnChanges*/ { + selectedIndex = -1; + @Input() editSubmenuOpen; + + constructor() { super() } - cardShowChanged(i,$event:PluginEditEvent){ - if(this.editTemplate){ - this.pluginTemplate.object.cardInfoArray[i].show=$event.value; - $event.value =this.pluginTemplate.object.cardInfoArray; - }else{ - this.plugin.object.cardInfoArray[i].show=$event.value; - $event.value =this.plugin.object.cardInfoArray; - } - this.valuesChanged.emit({field:$event.field, value: $event.value, type: 'parent'}) + ngOnChanges(changes: SimpleChanges) { + if (this.editSubmenuOpen == false && this.selectedIndex > -1) { + this.close(); + } } + cardShowChanged(i, $event: PluginEditEvent) { + if (this.editTemplate) { + this.pluginTemplate.object.cardInfoArray[i].show = $event.value; + $event.value = this.pluginTemplate.object.cardInfoArray; + } else { + this.plugin.object.cardInfoArray[i].show = $event.value; + $event.value = this.plugin.object.cardInfoArray; + } + + this.valuesChanged.emit({field: $event.field, value: $event.value, type: 'parent'}) + } + + cardValueChanged(i, $event: PluginEditEvent) { + if (this.editTemplate) { + this.pluginTemplate.object.cardInfoArray[i][$event.field] = $event.value; + $event.value = this.pluginTemplate.object.cardInfoArray; + } else { + this.plugin.object.cardInfoArray[i][$event.field] = $event.value; + $event.value = this.plugin.object.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/suggested-repositories/plugin-suggested-repositories.component.ts b/dashboard/plugins/components/suggested-repositories/plugin-suggested-repositories.component.ts index 3bacaf66..10bcb13f 100644 --- a/dashboard/plugins/components/suggested-repositories/plugin-suggested-repositories.component.ts +++ b/dashboard/plugins/components/suggested-repositories/plugin-suggested-repositories.component.ts @@ -1,6 +1,6 @@ import {Component} from '@angular/core'; -import {PluginBaseComponent} from "../../utils/base-plugin.component"; -export class PluginSuggestedRepositories{ +import {PluginBaseComponent, PluginBaseInfo} from "../../utils/base-plugin.component"; +export class PluginSuggestedRepositories extends PluginBaseInfo{ title:string ="Lorem ipsum"; description: string = "Lorem ipsum"; } diff --git a/dashboard/plugins/plugins.component.html b/dashboard/plugins/plugins.component.html index d6a15258..322885d3 100644 --- a/dashboard/plugins/plugins.component.html +++ b/dashboard/plugins/plugins.component.html @@ -2,51 +2,78 @@