Compare commits

..

46 Commits

Author SHA1 Message Date
argirok f427350d71 Merge remote-tracking branch 'origin/develop'
# Conflicts:
#	src/app/openaireLibrary
2024-06-13 11:26:26 +03:00
Argiro Kokogiannaki c265ffc11b Merge pull request 'plugins-functionality' (#10) from plugins-functionality into develop
Reviewed-on: #10
2024-06-13 09:32:43 +02:00
argirok a59f96cdad [plugins-functionality | DONE | Changed ] rename master to main 2024-06-11 14:11:30 +03:00
argirok f03273f40c [plugins-functionality | DONE | Changed ] fix loading when as content source is unselected 2024-06-11 14:10:48 +03:00
argirok 4a4d02d872 [plugins-functionality | DONE | FIXED ] initialize properly display names in the form 2024-06-11 12:19:53 +03:00
argirok 59e9c77e49 [plugins-functionality | DONE | CHANGED ] update the way we manage zenodo communities and master zenodo community 2024-06-10 09:03:55 +03:00
argirok a9945d5da4 [plugins-functionality | DONE | CHANGED ] create validateEnabledPage.component.ts include it in manage pages 2024-06-10 09:03:15 +03:00
argirok 99758d7319 [plugins-functionality | DONE | CHANGED ] add width for organization logos 2024-05-23 12:52:14 +03:00
argirok 9d885d5c84 [plugins-functionality | DONE | ADDED ] add and delete custom plugins, edit plugin in distinct route, add prompt to go back to plugins list 2024-05-22 11:09:18 +03:00
argirok b9f0252392 [plugins-functionality | DONE | CHANGED ] content providers use HTML editor 2024-05-17 10:36:09 +03:00
argirok 6b02ff3ba0 [plugins-functionality | DONE | ADDED ] HTML editor switch 2024-05-16 15:13:03 +03:00
argirok a4a592e248 [plugins-functionality | DONE | CHANGED ] allow add/remove main zenodo community - complete previous commit - add service change 2024-05-16 15:00:44 +03:00
argirok 37f8c73720 [plugins-functionality | DONE | CHANGED ] allow add/remove main zenodo community 2024-05-16 15:00:09 +03:00
argirok 488ac615d4 [plugins-functionality | DONE | ADDED ] add display title and shortitle and use them instead of title/ short title 2024-05-14 14:49:59 +03:00
argirok c7ce678915 [plugins-functionality | DONE | FIXED ] add content providers: fix upper/lower case 2024-04-25 14:30:46 +03:00
argirok ba0bfeb356 [plugins-functionality | DONE | FIXED ] Criteria utils: allow short (3 criteria) or full version (for advanced criteria page) 2024-04-22 10:45:50 +03:00
argirok 30def2150b [plugins-functionality | DONE | CHANGED ] Criteria utils: rename description label to abstract 2024-04-09 13:03:27 +03:00
argirok 99e8f727b0 [plugins-functionality | WIP ] add properties for stats 2024-04-03 10:27:15 +03:00
argirok ce1b87aaa3 [plugins-functionality | DONE | CHANGED ] Change the way the cache is cleared 2024-04-03 10:26:29 +03:00
argirok 5f8d9f32f6 [plugins-functionality | WIP ] Plugins change background when preview in admin 2024-04-01 13:15:52 +03:00
argirok 1114ce4e36 [plugins-functionality | DONE CHANGED ] Edit community info - html editor: remove buttons with css style for text 2024-04-01 11:46:25 +03:00
argirok 6f323f8111 [plugins-functionality | DONE CHANGED ] Criteria: add experimental feature label 2024-04-01 11:44:57 +03:00
argirok c033102dcf Merge branch 'develop' into plugins-functionality 2024-03-28 12:37:27 +02:00
argirok b6e803b56e [plugins-functionality | WIP ] updates and fixes after initial beta release 2024-03-28 12:37:00 +02:00
argirok 75b4328623 [plugins-functionality | DONE | CHANGED] give option to for content, deposit or both, use a common form to edit the options + the criteria 2024-03-15 15:58:15 +02:00
argirok 7a43b29617 [plugins-functionality | WIP] more updates and fixes 2024-03-15 15:56:54 +02:00
argirok b12ce55b20 [plugins-functionality | DONE | FIX] initialize properly view for master zenodo community 2024-03-11 14:08:51 +02:00
argirok ed512f6f05 [plugins-functionality | WIP] add graph info 2024-03-11 13:29:29 +02:00
argirok 2a27c1caf7 [plugins-functionality | WIP] content providers: update methods, add options to select for deposit and add deposition message 2024-02-28 14:46:29 +02:00
argirok a3d67696ad commit libraries 2024-02-15 12:28:43 +02:00
argirok d2384ea07f Merge branch 'develop' 2024-02-15 12:15:18 +02:00
argirok c1e306cff0 [develop | DONE | ADDED ] add again publicationyear in criteria fields, add different list of verbs for numeric values 2024-02-14 11:27:00 +02:00
argirok f2e2edd1f2 [develop | DONE | FIXED ] community status checks 2024-02-14 10:47:03 +02:00
argirok 49e8e56e92 [plugin-functionalities | WIP] : update plugin forms, add reording, filtering by position, create multiple templates per position, etc 2024-02-02 09:33:01 +02:00
argirok 1003382304 [develop | DONE | REMOVED] : criteria-utils: comment out publicationyear option until integer value operators are available 2024-01-19 11:08:08 +02:00
argirok 044d5da78a [plugins-functionality | WIP] : update admn tools API 2024-01-19 11:03:57 +02:00
argirok 1435c5c718 Merge branch 'develop' into plugins-functionality 2024-01-19 11:01:10 +02:00
argirok 4147ffca98 Merge remote-tracking branch 'origin/develop' into develop 2023-11-21 12:59:57 +02:00
argirok f23f75e2d8 [develop | DONE | UPDATED] Community form: remove old visibility statuses 2023-11-21 12:59:46 +02:00
Alex Martzios 7827d23088 [develop | DONE | ADDED] add two new fields in datasources selection criteria & advanced criteria 2023-11-08 09:40:25 +02:00
argirok 9a49371a39 manage plugins of a template 2023-10-17 09:20:16 +03:00
argirok 80c6b47c1b Merge branch 'angular-16' into plugins-functionality 2023-10-09 13:56:48 +03:00
argirok 47201b9dff commit libraries 2023-10-09 13:55:30 +03:00
argirok a1754df0b3 Merge branch 'develop' into plugins-functionality 2023-10-06 21:09:55 +03:00
argirok 703b163803 route for plugins 2023-10-02 12:30:13 +03:00
argirok 10cad849a9 Initial commit for plugins functionality:
Manage Plugin Templates
2023-09-25 11:36:05 +03:00
46 changed files with 714 additions and 415 deletions

@ -1 +1 @@
Subproject commit e63d61b4693843c30ed41440e90bd3b6b6865806 Subproject commit 2e2a71c3101660480ede67c06edc22aa00faa79d

View File

@ -29,6 +29,16 @@ import {RouterModule} from '@angular/router';
loadChildren: () => import('../../openaireLibrary/dashboard/helpTexts/page-help-content-form.module').then(m => m.PageHelpContentFormModule), loadChildren: () => import('../../openaireLibrary/dashboard/helpTexts/page-help-content-form.module').then(m => m.PageHelpContentFormModule),
pathMatch: 'full' pathMatch: 'full'
}, },
{
path: 'plugins',
loadChildren: () => import('../../openaireLibrary/dashboard/plugins/plugins.module').then(m => m.PluginsModule),
pathMatch: 'full', data: {hasInternalSidebar: false, hasHeader: false}
},
{
path: 'plugins/edit',
loadChildren: () => import('../../openaireLibrary/dashboard/plugins/plugins-form/pluginsForm.module').then(m => m.PluginsFormModule),
pathMatch: 'full', data: {hasInternalSidebar: true, hasHeader: false}
},
{ {
path: 'pages', path: 'pages',
loadChildren: () => import('../../openaireLibrary/dashboard/page/pages.module').then(m => m.PagesModule), loadChildren: () => import('../../openaireLibrary/dashboard/page/pages.module').then(m => m.PagesModule),

View File

@ -5,7 +5,9 @@ import {RouterModule} from "@angular/router";
imports: [RouterModule.forChild([ imports: [RouterModule.forChild([
{path: '', loadChildren: () => import('./admin-tools-routing.module').then(m => m.AdminToolsRoutingModule)}, {path: '', loadChildren: () => import('./admin-tools-routing.module').then(m => m.AdminToolsRoutingModule)},
{path: 'portals', loadChildren: () => import('../../openaireLibrary/dashboard/portal/portals.module').then(m => m.PortalsModule)}, {path: 'portals', loadChildren: () => import('../../openaireLibrary/dashboard/portal/portals.module').then(m => m.PortalsModule)},
{path: 'classes', loadChildren: () => import('../../openaireLibrary/dashboard/divId/divIds.module').then(m => m.DivIdsModule)} {path: 'classes', loadChildren: () => import('../../openaireLibrary/dashboard/divId/divIds.module').then(m => m.DivIdsModule)},
{path: 'templates', loadChildren: () => import('../../openaireLibrary/dashboard/plugins/templates/pluginTemplates.module').then(m => m.PluginTemplatesModule)},
{path: 'templates/plugins', loadChildren: () => import('../../openaireLibrary/dashboard/plugins/plugins.module').then(m => m.PluginsModule)},
])] ])]
}) })
export class PortalAdminToolsRoutingModule { export class PortalAdminToolsRoutingModule {

View File

@ -36,7 +36,7 @@ import {CommunityInfo} from "../../openaireLibrary/connect/community/communityIn
<div *ngIf="!loading"> <div *ngIf="!loading">
<div *ngIf="selectionCriteria?.criteria?.length > 0" class="uk-margin-small-bottom"> <div *ngIf="selectionCriteria?.criteria?.length > 0" class="uk-margin-small-bottom">
<div class="uk-text-meta uk-margin-small-bottom">Criteria</div> <div class="uk-text-meta uk-margin-small-bottom">Criteria</div>
<div [innerHTML]="criteriaUtils.getFiltersAsText(selectionCriteria.criteria)"></div> <div [innerHTML]="criteriaUtils.getFiltersAsText(selectionCriteria.criteria,false)"></div>
</div> </div>
<div *ngIf="selectionCriteria?.criteria?.length === 0" class="message"> <div *ngIf="selectionCriteria?.criteria?.length === 0" class="message">
<h5 class="uk-margin-small-bottom">No criteria yet</h5> <h5 class="uk-margin-small-bottom">No criteria yet</h5>

View File

@ -2,10 +2,6 @@
<div actions> <div actions>
<div class="uk-section-xsmall uk-margin-top"> <div class="uk-section-xsmall uk-margin-top">
<div class="uk-flex uk-flex-center uk-flex-right@m"> <div class="uk-flex uk-flex-center uk-flex-right@m">
<button *ngIf="!organizationsEnabled" class="uk-button uk-button-default uk-margin-right" [class.uk-disabled]="loading"
[disabled]="loading"
(click)="enableAffiliations()">Enable Organizations Page
</button>
<button class="uk-button uk-button-default uk-flex uk-flex-middle" <button class="uk-button uk-button-default uk-flex uk-flex-middle"
[disabled]="loading" [class.uk-disabled]="loading" [disabled]="loading" [class.uk-disabled]="loading"
(click)="editAffiliationOpen()"> (click)="editAffiliationOpen()">
@ -20,6 +16,7 @@
<div *ngIf="loading" class="uk-position-center"> <div *ngIf="loading" class="uk-position-center">
<loading></loading> <loading></loading>
</div> </div>
<validate-page-enabled pageRoute="/organizations"></validate-page-enabled>
<div *ngIf="!loading"> <div *ngIf="!loading">
<div *ngIf="affiliations.length == 0" <div *ngIf="affiliations.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold"> class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
@ -35,7 +32,7 @@
<div class="uk-card-body"> <div class="uk-card-body">
<div class="uk-flex uk-flex-middle uk-flex-column"> <div class="uk-flex uk-flex-middle uk-flex-column">
<div class="uk-flex uk-flex-center uk-height-xsmall"> <div class="uk-flex uk-flex-center uk-height-xsmall">
<img class="uk-height-max-xsmall uk-blend-multiply" [src]="affiliation.logo_url | urlPrefix"> <img class="uk-height-max-xsmall uk-blend-multiply uk-width-small" [src]="affiliation.logo_url | urlPrefix">
</div> </div>
<h5>{{affiliation.name}}</h5> <h5>{{affiliation.name}}</h5>
<div class="uk-text-truncate uk-text-small"> <div class="uk-text-truncate uk-text-small">

View File

@ -54,7 +54,6 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
if (this.community) { if (this.community) {
this.title.setTitle(this.community.shortTitle.toUpperCase() + ' | Organizations'); this.title.setTitle(this.community.shortTitle.toUpperCase() + ' | Organizations');
this.getAffiliations(); this.getAffiliations();
this.organizationsPageStatus();
} }
})); }));
} }
@ -81,10 +80,6 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
); );
} }
public get organizationsEnabled(): boolean {
return !this.organizationsPage || this.organizationsPage.isEnabled;
}
editAffiliationOpen(index: number = -1) { editAffiliationOpen(index: number = -1) {
let affiliation: Affiliation; let affiliation: Affiliation;
this.index = index; this.index = index;
@ -179,13 +174,6 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
this.handleUpdateError('An error has been occurred. Try again later!'); this.handleUpdateError('An error has been occurred. Try again later!');
}); });
} }
private organizationsPageStatus() {
this.helpContentService.getCommunityPagesByRoute(this.community.communityId, '/organizations', this.properties.adminToolsAPIURL).subscribe((page) => {
this.organizationsPage = page;
})
}
handleUpdateError(message: string) { handleUpdateError(message: string) {
NotificationHandler.rise(message, "danger"); NotificationHandler.rise(message, "danger");
this.loading = false; this.loading = false;
@ -196,13 +184,4 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
this.loading = false; this.loading = false;
} }
enableAffiliations() {
this.helpContentService.togglePages(this.community.communityId, [this.organizationsPage._id], true, this.properties.adminToolsAPIURL).subscribe(() => {
this.organizationsPage.isEnabled = true;
this._clearCacheService.purgeBrowserCache("Organizations Page enabled", this.community.communityId);
NotificationHandler.rise('Organizations Page has been <b>enabled successfully</b>');
}, error => {
this.handleUpdateError('An error has been occurred. Try again later!');
});
}
} }

View File

@ -17,11 +17,12 @@ import {LoadingModule} from "../../openaireLibrary/utils/loading/loading.module"
import {UrlPrefixModule} from "../../openaireLibrary/utils/pipes/url-prefix.module"; import {UrlPrefixModule} from "../../openaireLibrary/utils/pipes/url-prefix.module";
import {HelpContentService} from "../../services/help-content.service"; import {HelpContentService} from "../../services/help-content.service";
import {PagingModule} from "../../openaireLibrary/utils/paging.module"; import {PagingModule} from "../../openaireLibrary/utils/paging.module";
import {ValidateEnabledPageModule} from "../../utils/validateEnabledPage.module";
@NgModule({ @NgModule({
imports: [ imports: [
AffiliationsRoutingModule, CommonModule, FormsModule, RouterModule, AffiliationsRoutingModule, CommonModule, FormsModule, RouterModule,
AlertModalModule, ReactiveFormsModule, InputModule, PageContentModule, IconsModule, NoLoadPaging, LoadingModule, UrlPrefixModule, PagingModule AlertModalModule, ReactiveFormsModule, InputModule, PageContentModule, IconsModule, NoLoadPaging, LoadingModule, UrlPrefixModule, PagingModule, ValidateEnabledPageModule
], ],
declarations: [ declarations: [
AffiliationsComponent AffiliationsComponent

View File

@ -20,11 +20,19 @@ import {ClearCacheService} from "../../../../openaireLibrary/services/clear-cach
<div class="uk-grid uk-grid-large" uk-grid> <div class="uk-grid uk-grid-large" uk-grid>
<div class="uk-width-1-2@m"> <div class="uk-width-1-2@m">
<div input id="name" [formInput]="communityFb.get('name')" <div input id="name" [formInput]="communityFb.get('name')"
placeholder="Name of the community profile."></div> placeholder="Index name of the community."></div>
</div> </div>
<div class="uk-width-1-2@m"> <div class="uk-width-1-2@m">
<div input [formInput]="communityFb.get('shortName')" <div input [formInput]="communityFb.get('shortName')"
placeholder="Short name of the community."></div> placeholder="Index short name of the community."></div>
</div>
<div class="uk-width-1-2@m">
<div input id="name" [formInput]="communityFb.get('displayName')"
placeholder="Display name of the community."></div>
</div>
<div class="uk-width-1-2@m">
<div input [formInput]="communityFb.get('displayShortName')"
placeholder="Display short name of the community."></div>
</div> </div>
<div class="uk-width-1-1"> <div class="uk-width-1-1">
<div class="uk-text-bold uk-margin-bottom uk-form-hint">Description of the community</div> <div class="uk-text-bold uk-margin-bottom uk-form-hint">Description of the community</div>
@ -35,7 +43,7 @@ import {ClearCacheService} from "../../../../openaireLibrary/services/clear-cach
removeButtons: 'Save,NewPage,DocProps,Preview,Print,' + removeButtons: 'Save,NewPage,DocProps,Preview,Print,' +
'Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,' + 'Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,' +
'CreateDiv,Flash,PageBreak,' + 'CreateDiv,Flash,PageBreak,' +
'Subscript,Superscript,Anchor,Smiley,Iframe,Styles,Font,About,Language', 'Subscript,Superscript,Anchor,Smiley,Iframe,Styles,Font,About,Language,JustifyLeft,JustifyRight,JustifyCenter,JustifyBlock,FontSize,TextColor,BGColor',
extraPlugins: 'divarea'}"> extraPlugins: 'divarea'}">
</ckeditor> </ckeditor>
</div> </div>
@ -100,13 +108,10 @@ import {ClearCacheService} from "../../../../openaireLibrary/services/clear-cach
export class EditCommunityComponent { export class EditCommunityComponent {
public communityFb: UntypedFormGroup; public communityFb: UntypedFormGroup;
public statuses: Option[] = [ public statuses: Option[] = [
{label: 'Visible', value: 'all'}, // {label: 'Visible', value: 'all'},
{label: 'Visible [Public*]', value: 'PUBLIC'}, {label: 'Visible', value: 'PUBLIC'},
{label: 'Visible to managers', value: 'manager'}, // {label: 'Visible to managers', value: 'manager'},
{label: 'Visible to managers [Restricted*]', value: 'RESTRICTED'}, {label: 'Visible to managers', value: 'RESTRICTED'},
/*
{label: 'Hidden [Private*]', value: 'PRIVATE'},
*/
{label: 'Hidden', value: 'hidden'} {label: 'Hidden', value: 'hidden'}
] ]
public claimOptions: Option[] = [ public claimOptions: Option[] = [
@ -156,6 +161,8 @@ export class EditCommunityComponent {
communityId: this.fb.control(this.community.communityId), communityId: this.fb.control(this.community.communityId),
name: this.fb.control(this.community.title, Validators.required), name: this.fb.control(this.community.title, Validators.required),
shortName: this.fb.control(this.community.shortTitle, Validators.required), shortName: this.fb.control(this.community.shortTitle, Validators.required),
displayName: this.fb.control(this.community.displayTitle, Validators.required),
displayShortName: this.fb.control(this.community.displayShortTitle, Validators.required),
description: this.fb.control(this.community.description), description: this.fb.control(this.community.description),
status: this.fb.control(this.community.status), status: this.fb.control(this.community.status),
claim: this.fb.control(this.community.claim), claim: this.fb.control(this.community.claim),
@ -185,6 +192,7 @@ export class EditCommunityComponent {
if (!this.isAdmin) { if (!this.isAdmin) {
setTimeout(() => { setTimeout(() => {
this.communityFb.get('shortName').disable(); this.communityFb.get('shortName').disable();
this.communityFb.get('name').disable();
}, 0); }, 0);
} }
} }
@ -193,7 +201,7 @@ export class EditCommunityComponent {
} }
public get isAdmin() { public get isAdmin() {
return Session.isPortalAdministrator(this.user); return Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user);
} }
public get disabled(): boolean { public get disabled(): boolean {
@ -240,8 +248,7 @@ export class EditCommunityComponent {
this.removePhoto(); this.removePhoto();
this.subscriptions.push(this.communityService.updateCommunity( this.subscriptions.push(this.communityService.updateCommunity(
this.properties.communityAPI + this.community.communityId, this.communityFb.getRawValue()).subscribe(() => { this.properties.communityAPI + this.community.communityId, this.communityFb.getRawValue()).subscribe(() => {
this._clearCacheService.clearCache("Community saved"); this._clearCacheService.clearCacheInRoute("Community saved",this.community.communityId,"/");
this._clearCacheService.purgeBrowserCache("Community saved", this.community.communityId);
this.communityService.getCommunity(this.community.communityId, true).subscribe(community => { this.communityService.getCommunity(this.community.communityId, true).subscribe(community => {
NotificationHandler.rise(community.shortTitle + ' has been <b>successfully created</b>'); NotificationHandler.rise(community.shortTitle + ' has been <b>successfully created</b>');
callback(community); callback(community);
@ -254,8 +261,7 @@ export class EditCommunityComponent {
})); }));
} else { } else {
this.subscriptions.push(this.communityService.updateCommunity(this.properties.communityAPI + this.community.communityId, this.communityFb.getRawValue()).subscribe(() => { this.subscriptions.push(this.communityService.updateCommunity(this.properties.communityAPI + this.community.communityId, this.communityFb.getRawValue()).subscribe(() => {
this._clearCacheService.clearCache("Community updated"); this._clearCacheService.clearCacheInRoute("Community saved",this.community.communityId,"/");
this._clearCacheService.purgeBrowserCache("Community updated", this.community.communityId);
this.communityService.getCommunity(this.community.communityId, true).subscribe(community => { this.communityService.getCommunity(this.community.communityId, true).subscribe(community => {
NotificationHandler.rise(community.shortTitle + ' has been <b>successfully saved</b>'); NotificationHandler.rise(community.shortTitle + ' has been <b>successfully saved</b>');
callback(community); callback(community);

View File

@ -16,14 +16,28 @@ declare var UIkit;
<admin-tabs tab="customization" portal="connect"></admin-tabs> <admin-tabs tab="customization" portal="connect"></admin-tabs>
</div> </div>
<div inner> <div inner>
<div>
<div class="uk-alert uk-alert-warning uk-margin-top "> <div class="uk-alert uk-alert-warning uk-margin-top ">
<div class="uk-text-large">Use only after connect deployment. And only if there are css updates!</div> <div class="uk-text-large">Use only after connect deployment. And only if there are css updates!</div>
Press the following button to update the timestamp in the saved layouts and recreate the css files. Press the following button to update the timestamp in the saved layouts and recreate the css files.
</div> </div>
<button (click)="updateCss()" class="uk-button uk-button-danger" [class.uk-disabled]="savingChanges"> Update CSS</button> <button (click)="updateCss()" class="uk-button uk-button-danger" [class.uk-disabled]="savingChanges"> Update CSS</button>
<button (click)="purgeBrowserCache()" class="uk-button uk-button-danger uk-margin-left" [class.uk-disabled]="savingChanges"> Purge Browser Cache</button> <hr>
</div>
<div class="uk-margin-medium-top">
<div>Purge ICM cache for all communities</div>
<ng-container *ngIf="properties.domain != 'production'"> <button (click)="purgeBrowserCache()" class="uk-button uk-button-danger uk-margin-top" [class.uk-disabled]="savingChanges"> Purge Browser Cache</button>
<hr>
</div>
<div class="uk-margin-medium-top">
<div>Reload cache requests either per community or for all communities</div>
<div input [(value)]="community" [placeholder]="'e.g. galaxy'" class="uk-width-1-2 uk-margin-top"></div>
<div input [(value)]="route" [placeholder]="'Route e.g. /'" class="uk-width-1-2 uk-margin-top"></div>
<button (click)="forceReloadCache()" class="uk-button uk-button-danger uk-margin-top" [class.uk-disabled]="savingChanges"> Reload Cache</button>
</div>
<!--<ng-container *ngIf="properties.domain != 'production'">
<hr> <hr>
<div class="uk-alert uk-alert-danger uk-margin-top "> <div class="uk-alert uk-alert-danger uk-margin-top ">
Delete after next deployment Delete after next deployment
@ -33,7 +47,7 @@ declare var UIkit;
</div> </div>
<div input [(value)]="community" [placeholder]="'e.g. galaxy'"></div> <div input [(value)]="community" [placeholder]="'e.g. galaxy'"></div>
<button (click)="deleteLayout()" class="uk-button uk-button-danger" [class.uk-disabled]="!community"> Delete layout</button> <button (click)="deleteLayout()" class="uk-button uk-button-danger" [class.uk-disabled]="!community"> Delete layout</button>
</ng-container> </ng-container>-->
</div> </div>
</div> </div>
@ -45,6 +59,7 @@ export class ConnectAdminCustomizationComponent implements OnInit {
cssCreated: number = 0; cssCreated: number = 0;
totalLayouts: number = 0; totalLayouts: number = 0;
community; community;
route;
properties = properties; properties = properties;
constructor( private customizationService: CustomizationService, private _clearCacheService: ClearCacheService, constructor( private customizationService: CustomizationService, private _clearCacheService: ClearCacheService,
@ -133,4 +148,20 @@ export class ConnectAdminCustomizationComponent implements OnInit {
})); }));
} }
} }
forceReloadCache() {
if (this.community) {
this._clearCacheService.clearCacheInRoute("Clear cache", this.community, this.route ? this.route : "/")
} else {
this.savingChanges = true;
this.subscriptions.push(this.communitiesService.getCommunities(this.properties, this.properties.communityAPI + 'communities').subscribe(
communities => {
communities.forEach(community => {
this._clearCacheService.clearCacheInRoute("Clear cache for "+ community.communityId, community.communityId, this.route ? this.route : "/")
});
this.savingChanges = false;
}
));
}
}
} }

View File

@ -36,12 +36,21 @@
<div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid> <div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid>
<div *ngIf="!getCommunityContentProvider(result)"> <div *ngIf="!getCommunityContentProvider(result)">
<div class="uk-padding-small uk-padding-remove-horizontal"> <div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="addContentProvider(result)" class="uk-button uk-button-link uk-flex uk-flex-middle"> <a class="uk-button uk-button-link uk-flex uk-flex-middle">
<icon name="add" [flex]="true"></icon> <icon name="add" [flex]="true"></icon>
<span class="uk-margin-small-left"> <span class="uk-margin-small-left">
Add Add
</span> </span>
</a> </a>
<div uk-dropdown="mode:click">
<ul class="uk-nav uk-dropdown-nav">
<li class="uk-nav-header uk-margin-left">Add</li>
<li><a (click)="addContentProvider(result,true, false)"> as content source</a></li>
<li ><a (click)="addContentProvider(result,false, true)">as suggestion for deposit</a></li>
<li ><a (click)="addContentProvider(result,true, true)"> both</a></li>
</ul>
</div>
</div> </div>
</div> </div>
<div *ngIf="getCommunityContentProvider(result)"> <div *ngIf="getCommunityContentProvider(result)">

View File

@ -102,8 +102,8 @@ export class AddContentProvidersComponent implements OnInit {
"</div>" "</div>"
} }
public addContentProvider(contentProvider: SearchResult) { public addContentProvider(contentProvider: SearchResult, content = true, deposit =false) {
this.subscriptions.push(this.manageCommunityContentProvidersService.addContentProvider(this.properties, this.community.communityId, contentProvider).subscribe( this.subscriptions.push(this.manageCommunityContentProvidersService.addContentProvider(this.properties, this.community.communityId, contentProvider, content, deposit).subscribe(
data => { data => {
this.communityContentProviders.push(data); this.communityContentProviders.push(data);
this._clearCacheService.purgeBrowserCache(this.openAIREEntities.DATASOURCE+" added", this.community.communityId); this._clearCacheService.purgeBrowserCache(this.openAIREEntities.DATASOURCE+" added", this.community.communityId);
@ -120,7 +120,7 @@ export class AddContentProvidersComponent implements OnInit {
public removeContentProvider(contentProvider) { public removeContentProvider(contentProvider) {
let communityContentProvider = this.getCommunityContentProvider(contentProvider); let communityContentProvider = this.getCommunityContentProvider(contentProvider);
let contentProviderId: string = communityContentProvider['id']; let contentProviderId: string = communityContentProvider['openaireId'];
this.subscriptions.push(this.manageCommunityContentProvidersService.removeContentProvider(this.properties, this.community.communityId, contentProviderId).subscribe( this.subscriptions.push(this.manageCommunityContentProvidersService.removeContentProvider(this.properties, this.community.communityId, contentProviderId).subscribe(
data => { data => {
let index = this.communityContentProviders.indexOf(communityContentProvider); let index = this.communityContentProviders.indexOf(communityContentProvider);

View File

@ -28,6 +28,9 @@ import {AddContentProvidersComponent} from "./add-content-providers.component";
import {ManageCommunityContentProvidersService} from "../../services/manageContentProviders.service"; import {ManageCommunityContentProvidersService} from "../../services/manageContentProviders.service";
import {SearchDataprovidersService} from "../../openaireLibrary/services/searchDataproviders.service"; import {SearchDataprovidersService} from "../../openaireLibrary/services/searchDataproviders.service";
import {CriteriaModule} from "./criteria/criteria.module"; import {CriteriaModule} from "./criteria/criteria.module";
import {MatSlideToggleModule} from "@angular/material/slide-toggle";
import {CKEditorModule} from "ng2-ckeditor";
import {ValidateEnabledPageModule} from "../../utils/validateEnabledPage.module";
@NgModule({ @NgModule({
imports: [ imports: [
@ -48,7 +51,7 @@ import {CriteriaModule} from "./criteria/criteria.module";
path: '', component: ManageContentProvidersComponent path: '', component: ManageContentProvidersComponent
} }
]), ]),
NoLoadPaging, LoadingModule, IconsModule, FullScreenModalModule, ResultPreviewModule, CriteriaModule NoLoadPaging, LoadingModule, IconsModule, FullScreenModalModule, ResultPreviewModule, CriteriaModule, MatSlideToggleModule, CKEditorModule, ReactiveFormsModule, ValidateEnabledPageModule
], ],
declarations: [ declarations: [
ManageContentProvidersComponent, ManageContentProvidersComponent,

View File

@ -7,12 +7,14 @@ export class CriteriaUtils {
{value: 'title', label: 'Title'}, {value: 'title', label: 'Title'},
{value: 'orcid', label: 'Author\'s ORCID'}, {value: 'orcid', label: 'Author\'s ORCID'},
{value: 'contributor', label: 'Contributor'}, {value: 'contributor', label: 'Contributor'},
{value: 'description', label: 'Description'}, {value: 'description', label: 'Abstract'},
{value: 'subject', label: 'Subject'}, {value: 'subject', label: 'Subject'},
{value: 'fos', label: 'Field of Science'}, {value: 'fos', label: 'Field of Science'},
{value: 'sdg', label: 'SDG'} {value: 'sdg', label: 'SDG'},
{value: 'publisher', label: 'Publisher'},
{value: 'publicationyear', label: 'Publication Year'}
] ]
public readonly numericFields: string[] = ['publicationyear'];
public readonly verbs: Option[] = [ public readonly verbs: Option[] = [
{value: 'contains', label: 'contains'}, {value: 'contains', label: 'contains'},
{value: 'equals', label: 'equals'}, {value: 'equals', label: 'equals'},
@ -20,17 +22,24 @@ export class CriteriaUtils {
{value: 'not_equals', label: 'not equals'}, {value: 'not_equals', label: 'not equals'},
{value: 'starts_with', label: 'starts with'} {value: 'starts_with', label: 'starts with'}
] ]
public readonly verbsForNumbers: Option[] = [
{value: 'equals', label: 'equals'},
{value: 'lesser_than', label: 'lesser than'},
{value: 'greater_than', label: 'greater than'}
]
public getFiltersAsText(criteria: Criteria[]): string { public getFiltersAsText(criteria: Criteria[], shortVersion=true): string {
let text = criteria.slice(0, 3).map((criterion, index) => (index + 1) + ". " + criterion.constraint.map(constraint => { let text = criteria.slice(0, shortVersion?3:criteria.length).map((criterion, index) => (index + 1) + ". " + criterion.constraint.map(constraint => {
let field = this.fields.find(field => field.value === constraint.field)?.label; let field = this.fields.find(field => field.value === constraint.field)?.label;
let matchCase = false; let matchCase = false;
if (!constraint.verb.includes('_caseinsensitive')) { if (!constraint.verb.includes('_caseinsensitive')) {
matchCase = true; matchCase = true;
} }
let verb = this.verbs.find(verb => verb.value === constraint.verb.replace("_caseinsensitive", "")).label; let verb = [...this.verbs,...this.verbsForNumbers].find(verb => verb.value === constraint.verb.replace("_caseinsensitive", "")).label;
let value = '"' + constraint.value + '"' + (matchCase ? " (Match case)" : ""); let value = '"' + constraint.value + '"' + (matchCase ? " (Match case)" : "");
return field + " " + verb + " " + value; let expFeature = field =='Publisher' || field == 'Publication Year'? `<span *ngIf="constraint.get('field').value == 'publisher' || constraint.get('field').value == 'publicationyear'" class="
uk-margin-xsmall-left uk-padding-remove-vertical uk-label uk-label-warning uk-text-lowercase uk-padding-xsmall">experimental feature</span>`:''
return field + " " + verb + " " + value + expFeature;
}).join(" <b>and</b> ")); }).join(" <b>and</b> "));
return text.join("<br>"); return text.join("<br>");
} }

View File

@ -1,4 +1,4 @@
<div class="uk-position-relative" style="min-height: 60vh"> <div class="uk-position-relative" [style]=" height == -1?'': 'min-height:60vh'">
<div *ngIf="loading" class="uk-position-center"> <div *ngIf="loading" class="uk-position-center">
<loading></loading> <loading></loading>
</div> </div>
@ -32,6 +32,8 @@
</div> </div>
<div *ngFor="let constraint of getConstraint(i).controls; let j=index" [formGroupName]="j.toString()" <div *ngFor="let constraint of getConstraint(i).controls; let j=index" [formGroupName]="j.toString()"
class="uk-margin-bottom uk-hidden@l"> class="uk-margin-bottom uk-hidden@l">
<span *ngIf="constraint.get('field').value == 'publisher' || constraint.get('field').value == 'publicationyear'" class="
uk-padding-remove-vertical uk-label uk-label-warning uk-text-lowercase uk-float-left uk-padding-xsmall">experimental feature</span>
<div class="uk-flex-middle uk-grid-small uk-margin-medium-bottom" uk-grid> <div class="uk-flex-middle uk-grid-small uk-margin-medium-bottom" uk-grid>
<div class="uk-flex uk-flex-right uk-width-1-1"> <div class="uk-flex uk-flex-right uk-width-1-1">
<button class="uk-close uk-icon" (click)="removeConstraint(i, j)"> <button class="uk-close uk-icon" (click)="removeConstraint(i, j)">
@ -40,13 +42,17 @@
</button> </button>
</div> </div>
<div class="uk-width-1-1" input type="select" inputClass="border-bottom" [placeholder]="{static: true, label: 'Choose a field'}" <div class="uk-width-1-1" input type="select" inputClass="border-bottom" [placeholder]="{static: true, label: 'Choose a field'}"
[options]="criteriaUtils.fields" [formInput]="constraint.get('field')"> [options]="criteriaUtils.fields" [formInput]="constraint.get('field')" (valueChange)="resetFieldWhenValueChange(constraint)">
<label class="uk-text-uppercase uk-text-bold uk-width-1-3 uk-text-truncate">Field:</label> <label class="uk-text-uppercase uk-text-bold uk-width-1-3 uk-text-truncate">Field:</label>
</div> </div>
<div class="uk-width-1-1" input type="select" inputClass="border-bottom" <div *ngIf="criteriaUtils.numericFields.indexOf(constraint.get('field').value) == -1" class="uk-width-1-1" input type="select" inputClass="border-bottom"
[options]="criteriaUtils.verbs" [formInput]="constraint.get('verb')"> [options]="criteriaUtils.verbs" [formInput]="constraint.get('verb')">
<label class="uk-text-uppercase uk-text-bold uk-width-1-3 uk-text-truncate">Operator:</label> <label class="uk-text-uppercase uk-text-bold uk-width-1-3 uk-text-truncate">Operator:</label>
</div> </div>
<div *ngIf="criteriaUtils.numericFields.indexOf(constraint.get('field').value) != -1" class="uk-width-1-1" input type="select" inputClass="border-bottom"
[options]="criteriaUtils.verbsForNumbers" [formInput]="constraint.get('verb')">
<label class="uk-text-uppercase uk-text-bold uk-width-1-3 uk-text-truncate">Operator:</label>
</div>
<div class="uk-width-1-1" input [placeholder]="{static: true, label: 'Type a keyword'}" <div class="uk-width-1-1" input [placeholder]="{static: true, label: 'Type a keyword'}"
[formInput]="constraint.get('value')"> [formInput]="constraint.get('value')">
<label class="uk-text-uppercase uk-text-bold uk-width-1-3 uk-text-truncate">Term:</label> <label class="uk-text-uppercase uk-text-bold uk-width-1-3 uk-text-truncate">Term:</label>
@ -66,11 +72,15 @@
</div> </div>
<div *ngFor="let constraint of getConstraint(i).controls; let j=index" <div *ngFor="let constraint of getConstraint(i).controls; let j=index"
[formGroupName]="j.toString()" class="uk-margin-bottom uk-visible@l"> [formGroupName]="j.toString()" class="uk-margin-bottom uk-visible@l">
<span *ngIf="constraint.get('field').value == 'publisher' || constraint.get('field').value == 'publicationyear'" class="
uk-padding-remove-vertical uk-label uk-label-warning uk-text-lowercase uk-padding-xsmall">experimental feature</span>
<div class="uk-flex uk-flex-middle uk-grid" uk-grid> <div class="uk-flex uk-flex-middle uk-grid" uk-grid>
<div class="uk-width-1-4" input type="select" inputClass="border-bottom" [placeholder]="{static: true, label: 'Choose a field'}" <div class="uk-width-1-4" input type="select" inputClass="border-bottom" [placeholder]="{static: true, label: 'Choose a field'}"
[options]="criteriaUtils.fields" [formInput]="constraint.get('field')"></div> [options]="criteriaUtils.fields" [formInput]="constraint.get('field')"></div>
<div class="uk-width-1-4" input type="select" inputClass="border-bottom" <div *ngIf="criteriaUtils.numericFields.indexOf(constraint.get('field').value) == -1" class="uk-width-1-4" input type="select" inputClass="border-bottom"
[options]="criteriaUtils.verbs" [formInput]="constraint.get('verb')"></div> [options]="criteriaUtils.verbs" [formInput]="constraint.get('verb')"></div>
<div *ngIf="criteriaUtils.numericFields.indexOf(constraint.get('field').value) != -1" class="uk-width-1-4" input type="select" inputClass="border-bottom"
[options]="criteriaUtils.verbsForNumbers" [formInput]="constraint.get('verb')"></div>
<div *ngIf="constraint.get('field').value !== 'fos' && constraint.get('field').value !== 'sdg'" class="uk-width-1-4" inputClass="flat small" input [placeholder]="{static: true, label: 'Type a keyword'}" <div *ngIf="constraint.get('field').value !== 'fos' && constraint.get('field').value !== 'sdg'" class="uk-width-1-4" inputClass="flat small" input [placeholder]="{static: true, label: 'Type a keyword'}"
[formInput]="constraint.get('value')"></div> [formInput]="constraint.get('value')"></div>
<div *ngIf="constraint.get('field').value === 'fos'" class="uk-width-1-4" inputClass="flat small" input [placeholder]="{static: true, label: 'Choose a FoS'}" <div *ngIf="constraint.get('field').value === 'fos'" class="uk-width-1-4" inputClass="flat small" input [placeholder]="{static: true, label: 'Choose a FoS'}"

View File

@ -225,4 +225,14 @@ export class CriteriaComponent implements OnInit, OnChanges, AfterViewInit, OnDe
}) })
return selectionCriteria; return selectionCriteria;
} }
resetFieldWhenValueChange(constraint){
// if field not numeric, but verb is numeric clear the verb
if(this.criteriaUtils.numericFields.indexOf(constraint.get('field').value) == -1 && this.criteriaUtils.verbs.indexOf(constraint.get('verb').value)){
constraint.get('verb').setValue(this.criteriaUtils.verbs[0].value);
}
if(this.criteriaUtils.numericFields.indexOf(constraint.get('field').value) != -1 && this.criteriaUtils.numericFields.indexOf(constraint.get('verb').value)){
constraint.get('verb').setValue(this.criteriaUtils.verbsForNumbers[0].value);
}
}
} }

View File

@ -1,4 +1,4 @@
import {ChangeDetectorRef, Component, OnInit, ViewChild} from '@angular/core'; import {ChangeDetectorRef, Component, OnInit, SimpleChanges, ViewChild} from '@angular/core';
import {RemoveContentProvidersComponent} from './remove-content-providers.component'; import {RemoveContentProvidersComponent} from './remove-content-providers.component';
import {Title} from '@angular/platform-browser'; import {Title} from '@angular/platform-browser';
import { import {
@ -15,6 +15,7 @@ import {OpenaireEntities} from "../../openaireLibrary/utils/properties/searchFie
import {CriteriaComponent} from "./criteria/criteria.component"; import {CriteriaComponent} from "./criteria/criteria.component";
import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler"; import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler";
import {ManageCommunityContentProvidersService} from "../../services/manageContentProviders.service"; import {ManageCommunityContentProvidersService} from "../../services/manageContentProviders.service";
import {UntypedFormBuilder} from "@angular/forms";
@Component({ @Component({
selector: 'manage-content-providers', selector: 'manage-content-providers',
@ -23,6 +24,7 @@ import {ManageCommunityContentProvidersService} from "../../services/manageConte
[communityContentProviders]="communityContentProviders" [communityContentProviders]="communityContentProviders"
[loading]="showLoadingInRemove" [community]="community" [loading]="showLoadingInRemove" [community]="community"
(editCriteria)="openCriteria($event)" (editCriteria)="openCriteria($event)"
(communityContentProvidersChanged)="communityContentProvidersChanged($event)"> (communityContentProvidersChanged)="communityContentProvidersChanged($event)">
</remove-content-providers> </remove-content-providers>
<fs-modal #addContentProvidersModal> <fs-modal #addContentProvidersModal>
@ -30,10 +32,23 @@ import {ManageCommunityContentProvidersService} from "../../services/manageConte
[community]="community" [community]="community"
(communityContentProvidersChanged)="communityContentProvidersChanged($event)"></add-content-providers> (communityContentProvidersChanged)="communityContentProvidersChanged($event)"></add-content-providers>
</fs-modal> </fs-modal>
<fs-modal #filtersModal (okEmitter)="saveCriteria()" (cancelEmitter)="criteria.reset()" <fs-modal #filtersModal (okEmitter)="saveCriteria()" (cancelEmitter)="criteria.reset(); depositReset();"
[okButtonDisabled]="criteria && criteria.disabled"> [okButtonDisabled]="(criteria && criteria.disabled && !depositInfoChanged)">
<div class="uk-container uk-container-large"> <div class="uk-container uk-container-large">
<criteria #criteria *ngIf="dataProvider" [height]="filtersModal.bodyHeight" <div *ngIf="dataProvider" class="uk-text-large">{{dataProvider.officialname}}</div>
<div class="uk-flex uk-flex-center">
<div>
<mat-slide-toggle [checked]="enabled" (change)="enabled = !enabled; depositInfoChanged = true;"></mat-slide-toggle>
<label class="uk-margin-medium-top uk-margin-small-left ">Content source</label>
</div>
<div class="uk-margin-small-left">
<mat-slide-toggle [checked]="deposit" (change)="deposit = !deposit; depositInfoChanged = true;"></mat-slide-toggle>
<label class="uk-margin-medium-top uk-margin-small-left ">Suggest for deposit</label>
</div>
</div>
<div class="uk-hr" [class.uk-hidden]="!enabled">
<div class="uk-text-center uk-text-bold uk-text-large uk-margin-top ">Content filters</div>
<criteria #criteria *ngIf="dataProvider" [height]="'-1'"
[selectionCriteria]="dataProvider.selectioncriteria"> [selectionCriteria]="dataProvider.selectioncriteria">
<div no-criteria> <div no-criteria>
<h5 class="uk-margin-small-bottom">No Filters for {{dataProvider.officialname}} yet</h5> <h5 class="uk-margin-small-bottom">No Filters for {{dataProvider.officialname}} yet</h5>
@ -43,6 +58,24 @@ import {ManageCommunityContentProvidersService} from "../../services/manageConte
</div> </div>
</criteria> </criteria>
</div> </div>
<div *ngIf="deposit" class="uk-hr">
<!--<div class="uk-width-1-1 uk-margin-medium-top" input placeholder="Type a message or instruction for researchers about deposition in this datasource"
[value]="message" (valueChange)="message=$event; depositInfoChanged = true;">
</div>-->
<div class="uk-margin-top uk-text-meta">Type a message or instruction for researchers about deposition in this datasource</div>
<ckeditor [readonly]="false"
debounce="500"
[formControl]="messageForm" (change)="messageChanged()"
[config]="{ extraAllowedContent: '* [uk-*](*) ; span', disallowedContent: 'script; *[on*]',
removeButtons: 'Save,NewPage,DocProps,Preview,Print,' +
'Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,' +
'CreateDiv,Flash,PageBreak,' +
'Subscript,Superscript,Anchor,Smiley,Iframe,Styles,Font,About,Language,JustifyLeft,JustifyRight,JustifyCenter,JustifyBlock,FontSize,TextColor,BGColor',
extraPlugins: 'divarea'}">
</ckeditor>
</div>
</div>
</fs-modal> </fs-modal>
` `
}) })
@ -53,6 +86,7 @@ export class ManageContentProvidersComponent implements OnInit {
@ViewChild('criteria') criteria: CriteriaComponent; @ViewChild('criteria') criteria: CriteriaComponent;
@ViewChild('addContentProvidersModal', { static: true }) addContentProvidersModal: FullScreenModalComponent; @ViewChild('addContentProvidersModal', { static: true }) addContentProvidersModal: FullScreenModalComponent;
@ViewChild('filtersModal', { static: true }) filtersModal: FullScreenModalComponent; @ViewChild('filtersModal', { static: true }) filtersModal: FullScreenModalComponent;
@ViewChild('depositModal', { static: true }) depositModal: FullScreenModalComponent;
private subscriptions: any[] = []; private subscriptions: any[] = [];
public showLoadingInRemove: boolean = true; public showLoadingInRemove: boolean = true;
public body: string = "Send from page"; public body: string = "Send from page";
@ -60,11 +94,16 @@ export class ManageContentProvidersComponent implements OnInit {
public openaireEntities = OpenaireEntities; public openaireEntities = OpenaireEntities;
public community: CommunityInfo; public community: CommunityInfo;
public dataProvider: ContentProvider; public dataProvider: ContentProvider;
message = "";
deposit= false;
enabled = false;
depositInfoChanged =false;
messageForm = this.fb.control("");
constructor(private title: Title, constructor(private title: Title,
private cdr: ChangeDetectorRef, private cdr: ChangeDetectorRef,
private communityService: CommunityService, private communityService: CommunityService,
private manageCommunityContentProvidersService: ManageCommunityContentProvidersService) { private manageCommunityContentProvidersService: ManageCommunityContentProvidersService,
private fb: UntypedFormBuilder) {
} }
ngOnInit() { ngOnInit() {
@ -96,17 +135,26 @@ export class ManageContentProvidersComponent implements OnInit {
public openCriteria(contentProvider: ContentProvider) { public openCriteria(contentProvider: ContentProvider) {
this.dataProvider = contentProvider; this.dataProvider = contentProvider;
this.filtersModal.title = 'Filters'; this.deposit = this.dataProvider.deposit;
this.message = this.dataProvider.message;
this.enabled = this.dataProvider.enabled;
this.messageForm = this.fb.control(this.message);
this.depositInfoChanged = false;
this.filtersModal.title = 'Edit datasource options';
this.filtersModal.okButtonText = "Save"; this.filtersModal.okButtonText = "Save";
this.filtersModal.back = true; this.filtersModal.back = true;
this.filtersModal.okButton = true; this.filtersModal.okButton = true;
this.filtersModal.open(); this.filtersModal.open();
this.cdr.detectChanges(); this.cdr.detectChanges();
} }
public saveCriteria() { public saveCriteria() {
let callback = (selectionCriteria): void => { let callback = (selectionCriteria): void => {
this.dataProvider.selectioncriteria = selectionCriteria; this.dataProvider.selectioncriteria = selectionCriteria;
this.dataProvider.deposit = this.deposit;
this.dataProvider.message = this.message;
this.dataProvider.enabled = this.enabled;
console.log(this.dataProvider)
this.manageCommunityContentProvidersService.saveContentProvider(this.properties, this.dataProvider).subscribe(() => { this.manageCommunityContentProvidersService.saveContentProvider(this.properties, this.dataProvider).subscribe(() => {
this.criteria.reset(); this.criteria.reset();
this.removeContentProvidersComponent.getCommunityContentProviders(); this.removeContentProvidersComponent.getCommunityContentProviders();
@ -118,6 +166,7 @@ export class ManageContentProvidersComponent implements OnInit {
}); });
} }
this.removeContentProvidersComponent.loading = true; this.removeContentProvidersComponent.loading = true;
console.log()
this.criteria.save(callback); this.criteria.save(callback);
} }
@ -128,4 +177,17 @@ export class ManageContentProvidersComponent implements OnInit {
this.removeContentProvidersComponent.applyFilters(); this.removeContentProvidersComponent.applyFilters();
} }
} }
depositReset(){
this.message = this.dataProvider.message;
this.messageForm.setValue(this.message);
this.deposit = this.dataProvider.deposit;
this.enabled = this.dataProvider.enabled;
}
messageChanged(){
this.message = this.messageForm.value;
this.depositInfoChanged = true;
}
} }

View File

@ -22,6 +22,8 @@
<loading></loading> <loading></loading>
</div> </div>
<div *ngIf="!loading"> <div *ngIf="!loading">
<validate-page-enabled pageRoute="/search/find/dataproviders"></validate-page-enabled>
<validate-page-enabled pageRoute="/participate/deposit/suggested"></validate-page-enabled>
<div *ngIf="previewCommunityContentProviders.length == 0" <div *ngIf="previewCommunityContentProviders.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold"> class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No <span class="uk-text-lowercase">{{openAIREEntities.DATASOURCES}} </span> <div>No <span class="uk-text-lowercase">{{openAIREEntities.DATASOURCES}} </span>
@ -54,7 +56,13 @@
<span *ngIf="!item.officialname && !item.name">[no title available]</span> <span *ngIf="!item.officialname && !item.name">[no title available]</span>
</span> </span>
</h6> </h6>
<div *ngIf="item.selectioncriteria?.criteria?.length > 0" class="uk-margin-small-bottom uk-text-small"> <div *ngIf="item.enabled" class="uk-label uk-text-primary uk-margin-small-right uk-padding-xsmall ">Content source</div>
<div *ngIf="item.deposit" class="uk-label uk-label-success uk-padding-xsmall">Suggested for deposit</div>
<div *ngIf="item.deposit && item.message" class=" uk-text-small uk-margin-top">
<div class="uk-text-muted uk-text-xsmall">Deposit info:</div>
<div [innerHTML]="item.message"></div>
</div>
<div *ngIf="item.selectioncriteria?.criteria?.length > 0" class="uk-margin-small-bottom uk-margin-small-top uk-text-small">
<div class="uk-text-meta uk-margin-small-bottom">Filters</div> <div class="uk-text-meta uk-margin-small-bottom">Filters</div>
<div [innerHTML]="criteriaUtils.getFiltersAsText(item.selectioncriteria.criteria)"></div> <div [innerHTML]="criteriaUtils.getFiltersAsText(item.selectioncriteria.criteria)"></div>
<div *ngIf="item.selectioncriteria.criteria.length > 3" class="uk-margin-small-top"> <div *ngIf="item.selectioncriteria.criteria.length > 3" class="uk-margin-small-top">
@ -64,17 +72,23 @@
</div> </div>
<div class="uk-card-footer uk-padding-remove-vertical"> <div class="uk-card-footer uk-padding-remove-vertical">
<div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid> <div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid>
<div>
</div>
<div> <div>
<div class="uk-padding-small uk-padding-remove-horizontal"> <div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="openCriteria(item)" class="uk-button uk-button-link uk-flex uk-flex-middle"> <a (click)="openCriteria(item)" class="uk-button uk-button-link uk-flex uk-flex-middle">
<icon name="filters" [flex]="true"></icon> <icon name="edit" [flex]="true"></icon>
<span *ngIf="item.selectioncriteria?.criteria?.length > 0" class="uk-margin-small-left" <!--<span *ngIf="item.selectioncriteria?.criteria?.length > 0" class="uk-margin-small-left"
uk-tooltip="<div>Edit filters to limit research results.<br>Results which satisfy any of the selected filters will be included in your community.</div>"> uk-tooltip="<div>Edit filters to limit research results.<br>Results which satisfy any of the selected filters will be included in your community.</div>">
Edit filters Edit filters
</span> </span>
<span *ngIf="!(item.selectioncriteria?.criteria?.length > 0)" class="uk-margin-small-left" <span *ngIf="!(item.selectioncriteria?.criteria?.length > 0)" class="uk-margin-small-left"
uk-tooltip="<div>Add filter to limit research results.<br>Results which satisfy any of the selected filters will be included in your community.</div>"> uk-tooltip="<div>Add filter to limit research results.<br>Results which satisfy any of the selected filters will be included in your community.</div>">
Add filters Add filters
</span>-->
<span class="uk-margin-small-left"
uk-tooltip="<div>Select datasource as content source and/or suggest for deposit. Add filters to limit research results.<br>Results which satisfy any of the selected filters will be included in your community.</div>">
Edit Options
</span> </span>
</a> </a>
</div> </div>

View File

@ -87,6 +87,7 @@ export class RemoveContentProvidersComponent implements OnInit {
let index = this.communityContentProviders.indexOf(this.selectedCommunityContentProvider); let index = this.communityContentProviders.indexOf(this.selectedCommunityContentProvider);
this.communityContentProviders.splice(index, 1); this.communityContentProviders.splice(index, 1);
this.applyFilters(); this.applyFilters();
this._clearCacheService.clearCacheInRoute(this.openAIREEntities.DATASOURCE+" removed", this.community.communityId)
this._clearCacheService.purgeBrowserCache(this.openAIREEntities.DATASOURCE+" removed", this.community.communityId); this._clearCacheService.purgeBrowserCache(this.openAIREEntities.DATASOURCE+" removed", this.community.communityId);
this.handleSuccess(this.openAIREEntities.DATASOURCE + ' successfully removed!') this.handleSuccess(this.openAIREEntities.DATASOURCE + ' successfully removed!')
this.communityContentProvidersChanged.emit({ this.communityContentProvidersChanged.emit({
@ -183,4 +184,5 @@ export class RemoveContentProvidersComponent implements OnInit {
openCriteria(contentProvider: ContentProvider) { openCriteria(contentProvider: ContentProvider) {
this.editCriteria.emit(contentProvider); this.editCriteria.emit(contentProvider);
} }
} }

View File

@ -208,12 +208,12 @@
[light]="false"></background> [light]="false"></background>
<background label="Light" [background]="draftCustomizationOptions.backgrounds.light" <background label="Light" [background]="draftCustomizationOptions.backgrounds.light"
[light]="true"></background> [light]="true"></background>
<background label="Hero section" [background]="draftCustomizationOptions.backgrounds.form" <background label="Custom section" [background]="draftCustomizationOptions.backgrounds.form"
[light]="draftCustomizationOptions.backgrounds.form.fontsDarkMode" [light]="draftCustomizationOptions.backgrounds.form.fontsDarkMode"
[oldBackground]="publishedCustomizationOptions.backgrounds.form" [oldBackground]="publishedCustomizationOptions.backgrounds.form"
[communityId]="communityId" description="The area under menu"></background> [communityId]="communityId"></background>
<div class="uk-margin-xsmall-bottom uk-text-uppercase uk-text-meta uk-text-bold uk-margin-large-top uk-flex uk-flex-middle uk-heading-divider"> <div class="uk-margin-xsmall-bottom uk-text-uppercase uk-text-meta uk-text-bold uk-margin-large-top uk-flex uk-flex-middle uk-heading-divider">
Hero section Custom section
</div> </div>
<div class="uk-margin-xsmall-bottom uk-text-uppercase uk-text-meta uk-text-bold uk-margin-medium-top uk-flex uk-flex-middle"> <div class="uk-margin-xsmall-bottom uk-text-uppercase uk-text-meta uk-text-bold uk-margin-medium-top uk-flex uk-flex-middle">
Fonts Fonts
@ -231,7 +231,7 @@
[checked]="draftCustomizationOptions.backgrounds.form.fontsDarkMode" [checked]="draftCustomizationOptions.backgrounds.form.fontsDarkMode"
(change)="draftCustomizationOptions.backgrounds.form.fontsDarkMode=!draftCustomizationOptions.backgrounds.form.fontsDarkMode;" (change)="draftCustomizationOptions.backgrounds.form.fontsDarkMode=!draftCustomizationOptions.backgrounds.form.fontsDarkMode;"
[attr.uk-tooltip]="'title:<div class=\'uk-width-large\'>' + [attr.uk-tooltip]="'title:<div class=\'uk-width-large\'>' +
(draftCustomizationOptions.backgrounds.form.fontsDarkMode?'Change to light color mode if the hero section background is dark':'Change to dark mode if the hero section background is light')+'</div>'" (draftCustomizationOptions.backgrounds.form.fontsDarkMode?'Change to light color mode if the custom section background is dark':'Change to dark mode if the custom section background is light')+'</div>'"
> >
</mat-slide-toggle> </mat-slide-toggle>
</span> </span>

View File

@ -164,11 +164,6 @@ sidebarItems = [{name:"Identity", id : "identity", icon: "desktop_windows" },
return JSON.stringify(object1) != JSON.stringify(object2); return JSON.stringify(object1) != JSON.stringify(object2);
} }
saveLayout() { saveLayout() {
if (!Session.isLoggedIn()) {
this._router.navigate(['/user-info'], {
queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url}
});
}
this.publishedLayout.layoutOptions = this.copyObject(this.draftCustomizationOptions); this.publishedLayout.layoutOptions = this.copyObject(this.draftCustomizationOptions);
this.publishedCustomizationOptions = this.copyObject(this.publishedLayout.layoutOptions) this.publishedCustomizationOptions = this.copyObject(this.publishedLayout.layoutOptions)
this.publishedLayout.date = new Date(); this.publishedLayout.date = new Date();

View File

@ -83,7 +83,7 @@ type Tab = 'all' | 'communities' | 'ris';
<div class="uk-card uk-card-default uk-card-body uk-position-relative"> <div class="uk-card uk-card-default uk-card-body uk-position-relative">
<div class="uk-position-top-right uk-margin-small-right uk-margin-small-top"> <div class="uk-position-top-right uk-margin-small-right uk-margin-small-top">
<div class="uk-flex uk-flex-middle"> <div class="uk-flex uk-flex-middle">
<icon [flex]="true" [name]="community.status == 'all'?'earth':(community.status == 'manager'?'restricted':'incognito')" ratio="0.6"></icon> <icon [flex]="true" [name]="community.isPublic()?'earth':(community.isRestricted()?'restricted':'incognito')" ratio="0.6"></icon>
</div> </div>
</div> </div>
<a class="uk-display-block uk-text-center uk-link-reset" [routerLink]="community.communityId"> <a class="uk-display-block uk-text-center uk-link-reset" [routerLink]="community.communityId">

View File

@ -123,6 +123,7 @@ export class AddProjectsComponent implements OnInit {
this.subscriptions.push(this._manageCommunityProjectsService.addProject(this.properties, this.community.communityId, project).subscribe( this.subscriptions.push(this._manageCommunityProjectsService.addProject(this.properties, this.community.communityId, project).subscribe(
data => { data => {
// this.communityProjects.push(data); // this.communityProjects.push(data);
this._clearCacheService.clearCacheInRoute(this.openaireEntities.PROJECT+" added", this.community.communityId);
this._clearCacheService.purgeBrowserCache(this.openaireEntities.PROJECT+" added", this.community.communityId); this._clearCacheService.purgeBrowserCache(this.openaireEntities.PROJECT+" added", this.community.communityId);
UIkit.notification(this.openaireEntities.PROJECT+' successfully added!', { UIkit.notification(this.openaireEntities.PROJECT+' successfully added!', {

View File

@ -24,6 +24,7 @@ import {ResultPreviewModule} from "../../openaireLibrary/utils/result-preview/re
import {ErrorMessagesModule} from "../../openaireLibrary/utils/errorMessages.module"; import {ErrorMessagesModule} from "../../openaireLibrary/utils/errorMessages.module";
import {DropdownFilterModule} from "../../openaireLibrary/utils/dropdown-filter/dropdown-filter.module"; import {DropdownFilterModule} from "../../openaireLibrary/utils/dropdown-filter/dropdown-filter.module";
import {SearchFilterModule} from "../../openaireLibrary/searchPages/searchUtils/searchFilter.module"; import {SearchFilterModule} from "../../openaireLibrary/searchPages/searchUtils/searchFilter.module";
import {ValidateEnabledPageModule} from "../../utils/validateEnabledPage.module";
@NgModule({ @NgModule({
imports: [ imports: [
@ -44,7 +45,7 @@ import {SearchFilterModule} from "../../openaireLibrary/searchPages/searchUtils/
path: '', component: ManageProjectsComponent path: '', component: ManageProjectsComponent
} }
]), ]),
NoLoadPaging, LoadingModule, IconsModule, FullScreenModalModule, ResultPreviewModule, DropdownFilterModule, SearchFilterModule NoLoadPaging, LoadingModule, IconsModule, FullScreenModalModule, ResultPreviewModule, DropdownFilterModule, SearchFilterModule, ValidateEnabledPageModule
], ],
declarations: [ declarations: [
ManageProjectsComponent, ManageProjectsComponent,

View File

@ -67,6 +67,7 @@
<div *ngIf="loading" class="uk-position-center"> <div *ngIf="loading" class="uk-position-center">
<loading></loading> <loading></loading>
</div> </div>
<validate-page-enabled pageRoute="/search/find/projects"></validate-page-enabled>
<div *ngIf="!loading"> <div *ngIf="!loading">
<div class="uk-margin-medium-bottom"> <div class="uk-margin-medium-bottom">
<div *ngIf="previewCommunityProjects.length == 0" <div *ngIf="previewCommunityProjects.length == 0"

View File

@ -131,7 +131,7 @@ export class RemoveProjectsComponent implements OnInit {
public confirmedDeleteProject(data: any) { public confirmedDeleteProject(data: any) {
this.subscriptions.push(this._manageCommunityProjectsService.removeProject(this.properties, this.community.communityId, this.selectedCommunityProject.openaireId).subscribe( this.subscriptions.push(this._manageCommunityProjectsService.removeProject(this.properties, this.community.communityId, this.selectedCommunityProject.openaireId).subscribe(
data => { data => {
this._clearCacheService.clearCacheInRoute(this.openaireEntiites.PROJECT+" removed", this.community.communityId);
this._clearCacheService.purgeBrowserCache(this.openaireEntiites.PROJECT+" removed", this.community.communityId); this._clearCacheService.purgeBrowserCache(this.openaireEntiites.PROJECT+" removed", this.community.communityId);
NotificationHandler.rise(OpenaireEntities.PROJECT+' successfully removed!'); NotificationHandler.rise(OpenaireEntities.PROJECT+' successfully removed!');
this._getCommunityProjects(this.communitySearchUtils.page, this.keyword,null); this._getCommunityProjects(this.communitySearchUtils.page, this.keyword,null);

View File

@ -21,6 +21,7 @@
<div *ngIf="loading" class="uk-position-center"> <div *ngIf="loading" class="uk-position-center">
<loading></loading> <loading></loading>
</div> </div>
<validate-page-enabled pageRoute="/subjects"></validate-page-enabled>
<div *ngIf="!loading"> <div *ngIf="!loading">
<div *ngIf="displayedSubjects?.length == 0 && displayedSdg?.length == 0 && displayedFos?.length == 0" <div *ngIf="displayedSubjects?.length == 0 && displayedSdg?.length == 0 && displayedFos?.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold"> class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">

View File

@ -344,6 +344,7 @@ export class SubjectsEditFormComponent implements OnInit {
} }
}); });
this._communityService.updateSubjects(this.community.subjects, this.community.fos, this.community.sdg); this._communityService.updateSubjects(this.community.subjects, this.community.fos, this.community.sdg);
this._clearCacheService.clearCacheInRoute("Subjects " + message, this.communityId);
this._clearCacheService.purgeBrowserCache("Subjects " + message, this.communityId); this._clearCacheService.purgeBrowserCache("Subjects " + message, this.communityId);
NotificationHandler.rise('Subjects successfully ' + message + '!') NotificationHandler.rise('Subjects successfully ' + message + '!')
this.loading = false; this.loading = false;

View File

@ -18,12 +18,13 @@ import {FullScreenModalModule} from 'src/app/openaireLibrary/utils/modal/full-sc
import {PagingModule} from "../../../openaireLibrary/utils/paging.module"; import {PagingModule} from "../../../openaireLibrary/utils/paging.module";
import {SdgSelectionModule} from '../../../openaireLibrary/sdg/sdg-selection/sdg-selection.module'; import {SdgSelectionModule} from '../../../openaireLibrary/sdg/sdg-selection/sdg-selection.module';
import {FosSelectionModule} from '../../../openaireLibrary/fos/fos-selection/fos-selection.module'; import {FosSelectionModule} from '../../../openaireLibrary/fos/fos-selection/fos-selection.module';
import {ValidateEnabledPageModule} from "../../../utils/validateEnabledPage.module";
@NgModule({ @NgModule({
imports: [ imports: [
SubjectsEditFormRoutingModule, CommonModule, FormsModule, RouterModule, SubjectsEditFormRoutingModule, CommonModule, FormsModule, RouterModule,
PageContentModule, IconsModule, AlertModalModule, NoLoadPaging, LoadingModule, InputModule, PageContentModule, IconsModule, AlertModalModule, NoLoadPaging, LoadingModule, InputModule,
SearchInputModule, FullScreenModalModule, PagingModule, SdgSelectionModule, FosSelectionModule SearchInputModule, FullScreenModalModule, PagingModule, SdgSelectionModule, FosSelectionModule, ValidateEnabledPageModule
], ],
declarations: [ declarations: [
SubjectsEditFormComponent SubjectsEditFormComponent

View File

@ -42,7 +42,7 @@ export class UsersManagersComponent implements OnInit {
this.link = this.getURL(this.community.communityId); this.link = this.getURL(this.community.communityId);
this.message = 'A manager has the right to access the administration part of Research Community Dashboard, ' + this.message = 'A manager has the right to access the administration part of Research Community Dashboard, ' +
'where he is able to customize and manage the content, invite other users as managers or members.'; 'where he is able to customize and manage the content, invite other users as managers or members.';
if(community.status === "hidden") { if(community.isPrivate()) {
this.inviteDisableMessage = "Community's status is Hidden and invitation to manage the Research community dashboard is disabled. Update the community status to enable invitations." this.inviteDisableMessage = "Community's status is Hidden and invitation to manage the Research community dashboard is disabled. Update the community status to enable invitations."
} }
this.loading = false; this.loading = false;

View File

@ -46,8 +46,8 @@ export class UsersSubscribersComponent implements OnInit {
this.link = this.getURL(this.community.communityId); this.link = this.getURL(this.community.communityId);
this.message = 'A member can access the community dashboard and link research results with projects, ' + this.message = 'A member can access the community dashboard and link research results with projects, ' +
'communities and other research projects.'; 'communities and other research projects.';
if(community.status !== "all") { if(!community.isPublic()) {
this.inviteDisableMessage = "Community's status is " + (community.status === 'manager'?'Visible to managers':'Hidden') + " and invitation to join the Research community dashboard is disabled. Update the community status to enable invitations." this.inviteDisableMessage = "Community's status is " + (community.isRestricted()?'Visible to managers':'Hidden') + " and invitation to join the Research community dashboard is disabled. Update the community status to enable invitations."
} }
this.loading = false; this.loading = false;
} }

View File

@ -22,9 +22,27 @@
<div class="uk-card-body"> <div class="uk-card-body">
<preview-zenodo-community [item]="item" [master]="masterCommunity && item.id==masterCommunity.id"></preview-zenodo-community> <preview-zenodo-community [item]="item" [master]="masterCommunity && item.id==masterCommunity.id"></preview-zenodo-community>
</div> </div>
<div *ngIf="!masterCommunity || item.id!==masterCommunity.id" class="uk-card-footer uk-padding-remove-vertical"> <div class="uk-card-footer uk-padding-remove-vertical">
<div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid> <div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid>
<div *ngIf="!inThelist(item, selectedCommunities) && !(masterCommunity && item.id==masterCommunity.id)"> <div *ngIf="inThelist(item, selectedCommunities) && !(masterCommunity && item.id==masterCommunity.id)">
<div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="removeCommunity(item)"
class="uk-button uk-button-link uk-flex uk-flex-middle">
<icon name="remove" [flex]="true"></icon>
<span class="uk-margin-small-left">Remove</span>
</a>
</div>
</div>
<div *ngIf="(masterCommunity && item.id==masterCommunity.id)">
<div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="removeCommunity(item, true)"
class="uk-button uk-button-link uk-flex uk-flex-middle">
<icon name="remove" [flex]="true"></icon>
<span class="uk-margin-small-left">Remove as Main</span>
</a>
</div>
</div>
<div *ngIf="!inThelist(item, selectedCommunities)">
<div class="uk-padding-small uk-padding-remove-horizontal"> <div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="addCommunity(item)" class="uk-button uk-button-link uk-flex uk-flex-middle"> <a (click)="addCommunity(item)" class="uk-button uk-button-link uk-flex uk-flex-middle">
<icon name="add" [flex]="true"></icon> <icon name="add" [flex]="true"></icon>
@ -34,15 +52,17 @@
</a> </a>
</div> </div>
</div> </div>
<div *ngIf="inThelist(item, selectedCommunities)"> <div *ngIf="!(masterCommunity)">
<div class="uk-padding-small uk-padding-remove-horizontal"> <div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="removeCommunity(item)" <a (click)="addCommunity(item,true)" class="uk-button uk-button-link uk-flex uk-flex-middle">
class="uk-button uk-button-link uk-flex uk-flex-middle"> <icon name="add" [flex]="true"></icon>
<icon name="remove" [flex]="true"></icon> <span class="uk-margin-small-left">
<span class="uk-margin-small-left">Remove</span> Add as Main
</span>
</a> </a>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -11,6 +11,8 @@ import {Subject, Subscription} from 'rxjs';
import {debounceTime, distinctUntilChanged} from 'rxjs/operators'; import {debounceTime, distinctUntilChanged} from 'rxjs/operators';
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo"; import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class"; import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
import {CommunityService} from "../../openaireLibrary/connect/community/community.service";
import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler";
declare var UIkit; declare var UIkit;
@ -39,7 +41,8 @@ export class AddZenodoCommunitiesComponent implements OnInit {
private _router: Router, private _router: Router,
public _fb: UntypedFormBuilder, public _fb: UntypedFormBuilder,
private _zenodoCommunitieService: ZenodoCommunitiesService, private _zenodoCommunitieService: ZenodoCommunitiesService,
private _manageZenodoCommunitiesService: ManageZenodoCommunitiesService) { private _manageZenodoCommunitiesService: ManageZenodoCommunitiesService,
private _communityService: CommunityService) {
this.errorCodes = new ErrorCodes(); this.errorCodes = new ErrorCodes();
this.zenodoCommunitySearchUtils.status = this.errorCodes.LOADING; this.zenodoCommunitySearchUtils.status = this.errorCodes.LOADING;
@ -130,18 +133,26 @@ export class AddZenodoCommunitiesComponent implements OnInit {
} }
public addCommunity(community) { public addCommunity(community, master:boolean = false) {
this.subscriptions.push(this._manageZenodoCommunitiesService.addZCommunity(this.properties, this.community.communityId, community.id).subscribe( if(master && this.getPosition(community) == -1 ){
this.addCommunity(community, false);
}
this.subscriptions.push(this._manageZenodoCommunitiesService.addZenodoCommunity(this.properties, this.community.communityId, community.id, master).subscribe(
data => { data => {
community["openaireId"] = data.id; // this._communityService.setCommunity(this._communityService.parseCommunity(data));
if(master){
this.masterCommunity = community;
}else {
this.selectedCommunities.push(community); this.selectedCommunities.push(community);
UIkit.notification('Community successfully added!', { }
UIkit.notification('Community successfully added' + (master?" as master!":"!"), {
status: 'success', status: 'success',
timeout: 6000, timeout: 6000,
pos: 'bottom-right' pos: 'bottom-right'
}); });
this.zenodoCommunitiesChanged.emit({ this.zenodoCommunitiesChanged.emit({
value: this.selectedCommunities, communities: this.selectedCommunities,
main:this.masterCommunity
}); });
}, },
err => { err => {
@ -151,10 +162,19 @@ export class AddZenodoCommunitiesComponent implements OnInit {
)); ));
} }
public removeCommunity(comm) { public removeCommunity(comm, master:boolean = false) {
var openaireId = this.getOpenaireId(comm); var openaireId = this.getOpenaireId(comm);
this.subscriptions.push(this._manageZenodoCommunitiesService.removeZCommunity(this.properties, this.community.communityId, openaireId,).subscribe( this.subscriptions.push(this._manageZenodoCommunitiesService.removeZenodoCommunity(this.properties, this.community.communityId, openaireId, master).subscribe(
data => { data => {
this.afterRemoveActions(comm, master);
},
err => {
this.handleError('An error has been occurred. Try again later!');
console.log(err.status);
}
));
}
getPosition(comm){
var pos = -1; var pos = -1;
for (var i = 0; i < this.selectedCommunities.length; i++) { for (var i = 0; i < this.selectedCommunities.length; i++) {
if (this.selectedCommunities[i].id == comm.id) { if (this.selectedCommunities[i].id == comm.id) {
@ -162,26 +182,24 @@ export class AddZenodoCommunitiesComponent implements OnInit {
break; break;
} }
} }
return pos;
}
afterRemoveActions(comm, master:boolean = false){
if(master){
this.masterCommunity = null;
NotificationHandler.rise('Community has been <b>removed from master</b>!')
}else {
var pos = this.getPosition(comm)
if (pos != -1) { if (pos != -1) {
this.selectedCommunities.splice(pos, 1); this.selectedCommunities.splice(pos, 1);
} }
}
UIkit.notification('Community successfully removed!', { NotificationHandler.rise('Community has been <b>removed</b>!')
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
this.zenodoCommunitiesChanged.emit({ this.zenodoCommunitiesChanged.emit({
value: this.selectedCommunities, communities: this.selectedCommunities,
main: this.masterCommunity
}); });
},
err => {
this.handleError('An error has been occurred. Try again later!');
console.log(err.status);
} }
));
}
public inThelist(community: any, list): any { public inThelist(community: any, list): any {
for (let com of list) { for (let com of list) {
if (com.id == community.id) { if (com.id == community.id) {

View File

@ -1,158 +0,0 @@
import {
ChangeDetectorRef,
Component,
EventEmitter,
Input,
OnDestroy,
OnInit,
Output,
ViewChild,
ViewEncapsulation
} from '@angular/core';
import {UntypedFormBuilder, UntypedFormControl} from '@angular/forms';
import {ActivatedRoute, Router} from '@angular/router';
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
import {properties} from "../../../environments/environment";
import {ErrorCodes} from '../../openaireLibrary/utils/properties/errorCodes';
import {SearchUtilsClass} from '../../openaireLibrary/searchPages/searchUtils/searchUtils.class';
import {ManageZenodoCommunitiesService} from '../../services/manageZenodoCommunities.service';
import {SearchInputComponent} from '../../openaireLibrary/sharedComponents/search-input/search-input.component';
import {Subscription} from 'rxjs';
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler";
@Component({
selector: 'manage-zenodo-communities',
templateUrl: './manage-zenodo-communities.component.html'
})
export class ManageZenodoCommunitiesComponent implements OnInit, OnDestroy {
properties: EnvProperties = properties;
@Input() community: CommunityInfo = null;
@Input() public loading: boolean = true;
@Input() searchUtils: SearchUtilsClass = null;
errorCodes: ErrorCodes;
public rowsOnPage = 10;
@Input() masterCommunity = null;
@Input() selectedCommunities = [];
previewCommunities = [];
@ViewChild('AlertModalDeleteCommunity') alertModalDeleteCommunity;
selectedToDelete = null;
@Output() addZenodoCommunity: EventEmitter<any> = new EventEmitter();
@Output() zenodoCommunitiesChanged = new EventEmitter();
page = 1;
size = 10;
@ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent;
public filterForm: UntypedFormControl;
private subscriptions: any[] = [];
constructor(private route: ActivatedRoute,
private _router: Router,
public _fb: UntypedFormBuilder,
private cdr: ChangeDetectorRef,
private _manageZenodoCommunitiesService: ManageZenodoCommunitiesService) {
this.errorCodes = new ErrorCodes();
}
ngOnInit() {
this.init();
}
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscription) {
subscription.unsubscribe();
}
});
}
private init() {
this.filterForm = this._fb.control('');
this.filterPreviewCommunities("");
this.subscriptions.push(this.filterForm.valueChanges.subscribe(value => {
this.page = 1;
this.filterPreviewCommunities(value);
}));
this.searchUtils.keyword = "";
this.searchUtils.totalResults = this.selectedCommunities.length;
}
public filterPreviewCommunities(value: string) {
this.previewCommunities = this.selectedCommunities.filter(community => {
return !value || community.title.toLowerCase().indexOf(value.toLowerCase()) != -1
});
if (this.previewCommunities.slice((this.page - 1) * this.rowsOnPage, this.page * this.rowsOnPage).length == 0) {
this.page = 1;
}
this.cdr.detectChanges();
}
public confirmedDeleteCommunity(data: any) {
this.subscriptions.push(this._manageZenodoCommunitiesService.removeZCommunity(this.properties, this.community.communityId, this.selectedToDelete.id).subscribe(
data => {
var pos = -1;
for (var i = 0; i < this.selectedCommunities.length; i++) {
if (this.selectedCommunities[i].id == this.selectedToDelete.id) {
pos = i;
break;
}
}
if (pos != -1) {
this.selectedCommunities.splice(pos, 1);
this.searchUtils.totalResults = this.selectedCommunities.length;
}
this.searchUtils.totalResults = this.selectedCommunities.length;
this.filterPreviewCommunities(this.filterForm.value);
NotificationHandler.rise('Community has been <b>successfully removed</b>!')
this.zenodoCommunitiesChanged.emit({
value: this.selectedCommunities,
});
},
err => {
this.handleError('An error has been occurred. Try again later!');
console.log(err.status);
}
));
}
public removeCommunity(comm) {
this.selectedToDelete = comm;
this.alertModalDeleteCommunity.cancelButton = true;
this.alertModalDeleteCommunity.okButton = true;
this.alertModalDeleteCommunity.alertTitle = "Remove zenodo community";
let title = "";
if (comm.title) {
title = comm.title;
}
this.alertModalDeleteCommunity.message = "Zenodo community";
if (title) {
this.alertModalDeleteCommunity.message += " '" + title + "' ";
}
this.alertModalDeleteCommunity.message += "will be removed from your community. Are you sure?";
this.alertModalDeleteCommunity.okButtonText = "Yes";
this.alertModalDeleteCommunity.open();
}
totalPages(): number {
let totalPages: any = this.searchUtils.totalResults / (this.rowsOnPage);
if (!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
return totalPages;
}
public updatePage($event) {
HelperFunctions.scroll();
this.page = $event.value;
}
addNew() {
this.addZenodoCommunity.emit();
}
handleError(message: string) {
NotificationHandler.rise(message, 'danger');
}
}

View File

@ -8,7 +8,7 @@ import {Component, Input} from '@angular/core';
<a target="_blank" [href]="item.link"> <a target="_blank" [href]="item.link">
<img *ngIf="item.logoUrl" <img *ngIf="item.logoUrl"
src="{{item.logoUrl}}" width="80" height="80" src="{{item.logoUrl}}" width="80" height="80"
alt="{{item.title}}"> alt="">
</a> </a>
</div> </div>
<div class="uk-width-expand"> <div class="uk-width-expand">

View File

@ -1,4 +1,4 @@
<div page-content> <div page-content *ngIf="community && searchUtils">
<div actions> <div actions>
<div class="uk-section-xsmall uk-margin-top"> <div class="uk-section-xsmall uk-margin-top">
<div class="uk-flex uk-flex-right@m uk-flex-center uk-flex-middle uk-grid" uk-grid> <div class="uk-flex uk-flex-right@m uk-flex-center uk-flex-middle uk-grid" uk-grid>
@ -6,7 +6,7 @@
placeholder="Search Zenodo Community" [disabled]="searchUtils.status === errorCodes.LOADING" placeholder="Search Zenodo Community" [disabled]="searchUtils.status === errorCodes.LOADING"
class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div> class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div>
<div> <div>
<button class="uk-button uk-button-default uk-flex uk-flex-middle" (click)="addNew()" <button class="uk-button uk-button-default uk-flex uk-flex-middle" (click)="openAddZenodoCommunites()"
uk-tooltip="title:<div class='uk-text-bold'> Search and add more Zenodo Communities</div><div>The research results of a Zenodo community specified here will be automatically linked to your community dashboard.</div>" uk-tooltip="title:<div class='uk-text-bold'> Search and add more Zenodo Communities</div><div>The research results of a Zenodo community specified here will be automatically linked to your community dashboard.</div>"
[disabled]="searchUtils.status === errorCodes.LOADING" [disabled]="searchUtils.status === errorCodes.LOADING"
[class.uk-disabled]="searchUtils.status === errorCodes.LOADING"> [class.uk-disabled]="searchUtils.status === errorCodes.LOADING">
@ -19,6 +19,7 @@
</div> </div>
<div inner> <div inner>
<div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh"> <div class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">
<validate-page-enabled pageRoute="/participate/deposit/zenodo"></validate-page-enabled>
<div *ngIf="searchUtils.status == errorCodes.LOADING" class="uk-position-center"> <div *ngIf="searchUtils.status == errorCodes.LOADING" class="uk-position-center">
<loading></loading> <loading></loading>
</div> </div>
@ -43,9 +44,9 @@
<div class="uk-card-body"> <div class="uk-card-body">
<preview-zenodo-community [item]="item" [master]="masterCommunity && item.id==masterCommunity.id"></preview-zenodo-community> <preview-zenodo-community [item]="item" [master]="masterCommunity && item.id==masterCommunity.id"></preview-zenodo-community>
</div> </div>
<div *ngIf="!masterCommunity || item.id!==masterCommunity.id" class="uk-card-footer uk-padding-remove-vertical"> <div class="uk-card-footer uk-padding-remove-vertical">
<div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid> <div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid>
<div> <div *ngIf="item.id!==masterZenodoCommunityId" >
<div class="uk-padding-small uk-padding-remove-horizontal"> <div class="uk-padding-small uk-padding-remove-horizontal">
<button class="uk-button uk-button-link uk-flex uk-flex-middle" <button class="uk-button uk-button-link uk-flex uk-flex-middle"
(click)="removeCommunity(item)"> (click)="removeCommunity(item)">
@ -54,6 +55,25 @@
</button> </button>
</div> </div>
</div> </div>
<div *ngIf="(item.id==masterZenodoCommunityId)">
<div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="removeFromMasterCommunity(item)"
class="uk-button uk-button-link uk-flex uk-flex-middle">
<icon name="remove" [flex]="true"></icon>
<span class="uk-margin-small-left">Remove as Main</span>
</a>
</div>
</div>
<div *ngIf="(!masterZenodoCommunityId)">
<div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="addAsMasterCommunity(item)"
class="uk-button uk-button-link uk-flex uk-flex-middle">
<icon name="add" [flex]="true"></icon>
<span class="uk-margin-small-left">Add as Main</span>
</a>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -72,3 +92,9 @@
</div> </div>
</div> </div>
<modal-alert #AlertModalDeleteCommunity (alertOutput)="confirmedDeleteCommunity($event)" [overflowBody]="false"></modal-alert> <modal-alert #AlertModalDeleteCommunity (alertOutput)="confirmedDeleteCommunity($event)" [overflowBody]="false"></modal-alert>
<fs-modal #fsModal>
<add-zenodo-communities *ngIf="community" [masterCommunity]=masterCommunity
[selectedCommunities]=selectedCommunities
[community]="community" (zenodoCommunitiesChanged)="zenodoCommunitiesChanged($event)"></add-zenodo-communities>
</fs-modal>

View File

@ -1,4 +1,14 @@
import {Component, ElementRef, Input, OnDestroy, OnInit, ViewChild} from '@angular/core'; import {
ChangeDetectorRef,
Component,
ElementRef,
EventEmitter,
Input,
OnDestroy,
OnInit,
Output,
ViewChild
} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router'; import {ActivatedRoute, Router} from '@angular/router';
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties'; import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
@ -12,92 +22,74 @@ import {Title} from '@angular/platform-browser';
import {properties} from '../../../environments/environment'; import {properties} from '../../../environments/environment';
import {Subscription} from 'rxjs'; import {Subscription} from 'rxjs';
import {FullScreenModalComponent} from '../../openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.component'; import {FullScreenModalComponent} from '../../openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.component';
import {ManageZenodoCommunitiesComponent} from './manage-zenodo-communities.component'; import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler";
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
import {SearchInputComponent} from "../../openaireLibrary/sharedComponents/search-input/search-input.component";
import {UntypedFormBuilder, UntypedFormControl} from "@angular/forms";
import {ManageZenodoCommunitiesService} from "../../services/manageZenodoCommunities.service";
@Component({ @Component({
selector: 'zenodo-communities', selector: 'zenodo-communities',
template: ` templateUrl: 'zenodo-communities.component.html'
<manage-zenodo-communities #manage *ngIf="community && zenodoSearchUtils"
[loading]="showLoadingInRemove"
[masterCommunity]=masterZenodoCommunity [selectedCommunities]=selectedCommunities
[community]="community" [searchUtils]=zenodoSearchUtils (addZenodoCommunity)="openAddZenodoCommunites()"
(zenodoCommunitiesChanged)="zenodoCommunitiesChanged($event)"></manage-zenodo-communities>
<fs-modal #fsModal>
<add-zenodo-communities [masterCommunity]=masterZenodoCommunity
[selectedCommunities]=selectedCommunities
[community]="community" (zenodoCommunitiesChanged)="zenodoCommunitiesChanged($event)"></add-zenodo-communities>
</fs-modal>
`
}) })
export class ZenodoCommunitiesComponent implements OnInit, OnDestroy { export class ZenodoCommunitiesComponent implements OnInit, OnDestroy {
public community: CommunityInfo = null; public community: CommunityInfo = null;
public toggle = false; public toggle = false;
public pageTitle = 'Manage zenodo communities'; public pageTitle = 'Manage zenodo communities';
masterZenodoCommunityId = null; masterZenodoCommunityId = null;
masterZenodoCommunity = null; masterCommunity = null;
public properties: EnvProperties = null; public properties: EnvProperties = null;
selectedCommunityIds = null; selectedCommunityIds = null;
selectedCommunities = []; selectedCommunities = null;
zenodocommunitiesloadedCount = 0; zenodocommunitiesloadedCount = 0;
zenodoSearchUtils: SearchUtilsClass = new SearchUtilsClass();
public errorCodes: ErrorCodes = new ErrorCodes(); public errorCodes: ErrorCodes = new ErrorCodes();
subscriptions = []; subscriptions = [];
@ViewChild('fsModal', {static: true}) fullscreen: FullScreenModalComponent; @ViewChild('fsModal', {static: true}) fullscreen: FullScreenModalComponent;
@ViewChild(ManageZenodoCommunitiesComponent) manage: ManageZenodoCommunitiesComponent;
public showLoadingInRemove: boolean = true; public showLoadingInRemove: boolean = true;
@Input() public loading: boolean = true;
@Input() searchUtils: SearchUtilsClass = new SearchUtilsClass();
public rowsOnPage = 10;
previewCommunities = [];
@ViewChild('AlertModalDeleteCommunity') alertModalDeleteCommunity;
selectedToDelete = null;
@Output() addZenodoCommunity: EventEmitter<any> = new EventEmitter();
page = 1;
size = 10;
@ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent;
public filterForm: UntypedFormControl;
deleteMaster = false;
constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router, constructor(private element: ElementRef, private route: ActivatedRoute, private _router: Router,
private _zenodoCommunitieService: ZenodoCommunitiesService, private title: Title, private _zenodoCommunitieService: ZenodoCommunitiesService, private title: Title,
private _communityService: CommunityService) { private _communityService: CommunityService,
public _fb: UntypedFormBuilder,
private cdr: ChangeDetectorRef,
private _manageZenodoCommunitiesService: ManageZenodoCommunitiesService) {
} }
ngOnInit() { ngOnInit() {
this.zenodoSearchUtils.status = this.errorCodes.LOADING; this.searchUtils.status = this.errorCodes.LOADING;
this.properties = properties; this.properties = properties;
this.subscriptions.push(this.route.params.subscribe(params => {
this.subscriptions.push(this._communityService.getCommunityAsObservable().subscribe( //use this method to ensure that get the lattest version of the community and the updated information for the list of zenodo communities
this.subscriptions.push(this._communityService.getCommunity(params['community'],true).subscribe(
community => { community => {
this.community = community; this.community = community;
this.title.setTitle(this.community.shortTitle.toUpperCase() + ' | Zenodo Communities'); this.title.setTitle(this.community.shortTitle.toUpperCase() + ' | Zenodo Communities');
this.masterZenodoCommunityId = this.community.zenodoCommunity; this.masterZenodoCommunityId = this.community.zenodoCommunity;
if (this.masterZenodoCommunityId) { this.selectedCommunities = [];
this.subscriptions.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.searchUtils.status = this.errorCodes.LOADING;
this.masterZenodoCommunityId).subscribe(
result => {
this.masterZenodoCommunity = result;
this.selectedCommunities.unshift(this.masterZenodoCommunity);
},
error => {
const emptyCommunity: ZenodoCommunityInfo = new ZenodoCommunityInfo();
emptyCommunity.id = this.masterZenodoCommunityId;
emptyCommunity.title = this.masterZenodoCommunityId;
this.masterZenodoCommunity = emptyCommunity;
}
));
}
this.zenodoSearchUtils.status = this.errorCodes.LOADING;
this.zenodoSearchUtils.status = this.errorCodes.LOADING;
// this._searchZenodoCommunitiesService.searchZCommunities(this.properties, this.community.communityId).subscribe(
// result => {
this.selectedCommunityIds = this.community.otherZenodoCommunities; this.selectedCommunityIds = this.community.otherZenodoCommunities;
this.zenodoSearchUtils.totalResults = this.selectedCommunityIds.length; this.searchUtils.totalResults = this.selectedCommunityIds.length;
if (this.selectedCommunityIds.length === 0) { if (this.selectedCommunityIds.length === 0) {
this.zenodoSearchUtils.status = this.errorCodes.NONE; this.searchUtils.status = this.errorCodes.NONE;
} }
for (let i = 0; i < this.selectedCommunityIds.length; i++) { for (let i = 0; i < this.selectedCommunityIds.length; i++) {
this.getZenodoCommunityById( this.getZenodoCommunityById(this.selectedCommunityIds[i]);
this.selectedCommunityIds[i]);
} }
this.init();
// },
// error => {
// console.log('list of zenodo communities couldn\'t be loaded');
// this.zenodoSearchUtils.status = this.errorCodes.DONE;
// }
// );
}) })
); );
}));
this.fullscreen.title = "Search and Add Zenodo Communities"; this.fullscreen.title = "Search and Add Zenodo Communities";
this.fullscreen.okButtonText = "Done"; this.fullscreen.okButtonText = "Done";
this.fullscreen.okButton = true; this.fullscreen.okButton = true;
@ -115,13 +107,18 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy {
this.subscriptions.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties, this.subscriptions.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties,
zenodoid).subscribe( zenodoid).subscribe(
result => { result => {
if(zenodoid == this.masterZenodoCommunityId){
this.masterCommunity = result;
result.master = true;
this.selectedCommunities.unshift(result);
}else {
this.selectedCommunities.push(result); this.selectedCommunities.push(result);
}
this.zenodocommunitiesloadedCount++; this.zenodocommunitiesloadedCount++;
if (this.zenodocommunitiesloadedCount >= this.selectedCommunityIds.length) { if (this.zenodocommunitiesloadedCount >= this.selectedCommunityIds.length) {
this.zenodoSearchUtils.status = this.errorCodes.DONE; this.searchUtils.status = this.errorCodes.DONE;
} }
}, },
error => { error => {
const emptyCommunity: ZenodoCommunityInfo = new ZenodoCommunityInfo(); const emptyCommunity: ZenodoCommunityInfo = new ZenodoCommunityInfo();
@ -130,7 +127,7 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy {
this.selectedCommunities.push(emptyCommunity); this.selectedCommunities.push(emptyCommunity);
this.zenodocommunitiesloadedCount++; this.zenodocommunitiesloadedCount++;
if (this.zenodocommunitiesloadedCount >= this.selectedCommunityIds.length) { if (this.zenodocommunitiesloadedCount >= this.selectedCommunityIds.length) {
this.zenodoSearchUtils.status = this.errorCodes.DONE; this.searchUtils.status = this.errorCodes.DONE;
} }
console.log('Zenodo community\'' + zenodoid + '\' couldn\'t be loaded'); console.log('Zenodo community\'' + zenodoid + '\' couldn\'t be loaded');
} }
@ -147,11 +144,150 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy {
} }
public zenodoCommunitiesChanged($event) { public zenodoCommunitiesChanged($event) {
this.selectedCommunities = $event.value; this.selectedCommunities = $event.communities;
this.masterCommunity = $event.main;
if(!this.masterZenodoCommunityId && $event.main){
this.selectedCommunityIds.unshift($event.main.id)
this.selectedCommunities.unshift($event.main);
}
this.masterZenodoCommunityId = $event.main?$event.main.id:null;
this.showLoadingInRemove = false; this.showLoadingInRemove = false;
if (this.fullscreen.isOpen) { if (this.fullscreen.isOpen) {
this.manage.filterPreviewCommunities(this.manage.filterForm.value); this.filterPreviewCommunities(this.filterForm.value);
}
this.filterPreviewCommunities(this.searchUtils.keyword);
}
private init() {
this.filterForm = this._fb.control('');
this.filterPreviewCommunities("");
this.subscriptions.push(this.filterForm.valueChanges.subscribe(value => {
this.page = 1;
this.filterPreviewCommunities(value);
}));
this.searchUtils.keyword = "";
this.searchUtils.totalResults = this.selectedCommunities.length;
}
public filterPreviewCommunities(value: string) {
this.previewCommunities = this.selectedCommunities.filter(community => {
return !value || community.title.toLowerCase().indexOf(value.toLowerCase()) != -1
});
if (this.previewCommunities.slice((this.page - 1) * this.rowsOnPage, this.page * this.rowsOnPage).length == 0) {
this.page = 1;
}
this.cdr.detectChanges();
}
public confirmedDeleteCommunity(data: any) {
if(this.deleteMaster){
this.subscriptions.push(this._manageZenodoCommunitiesService.removeZenodoCommunity(this.properties, this.community.communityId, this.selectedToDelete.id, true).subscribe(
data => {
this.afterRemoveActions();
}
));
}else {
this.subscriptions.push(this._manageZenodoCommunitiesService.removeZenodoCommunity(this.properties, this.community.communityId, this.selectedToDelete.id).subscribe(
data => {
this.afterRemoveActions();
}
));
} }
} }
afterRemoveActions(){
if(this.deleteMaster){
this.masterCommunity = null;
this.masterZenodoCommunityId = null
NotificationHandler.rise('Community has been <b>removed from master</b>!')
}else {
var pos = -1;
for (var i = 0; i < this.selectedCommunities.length; i++) {
if (this.selectedCommunities[i].id == this.selectedToDelete.id) {
pos = i;
break;
}
}
if (pos != -1) {
this.selectedCommunities.splice(pos, 1);
this.selectedCommunityIds.splice(pos,1)
this.searchUtils.totalResults = this.selectedCommunities.length;
}
this.searchUtils.totalResults = this.selectedCommunities.length;
this.filterPreviewCommunities(this.filterForm.value);
NotificationHandler.rise('Community has been <b>successfully removed</b>!')
}
}
public removeCommunity(comm) {
this.deleteMaster = false;
this.selectedToDelete = comm;
this.alertModalDeleteCommunity.cancelButton = true;
this.alertModalDeleteCommunity.okButton = true;
this.alertModalDeleteCommunity.alertTitle = "Remove zenodo community";
let title = "";
if (comm.title) {
title = comm.title;
}
this.alertModalDeleteCommunity.message = "Zenodo community";
if (title) {
this.alertModalDeleteCommunity.message += " '" + title + "' ";
}
this.alertModalDeleteCommunity.message += "will be removed from your community. Are you sure?";
this.alertModalDeleteCommunity.okButtonText = "Yes";
this.alertModalDeleteCommunity.open();
}
public removeFromMasterCommunity(comm) {
this.deleteMaster = true;
this.selectedToDelete = comm;
this.alertModalDeleteCommunity.cancelButton = true;
this.alertModalDeleteCommunity.okButton = true;
this.alertModalDeleteCommunity.alertTitle = "Remove master zenodo community";
let title = "";
if (comm.title) {
title = comm.title;
}
this.alertModalDeleteCommunity.message = "Zenodo community";
if (title) {
this.alertModalDeleteCommunity.message += " '" + title + "' ";
}
this.alertModalDeleteCommunity.message += "will be removed as master from your community, but will remain in the list of the related communities. Do you want to proceed?";
this.alertModalDeleteCommunity.okButtonText = "Yes";
this.alertModalDeleteCommunity.open();
}
totalPages(): number {
let totalPages: any = this.searchUtils.totalResults / (this.rowsOnPage);
if (!(Number.isInteger(totalPages))) {
totalPages = (parseInt(totalPages, 10) + 1);
}
return totalPages;
}
public updatePage($event) {
HelperFunctions.scroll();
this.page = $event.value;
}
addNew() {
this.addZenodoCommunity.emit();
}
handleError(message: string) {
NotificationHandler.rise(message, 'danger');
}
public addAsMasterCommunity(community) {
this.subscriptions.push(this._manageZenodoCommunitiesService.addZenodoCommunity(this.properties ,this.community.communityId,community.id, true).subscribe(
data => {
this.masterCommunity = community;
this.masterZenodoCommunityId = community.id
},
err => {
this.handleError('An error has been occurred. Try again later!');
console.log(err.status);
}
));
}
} }

View File

@ -2,7 +2,6 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common'; import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms'; import {FormsModule} from '@angular/forms';
import {RouterModule} from '@angular/router'; import {RouterModule} from '@angular/router';
import {ManageZenodoCommunitiesComponent} from './manage-zenodo-communities.component';
import {AddZenodoCommunitiesComponent} from './add-zenodo-communities.component'; import {AddZenodoCommunitiesComponent} from './add-zenodo-communities.component';
import {ZenodoCommunitiesComponent} from './zenodo-communities.component'; import {ZenodoCommunitiesComponent} from './zenodo-communities.component';
import {ManageZenodoCommunitiesService} from '../../services/manageZenodoCommunities.service'; import {ManageZenodoCommunitiesService} from '../../services/manageZenodoCommunities.service';
@ -18,14 +17,15 @@ import {PageContentModule} from '../../openaireLibrary/dashboard/sharedComponent
import {FullScreenModalModule} from '../../openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.module'; import {FullScreenModalModule} from '../../openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.module';
import {HTMLToStringPipeModule} from '../../openaireLibrary/utils/pipes/HTMLToStringPipe.module'; import {HTMLToStringPipeModule} from '../../openaireLibrary/utils/pipes/HTMLToStringPipe.module';
import {PagingModule} from "../../openaireLibrary/utils/paging.module"; import {PagingModule} from "../../openaireLibrary/utils/paging.module";
import {ValidateEnabledPageModule} from "../../utils/validateEnabledPage.module";
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, FormsModule, RouterModule, ZenodoCommunitiesServiceModule, CommonModule, FormsModule, RouterModule, ZenodoCommunitiesServiceModule,
AlertModalModule, ZenodoCommunitiesRoutingModule, PageContentModule, SearchInputModule, IconsModule, NoLoadPaging, LoadingModule, FullScreenModalModule, HTMLToStringPipeModule, PagingModule AlertModalModule, ZenodoCommunitiesRoutingModule, PageContentModule, SearchInputModule, IconsModule, NoLoadPaging, LoadingModule, FullScreenModalModule, HTMLToStringPipeModule, PagingModule, ValidateEnabledPageModule
], ],
declarations: [ declarations: [
ManageZenodoCommunitiesComponent, ZenodoCommunitiesComponent, AddZenodoCommunitiesComponent, PreviewZenodoCommunityComponent ZenodoCommunitiesComponent, AddZenodoCommunitiesComponent, PreviewZenodoCommunityComponent
], ],
providers: [ providers: [
ManageZenodoCommunitiesService ManageZenodoCommunitiesService

View File

@ -11,27 +11,29 @@ export class ManageCommunityContentProvidersService {
removeContentProvider(properties: EnvProperties, pid: string, id: string): any { removeContentProvider(properties: EnvProperties, pid: string, id: string): any {
let headers = new HttpHeaders({'Content-Type': 'application/json', 'accept': 'application/json'}); let headers = new HttpHeaders({'Content-Type': 'application/json', 'accept': 'application/json'});
let url = properties.communityAPI + pid + '/contentproviders?contentproviderId=' +id; let url = properties.communityAPI + pid + '/datasources?dsId=' +id;
return this.http.request('delete', url, {body: id, headers: headers}); return this.http.request('delete', url, {body: id, headers: headers});
} }
addContentProvider(properties: EnvProperties, pid: string, contentProvider: any): Observable<ContentProvider> { addContentProvider(properties: EnvProperties, pid: string, contentProvider: any, content:boolean, deposit:boolean): Observable<ContentProvider> {
let url = properties.communityAPI + pid + '/contentproviders'; let url = properties.communityAPI + pid + '/datasources';
let communityContentProvider = this.convertSearchContentProviderToCommunityContentProvider(contentProvider, pid); let communityContentProvider = this.convertSearchContentProviderToCommunityContentProvider(contentProvider, pid, content, deposit);
return this.http.post<ContentProvider>(url, communityContentProvider); return this.http.post<ContentProvider>(url, communityContentProvider);
} }
saveContentProvider(properties: EnvProperties, contentProvider: ContentProvider): Observable<ContentProvider> { saveContentProvider(properties: EnvProperties, contentProvider: ContentProvider): Observable<ContentProvider> {
let url = properties.communityAPI + contentProvider.communityId + '/contentproviders'; let url = properties.communityAPI + contentProvider.communityId + '/datasources';
return this.http.post<ContentProvider>(url, contentProvider); return this.http.post<ContentProvider>(url, contentProvider);
} }
convertSearchContentProviderToCommunityContentProvider(contentProvider: any, community: string): ContentProvider { convertSearchContentProviderToCommunityContentProvider(contentProvider: any, community: string, content:boolean, deposit:boolean): ContentProvider {
let communityContentProvider: ContentProvider = new ContentProvider(); let communityContentProvider: ContentProvider = new ContentProvider();
communityContentProvider.communityId = community; communityContentProvider.communityId = community;
communityContentProvider.officialname = contentProvider.title.name; communityContentProvider.officialname = contentProvider.title.name;
communityContentProvider.name = contentProvider.englishname; communityContentProvider.name = contentProvider.englishname;
communityContentProvider.openaireId = contentProvider.id; communityContentProvider.openaireId = contentProvider.id;
communityContentProvider.enabled = content;
communityContentProvider.deposit = deposit;
return communityContentProvider; return communityContentProvider;
} }

View File

@ -5,31 +5,25 @@ import{EnvProperties} from '../openaireLibrary/utils/properties/env-properties';
@Injectable() @Injectable()
export class ManageZenodoCommunitiesService { export class ManageZenodoCommunitiesService {
constructor(private http: HttpClient ) {} constructor(private http: HttpClient ) {}
removeZenodoCommunity(properties:EnvProperties, pid: string,zenodoid: string, main:boolean = false) {
removeZCommunity (properties: EnvProperties, pid: string,id: string):any { const options = {
//let headers = new Headers({'Content-Type': 'application/json', 'accept': 'application/json'}); headers: new HttpHeaders({
//let options = new RequestOptions({headers: headers, body: id}); 'Content-Type': 'application/json',
})
};
let url = properties.communityAPI+pid+"/zenodocommunities?zenodocommunity="+zenodoid + "&main=" + main;
return this.http.delete<any>(url, options);
}
addZenodoCommunity(properties:EnvProperties, pid: string,zenodoid: string, main:boolean = false) {
let headers = new HttpHeaders({'Content-Type': 'application/json', 'accept': 'application/json'}); const options = {
let url = properties.communityAPI + pid + "/zenodocommunities?zenodocommunity="+id; headers: new HttpHeaders({
'Content-Type': 'application/json',
//return this.http.delete(url, options); })
return this.http.request('delete', url, { headers: headers}) };
let url = properties.communityAPI+pid+"/zenodocommunities?zenodocommunity="+zenodoid + "&main=" + main;
return this.http.post<any>(url, options);
} }
addZCommunity(properties:EnvProperties, pid: string,zenodoid: string) {
//let headers = new Headers({'Content-Type': 'application/json'});
//let options = new RequestOptions({headers: headers});
let headers = new HttpHeaders({'Content-Type': 'application/json'});
let url = properties.communityAPI+pid+"/zenodocommunities?zenodocommunity="+zenodoid;
return this.http.post<any>(url, headers);
//.map(res => <any> res.json())
}
} }

View File

@ -0,0 +1,93 @@
import {Component, Input, OnDestroy, OnInit, ViewChild} from "@angular/core";
import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties";
import {UntypedFormBuilder} from "@angular/forms";
import {CommunityInfo} from "../openaireLibrary/connect/community/communityInfo";
import {Page} from "../openaireLibrary/utils/entities/adminTool/page";
import {AlertModal} from "../openaireLibrary/utils/modal/alert";
import {ActivatedRoute, Router} from "@angular/router";
import {Title} from "@angular/platform-browser";
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
import {AffiliationService} from "../openaireLibrary/connect/affiliations/affiliation.service";
import {HelpContentService} from "../services/help-content.service";
import {ClearCacheService} from "../openaireLibrary/services/clear-cache.service";
import {Subscription} from "rxjs";
import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
import {NotificationHandler} from "../openaireLibrary/utils/notification-handler";
import {properties} from "src/environments/environment";
@Component({
selector: 'validate-page-enabled',
template: `
<div *ngIf="page && !pageEnabled" class="uk-width-1-1 uk-alert uk-alert-warning">
<b>{{page.name}}</b> page is not enabled. Manage pages <a [href]="community.communityId + '/admin-tools/pages'" target="_blank">here</a> or
<a *ngIf="!pageEnabled" class=" uk-margin-right" [class.uk-disabled]="loading" [disabled]="loading"
(click)="enablePage()">enable it now</a>
</div>
`
})
export class ValidateEnabledPageComponent implements OnInit, OnDestroy {
@Input() pageRoute:string;
public properties: EnvProperties = properties;
public community: CommunityInfo;
public page: Page;
loading;
private subs: any[] = [];
@ViewChild('affiliationModal') affiliationModal: AlertModal;
@ViewChild('removeAffiliationModal') removeAffiliationModal: AlertModal;
constructor(private route: ActivatedRoute,
private router: Router,
private title: Title,
private fb: UntypedFormBuilder,
private communityService: CommunityService,
private helpContentService: HelpContentService,
private _clearCacheService: ClearCacheService) {
}
ngOnInit() {
this.subs.push(this.communityService.getCommunityAsObservable().subscribe( community => {
this.community = community;
this.getPageStatus();
}));
}
ngOnDestroy() {
this.subs.forEach(sub => {
if (sub instanceof Subscription) {
sub.unsubscribe();
}
})
}
public get pageEnabled(): boolean {
return !this.page || this.page.isEnabled;
}
public updatePage(event) {
HelperFunctions.scroll();
this.page = event.value;
}
private getPageStatus() {
this.helpContentService.getCommunityPagesByRoute(this.community.communityId, this.pageRoute, this.properties.adminToolsAPIURL).subscribe((page) => {
this.page = page;
})
}
enablePage() {
this.loading = true;
this.helpContentService.togglePages(this.community.communityId, [this.page._id], true, this.properties.adminToolsAPIURL).subscribe(() => {
this.page.isEnabled = true;
this._clearCacheService.purgeBrowserCache("Page enabled", this.community.communityId);
NotificationHandler.rise(this.page.name + ' has been <b>enabled successfully</b>');
this.loading = false;
}, error => {
});
}
}

View File

@ -0,0 +1,17 @@
import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {RouterModule} from "@angular/router";
import {ValidateEnabledPageComponent} from "./validateEnabledPage.component";
import {AdminToolServiceModule} from "../openaireLibrary/services/adminToolService.module";
import {HelpContentService} from "../services/help-content.service";
@NgModule({
declarations: [ValidateEnabledPageComponent],
imports: [
CommonModule, RouterModule, AdminToolServiceModule
],
exports:[ValidateEnabledPageComponent],
providers:[HelpContentService]
})
export class ValidateEnabledPageModule {
}

@ -1 +1 @@
Subproject commit e82544c43fa55393581d5278a8b0540d64bf30f0 Subproject commit 3b437aafda7a716a0a89785a106456cbe520dce3

@ -1 +1 @@
Subproject commit 921802642010c1057b79de55f93361f0b25a7b3d Subproject commit 99ab54cdd7b973a2ba047f0a6b37667270b58439

View File

@ -5,8 +5,8 @@ let props: EnvProperties = {
isDashboard: true, isDashboard: true,
enablePiwikTrack: false, enablePiwikTrack: false,
useCache: false, useCache: false,
domain:'https://beta.admin.connect.openaire.eu' domain:'https://beta.admin.connect.openaire.eu',
monitorStatsFrameUrl:"https://beta.services.openaire.eu/stats-tool/"
}; };
export let properties: EnvProperties = { export let properties: EnvProperties = {

View File

@ -7,6 +7,7 @@ let props: EnvProperties = {
enablePiwikTrack: false, enablePiwikTrack: false,
useCache: false, useCache: false,
domain:'https://admin.connect.openaire.eu', domain:'https://admin.connect.openaire.eu',
monitorStatsFrameUrl:"https://services.openaire.eu/stats-tool/"
}; };

View File

@ -13,7 +13,11 @@ let props: EnvProperties = {
useCache: false, useCache: false,
connectPortalUrl: 'http://scoobydoo.di.uoa.gr:4200', connectPortalUrl: 'http://scoobydoo.di.uoa.gr:4200',
domain:'https://beta.admin.connect.openaire.eu', domain:'https://beta.admin.connect.openaire.eu',
adminToolsAPIURL: 'http://scoobydoo.di.uoa.gr:8880/uoa-admin-tools/',
utilsService: "http://scoobydoo.di.uoa.gr:8000",
monitorStatsFrameUrl:"https://stats.madgik.di.uoa.gr/stats-api/",
// disableFrameLoad : true
}; };
export let properties: EnvProperties = { export let properties: EnvProperties = {