Compare commits

..

No commits in common. "master" and "production-release-june-2023" have entirely different histories.

60 changed files with 1395 additions and 1465 deletions

View File

@ -1,7 +1,7 @@
rm -f interactiveminingv3.tgz
git clone https://code-repo.d4science.org/MaDgIK/interactive-mining.git
cd interactive-mining/
git checkout angular-16
git checkout angular-14
cd interactive-mining-angular-frontend/
npm install
npm run packagr

View File

@ -17,40 +17,41 @@
},
"private": true,
"dependencies": {
"@angular/animations": "^16.1.8",
"@angular/cdk": "^16.1.7",
"@angular/common": "^16.1.8",
"@angular/compiler": "^16.1.8",
"@angular/core": "^16.1.8",
"@angular/forms": "^16.1.8",
"@angular/localize": "^16.1.8",
"@angular/material": "^16.1.7",
"@angular/platform-browser": "^16.1.8",
"@angular/platform-browser-dynamic": "^16.1.8",
"@angular/router": "^16.1.8",
"@angular/animations": "^14.2.3",
"@angular/cdk": "^14.2.2",
"@angular/common": "^14.2.3",
"@angular/compiler": "^14.2.3",
"@angular/core": "^14.2.3",
"@angular/forms": "^14.2.3",
"@angular/localize": "^14.2.3",
"@angular/material": "^14.2.2",
"@angular/platform-browser": "^14.2.3",
"@angular/platform-browser-dynamic": "^14.2.3",
"@angular/router": "^14.2.3",
"clipboard": "^1.5.16",
"core-js": "^2.5.4",
"express": "^4.15.2",
"jquery": "^3.4.1",
"ng-recaptcha": "^12.0.2",
"ng-recaptcha": "^10.0.0",
"ng2-ckeditor": "1.3.7",
"ngx-color-picker": "^14.0.0",
"ngx-color-picker": "^8.1.0",
"rxjs": "^6.5.1",
"sass-loader": "7.3.1",
"ts-md5": "^1.2.0",
"tslib": "^2.0.0",
"uikit": "3.16.24",
"zone.js": "~0.13.1"
"uikit": "3.13.10",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^16.1.7",
"@angular/cli": "^16.1.7",
"@angular/compiler-cli": "^16.1.8",
"@angular/language-service": "^16.1.8",
"@types/ckeditor": "^4.9.10",
"@angular-devkit/build-angular": "^14.2.3",
"@angular/cli": "^14.2.3",
"@angular/compiler-cli": "^14.2.3",
"@angular/language-service": "^14.2.3",
"@types/express": "^4.17.0",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"@types/ckeditor": "^4.9.10",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.8.0",
"jasmine-spec-reporter": "~5.0.0",
@ -61,6 +62,6 @@
"karma-jasmine-html-reporter": "^1.6.0",
"protractor": "~7.0.0",
"ts-node": "~7.0.0",
"typescript": "~4.9.5"
"typescript": "~4.6.4"
}
}

View File

@ -2,15 +2,17 @@
<loading [full]="true"></loading>
</div>
<div *ngIf="loading == false">
<div id="modal-container"></div>
<navbar *ngIf="hasHeader" portal="connect-admin" [header]="menuHeader" [communityId]="community ? community.communityId : null"
[userMenuItems]=userMenuItems [menuItems]="menuItems" [user]="user"></navbar>
<div class="sidebar_main_swipe uk-flex" [class.sidebar_main_active]="open && (hasSidebar || hasInternalSidebar)" [class.sidebar_mini]="!open && (hasSidebar || hasInternalSidebar)"
<div class="sidebar_main_swipe" [class.sidebar_main_active]="open && hasSidebar" [class.sidebar_mini]="!open && hasSidebar"
[class.sidebar_hover]="hover">
<dashboard-sidebar *ngIf="hasSidebar && !hasInternalSidebar" [items]="sideBarItems" [backItem]="backItem"></dashboard-sidebar>
<main class="uk-width-1-1">
<div id="modal-container"></div>
<navbar *ngIf="hasHeader" portal="connect-admin" [header]="menuHeader" [communityId]="community ? community.communityId : null"
[userMenuItems]=userMenuItems [menuItems]="menuItems" [user]="user"></navbar>
<div>
<dashboard-sidebar *ngIf="hasSidebar" [items]="sideBarItems" [backItem]="backItem"></dashboard-sidebar>
<main>
<router-outlet></router-outlet>
</main>
</div>
</div>
</div>

View File

@ -28,7 +28,6 @@ export class AppComponent implements OnInit {
params: BehaviorSubject<Params> = new BehaviorSubject<Params>(null);
data: BehaviorSubject<Data> = new BehaviorSubject<Data>(null);
hasSidebar: boolean = false;
hasInternalSidebar: boolean = false;
hasHeader: boolean = true;
hasAdminMenu: boolean = false;
isFrontPage: boolean = false;
@ -82,10 +81,6 @@ export class AppComponent implements OnInit {
this.hasSidebar = hasSidebar;
this.cdr.detectChanges();
}));
this.subscriptions.push(this.layoutService.hasInternalSidebar.subscribe(hasInternalSidebar => {
this.hasInternalSidebar = hasInternalSidebar;
this.cdr.detectChanges();
}));
this.subscriptions.push(this.layoutService.hasHeader.subscribe(hasHeader => {
this.hasHeader = hasHeader;
this.cdr.detectChanges();
@ -131,7 +126,7 @@ export class AppComponent implements OnInit {
this.subscriptions.push(this.data.subscribe(data => {
if(data && data.portal) {
this.setProperties(data.portal);
this.configurationService.initPortal(this.properties, this.properties.adminToolsCommunity);
this.configurationService.initCommunityInformation(this.properties, this.properties.adminToolsCommunity);
}
}));
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
@ -177,7 +172,7 @@ export class AppComponent implements OnInit {
} else {
ConnectHelper.setPortalTypeFromPid(id);
}
this.configurationService.initPortal(this.properties, this.properties.adminToolsCommunity);
this.configurationService.initCommunityInformation(this.properties, this.properties.adminToolsCommunity);
}
public get open() {

@ -1 +1 @@
Subproject commit 2e2a71c3101660480ede67c06edc22aa00faa79d
Subproject commit 56428d0daed8726c9c70c8b7dad8f11b4ed604b8

View File

@ -29,16 +29,6 @@ import {RouterModule} from '@angular/router';
loadChildren: () => import('../../openaireLibrary/dashboard/helpTexts/page-help-content-form.module').then(m => m.PageHelpContentFormModule),
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',
loadChildren: () => import('../../openaireLibrary/dashboard/page/pages.module').then(m => m.PagesModule),

View File

@ -5,9 +5,7 @@ import {RouterModule} from "@angular/router";
imports: [RouterModule.forChild([
{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: '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)},
{path: 'classes', loadChildren: () => import('../../openaireLibrary/dashboard/divId/divIds.module').then(m => m.DivIdsModule)}
])]
})
export class PortalAdminToolsRoutingModule {

View File

@ -36,7 +36,7 @@ import {CommunityInfo} from "../../openaireLibrary/connect/community/communityIn
<div *ngIf="!loading">
<div *ngIf="selectionCriteria?.criteria?.length > 0" class="uk-margin-small-bottom">
<div class="uk-text-meta uk-margin-small-bottom">Criteria</div>
<div [innerHTML]="criteriaUtils.getFiltersAsText(selectionCriteria.criteria,false)"></div>
<div [innerHTML]="criteriaUtils.getFiltersAsText(selectionCriteria.criteria)"></div>
</div>
<div *ngIf="selectionCriteria?.criteria?.length === 0" class="message">
<h5 class="uk-margin-small-bottom">No criteria yet</h5>
@ -48,7 +48,7 @@ import {CommunityInfo} from "../../openaireLibrary/connect/community/communityIn
</div>
</div>
<fs-modal #filtersModal (okEmitter)="saveCriteria()" (cancelEmitter)="criteria.reset()"
[okButtonDisabled]="!criteria || criteria.disabled">
[okButtonDisabled]="criteria && criteria.disabled">
<div *ngIf="selectionCriteria" class="uk-container uk-container-large">
<criteria #criteria [height]="filtersModal.bodyHeight" [entityType]="'criterion'"
[entityTypePlural]="'criteria'" [selectionCriteria]="selectionCriteria">

View File

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

View File

@ -54,6 +54,7 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
if (this.community) {
this.title.setTitle(this.community.shortTitle.toUpperCase() + ' | Organizations');
this.getAffiliations();
this.organizationsPageStatus();
}
}));
}
@ -79,7 +80,11 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
}
);
}
public get organizationsEnabled(): boolean {
return !this.organizationsPage || this.organizationsPage.isEnabled;
}
editAffiliationOpen(index: number = -1) {
let affiliation: Affiliation;
this.index = index;
@ -108,7 +113,6 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
deleteAffiliationOpen(index: number) {
this.index = index;
let affiliation: Affiliation = this.affiliations[index];
console.log(index, affiliation)
this.removeAffiliationModal.alertTitle = 'Delete Organization';
this.removeAffiliationModal.message = 'Do you want to remove <b>' +
affiliation.name + '</b> from Organizations?';
@ -160,8 +164,7 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
removeAffiliation() {
this.loading = true;
console.log(this.index, this.affiliations[this.index].id)
this.affiliationService.deleteAffiliation(this.properties.communityAPI + this.community.communityId + '/organizations?organizationName='+this.affiliations[this.index].name,
this.affiliationService.deleteAffiliation(this.properties.communityAPI + this.community.communityId + '/organizations',
this.affiliations[this.index].id).subscribe((deleteOK) => {
this.affiliations.splice(this.index, 1);
if (this.currentPage.length === 0) {
@ -174,6 +177,13 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
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) {
NotificationHandler.rise(message, "danger");
this.loading = false;
@ -183,5 +193,14 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
NotificationHandler.rise(message);
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,12 +17,11 @@ import {LoadingModule} from "../../openaireLibrary/utils/loading/loading.module"
import {UrlPrefixModule} from "../../openaireLibrary/utils/pipes/url-prefix.module";
import {HelpContentService} from "../../services/help-content.service";
import {PagingModule} from "../../openaireLibrary/utils/paging.module";
import {ValidateEnabledPageModule} from "../../utils/validateEnabledPage.module";
@NgModule({
imports: [
AffiliationsRoutingModule, CommonModule, FormsModule, RouterModule,
AlertModalModule, ReactiveFormsModule, InputModule, PageContentModule, IconsModule, NoLoadPaging, LoadingModule, UrlPrefixModule, PagingModule, ValidateEnabledPageModule
AlertModalModule, ReactiveFormsModule, InputModule, PageContentModule, IconsModule, NoLoadPaging, LoadingModule, UrlPrefixModule, PagingModule
],
declarations: [
AffiliationsComponent

View File

@ -20,19 +20,11 @@ import {ClearCacheService} from "../../../../openaireLibrary/services/clear-cach
<div class="uk-grid uk-grid-large" uk-grid>
<div class="uk-width-1-2@m">
<div input id="name" [formInput]="communityFb.get('name')"
placeholder="Index name of the community."></div>
placeholder="Name of the community profile."></div>
</div>
<div class="uk-width-1-2@m">
<div input [formInput]="communityFb.get('shortName')"
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>
placeholder="Short name of the community."></div>
</div>
<div class="uk-width-1-1">
<div class="uk-text-bold uk-margin-bottom uk-form-hint">Description of the community</div>
@ -43,14 +35,14 @@ import {ClearCacheService} from "../../../../openaireLibrary/services/clear-cach
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',
'Subscript,Superscript,Anchor,Smiley,Iframe,Styles,Font,About,Language',
extraPlugins: 'divarea'}">
</ckeditor>
</div>
<div class="uk-width-1-1">
<input #file id="photo" type="file" class="uk-hidden" (change)="fileChangeEvent($event)"/>
<div *ngIf="!communityFb.get('isUpload').value" class="uk-grid uk-grid-column-large" uk-grid>
<div class="uk-margin-xsmall-top uk-width-auto@l uk-width-1-1">
<div class="uk-margin-top uk-width-auto@l uk-width-1-1">
<div class="uk-grid uk-grid-column-large uk-flex-middle" uk-grid>
<div class="uk-width-auto@l uk-width-1-1 uk-flex uk-flex-center">
<button class="uk-button uk-button-primary uk-flex uk-flex-middle uk-flex-wrap"
@ -85,21 +77,11 @@ import {ClearCacheService} from "../../../../openaireLibrary/services/clear-cach
<!-- Full width error message -->
<div *ngIf="uploadError" class="uk-text-danger uk-margin-small-top uk-width-1-1">{{uploadError}}</div>
</div>
<div class="uk-width-1-3@m">
<div class="uk-width-1-2@m">
<div input [formInput]="communityFb.get('status')"
placeholder="Visibility status for your community's profile."
[options]="statuses" type="select"></div>
</div>
<div class="uk-width-1-3@m">
<div input [formInput]="communityFb.get('claim')"
placeholder="Who can create links for your community"
[options]="claimOptions" type="select"></div>
</div>
<div class="uk-width-1-3@m">
<div input [formInput]="communityFb.get('membership')"
placeholder="Who can join"
[options]="membershipOptions" type="select"></div>
</div>
</div>
</form>
`,
@ -108,22 +90,10 @@ import {ClearCacheService} from "../../../../openaireLibrary/services/clear-cach
export class EditCommunityComponent {
public communityFb: UntypedFormGroup;
public statuses: Option[] = [
// {label: 'Visible', value: 'all'},
{label: 'Visible', value: 'PUBLIC'},
// {label: 'Visible to managers', value: 'manager'},
{label: 'Visible to managers', value: 'RESTRICTED'},
{label: 'Visible', value: 'all'},
{label: 'Visible to managers', value: 'manager'},
{label: 'Hidden', value: 'hidden'}
]
public claimOptions: Option[] = [
{label: 'Logged in users', value: 'all'},
{label: 'Members only', value: 'membersOnly'},
{label: 'Managers only', value: 'managersOnly'}
]
public membershipOptions: Option[] = [
{label: 'Anyone can join', value: 'open'},
{label: 'By invitation', value: 'byInvitation'}
]
public community: CommunityInfo;
public isNew: boolean;
public properties: EnvProperties = properties
@ -161,12 +131,8 @@ export class EditCommunityComponent {
communityId: this.fb.control(this.community.communityId),
name: this.fb.control(this.community.title, 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),
status: this.fb.control(this.community.status),
claim: this.fb.control(this.community.claim),
membership: this.fb.control(this.community.membership),
managers: this.fb.control(this.community.managers),
isUpload: this.fb.control(this.community.isUpload),
logoUrl: this.fb.control(this.community.logoUrl)
@ -192,7 +158,6 @@ export class EditCommunityComponent {
if (!this.isAdmin) {
setTimeout(() => {
this.communityFb.get('shortName').disable();
this.communityFb.get('name').disable();
}, 0);
}
}
@ -201,9 +166,9 @@ export class EditCommunityComponent {
}
public get isAdmin() {
return Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user);
return Session.isPortalAdministrator(this.user);
}
public get disabled(): boolean {
return (this.communityFb && this.communityFb.invalid) ||
(this.communityFb && this.communityFb.pristine && !this.isNew && !this.file) ||
@ -248,7 +213,8 @@ export class EditCommunityComponent {
this.removePhoto();
this.subscriptions.push(this.communityService.updateCommunity(
this.properties.communityAPI + this.community.communityId, this.communityFb.getRawValue()).subscribe(() => {
this._clearCacheService.clearCacheInRoute("Community saved",this.community.communityId,"/");
this._clearCacheService.clearCache("Community saved");
this._clearCacheService.purgeBrowserCache("Community saved", this.community.communityId);
this.communityService.getCommunity(this.community.communityId, true).subscribe(community => {
NotificationHandler.rise(community.shortTitle + ' has been <b>successfully created</b>');
callback(community);
@ -261,7 +227,8 @@ export class EditCommunityComponent {
}));
} else {
this.subscriptions.push(this.communityService.updateCommunity(this.properties.communityAPI + this.community.communityId, this.communityFb.getRawValue()).subscribe(() => {
this._clearCacheService.clearCacheInRoute("Community saved",this.community.communityId,"/");
this._clearCacheService.clearCache("Community updated");
this._clearCacheService.purgeBrowserCache("Community updated", this.community.communityId);
this.communityService.getCommunity(this.community.communityId, true).subscribe(community => {
NotificationHandler.rise(community.shortTitle + ' has been <b>successfully saved</b>');
callback(community);

View File

@ -31,7 +31,7 @@ import {ConnectRIGuard} from "../openaireLibrary/connect/communityGuard/connectR
{
path: 'customize-layout',
loadChildren: () => import('./customization/customization.module').then(m => m.CustomizationModule),
data: {hasInternalSidebar: true, hasHeader: false}
data: {hasSidebar: true, hasHeader: false}
},
{
path: 'user-info',

View File

@ -16,28 +16,14 @@ declare var UIkit;
<admin-tabs tab="customization" portal="connect"></admin-tabs>
</div>
<div inner>
<div>
<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>
Press the following button to update the timestamp in the saved layouts and recreate the css files.
</div>
<button (click)="updateCss()" class="uk-button uk-button-danger" [class.uk-disabled]="savingChanges"> Update CSS</button>
<hr>
<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>
Press the following button to update the timestamp in the saved layouts and recreate the css files.
</div>
<div class="uk-margin-medium-top">
<div>Purge ICM cache for all communities</div>
<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>
<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'">
<ng-container *ngIf="properties.domain != 'production'">
<hr>
<div class="uk-alert uk-alert-danger uk-margin-top ">
Delete after next deployment
@ -47,7 +33,7 @@ declare var UIkit;
</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>
</ng-container>-->
</ng-container>
</div>
</div>
@ -59,7 +45,6 @@ export class ConnectAdminCustomizationComponent implements OnInit {
cssCreated: number = 0;
totalLayouts: number = 0;
community;
route;
properties = properties;
constructor( private customizationService: CustomizationService, private _clearCacheService: ClearCacheService,
@ -148,20 +133,4 @@ 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,21 +36,12 @@
<div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid>
<div *ngIf="!getCommunityContentProvider(result)">
<div class="uk-padding-small uk-padding-remove-horizontal">
<a class="uk-button uk-button-link uk-flex uk-flex-middle">
<a (click)="addContentProvider(result)" class="uk-button uk-button-link uk-flex uk-flex-middle">
<icon name="add" [flex]="true"></icon>
<span class="uk-margin-small-left">
Add
</span>
</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 *ngIf="getCommunityContentProvider(result)">

View File

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

View File

@ -28,9 +28,6 @@ import {AddContentProvidersComponent} from "./add-content-providers.component";
import {ManageCommunityContentProvidersService} from "../../services/manageContentProviders.service";
import {SearchDataprovidersService} from "../../openaireLibrary/services/searchDataproviders.service";
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({
imports: [
@ -51,7 +48,7 @@ import {ValidateEnabledPageModule} from "../../utils/validateEnabledPage.module"
path: '', component: ManageContentProvidersComponent
}
]),
NoLoadPaging, LoadingModule, IconsModule, FullScreenModalModule, ResultPreviewModule, CriteriaModule, MatSlideToggleModule, CKEditorModule, ReactiveFormsModule, ValidateEnabledPageModule
NoLoadPaging, LoadingModule, IconsModule, FullScreenModalModule, ResultPreviewModule, CriteriaModule
],
declarations: [
ManageContentProvidersComponent,

View File

@ -7,14 +7,12 @@ export class CriteriaUtils {
{value: 'title', label: 'Title'},
{value: 'orcid', label: 'Author\'s ORCID'},
{value: 'contributor', label: 'Contributor'},
{value: 'description', label: 'Abstract'},
{value: 'description', label: 'Description'},
{value: 'subject', label: 'Subject'},
{value: 'fos', label: 'Field of Science'},
{value: 'sdg', label: 'SDG'},
{value: 'publisher', label: 'Publisher'},
{value: 'publicationyear', label: 'Publication Year'}
{value: 'sdg', label: 'SDG'}
]
public readonly numericFields: string[] = ['publicationyear'];
public readonly verbs: Option[] = [
{value: 'contains', label: 'contains'},
{value: 'equals', label: 'equals'},
@ -22,24 +20,17 @@ export class CriteriaUtils {
{value: 'not_equals', label: 'not equals'},
{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[], shortVersion=true): string {
let text = criteria.slice(0, shortVersion?3:criteria.length).map((criterion, index) => (index + 1) + ". " + criterion.constraint.map(constraint => {
public getFiltersAsText(criteria: Criteria[]): string {
let text = criteria.slice(0, 3).map((criterion, index) => (index + 1) + ". " + criterion.constraint.map(constraint => {
let field = this.fields.find(field => field.value === constraint.field)?.label;
let matchCase = false;
if (!constraint.verb.includes('_caseinsensitive')) {
matchCase = true;
}
let verb = [...this.verbs,...this.verbsForNumbers].find(verb => verb.value === constraint.verb.replace("_caseinsensitive", "")).label;
let verb = this.verbs.find(verb => verb.value === constraint.verb.replace("_caseinsensitive", "")).label;
let value = '"' + constraint.value + '"' + (matchCase ? " (Match case)" : "");
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;
return field + " " + verb + " " + value;
}).join(" <b>and</b> "));
return text.join("<br>");
}

View File

@ -1,4 +1,4 @@
<div class="uk-position-relative" [style]=" height == -1?'': 'min-height:60vh'">
<div class="uk-position-relative" style="min-height: 60vh">
<div *ngIf="loading" class="uk-position-center">
<loading></loading>
</div>
@ -32,8 +32,6 @@
</div>
<div *ngFor="let constraint of getConstraint(i).controls; let j=index" [formGroupName]="j.toString()"
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 uk-flex-right uk-width-1-1">
<button class="uk-close uk-icon" (click)="removeConstraint(i, j)">
@ -42,17 +40,13 @@
</button>
</div>
<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')" (valueChange)="resetFieldWhenValueChange(constraint)">
[options]="criteriaUtils.fields" [formInput]="constraint.get('field')">
<label class="uk-text-uppercase uk-text-bold uk-width-1-3 uk-text-truncate">Field:</label>
</div>
<div *ngIf="criteriaUtils.numericFields.indexOf(constraint.get('field').value) == -1" class="uk-width-1-1" input type="select" inputClass="border-bottom"
<div class="uk-width-1-1" input type="select" inputClass="border-bottom"
[options]="criteriaUtils.verbs" [formInput]="constraint.get('verb')">
<label class="uk-text-uppercase uk-text-bold uk-width-1-3 uk-text-truncate">Operator:</label>
</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'}"
[formInput]="constraint.get('value')">
<label class="uk-text-uppercase uk-text-bold uk-width-1-3 uk-text-truncate">Term:</label>
@ -72,15 +66,11 @@
</div>
<div *ngFor="let constraint of getConstraint(i).controls; let j=index"
[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-width-1-4" input type="select" inputClass="border-bottom" [placeholder]="{static: true, label: 'Choose a field'}"
[options]="criteriaUtils.fields" [formInput]="constraint.get('field')"></div>
<div *ngIf="criteriaUtils.numericFields.indexOf(constraint.get('field').value) == -1" class="uk-width-1-4" input type="select" inputClass="border-bottom"
<div class="uk-width-1-4" input type="select" inputClass="border-bottom"
[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'}"
[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'}"

View File

@ -161,7 +161,7 @@ export class CriteriaComponent implements OnInit, OnChanges, AfterViewInit, OnDe
}
get dirty() {
if (!this.selectionCriteria && !this.criteria) {
if (!this.selectionCriteria || !this.criteria) {
return false;
} else if (this.criteria.length !== this.criteriaArray.length) {
return true;
@ -225,14 +225,4 @@ export class CriteriaComponent implements OnInit, OnChanges, AfterViewInit, OnDe
})
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, SimpleChanges, ViewChild} from '@angular/core';
import {ChangeDetectorRef, Component, OnInit, ViewChild} from '@angular/core';
import {RemoveContentProvidersComponent} from './remove-content-providers.component';
import {Title} from '@angular/platform-browser';
import {
@ -15,7 +15,6 @@ import {OpenaireEntities} from "../../openaireLibrary/utils/properties/searchFie
import {CriteriaComponent} from "./criteria/criteria.component";
import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler";
import {ManageCommunityContentProvidersService} from "../../services/manageContentProviders.service";
import {UntypedFormBuilder} from "@angular/forms";
@Component({
selector: 'manage-content-providers',
@ -24,7 +23,6 @@ import {UntypedFormBuilder} from "@angular/forms";
[communityContentProviders]="communityContentProviders"
[loading]="showLoadingInRemove" [community]="community"
(editCriteria)="openCriteria($event)"
(communityContentProvidersChanged)="communityContentProvidersChanged($event)">
</remove-content-providers>
<fs-modal #addContentProvidersModal>
@ -32,23 +30,10 @@ import {UntypedFormBuilder} from "@angular/forms";
[community]="community"
(communityContentProvidersChanged)="communityContentProvidersChanged($event)"></add-content-providers>
</fs-modal>
<fs-modal #filtersModal (okEmitter)="saveCriteria()" (cancelEmitter)="criteria.reset(); depositReset();"
[okButtonDisabled]="(criteria && criteria.disabled && !depositInfoChanged)">
<fs-modal #filtersModal (okEmitter)="saveCriteria()" (cancelEmitter)="criteria.reset()"
[okButtonDisabled]="criteria && criteria.disabled">
<div class="uk-container uk-container-large">
<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'"
<criteria #criteria *ngIf="dataProvider" [height]="filtersModal.bodyHeight"
[selectionCriteria]="dataProvider.selectioncriteria">
<div no-criteria>
<h5 class="uk-margin-small-bottom">No Filters for {{dataProvider.officialname}} yet</h5>
@ -57,24 +42,6 @@ import {UntypedFormBuilder} from "@angular/forms";
</i>
</div>
</criteria>
</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>
`
@ -86,7 +53,6 @@ export class ManageContentProvidersComponent implements OnInit {
@ViewChild('criteria') criteria: CriteriaComponent;
@ViewChild('addContentProvidersModal', { static: true }) addContentProvidersModal: FullScreenModalComponent;
@ViewChild('filtersModal', { static: true }) filtersModal: FullScreenModalComponent;
@ViewChild('depositModal', { static: true }) depositModal: FullScreenModalComponent;
private subscriptions: any[] = [];
public showLoadingInRemove: boolean = true;
public body: string = "Send from page";
@ -94,16 +60,11 @@ export class ManageContentProvidersComponent implements OnInit {
public openaireEntities = OpenaireEntities;
public community: CommunityInfo;
public dataProvider: ContentProvider;
message = "";
deposit= false;
enabled = false;
depositInfoChanged =false;
messageForm = this.fb.control("");
constructor(private title: Title,
private cdr: ChangeDetectorRef,
private communityService: CommunityService,
private manageCommunityContentProvidersService: ManageCommunityContentProvidersService,
private fb: UntypedFormBuilder) {
private manageCommunityContentProvidersService: ManageCommunityContentProvidersService) {
}
ngOnInit() {
@ -135,26 +96,17 @@ export class ManageContentProvidersComponent implements OnInit {
public openCriteria(contentProvider: ContentProvider) {
this.dataProvider = contentProvider;
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.title = 'Filters';
this.filtersModal.okButtonText = "Save";
this.filtersModal.back = true;
this.filtersModal.okButton = true;
this.filtersModal.open();
this.cdr.detectChanges();
}
public saveCriteria() {
let callback = (selectionCriteria): void => {
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.criteria.reset();
this.removeContentProvidersComponent.getCommunityContentProviders();
@ -166,7 +118,6 @@ export class ManageContentProvidersComponent implements OnInit {
});
}
this.removeContentProvidersComponent.loading = true;
console.log()
this.criteria.save(callback);
}
@ -177,17 +128,4 @@ export class ManageContentProvidersComponent implements OnInit {
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,8 +22,6 @@
<loading></loading>
</div>
<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"
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>
@ -56,13 +54,7 @@
<span *ngIf="!item.officialname && !item.name">[no title available]</span>
</span>
</h6>
<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 *ngIf="item.selectioncriteria?.criteria?.length > 0" class="uk-margin-small-bottom uk-text-small">
<div class="uk-text-meta uk-margin-small-bottom">Filters</div>
<div [innerHTML]="criteriaUtils.getFiltersAsText(item.selectioncriteria.criteria)"></div>
<div *ngIf="item.selectioncriteria.criteria.length > 3" class="uk-margin-small-top">
@ -72,24 +64,18 @@
</div>
<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>
</div>
<div>
<div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="openCriteria(item)" class="uk-button uk-button-link uk-flex uk-flex-middle">
<icon name="edit" [flex]="true"></icon>
<!--<span *ngIf="item.selectioncriteria?.criteria?.length > 0" class="uk-margin-small-left"
<icon name="filters" [flex]="true"></icon>
<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>">
Edit filters
</span>
<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>">
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>
</div>
</div>

View File

@ -49,7 +49,7 @@ export class RemoveContentProvidersComponent implements OnInit {
public keyword: string = '';
@Output() addContentProviders: EventEmitter<void> = new EventEmitter();
@Output() editCriteria: EventEmitter<ContentProvider> = new EventEmitter<ContentProvider>();
constructor(private route: ActivatedRoute, private _router: Router,
private _fb: UntypedFormBuilder,
private _manageCommunityContentProvidersService: ManageCommunityContentProvidersService,
@ -81,13 +81,11 @@ export class RemoveContentProvidersComponent implements OnInit {
}
public confirmedDeleteContentProvider() {
console.log(this.selectedCommunityContentProvider)
this.subscriptions.push(this._manageCommunityContentProvidersService.removeContentProvider(this.properties, this.community.communityId, this.selectedCommunityContentProvider.openaireId).subscribe(
this.subscriptions.push(this._manageCommunityContentProvidersService.removeContentProvider(this.properties, this.community.communityId, this.selectedCommunityContentProvider.id).subscribe(
() => {
let index = this.communityContentProviders.indexOf(this.selectedCommunityContentProvider);
this.communityContentProviders.splice(index, 1);
this.applyFilters();
this._clearCacheService.clearCacheInRoute(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.communityContentProvidersChanged.emit({
@ -184,5 +182,4 @@ export class RemoveContentProvidersComponent implements OnInit {
openCriteria(contentProvider: ContentProvider) {
this.editCriteria.emit(contentProvider);
}
}

View File

@ -21,14 +21,14 @@ import {CustomizationOptions} from '../../openaireLibrary/connect/community/Cust
`,
styles:[
`
.color-input{
width:24px;
height:14px;
border-radius:3px;
border:0.1px solid #707070;
cursor: pointer;
}`
.color-input{
width:24px;
height:14px;
border-radius:3px;
border:0.1px solid #707070;
cursor: pointer;
}`
]
})

View File

@ -1,135 +1,134 @@
<div *ngIf="draftCustomizationOptions" class="uk-flex">
<aside id="sidebar_main" class="uk-sticky" uk-sticky="start: 0; end: .sidebar_main_swipe">
<div sidebar-content>
<div class="back">
<a (click)="close()" class="uk-flex uk-flex-middle uk-flex-center">
<div class="uk-width-auto">
<icon *ngIf="menuSelected.id != 'home'" name="west" ratio="1.3"
[flex]="true"></icon>
<icon *ngIf="menuSelected.id == 'home'" name="close" ratio="1.3"
[flex]="true"></icon>
</div>
<span class="uk-width-expand uk-text-truncate uk-margin-left hide-on-close">{{menuSelected.name}}</span>
</a>
</div>
<div class="menu_section uk-margin-large-top">
<ul *ngIf="menuSelected.id == 'home'" class="uk-list uk-nav uk-nav-default" uk-nav>
<ng-template ngFor [ngForOf]="sidebarItems" let-item let-i="index">
<li class="uk-visible-toggle" [class.uk-active]="menuSelected.id == item.id">
<a (click)="changeMenu(item)"
[title]="item.name">
<div class="uk-flex uk-flex-middle uk-flex-center">
<div *ngIf="item.icon" class="uk-width-auto">
<icon class="menu-icon" [name]="item.icon" [flex]="true"></icon>
</div>
<span class="uk-width-expand uk-text-truncate uk-margin-small-left hide-on-close">
<aside *ngIf="draftCustomizationOptions" id="sidebar_main">
<div id="sidebar_content">
<div class="back">
<a (click)="close()" class="uk-flex uk-flex-middle uk-flex-center">
<div class="uk-width-auto">
<icon *ngIf="menuSelected.id != 'home'" name="west" ratio="1.3"
[flex]="true"></icon>
<icon *ngIf="menuSelected.id == 'home'" name="close" ratio="1.3"
[flex]="true"></icon>
</div>
<span class="uk-width-expand uk-text-truncate uk-margin-left hide-on-close">{{menuSelected.name}}</span>
</a>
</div>
<div class="menu_section uk-margin-large-top uk-overflow-auto" style="max-height: 75vh">
<ul *ngIf="menuSelected.id == 'home'" class="uk-list uk-nav uk-nav-default" uk-nav>
<ng-template ngFor [ngForOf]="sidebarItems" let-item let-i="index">
<li class="uk-visible-toggle" [class.uk-active]="menuSelected.id == item.id">
<a (click)="changeMenu(item)"
[title]="item.name">
<div class="uk-flex uk-flex-middle uk-flex-center">
<div *ngIf="item.icon" class="uk-width-auto">
<icon class="menu-icon" [name]="item.icon" [flex]="true"></icon>
</div>
<span class="uk-width-expand uk-text-truncate uk-margin-small-left hide-on-close">
{{item.name}}
</span>
<span uk-icon="triangle-right"></span>
</div>
</a>
</li>
</ng-template>
</ul>
<ng-container *ngIf="menuSelected.id == 'identity'">
<ng-container
*ngTemplateOutlet="identityOptions ; context: { }"></ng-container>
</ng-container>
<ng-container *ngIf="menuSelected.id == 'backgrounds'">
<ng-container
*ngTemplateOutlet="backgroundOptions ; context: { }"></ng-container>
</ng-container>
<ng-container *ngIf="menuSelected.id == 'buttons'">
<ng-container
*ngTemplateOutlet="buttonOptions ; context: { }"></ng-container>
</ng-container>
</div>
<span uk-icon="triangle-right"></span>
</div>
</a>
</li>
</ng-template>
</ul>
<ng-container *ngIf="menuSelected.id == 'identity'">
<ng-container
*ngTemplateOutlet="identityOptions ; context: { }"></ng-container>
</ng-container>
<ng-container *ngIf="menuSelected.id == 'backgrounds'">
<ng-container
*ngTemplateOutlet="backgroundOptions ; context: { }"></ng-container>
</ng-container>
<ng-container *ngIf="menuSelected.id == 'buttons'">
<ng-container
*ngTemplateOutlet="buttonOptions ; context: { }"></ng-container>
</ng-container>
</div>
</aside>
<div page-content class="uk-width-1-1">
<div actions>
<div class="uk-section-small">
<ng-container *ngTemplateOutlet="applyResetButtons;"></ng-container>
</div>
</div>
</aside>
<div *ngIf="draftCustomizationOptions" page-content>
<div actions>
<div class="uk-section-small">
<ng-container *ngTemplateOutlet="applyResetButtons;"></ng-container>
</div>
<div inner>
<div class="uk-section-small">
<div *ngIf="menuSelected.id == 'backgrounds'" class=" uk-padding-small ">
<div class="customizationMenuItems uk-margin-small">
<div class="uk-h4">Backgrounds</div>
<div>Note: Custom background style settings will override any identity settings that effect the
visualisation of a background.
</div>
<div class="uk-margin-large-top uk-margin-small-bottom uk-h5"> Quick look
</div>
<quick-look-backgrounds [darkBackgroundColor]="draftCustomizationOptions.backgrounds.dark.color "
[lightBackgroundColor]="draftCustomizationOptions.backgrounds.light.color "
[formBackgroundColor]="draftCustomizationOptions.backgrounds.form.color"
[primaryColor]="draftCustomizationOptions.identity.mainColor"
[secondaryColor]="draftCustomizationOptions.identity.secondaryColor"
[buttonsOnDark]="draftCustomizationOptions.buttons.darkBackground"
[buttonsOnLight]="draftCustomizationOptions.buttons.lightBackground"
></quick-look-backgrounds>
</div>
</div>
<div *ngIf="menuSelected.id == 'buttons'" class=" uk-padding-small ">
<div class="customizationMenuItems uk-margin-small">
<div class="uk-h4">Buttons</div>
<div>Note: Custom background style settings will override any identity settings that effect the
visualisation of a background.
</div>
<div class="uk-margin-large-top uk-margin-small-bottom uk-h5"> Quick look
</div>
<quick-look-backgrounds [darkBackgroundColor]="draftCustomizationOptions.backgrounds.dark.color "
[lightBackgroundColor]="draftCustomizationOptions.backgrounds.light.color "
[formBackgroundColor]="draftCustomizationOptions.backgrounds.form.color"
[primaryColor]="draftCustomizationOptions.identity.mainColor"
[secondaryColor]="draftCustomizationOptions.identity.secondaryColor"
[buttonsOnDark]="draftCustomizationOptions.buttons.darkBackground"
[buttonsOnLight]="draftCustomizationOptions.buttons.lightBackground"
[buttonView]="true"
></quick-look-backgrounds>
</div>
<div inner>
<div class="uk-section-small">
<div *ngIf="menuSelected.id == 'backgrounds'" class=" uk-padding-small ">
<div class="customizationMenuItems uk-margin-small">
<div class="uk-h4">Backgrounds</div>
<div>Note: Custom background style settings will override any identity settings that effect the
visualisation of a background.
</div>
</div>
<div *ngIf="menuSelected.id == 'identity'" class=" uk-padding-small ">
<div class=" customizationMenuItems uk-margin-small">
<div class="uk-h4">Identity</div>
<div>Note: Custom identity style settings will effect the visualisation of the whole gateway. That
includes <span class="uk-text-bold">buttons, links, tabs, backgrounds, etc.</span></div>
<div class="uk-margin-large-top uk-margin-small-bottom uk-h5"> Quick look
</div>
<quick-look-backgrounds [darkBackgroundColor]="draftCustomizationOptions.backgrounds.dark.color "
[lightBackgroundColor]="draftCustomizationOptions.backgrounds.light.color "
[formBackgroundColor]="draftCustomizationOptions.backgrounds.form.color"
[primaryColor]="draftCustomizationOptions.identity.mainColor"
[secondaryColor]="draftCustomizationOptions.identity.secondaryColor"
[buttonsOnDark]="draftCustomizationOptions.buttons.darkBackground"
[buttonsOnLight]="draftCustomizationOptions.buttons.lightBackground"
></quick-look-backgrounds>
</div>
<div class="uk-padding-small">
<div class="uk-margin-top uk-margin-small-bottom uk-h5">See a preview</div>
<div id="container" class=" uk-flex uk-flex-center uk-flex-middle">
<div id="iframecontainer" class="">
<div class="uk-height-1-1">
<div *ngIf="hasChanges(draftCustomizationOptions, appliedCustomizationOptions)"
class=" uk-width-1-1 refresh-indicator">
<div class="uk-position-relative uk-height-1-1">
<div class="uk-position-center uk-text-center clickable uk-h3" style="color:white"
(click)="applyLayout()">
<div>
<icon name="refresh" ratio="2.5"></icon>
</div>
<div class="uk-margin-medium-top">Style has been changed.</div>
<div class="uk-margin-top"> Click to refresh the view.</div>
</div>
<div *ngIf="menuSelected.id == 'buttons'" class=" uk-padding-small ">
<div class="customizationMenuItems uk-margin-small">
<div class="uk-h4">Buttons</div>
<div>Note: Custom background style settings will override any identity settings that effect the
visualisation of a background.
</div>
<div class="uk-margin-large-top uk-margin-small-bottom uk-h5"> Quick look
</div>
<quick-look-backgrounds [darkBackgroundColor]="draftCustomizationOptions.backgrounds.dark.color "
[lightBackgroundColor]="draftCustomizationOptions.backgrounds.light.color "
[formBackgroundColor]="draftCustomizationOptions.backgrounds.form.color"
[primaryColor]="draftCustomizationOptions.identity.mainColor"
[secondaryColor]="draftCustomizationOptions.identity.secondaryColor"
[buttonsOnDark]="draftCustomizationOptions.buttons.darkBackground"
[buttonsOnLight]="draftCustomizationOptions.buttons.lightBackground"
[buttonView]="true"
></quick-look-backgrounds>
</div>
</div>
<div *ngIf="menuSelected.id == 'identity'" class=" uk-padding-small ">
<div class=" customizationMenuItems uk-margin-small">
<div class="uk-h4">Identity</div>
<div>Note: Custom identity style settings will effect the visualisation of the whole gateway. That
includes <span class="uk-text-bold">buttons, links, tabs, backgrounds, etc.</span></div>
</div>
</div>
<div class="uk-padding-small">
<div class="uk-margin-top uk-margin-small-bottom uk-h5">See a preview</div>
<div id="container" class=" uk-flex uk-flex-center uk-flex-middle">
<div id="iframecontainer" class="">
<div class="uk-height-1-1">
<div *ngIf="hasChanges(draftCustomizationOptions, appliedCustomizationOptions)"
class=" uk-width-1-1 refresh-indicator">
<div class="uk-position-relative uk-height-1-1">
<div class="uk-position-center uk-text-center clickable uk-h3" style="color:white"
(click)="applyLayout()">
<div>
<icon name="refresh" ratio="2.5"></icon>
</div>
<div class="uk-margin-medium-top">Style has been changed.</div>
<div class="uk-margin-top"> Click to refresh the view.</div>
</div>
</div>
<iframe *ngIf="previewUrl" [src]="previewUrl" class="uk-width-1-1 "
style=" border-radius: 10px;"
></iframe>
</div>
<iframe *ngIf="previewUrl" [src]="previewUrl" class="uk-width-1-1 "
style=" border-radius: 10px;"
></iframe>
</div>
</div>
</div>
@ -137,7 +136,6 @@
</div>
</div>
</div>
<ng-template #identityOptions>
<div class="functionalities-container uk-text-small">
<div class="uk-margin-top">
@ -208,12 +206,12 @@
[light]="false"></background>
<background label="Light" [background]="draftCustomizationOptions.backgrounds.light"
[light]="true"></background>
<background label="Custom section" [background]="draftCustomizationOptions.backgrounds.form"
<background label="Hero section" [background]="draftCustomizationOptions.backgrounds.form"
[light]="draftCustomizationOptions.backgrounds.form.fontsDarkMode"
[oldBackground]="publishedCustomizationOptions.backgrounds.form"
[communityId]="communityId"></background>
[communityId]="communityId" description="The area under menu"></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">
Custom section
Hero section
</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">
Fonts
@ -231,7 +229,7 @@
[checked]="draftCustomizationOptions.backgrounds.form.fontsDarkMode"
(change)="draftCustomizationOptions.backgrounds.form.fontsDarkMode=!draftCustomizationOptions.backgrounds.form.fontsDarkMode;"
[attr.uk-tooltip]="'title:<div class=\'uk-width-large\'>' +
(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>'"
(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>'"
>
</mat-slide-toggle>
</span>

View File

@ -164,6 +164,11 @@ sidebarItems = [{name:"Identity", id : "identity", icon: "desktop_windows" },
return JSON.stringify(object1) != JSON.stringify(object2);
}
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.publishedCustomizationOptions = this.copyObject(this.publishedLayout.layoutOptions)
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-position-top-right uk-margin-small-right uk-margin-small-top">
<div class="uk-flex uk-flex-middle">
<icon [flex]="true" [name]="community.isPublic()?'earth':(community.isRestricted()?'restricted':'incognito')" ratio="0.6"></icon>
<icon [flex]="true" [name]="community.status == 'all'?'earth':(community.status == 'manager'?'restricted':'incognito')" ratio="0.6"></icon>
</div>
</div>
<a class="uk-display-block uk-text-center uk-link-reset" [routerLink]="community.communityId">

View File

@ -94,12 +94,12 @@
<div class="uk-card-body">
<result-preview [properties]="properties" [showOrganizations]="true"
[showSubjects]="true" [result]="getResultPreview(result)"
[externalUrl]="projectUrl" [hasLink]="false">
[externalUrl]="projectUrl">
</result-preview>
</div>
<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 *ngIf="!result['isPart']">
<div *ngIf="!getCommunityProject(result)">
<div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="addProject(result)" class="uk-button uk-button-link uk-flex uk-flex-middle">
<icon name="add" [flex]="true"></icon>
@ -109,7 +109,7 @@
</a>
</div>
</div>
<div *ngIf="result['isPart']">
<div *ngIf="getCommunityProject(result)">
<div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="removeProject(result)"
class="uk-button uk-button-link uk-flex uk-flex-middle">

View File

@ -19,7 +19,6 @@ import {CommunityInfo} from "../../openaireLibrary/connect/community/communityIn
import {OpenaireEntities} from "../../openaireLibrary/utils/properties/searchFields";
import {Filter, Value} from "../../openaireLibrary/searchPages/searchUtils/searchHelperClasses.class";
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
import {SearchCommunityProjectsService} from "../../openaireLibrary/connect/projects/searchProjects.service";
declare var UIkit;
@ -39,7 +38,7 @@ export class AddProjectsComponent implements OnInit {
public errorCodes: ErrorCodes;
public openaireSearchUtils: SearchUtilsClass = new SearchUtilsClass();
@Output() communityProjectsChanged = new EventEmitter();
// @Input() communityProjects = [];
@Input() communityProjects = [];
public openaireProjects = [];
public queryParameters: string = "";
@ -59,7 +58,7 @@ export class AddProjectsComponent implements OnInit {
constructor(private route: ActivatedRoute, private _router: Router, private _searchProjectsService: SearchProjectsService,
private _manageCommunityProjectsService: ManageCommunityProjectsService,
private _clearCacheService: ClearCacheService, private _searchCommunityProjectsService: SearchCommunityProjectsService,
private _clearCacheService: ClearCacheService,
private _fb: UntypedFormBuilder) {
this.errorCodes = new ErrorCodes();
this.openaireSearchUtils.status = this.errorCodes.LOADING;
@ -122,18 +121,15 @@ export class AddProjectsComponent implements OnInit {
public addProject(project: SearchResult) {
this.subscriptions.push(this._manageCommunityProjectsService.addProject(this.properties, this.community.communityId, project).subscribe(
data => {
// this.communityProjects.push(data);
this._clearCacheService.clearCacheInRoute(this.openaireEntities.PROJECT+" added", this.community.communityId);
this.communityProjects.push(data);
this._clearCacheService.purgeBrowserCache(this.openaireEntities.PROJECT+" added", this.community.communityId);
UIkit.notification(this.openaireEntities.PROJECT+' successfully added!', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
project["isPart"] = true;
this.communityProjectsChanged.emit({
value: project,
value: this.communityProjects,
});
},
err => {
@ -144,20 +140,20 @@ export class AddProjectsComponent implements OnInit {
}
public removeProject(project: any) {
// let communityProject = this.getCommunityProject(project);
this.subscriptions.push(this._manageCommunityProjectsService.removeProject(this.properties, this.community.communityId, project['id']).subscribe(
let communityProject = this.getCommunityProject(project);
let projectId: string = communityProject['id'];
this.subscriptions.push(this._manageCommunityProjectsService.removeProject(this.properties, this.community.communityId, projectId).subscribe(
data => {
// let index = this.communityProjects.indexOf(communityProject);
// this.communityProjects.splice(index, 1);
let index = this.communityProjects.indexOf(communityProject);
this.communityProjects.splice(index, 1);
this._clearCacheService.purgeBrowserCache(this.openaireEntities.PROJECT+" removed", this.community.communityId);
UIkit.notification(this.openaireEntities.PROJECT+' successfully removed!', {
status: 'success',
timeout: 6000,
pos: 'bottom-right'
});
project["isPart"] = false;
this.communityProjectsChanged.emit({
value: project,
value: this.communityProjects,
});
},
err => {
@ -167,19 +163,16 @@ export class AddProjectsComponent implements OnInit {
));
}
public getCommunityProject(project: any) {
this.subscriptions.push(this._searchCommunityProjectsService.searchProjectsWithPaging(this.properties, this.community.communityId, 1, this.resultsPerPage, project.id, null).subscribe(
data => {
if(data.totalElements > 0){
project["isPart"] = true;
}
},
err => {
console.error(err);
//TODO check erros (service not available, bad request)
public getCommunityProject(project: any): string {
let index: number = 0;
for (let communityProject of this.communityProjects) {
if (communityProject.openaireId == project.id ||
(project.code == communityProject.grantId && project.funderShortname == communityProject.funder)) {
return communityProject;
}
));
index++;
}
return "";
}
getFunders() {
@ -224,9 +217,7 @@ export class AddProjectsComponent implements OnInit {
data => {
this.openaireSearchUtils.totalResults = data[0];
this.openaireProjects = data[1];
for(let project of this.openaireProjects){
this.getCommunityProject(project);
}
this.openaireSearchUtils.status = this.errorCodes.DONE;
if (this.openaireSearchUtils.totalResults == 0) {
this.openaireSearchUtils.status = this.errorCodes.NONE;

View File

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

View File

@ -16,11 +16,12 @@ import {CommunityService} from "../../openaireLibrary/connect/community/communit
@Component({
selector: 'manage-projects',
template: `
<remove-projects #removeProjectsComponent (addProjects)="openAddProjects()"
[loading]="showLoadingInRemove" [community]="community">
<remove-projects #removeProjectsComponent (addProjects)="openAddProjects()" [communityProjects]="communityProjects"
[loading]="showLoadingInRemove" [community]="community"
(communityProjectsChanged)="communityProjectsChanged($event)">
</remove-projects>
<fs-modal #fsModalProjects>
<add-projects *ngIf="modalIsOpen" #addProjects [community]="community"
<add-projects #addProjects [communityProjects]="communityProjects" [community]="community"
(communityProjectsChanged)="communityProjectsChanged($event)"></add-projects>
</fs-modal>
`
@ -35,7 +36,6 @@ export class ManageProjectsComponent implements OnInit {
public body: string = "Send from page";
public properties: EnvProperties = properties;
public community: CommunityInfo = null;
modalIsOpen = false;
constructor(private element: ElementRef,
private title: Title,
@ -68,17 +68,15 @@ export class ManageProjectsComponent implements OnInit {
this.fullscreen.back = true;
this.fullscreen.okButton = true;
this.fullscreen.open();
this.modalIsOpen = true;
}
public communityProjectsChanged($event) {
/* this.communityProjects = $event.value;
this.communityProjects = $event.value;
this.showLoadingInRemove = false;
if (this.fullscreen.isOpen) {
this.removeProjectsComponent.applyFilters();
this.removeProjectsComponent.createFunderFilter();
}*/
this.removeProjectsComponent.getCommunityProjects();
}
}
}

View File

@ -24,21 +24,20 @@
</div>
<div inner>
<div class="uk-margin-top">
<results-and-pages [type]="openaireEntiites.PROJECTS | lowercase" [page]="communitySearchUtils.page" [pageSize]="resultsPerPage"
[totalResults]="communitySearchUtils.totalResults"></results-and-pages>
<results-and-pages [type]="openaireEntiites.PROJECTS | lowercase" [page]="page" [pageSize]="resultsPerPage"
[totalResults]="previewCommunityProjects.length"></results-and-pages>
</div>
<div class="uk-grid uk-flex-middle uk-margin-medium-top" uk-grid>
<div *ngIf="allFunderOptions.length > 0">
<div *ngIf="allOptions.length > 0">
<dropdown-filter #dropdownFilter dropdownClass="uk-width-medium uk-padding-small"
name="Filter by Funder" [count]="filterForm.get('funder').value?1:null">
name="Filter by Funder" [count]="filterForm.get('funder').value.length">
<h6 class="uk-margin-remove-bottom" title="Filter by Funder">Funder</h6>
<ul class="uk-list uk-margin-remove-bottom">
<li *ngFor="let option of previewFunderOptions">
<a class="uk-link-text" >
<label (click)="select(option, $event, dropdownFilter)" class="uk-flex uk-flex-middle">
<li *ngFor="let option of allOptions">
<a class="uk-link-text">
<label (click)="select(option.value, $event, dropdownFilter)" class="uk-flex uk-flex-middle">
<input class="uk-checkbox"
type="checkbox" [checked]="isSelected(option.value.id)">
type="checkbox" [checked]="isSelected(option.value)">
<span class="uk-margin-small-left">{{option.label}}</span>
</label>
</a>
@ -56,9 +55,9 @@
</div>
<!-- </div>-->
<div class="uk-width-expand@l uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center">
<paging-no-load *ngIf="communitySearchUtils.totalResults> 0" [currentPage]="communitySearchUtils.page"
<paging-no-load *ngIf="previewCommunityProjects.length > 0"
(pageChange)="updatePage($event)" [size]="resultsPerPage"
[totalResults]="communitySearchUtils.totalResults" customClasses="uk-flex-right">
[totalResults]="previewCommunityProjects.length" customClasses="uk-flex-right">
</paging-no-load>
</div>
</div>
@ -67,30 +66,30 @@
<div *ngIf="loading" class="uk-position-center">
<loading></loading>
</div>
<validate-page-enabled pageRoute="/search/find/projects"></validate-page-enabled>
<div *ngIf="!loading">
<div class="uk-margin-medium-bottom">
<div *ngIf="previewCommunityProjects.length == 0"
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
<div>No {{openaireEntiites.PROJECTS | lowercase}}
<span *ngIf="communitySearchUtils.totalResults == 0; else: notFound">for {{community.shortTitle}}</span>
<span *ngIf="communityProjects.length == 0; else: notFound">for {{community.shortTitle}}</span>
<ng-template #notFound>found</ng-template>
</div>
</div>
<div *ngIf="previewCommunityProjects.length > 0"
class="uk-grid uk-grid-large uk-child-width-1-1 uk-child-width-1-2@m uk-margin-bottom" uk-grid uk-height-match="target: .uk-card-body">
<div *ngFor="let item of previewCommunityProjects; let i=index">
<div *ngFor="let item of previewCommunityProjects.slice((page - 1)*resultsPerPage, page*resultsPerPage); let i=index">
<div class="uk-card uk-card-default">
<div class="uk-card-body">
<h6 class="uk-margin-bottom">
<a *ngIf="(item.openaireId || (item.grantId && item.funder)) && (!item['availableSince'] || !lastDBLoadDate || item['availableSince']<lastDBLoadDate)"
<a *ngIf="item.openaireId || (item.grantId && item.funder)"
target="_blank" class="custom-external uk-link-text"
[href]="projectUrl+'?' + ((item.openaireId) ? 'projectId='+item.openaireId : 'grantId='+item.grantId+'&funder='+item.funder)">
<span *ngIf="item.name">{{item.name}}</span>
<span *ngIf="item.name && item.acronym"> (</span><span *ngIf="item.acronym">{{item.acronym}}</span><span *ngIf="item.name && item.acronym">)</span>
<span *ngIf="!item.name && !item.acronym">[no title available]</span>
</a>
<span *ngIf="(!item.openaireId && !(item.grantId && item.funder) || (item['availableSince'] && lastDBLoadDate && item['availableSince'] >= lastDBLoadDate))">
<span *ngIf="!item.openaireId && !(item.grantId && item.funder)">
<span *ngIf="item.name">{{item.name}}</span>
<span *ngIf="item.name && item.acronym"> (</span><span *ngIf="item.acronym">{{item.acronym}}</span><span *ngIf="item.name && item.acronym">)</span>
<span *ngIf="!item.name && !item.acronym">[no title available]</span>
@ -125,7 +124,7 @@
</div>
<div class="uk-margin-small-top">
<paging-no-load [currentPage]="page"
[totalResults]="communitySearchUtils.totalResults" [size]="resultsPerPage"
[totalResults]="previewCommunityProjects.length" [size]="resultsPerPage"
(pageChange)="updatePage($event)" customClasses="uk-flex-right@m uk-flex-center">
</paging-no-load>
</div>

View File

@ -19,8 +19,6 @@ import {CommunityInfo} from "../../openaireLibrary/connect/community/communityIn
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler";
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
import {debounceTime, distinctUntilChanged} from "rxjs/operators";
import {IndexInfoService} from "../../openaireLibrary/utils/indexInfo.service";
@Component({
selector: 'remove-projects',
@ -37,7 +35,7 @@ export class RemoveProjectsComponent implements OnInit {
public projectUrl = "https://" + ((properties.environment == "beta" || properties.environment == "development") ? "beta." : "") + "explore.openaire.eu" + properties.searchLinkToProject.split("?")[0];
@Output() communityProjectsChanged = new EventEmitter();
// @Input() public communityProjects = [];
@Input() public communityProjects = [];
public previewCommunityProjects = [];
public communitySearchUtils: SearchUtilsClass = new SearchUtilsClass();
public errorCodes: ErrorCodes;
@ -53,49 +51,56 @@ export class RemoveProjectsComponent implements OnInit {
/* Search */
@ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent;
filterForm: UntypedFormGroup;
public fundersCtrl: UntypedFormArray;
private searchText: RegExp = new RegExp('');
public keyword: string = '';
allFunderOptions: Option[] = [];
previewFunderOptions: Option[] = [];
selectedFunders: string[] = [];
allOptions: Option[] = [];
sortOptions: Option[] = [
{label: "Title ", value: {sort: "name", descending: false}},
{label: "Grant ID ", value: {sort: "grantId", descending: false}},
//{label:"Title (desc) ", value:{ sort: "title",descending: true }},
{label: "Title ", value: {sort: "title", descending: false}},
//{label:"Grant ID (desc) ", value:{ sort: "grant",descending: true }},
{label: "Grant ID ", value: {sort: "grant", descending: false}},
//{label:"Funder (desc) ", value:{ sort: "funder",descending: true }},
{label: "Funder ", value: {sort: "funder", descending: false}}
];
public openaireEntiites = OpenaireEntities;
lastDBLoadDate = null;
constructor(private route: ActivatedRoute, private _router: Router,
private _fb: UntypedFormBuilder,
private communityService: CommunityService,
private _manageCommunityProjectsService: ManageCommunityProjectsService,
private _searchCommunityProjectsService: SearchCommunityProjectsService,
private _clearCacheService: ClearCacheService, private indexInfoService: IndexInfoService) {
private _clearCacheService: ClearCacheService) {
this.errorCodes = new ErrorCodes();
this.communitySearchUtils.status = this.errorCodes.LOADING;
}
ngOnInit() {
this.subscriptions.push(this.indexInfoService.getDBLoadLastDate(this.properties).subscribe(res => {
this.lastDBLoadDate = res;
}));
this.communitySearchUtils.keyword = "";
this.fundersCtrl = this._fb.array([]);
this.filterForm = this._fb.group({
keyword: [''],
funder: this._fb.control(null),
funder: this.fundersCtrl,
sort: this._fb.control(this.sortOptions[0].value)
});
this.subscriptions.push(this.filterForm.get('keyword').valueChanges.pipe(debounceTime(500), distinctUntilChanged()).subscribe(value => {
this.subscriptions.push(this.filterForm.get('keyword').valueChanges.subscribe(value => {
this.searchText = new RegExp(value, 'i');
this.page = 1;
this._getCommunityProjects(this.page, this.filterForm.get('keyword').value,(this.filterForm.get("funder").value? this.filterForm.get("funder").value.id:null),
this.filterForm.get("sort").value.sort );
this.applyFilters();
}));
this.subscriptions.push(this.filterForm.get('funder').valueChanges.subscribe(value => {
this.page = 1;
this.applyFilters();
}));
this.subscriptions.push(this.filterForm.get('sort').valueChanges.subscribe(value => {
this.page = 1;
this._getCommunityProjects(this.page, this.filterForm.get('keyword').value, this.filterForm.get("funder").value? this.filterForm.get("funder").value.id:null, this.filterForm.get("sort").value.sort );
this.sort();
}));
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(community => {
@ -106,8 +111,7 @@ export class RemoveProjectsComponent implements OnInit {
+ this.community.communityId + ".openaire.eu" + this.properties.searchLinkToProject.split("?")[0];
this.keyword = '';
this._getCommunityFunders();
this._getCommunityProjects(1,this.keyword, null);
this._getCommunityProjects();
}
}));
}
@ -129,13 +133,18 @@ export class RemoveProjectsComponent implements OnInit {
}
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.id).subscribe(
data => {
this._clearCacheService.clearCacheInRoute(this.openaireEntiites.PROJECT+" removed", this.community.communityId);
let index = this.communityProjects.indexOf(this.selectedCommunityProject);
this.communityProjects.splice(index, 1);
this.applyFilters();
this._clearCacheService.purgeBrowserCache(this.openaireEntiites.PROJECT+" removed", this.community.communityId);
NotificationHandler.rise(OpenaireEntities.PROJECT+' successfully removed!');
this._getCommunityProjects(this.communitySearchUtils.page, this.keyword,null);
this.communityProjectsChanged.emit({
value: this.communityProjects,
});
this.communitySearchUtils.totalResults--;
this.communitySearchUtils.page = 1;
},
err => {
this.handleError('An error has been occurred. Try again later!');
@ -170,21 +179,29 @@ export class RemoveProjectsComponent implements OnInit {
this.alertModalDeleteCommunity.okButtonText = "Yes";
this.alertModalDeleteCommunity.open();
}
public getCommunityProjects() {
this._getCommunityProjects(this.communitySearchUtils.page, this.keyword,null );
}
public _getCommunityProjects(page, keyword, funder, orderBy = "name" ) {
public _getCommunityProjects() {
this.communitySearchUtils.status = this.errorCodes.LOADING;
this.communitySearchUtils.page = page;
this.communitySearchUtils.keyword = keyword;
this.subscriptions.push(this._searchCommunityProjectsService.searchProjectsWithPaging(this.properties, this.community.communityId, this.communitySearchUtils.page, this.resultsPerPage, this.communitySearchUtils.keyword, funder, orderBy).subscribe(
this.communityProjects = [];
this.communitySearchUtils.totalResults = 0;
this.communitySearchUtils.page = 1;
this.communitySearchUtils.keyword = "";
this.subscriptions.push(this._searchCommunityProjectsService.searchProjects(this.properties, this.community.communityId).subscribe(
data => {
this.previewCommunityProjects = data.content;
this.communitySearchUtils.totalResults = data.totalElements;
this.communityProjects = data;
this.previewCommunityProjects = this.communityProjects;
this.sort();
this.communitySearchUtils.totalResults = data.length;
this.communitySearchUtils.status = this.errorCodes.DONE;
this.communityProjectsChanged.emit({
value: this.communitySearchUtils.totalResults
value: this.communityProjects,
});
this.createFunderFilter();
this.loading = false;
},
err => {
@ -198,33 +215,90 @@ export class RemoveProjectsComponent implements OnInit {
} else {
this.communitySearchUtils.status = this.errorCodes.NOT_AVAILABLE;
}
this.loading = false;
}
));
}
public _getCommunityFunders() {
this.subscriptions.push(this._searchCommunityProjectsService.getProjectFunders(this.properties, this.community.communityId).subscribe(
data => {
for (let funder of data) {
this.allFunderOptions.push({label: funder, value: {id: funder, label: funder}});
}
this.previewFunderOptions =[...this.allFunderOptions];
},
err => {
public createFunderFilter(): void {
let funders: Set<string> = new Set<string>();
this.allOptions = [];
let i;
for (i = 0; i < this.communityProjects.length; i++) {
let funder = this.communityProjects[i].funder;
if (funder && !funders.has(funder)) {
funders.add(funder);
this.allOptions.push({label: funder, value: {id: funder, label: funder}});
}
));
}
}
public updatePage($event) {
HelperFunctions.scroll();
this.page = $event.value;
this._getCommunityProjects(this.page, this.filterForm.get('keyword').value, null);
}
addNew() {
this.addProjects.emit();
}
public applyFilters() {
this.previewCommunityProjects = this.communityProjects.filter(project => {
return (this.filterCommunityProjectByKeyword(project) && this.filterCommunityProjectByFunder(project));
});
// check paging here!!!
if (this.previewCommunityProjects.slice((this.page - 1) * this.resultsPerPage, this.page * this.resultsPerPage).length == 0) {
this.page = 1;
}
this.sort();
}
public filterCommunityProjectByKeyword(project): boolean {
return this.searchText.toString() === ''
|| ((project.name + " " + project.acronym + " " + project.grantId + " " + project.funder)).match(this.searchText) != null;
}
public filterCommunityProjectByFunder(project): boolean {
if (this.fundersCtrl.getRawValue().length == 0) {
return true;
}
for (let funder of this.fundersCtrl.getRawValue()) {
if (project.funder.toLowerCase().indexOf(funder.label.toLowerCase()) != -1) {
return true;
}
}
return false;
}
private sort() {
let sortOption: { sort: string, descending: boolean } = this.filterForm.get('sort').value;
this.previewCommunityProjects.sort((left, right): number => {
if (sortOption.sort == "title") {
if ((left.name + left.acronym) > (right.name + right.acronym)) {
return sortOption.descending ? -1 : 1;
} else if ((left.name + left.acronym) < (right.name + right.acronym)) {
return sortOption.descending ? 1 : -1;
}
} else if (sortOption.sort == "grant") {
if (left.grantId > right.grantId) {
return sortOption.descending ? -1 : 1;
} else if (left.grantId < right.grantId) {
return sortOption.descending ? 1 : -1;
}
} else if (sortOption.sort == "funder") {
if (left.funder > right.funder) {
return sortOption.descending ? -1 : 1;
} else if (left.funder < right.funder) {
return sortOption.descending ? 1 : -1;
}
}
return 0;
});
}
public onSearchClose() {
this.communitySearchUtils.keyword = this.filterForm.get('keyword').value;
@ -239,25 +313,23 @@ export class RemoveProjectsComponent implements OnInit {
NotificationHandler.rise(message, 'danger');
}
select(option, event, dropdownFilter: DropdownFilterComponent) {
console.log(option)
select(value: string, event, dropdownFilter: DropdownFilterComponent) {
if(event.target instanceof HTMLInputElement) {
dropdownFilter.closeDropdown();
if(event.target.checked) {
this.filterForm.get("funder").setValue(option.value);
this._getCommunityProjects(1, this.filterForm.get('keyword').value, this.filterForm.get('funder').value.id );
this.previewFunderOptions =[option];
if(event.target.checked && !this.selectedFunders.find(entity => value === entity)) {
this.selectedFunders.push(value);
this.fundersCtrl.setControl(this.fundersCtrl.value.length, this._fb.control(value));
} else if(!event.target.checked) {
this.filterForm.get("funder").setValue(null);
this._getCommunityProjects(1, this.filterForm.get('keyword').value,null);
this.previewFunderOptions =[...this.allFunderOptions];
let index = this.selectedFunders.indexOf(value);
if(index !== -1) {
this.selectedFunders.splice(index, 1);
this.fundersCtrl.removeAt(index);
}
}
}
}
isSelected(value: string) {
return this.filterForm && this.filterForm.get('funder').value && this.filterForm.get('funder').value.id === value;
return this.filterForm && this.filterForm.get('funder').value.find(funder => funder === value)
}
}

View File

@ -133,7 +133,7 @@ export class StatsComponent implements OnInit {
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
} else {
//console.log(`calling ${this.properties.adminToolsAPIURL}/communityFull/${this.communityId}`);
this.configService.portalAsObservable.subscribe(
this.configService.communityInformationState.subscribe(
res => {
console.debug(res);
if(res) {

View File

@ -21,7 +21,6 @@
<div *ngIf="loading" class="uk-position-center">
<loading></loading>
</div>
<validate-page-enabled pageRoute="/subjects"></validate-page-enabled>
<div *ngIf="!loading">
<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">
@ -32,19 +31,19 @@
<li class="uk-active" *ngIf="displayedAllSubjects?.length" (click)="groupSubjects(displayedAllSubjects, 'all')">
<a>All ({{displayedAllSubjects.length}})</a>
</li>
<li (click)="groupSubjects(displayedSubjects, 'freeText')">
<li *ngIf="displayedSubjects?.length" (click)="groupSubjects(displayedSubjects, 'freeText')">
<a>Free Text ({{displayedSubjects.length}})</a>
</li>
<li (click)="groupSubjects(displayedSdg, 'sdg')">
<li *ngIf="displayedSdg?.length" (click)="groupSubjects(displayedSdg, 'sdg')">
<a>SDGs ({{displayedSdg.length}})</a>
</li>
<li (click)="groupSubjects(displayedFos, 'fos')">
<li *ngIf="displayedFos?.length" (click)="groupSubjects(displayedFos, 'fos')">
<a>Fields of Science ({{displayedFos.length}})</a>
</li>
</ul>
<ul class="uk-switcher">
<li>
<ng-container *ngIf="displayedAllSubjects?.length">
<li *ngIf="displayedAllSubjects?.length">
<ng-container *ngIf="groupedAllSubjects?.length">
<div>
<ul class="uk-nav uk-nav-default uk-flex uk-flex-wrap">
<li *ngFor="let item of groupedAllSubjects; let i = index;" class="uk-margin-right" [class.uk-margin-left]="i != 0"
@ -98,14 +97,9 @@
</div>
</div>
</ng-container>
<ng-container *ngIf="displayedAllSubjects?.length === 0">
<div class="uk-position-relative uk-height-medium">
<h6 class="uk-position-center uk-margin-remove">There are no subjects yet</h6>
</div>
</ng-container>
</li>
<li>
<ng-container *ngIf="displayedSubjects?.length">
<li *ngIf="displayedSubjects?.length">
<ng-container *ngIf="groupedSubjects?.length">
<div>
<ul class="uk-nav uk-nav-default uk-flex uk-flex-wrap">
<li *ngFor="let item of groupedSubjects; let i = index;" class="uk-margin-right" [class.uk-margin-left]="i != 0"
@ -159,14 +153,9 @@
</div>
</div>
</ng-container>
<ng-container *ngIf="displayedSubjects?.length === 0">
<div class="uk-position-relative uk-height-medium">
<h6 class="uk-position-center uk-margin-remove">There are no subjects yet</h6>
</div>
</ng-container>
</li>
<li>
<ng-container *ngIf="displayedSdg?.length">
<li *ngIf="displayedSdg?.length">
<ng-container *ngIf="groupedSdg?.length">
<div>
<ul class="uk-nav uk-nav-default uk-flex uk-flex-wrap">
<li *ngFor="let item of groupedSdg; let i = index;" class="uk-margin-right" [class.uk-margin-left]="i != 0"
@ -220,14 +209,9 @@
</div>
</div>
</ng-container>
<ng-container *ngIf="displayedSdg?.length === 0">
<div class="uk-position-relative uk-height-medium">
<h6 class="uk-position-center uk-margin-remove">There are no subjects yet</h6>
</div>
</ng-container>
</li>
<li>
<ng-container *ngIf="displayedFos?.length">
<li *ngIf="displayedFos?.length">
<ng-container *ngIf="groupedFos?.length">
<div>
<ul class="uk-nav uk-nav-default uk-flex uk-flex-wrap">
<li *ngFor="let item of groupedFos; let i = index;" class="uk-margin-right" [class.uk-margin-left]="i != 0"
@ -281,13 +265,7 @@
</div>
</div>
</ng-container>
<ng-container *ngIf="displayedFos?.length === 0">
<div class="uk-position-relative uk-height-medium">
<h6 class="uk-position-center uk-margin-remove">There are no subjects yet</h6>
</div>
</ng-container>
</li>
</ul>
</div>
</div>

View File

@ -10,9 +10,7 @@ import {AlertModal} from '../../../openaireLibrary/utils/modal/alert';
import {SearchInputComponent} from '../../../openaireLibrary/sharedComponents/search-input/search-input.component';
import {forkJoin, Subscription} from 'rxjs';
import {CommunityInfo} from '../../../openaireLibrary/connect/community/communityInfo';
import {
FullScreenModalComponent
} from 'src/app/openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.component';
import {FullScreenModalComponent} from 'src/app/openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.component';
import {HelperFunctions} from 'src/app/openaireLibrary/utils/HelperFunctions.class';
import {NotificationHandler} from "../../../openaireLibrary/utils/notification-handler";
import {ClearCacheService} from "../../../openaireLibrary/services/clear-cache.service";
@ -23,362 +21,361 @@ import {InputComponent} from "../../../openaireLibrary/sharedComponents/input/in
declare var UIkit: any;
@Component({
selector: 'subjects-edit-form',
templateUrl: './subjects-edit-form.component.html',
selector: 'subjects-edit-form',
templateUrl: './subjects-edit-form.component.html',
})
export class SubjectsEditFormComponent implements OnInit {
properties: EnvProperties = properties;
communityId: string = null;
community: CommunityInfo = null;
loading = true;
params: any;
private subscriptions: any[] = [];
properties: EnvProperties = properties;
communityId: string = null;
community: CommunityInfo = null;
loading = true;
params: any;
private subscriptions: any[] = [];
filterForm: UntypedFormControl;
subjectsForm = new UntypedFormArray([]);
hasChanges: boolean = false;
originalAllSubjects = [];
originalSubjects = [];
originalSdg = [];
originalFos = [];
displayedAllSubjects = [];
displayedSubjects = [];
displayedSdg = [];
displayedFos = [];
groupedAllSubjects = [];
groupedSubjects = [];
groupedSdg = [];
groupedFos = [];
subjectsColumns = [];
subjectsLimit: number = 6;
maxCharacters: number = 25;
activeTab: 'all' | 'freeText' | 'sdg' | 'fos' = 'all';
indexAll: number = 0;
indexSubjects: number = 0;
indexSdg: number = 0;
indexFos: number = 0;
filterForm: UntypedFormControl;
subjectsForm = new UntypedFormArray([]);
hasChanges: boolean = false;
originalAllSubjects = [];
originalSubjects = [];
originalSdg = [];
originalFos = [];
displayedAllSubjects = [];
displayedSubjects = [];
displayedSdg = [];
displayedFos = [];
groupedAllSubjects = [];
groupedSubjects = [];
groupedSdg = [];
groupedFos = [];
subjectsColumns = [];
subjectsLimit: number = 6;
maxCharacters: number = 25;
activeTab: 'all' | 'freeText' | 'sdg' | 'fos' = 'all';
indexAll: number = 0;
indexSubjects: number = 0;
indexSdg: number = 0;
indexFos: number = 0;
@ViewChild('addSubjectsInput') addSubjectsInput: InputComponent;
@ViewChild('editModal') editModal: AlertModal;
@ViewChild('deleteModal') deleteModal: AlertModal;
@ViewChild('fsModal', {static: true}) fullscreen: FullScreenModalComponent;
@ViewChild('modalTabs') modalTabs: ElementRef;
@ViewChild('sdgSelection') sdgSelection: SdgSelectionComponent;
@ViewChild('fosSelection') fosSelection: FosSelectionComponent;
@ViewChild('addSubjectsInput') addSubjectsInput: InputComponent;
@ViewChild('editModal') editModal: AlertModal;
@ViewChild('deleteModal') deleteModal: AlertModal;
@ViewChild('fsModal', {static: true}) fullscreen: FullScreenModalComponent;
@ViewChild('modalTabs') modalTabs: ElementRef;
@ViewChild('sdgSelection') sdgSelection: SdgSelectionComponent;
@ViewChild('fosSelection') fosSelection: FosSelectionComponent;
onEnter: () => void = () => {
this.addSubjectsIntoList();
}
constructor(private route: ActivatedRoute,
public _fb: UntypedFormBuilder,
private title: Title,
private _communityService: CommunityService,
private _subjectsService: SubjectsService,
private _clearCacheService: ClearCacheService) {
}
ngOnInit() {
this.filterForm = this._fb.control('');
this.subscriptions.push(this.filterForm.valueChanges.subscribe(value => {
this.displayedAllSubjects = this.originalAllSubjects.filter(subject => {
return !value || subject.toLowerCase().indexOf(value.toLowerCase()) != -1
onEnter: () => void = () => {
this.addSubjectsIntoList();
}
constructor(private route: ActivatedRoute,
public _fb: UntypedFormBuilder,
private title: Title,
private _communityService: CommunityService,
private _subjectsService: SubjectsService,
private _clearCacheService: ClearCacheService) {
}
ngOnInit() {
this.filterForm = this._fb.control('');
this.subscriptions.push(this.filterForm.valueChanges.subscribe(value => {
this.displayedAllSubjects = this.originalAllSubjects.filter(subject => {
return !value || subject.toLowerCase().indexOf(value.toLowerCase()) != -1
});
this.displayedSubjects = this.originalSubjects.filter(subject => {
return !value || subject.toLowerCase().indexOf(value.toLowerCase()) != -1
});
this.displayedSdg = this.originalSdg.filter(subject => {
return !value || subject.toLowerCase().indexOf(value.toLowerCase()) != -1
});
this.displayedFos = this.originalFos.filter(subject => {
return !value || subject.toLowerCase().indexOf(value.toLowerCase()) != -1
});
if(this.activeTab === 'all') {
this.groupSubjects(this.displayedAllSubjects, 'all');
} else if(this.activeTab === 'freeText') {
this.groupSubjects(this.displayedSubjects, 'freeText');
} else if(this.activeTab === 'sdg') {
this.groupSubjects(this.displayedSdg, 'sdg');
} else if(this.activeTab === 'fos') {
this.groupSubjects(this.displayedFos, 'fos');
}
}));
this.subscriptions.push(this.route.params.subscribe(
params => {
this.communityId = params['community'];
this.title.setTitle(this.communityId.toUpperCase() + ' | Subjects');
this.loading = true;
this.subscriptions.push(this._communityService.getCommunityAsObservable().subscribe(
community => {
this.community = community;
this.params = {
community: encodeURIComponent(
'"' + community.queryId + '"')
};
this.community.subjects.sort((n1,n2)=> {
if (n1.toLowerCase() > n2.toLowerCase()) {
return 1;
}
if (n1.toLowerCase() < n2.toLowerCase()) {
return -1;
}
return 0;
});
this.displayedSubjects = this.originalSubjects.filter(subject => {
return !value || subject.toLowerCase().indexOf(value.toLowerCase()) != -1
});
this.displayedSdg = this.originalSdg.filter(subject => {
return !value || subject.toLowerCase().indexOf(value.toLowerCase()) != -1
});
this.displayedFos = this.originalFos.filter(subject => {
return !value || subject.toLowerCase().indexOf(value.toLowerCase()) != -1
});
if (this.activeTab === 'all') {
this.groupSubjects(this.displayedAllSubjects, 'all');
} else if (this.activeTab === 'freeText') {
this.groupSubjects(this.displayedSubjects, 'freeText');
} else if (this.activeTab === 'sdg') {
this.groupSubjects(this.displayedSdg, 'sdg');
} else if (this.activeTab === 'fos') {
this.groupSubjects(this.displayedFos, 'fos');
}
}));
this.subscriptions.push(this.route.params.subscribe(
params => {
this.communityId = params['community'];
this.title.setTitle(this.communityId.toUpperCase() + ' | Subjects');
this.loading = true;
this.subscriptions.push(this._communityService.getCommunityAsObservable().subscribe(
community => {
this.community = community;
this.params = {
community: encodeURIComponent(
'"' + community.queryId + '"')
};
this.community.subjects.sort((n1, n2) => {
if (n1.toLowerCase() > n2.toLowerCase()) {
return 1;
}
if (n1.toLowerCase() < n2.toLowerCase()) {
return -1;
}
return 0;
});
this.displayedSubjects = HelperFunctions.copy(this.community.subjects);
this.displayedSdg = this.community.sdg;
this.displayedFos = this.community.fos;
this.displayedAllSubjects = [...this.displayedSubjects, ...this.displayedSdg, ...this.displayedFos];
this.groupSubjects(this.displayedAllSubjects, 'all');
this.originalAllSubjects = HelperFunctions.copy(this.displayedAllSubjects);
this.originalSubjects = HelperFunctions.copy(this.displayedSubjects);
this.originalSdg = HelperFunctions.copy(this.displayedSdg);
this.originalFos = HelperFunctions.copy(this.displayedFos);
this.loading = false;
},
error => this.handleUpdateError('System error retrieving community profile', error)
));
}));
this.displayedSubjects = HelperFunctions.copy(this.community.subjects);
this.displayedSdg = this.community.sdg;
this.displayedFos = this.community.fos;
this.displayedAllSubjects = [...this.displayedSubjects, ...this.displayedSdg, ...this.displayedFos];
this.groupSubjects(this.displayedAllSubjects, 'all');
this.originalAllSubjects = HelperFunctions.copy(this.displayedAllSubjects);
this.originalSubjects = HelperFunctions.copy(this.displayedSubjects);
this.originalSdg = HelperFunctions.copy(this.displayedSdg);
this.originalFos = HelperFunctions.copy(this.displayedFos);
this.loading = false;
},
error => this.handleUpdateError('System error retrieving community profile', error)
));
}));
}
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscription) {
subscription.unsubscribe();
}
});
}
public groupSubjects(subjects: string[], type: string) {
if(subjects.length === 0) {
return [];
}
subjects.sort((a, b) => a.localeCompare(b));
if(type === 'all') {
this.indexAll = 0;
this.activeTab = 'all';
this.groupedAllSubjects = Object.values(
subjects.reduce((acc, subject) => {
let firstLetter = subject[0].toLocaleUpperCase();
if(!acc[firstLetter]) {
acc[firstLetter] = {group: firstLetter, data: [subject]};
} else {
acc[firstLetter].data.push(subject);
}
return acc;
},{})
)
if(subjects.length > 1) {
this.groupedAllSubjects.unshift({group: 'All', data: subjects});
}
}
if(type === 'freeText') {
this.indexSubjects = 0;
this.activeTab = 'freeText';
this.groupedSubjects = Object.values(
subjects.reduce((acc, subject) => {
let firstLetter = subject[0].toLocaleUpperCase();
if(!acc[firstLetter]) {
acc[firstLetter] = {group: firstLetter, data: [subject]};
} else {
acc[firstLetter].data.push(subject);
}
return acc;
},{})
)
if(subjects.length > 1) {
this.groupedSubjects.unshift({group: 'All', data: subjects});
}
}
if(type === 'sdg') {
this.indexSdg = 0;
this.activeTab = 'sdg';
this.groupedSdg = Object.values(
subjects.reduce((acc, subject) => {
let firstLetter = subject[0].toLocaleUpperCase();
if(!acc[firstLetter]) {
acc[firstLetter] = {group: firstLetter, data: [subject]};
} else {
acc[firstLetter].data.push(subject);
}
return acc;
},{})
)
if(subjects.length > 1) {
this.groupedSdg.unshift({group: 'All', data: subjects});
}
}
if(type === 'fos') {
this.indexFos = 0;
this.activeTab = 'fos';
this.groupedFos = Object.values(
subjects.reduce((acc, subject) => {
let key = subject.substring(0,2).toLocaleUpperCase();
if(!acc[key]) {
acc[key] = {group: key, data: [subject]};
} else {
acc[key].data.push(subject);
}
return acc;
},{})
)
if(subjects.length > 1) {
this.groupedFos.unshift({group: 'All', data: subjects});
}
}
}
public changeDisplayedSubjects(i, group) {
this.subjectsColumns = [];
if(this.activeTab === 'all') {
this.indexAll = i;
} else if(this.activeTab === 'freeText') {
this.indexSubjects = i;
} else if(this.activeTab === 'sdg') {
this.indexSdg = i;
} else if(this.activeTab === 'fos') {
this.indexFos = i;
}
if(group.data.length > this.subjectsLimit && group.group != 'All') {
this.divideSubjects(group);
}
}
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscription) {
subscription.unsubscribe();
}
});
public divideSubjects(group) {
let columns = [];
for(let i = 0; i < (group.data.length / this.subjectsLimit); i++) {
columns.push(group.data.slice(i * this.subjectsLimit, ((i + 1) * this.subjectsLimit)));
}
this.subjectsColumns = columns;
}
public getSubjectsExistOnlyInFirst(firstArray: string[], secondArray: string[]): string[] {
const difference = [];
for (let i = 0; i < firstArray.length; i++) {
if (secondArray.indexOf(firstArray[i]) === -1) {
difference.push(firstArray[i]);
}
}
return difference;
}
public groupSubjects(subjects: string[], type: string) {
if (subjects.length === 0) {
return [];
}
subjects.sort((a, b) => a.localeCompare(b));
if (type === 'all') {
this.indexAll = 0;
this.activeTab = 'all';
this.groupedAllSubjects = Object.values(
subjects.reduce((acc, subject) => {
let firstLetter = subject[0].toLocaleUpperCase();
if (!acc[firstLetter]) {
acc[firstLetter] = {group: firstLetter, data: [subject]};
} else {
acc[firstLetter].data.push(subject);
}
return acc;
}, {})
)
if (subjects.length > 1) {
this.groupedAllSubjects.unshift({group: 'All', data: subjects});
}
}
if (type === 'freeText') {
this.indexSubjects = 0;
this.activeTab = 'freeText';
this.groupedSubjects = Object.values(
subjects.reduce((acc, subject) => {
let firstLetter = subject[0].toLocaleUpperCase();
if (!acc[firstLetter]) {
acc[firstLetter] = {group: firstLetter, data: [subject]};
} else {
acc[firstLetter].data.push(subject);
}
return acc;
}, {})
)
if (subjects.length > 1) {
this.groupedSubjects.unshift({group: 'All', data: subjects});
}
}
if (type === 'sdg') {
this.indexSdg = 0;
this.activeTab = 'sdg';
this.groupedSdg = Object.values(
subjects.reduce((acc, subject) => {
let firstLetter = subject[0].toLocaleUpperCase();
if (!acc[firstLetter]) {
acc[firstLetter] = {group: firstLetter, data: [subject]};
} else {
acc[firstLetter].data.push(subject);
}
return acc;
}, {})
)
if (subjects.length > 1) {
this.groupedSdg.unshift({group: 'All', data: subjects});
}
}
if (type === 'fos') {
this.indexFos = 0;
this.activeTab = 'fos';
this.groupedFos = Object.values(
subjects.reduce((acc, subject) => {
let key = subject.substring(0, 2).toLocaleUpperCase();
if (!acc[key]) {
acc[key] = {group: key, data: [subject]};
} else {
acc[key].data.push(subject);
}
return acc;
}, {})
)
if (subjects.length > 1) {
this.groupedFos.unshift({group: 'All', data: subjects});
}
}
public editAllSubjects() {
UIkit.tab(this.modalTabs.nativeElement).show(0);
this.displayedSubjects = HelperFunctions.copy(this.community.subjects);
this.sdgSelection.reset();
this.sdgSelection.sdgs.markAsPristine();
this.fosSelection.reset();
this.fosSelection.fosOptions.markAsPristine();
this.fullscreen.title = "Add/Edit Subjects";
this.fullscreen.okButtonText = "Save";
this.fullscreen.back = true;
this.fullscreen.okButton = true;
this.fullscreen.open();
}
public addSubjectsIntoList() {
if(this.addSubjectsInput.searchControl.getRawValue()) {
this.addSubjectsInput.add(null, true);
}
this.subjectsForm.getRawValue().forEach(element => {
this.displayedSubjects.unshift(element);
});
this.subjectsForm.clear();
this.hasChanges = true;
}
public removeSubjectFromList(i) {
this.displayedSubjects.splice(i, 1);
this.hasChanges = true;
}
public saveAllSubjects() {
let selectedSdg = this.sdgSelection.getSelectedSubjects().map(a => a.id);
let selectedFos = this.fosSelection.getSelectedSubjects().map(a => a.id);
let requests = [
...this.saveSubjects(this.community.subjects, this.displayedSubjects, 'subjects'),
...this.saveSubjects(this.community.sdg, selectedSdg, 'sdg'),
...this.saveSubjects(this.community.fos, selectedFos, 'fos')
];
this.subscriptions.push(forkJoin(requests).subscribe(res => {
this.afterUpdateActions(res, "updated");
}));
}
public saveSubjects(subjects, displayedSubjects, type: string) {
if (this.communityId != null && this.communityId !== '') {
this.loading = true;
const subjectsToDeleteAr = this.getSubjectsExistOnlyInFirst(subjects, displayedSubjects);
const subjectsToAddAr = this.getSubjectsExistOnlyInFirst(displayedSubjects, subjects);
const subjectsToDelete = this.getNonEmptyItems(subjectsToDeleteAr);
const subjectsToAdd = this.getNonEmptyItems(subjectsToAddAr);
let requests = [];
if (subjectsToDelete.length > 0) {
requests.push(this._subjectsService.removeSubjects(
this.properties.communityAPI + this.communityId + '/' + type, subjectsToDelete))
}
if (subjectsToAdd.length > 0) {
requests.push(this._subjectsService.addSubjects(
this.properties.communityAPI + this.communityId + '/' + type, subjectsToAdd))
}
return requests;
}
}
handleUpdateError(message: string, error = null) {
if(error) {
console.error(error)
}
public changeDisplayedSubjects(i, group) {
this.subjectsColumns = [];
if (this.activeTab === 'all') {
this.indexAll = i;
} else if (this.activeTab === 'freeText') {
this.indexSubjects = i;
} else if (this.activeTab === 'sdg') {
this.indexSdg = i;
} else if (this.activeTab === 'fos') {
this.indexFos = i;
}
if (group.data.length > this.subjectsLimit && group.group != 'All') {
this.divideSubjects(group);
}
NotificationHandler.rise(message, 'danger');
this.loading = false;
}
afterUpdateActions(response, message: string) {
response.forEach(res => {
if (res.subjects) {
this.community.subjects = res.subjects;
} else if (res.sdg) {
this.community.sdg = res.sdg;
} else if (res.fos) {
this.community.fos = res.fos;
}
});
this._communityService.updateSubjects(this.community.subjects, this.community.fos, this.community.sdg);
this._clearCacheService.purgeBrowserCache("Subjects "+message, this.communityId);
NotificationHandler.rise('Subjects successfully ' + message + '!')
this.loading = false;
}
private getNonEmptyItems(data: string[]): string[] {
const length = data.length;
const arrayNonEmpty = new Array<string>();
let j = 0;
for (let i = 0; i < length; i++) {
if (this.isEmpty(data[i])) {
} else if (this.isNonEmpty(data[i])) {
arrayNonEmpty[j] = data[i];
j++;
}
}
public divideSubjects(group) {
let columns = [];
for (let i = 0; i < (group.data.length / this.subjectsLimit); i++) {
columns.push(group.data.slice(i * this.subjectsLimit, ((i + 1) * this.subjectsLimit)));
}
this.subjectsColumns = columns;
return arrayNonEmpty;
}
private isEmpty(data: string): boolean {
if (data !== undefined && !data.replace(/\s/g, '').length) {
return true;
} else {
return false;
}
public getSubjectsExistOnlyInFirst(firstArray: string[], secondArray: string[]): string[] {
const difference = [];
for (let i = 0; i < firstArray.length; i++) {
if (secondArray.indexOf(firstArray[i]) === -1) {
difference.push(firstArray[i]);
}
}
return difference;
}
public editAllSubjects() {
UIkit.tab(this.modalTabs.nativeElement).show(0);
this.displayedSubjects = HelperFunctions.copy(this.community.subjects);
this.sdgSelection.reset();
this.sdgSelection.sdgs.markAsPristine();
this.fosSelection.reset();
this.fosSelection.fosOptions.markAsPristine();
this.fullscreen.title = "Add/Edit Subjects";
this.fullscreen.okButtonText = "Save";
this.fullscreen.back = true;
this.fullscreen.okButton = true;
this.fullscreen.open();
}
public addSubjectsIntoList() {
if (this.addSubjectsInput.searchControl.getRawValue()) {
this.addSubjectsInput.add(null, true);
}
this.subjectsForm.getRawValue().forEach(element => {
this.displayedSubjects.unshift(element);
});
this.subjectsForm.clear();
this.hasChanges = true;
}
public removeSubjectFromList(i) {
this.displayedSubjects.splice(i, 1);
this.hasChanges = true;
}
public saveAllSubjects() {
let selectedSdg = this.sdgSelection.getSelectedSubjects().map(a => a.id);
let selectedFos = this.fosSelection.getSelectedSubjects().map(a => a.id);
let requests = [
...this.saveSubjects(this.community.subjects, this.displayedSubjects, 'subjects'),
...this.saveSubjects(this.community.sdg, selectedSdg, 'sdg'),
...this.saveSubjects(this.community.fos, selectedFos, 'fos')
];
this.subscriptions.push(forkJoin(requests).subscribe(res => {
this.afterUpdateActions(res, "updated");
}));
}
public saveSubjects(subjects, displayedSubjects, type: string) {
if (this.communityId != null && this.communityId !== '') {
this.loading = true;
const subjectsToDeleteAr = this.getSubjectsExistOnlyInFirst(subjects, displayedSubjects);
const subjectsToAddAr = this.getSubjectsExistOnlyInFirst(displayedSubjects, subjects);
const subjectsToDelete = this.getNonEmptyItems(subjectsToDeleteAr);
const subjectsToAdd = this.getNonEmptyItems(subjectsToAddAr);
let requests = [];
if (subjectsToDelete.length > 0) {
requests.push(this._subjectsService.removeSubjects(
this.properties.communityAPI + this.communityId + '/' + type, subjectsToDelete))
}
if (subjectsToAdd.length > 0) {
requests.push(this._subjectsService.addSubjects(
this.properties.communityAPI + this.communityId + '/' + type, subjectsToAdd))
}
return requests;
}
}
handleUpdateError(message: string, error = null) {
if (error) {
console.error(error)
}
NotificationHandler.rise(message, 'danger');
this.loading = false;
}
afterUpdateActions(response, message: string) {
response.forEach(res => {
if (res.subjects) {
this.community.subjects = res.subjects;
} else if (res.sdg) {
this.community.sdg = res.sdg;
} else if (res.fos) {
this.community.fos = res.fos;
}
});
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);
NotificationHandler.rise('Subjects successfully ' + message + '!')
this.loading = false;
}
private getNonEmptyItems(data: string[]): string[] {
const length = data.length;
const arrayNonEmpty = new Array<string>();
let j = 0;
for (let i = 0; i < length; i++) {
if (this.isEmpty(data[i])) {
} else if (this.isNonEmpty(data[i])) {
arrayNonEmpty[j] = data[i];
j++;
}
}
return arrayNonEmpty;
}
private isEmpty(data: string): boolean {
if (data !== undefined && !data.replace(/\s/g, '').length) {
return true;
} else {
return false;
}
}
private isNonEmpty(data: string): boolean {
if (data !== undefined && data != null) {
return true;
} else {
return false;
}
}
private isNonEmpty(data: string): boolean {
if (data !== undefined && data != null) {
return true;
} else {
return false;
}
}
}

View File

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

View File

@ -25,11 +25,12 @@ export class UsersManagersComponent implements OnInit {
public message: string;
public inviteDisableMessage: string;
public emailComposer: Function = (name, recipient, role):Email => {
return Composer.composeEmailForCommunityDashboard(name, role, recipient);
return Composer.composeEmailForCommunityDashboard(name, recipient);
}
private subscriptions: any[] = [];
constructor(private communityService: CommunityService,
private route: ActivatedRoute,
private title: Title) {
}
@ -42,7 +43,7 @@ export class UsersManagersComponent implements OnInit {
this.link = this.getURL(this.community.communityId);
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.';
if(community.isPrivate()) {
if(community.status === "hidden") {
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;

View File

@ -4,36 +4,24 @@ import {ActivatedRoute} from "@angular/router";
import {CommunityService} from "../../../openaireLibrary/connect/community/community.service";
import {Subscriber} from "rxjs";
import {CommunityInfo} from "../../../openaireLibrary/connect/community/communityInfo";
import {Email} from "../../../openaireLibrary/utils/email/email";
import {Composer} from "../../../openaireLibrary/utils/email/composer";
import {properties} from "../../../../environments/environment";
@Component({
selector: 'users-subscribers',
template: `
<subscribers *ngIf="community.isOpen()" [id]="community.communityId" [type]="'community'" [name]="community.shortTitle"
<subscribers [id]="community.communityId" [type]="'community'" [name]="community.shortTitle"
[inviteDisableMessage]="inviteDisableMessage">
<users-tabs tab="member"></users-tabs>
</subscribers>
<role-users *ngIf="!community.isOpen()" [id]="community.communityId" [type]="community.type" [name]="community.shortTitle" [inviteDisableMessage]="inviteDisableMessage"
[link]="link" [role]="'member'"
[message]="message" [emailComposer]="emailComposer">
<users-tabs tab="member"></users-tabs>
</role-users>
`
})
export class UsersSubscribersComponent implements OnInit {
public community: CommunityInfo;
public link: string;
public loading: boolean;
public message: string;
public inviteDisableMessage: string;
public emailComposer: Function = (name, recipient, role):Email => {
return Composer.composeEmailForCommunityDashboard(name, role, recipient);
}
private subscriptions: any[] = [];
constructor(private communityService: CommunityService,
private route: ActivatedRoute,
private title: Title) {
}
@ -42,12 +30,9 @@ export class UsersSubscribersComponent implements OnInit {
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(community => {
if(community) {
this.community = community;
this.title.setTitle(this.community.shortTitle.toUpperCase() + " | Members");
this.link = this.getURL(this.community.communityId);
this.message = 'A member can access the community dashboard and link research results with projects, ' +
'communities and other research projects.';
if(!community.isPublic()) {
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.title.setTitle(this.community.shortTitle.toUpperCase() + " | Subscribers");
if(community.status !== "all") {
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.loading = false;
}
@ -61,8 +46,4 @@ export class UsersSubscribersComponent implements OnInit {
}
});
}
private getURL(id: string): string {
return 'https://' + (properties.environment !== "production"?'beta.':'') + id + ".openaire.eu?verify=";
}
}

View File

@ -5,12 +5,11 @@ import {LoadingModule} from "../../../openaireLibrary/utils/loading/loading.modu
import {RouterModule} from "@angular/router";
import {SubscribersModule} from "../../../openaireLibrary/dashboard/users/subscribers/subscribers.module";
import {UsersTabsModule} from '../users-tabs.module';
import {RoleUsersModule} from "../../../openaireLibrary/dashboard/users/role-users/role-users.module";
@NgModule({
imports: [CommonModule, LoadingModule, RouterModule.forChild([
{path: '', component: UsersSubscribersComponent}
]), SubscribersModule, UsersTabsModule, RoleUsersModule],
]), SubscribersModule, UsersTabsModule],
declarations: [UsersSubscribersComponent],
exports: [UsersSubscribersComponent]
})

View File

@ -22,27 +22,9 @@
<div class="uk-card-body">
<preview-zenodo-community [item]="item" [master]="masterCommunity && item.id==masterCommunity.id"></preview-zenodo-community>
</div>
<div class="uk-card-footer uk-padding-remove-vertical">
<div *ngIf="!masterCommunity || item.id!==masterCommunity.id" 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 *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 *ngIf="!inThelist(item, selectedCommunities) && !(masterCommunity && item.id==masterCommunity.id)">
<div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="addCommunity(item)" class="uk-button uk-button-link uk-flex uk-flex-middle">
<icon name="add" [flex]="true"></icon>
@ -52,17 +34,15 @@
</a>
</div>
</div>
<div *ngIf="!(masterCommunity)">
<div *ngIf="inThelist(item, selectedCommunities)">
<div class="uk-padding-small uk-padding-remove-horizontal">
<a (click)="addCommunity(item,true)" 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 (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>
</div>
</div>
@ -76,4 +56,4 @@
</div>
</ng-container>
</div>
</div>
</div>

View File

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

View File

@ -1,4 +1,4 @@
<div page-content *ngIf="community && searchUtils">
<div page-content>
<div actions>
<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>
@ -6,7 +6,7 @@
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>
<div>
<button class="uk-button uk-button-default uk-flex uk-flex-middle" (click)="openAddZenodoCommunites()"
<button class="uk-button uk-button-default uk-flex uk-flex-middle" (click)="addNew()"
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"
[class.uk-disabled]="searchUtils.status === errorCodes.LOADING">
@ -19,7 +19,6 @@
</div>
<div inner>
<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">
<loading></loading>
</div>
@ -37,16 +36,16 @@
[page]="page" [pageSize]="size"
[totalResults]="previewCommunities.length">
</no-load-paging>
<!-- <ul class="uk-margin-medium-top uk-margin-bottom uk-list uk-list-xlarge">-->
<!-- <ul class="uk-margin-medium-top uk-margin-bottom uk-list uk-list-xlarge">-->
<div class="uk-grid uk-grid-large uk-child-width-1-1 uk-margin-medium-top uk-margin-bottom" uk-grid>
<div *ngFor="let item of previewCommunities.slice((this.page - 1)*this.size, this.page*this.size); let i=index">
<div class="uk-card uk-card-default">
<div class="uk-card-body">
<preview-zenodo-community [item]="item" [master]="masterCommunity && item.id==masterCommunity.id"></preview-zenodo-community>
</div>
<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 *ngIf="item.id!==masterZenodoCommunityId" >
<div *ngIf="!masterCommunity || item.id!==masterCommunity.id" 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>
<div class="uk-padding-small uk-padding-remove-horizontal">
<button class="uk-button uk-button-link uk-flex uk-flex-middle"
(click)="removeCommunity(item)">
@ -55,31 +54,12 @@
</button>
</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>
<!-- </ul>-->
<!-- </ul>-->
<div class="uk-margin-small-top">
<paging-no-load [currentPage]="page"
[totalResults]="previewCommunities.length" [size]="size"
@ -92,9 +72,3 @@
</div>
</div>
<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

@ -0,0 +1,158 @@
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.openaireId).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">
<img *ngIf="item.logoUrl"
src="{{item.logoUrl}}" width="80" height="80"
alt="">
alt="{{item.title}}">
</a>
</div>
<div class="uk-width-expand">

View File

@ -1,18 +1,10 @@
import {
ChangeDetectorRef,
Component,
ElementRef,
EventEmitter,
Input,
OnDestroy,
OnInit,
Output,
ViewChild
} from '@angular/core';
import {Component, ElementRef, Input, OnDestroy, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
import {ZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communities.service';
import {SearchZenodoCommunitiesService} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunities.service';
import {CommunityService} from '../../openaireLibrary/connect/community/community.service';
import {CommunityInfo} from '../../openaireLibrary/connect/community/communityInfo';
import {ZenodoCommunityInfo} from '../../openaireLibrary/connect/zenodoCommunities/zenodoCommunityInfo';
@ -22,79 +14,100 @@ import {Title} from '@angular/platform-browser';
import {properties} from '../../../environments/environment';
import {Subscription} from 'rxjs';
import {FullScreenModalComponent} from '../../openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.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";
import {ManageZenodoCommunitiesComponent} from './manage-zenodo-communities.component';
@Component({
selector: 'zenodo-communities',
templateUrl: 'zenodo-communities.component.html'
template: `
<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 {
public community: CommunityInfo = null;
public toggle = false;
public pageTitle = 'Manage zenodo communities';
masterZenodoCommunityId = null;
masterCommunity = null;
masterZenodoCommunity = null;
public properties: EnvProperties = null;
selectedCommunityIds = null;
selectedCommunities = null;
selectedCommunities = [];
zenodocommunitiesloadedCount = 0;
zenodoSearchUtils: SearchUtilsClass = new SearchUtilsClass();
public errorCodes: ErrorCodes = new ErrorCodes();
subscriptions = [];
@ViewChild('fsModal', {static: true}) fullscreen: FullScreenModalComponent;
@ViewChild('fsModal', { static: true }) fullscreen: FullScreenModalComponent;
@ViewChild(ManageZenodoCommunitiesComponent) manage: ManageZenodoCommunitiesComponent;
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,
private _zenodoCommunitieService: ZenodoCommunitiesService, private title: Title,
private _communityService: CommunityService,
public _fb: UntypedFormBuilder,
private cdr: ChangeDetectorRef,
private _manageZenodoCommunitiesService: ManageZenodoCommunitiesService) {
private _searchZenodoCommunitiesService: SearchZenodoCommunitiesService) {
}
ngOnInit() {
this.searchUtils.status = this.errorCodes.LOADING;
this.zenodoSearchUtils.status = this.errorCodes.LOADING;
this.properties = properties;
this.subscriptions.push(this.route.params.subscribe(params => {
//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 => {
this.community = community;
this.title.setTitle(this.community.shortTitle.toUpperCase() + ' | Zenodo Communities');
this.masterZenodoCommunityId = this.community.zenodoCommunity;
this.selectedCommunities = [];
this.searchUtils.status = this.errorCodes.LOADING;
this.selectedCommunityIds = this.community.otherZenodoCommunities;
this.searchUtils.totalResults = this.selectedCommunityIds.length;
this.subscriptions.push(this._communityService.getCommunityAsObservable().subscribe(
community => {
this.community = community;
this.title.setTitle(this.community.shortTitle.toUpperCase() + ' | Zenodo Communities');
this.masterZenodoCommunityId = this.community.zenodoCommunity;
if (this.masterZenodoCommunityId) {
this.subscriptions.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties,
this.properties.zenodoCommunities + this.masterZenodoCommunityId,
null).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 = result;
this.zenodoSearchUtils.totalResults = this.selectedCommunityIds.length;
if (this.selectedCommunityIds.length === 0) {
this.searchUtils.status = this.errorCodes.NONE;
this.zenodoSearchUtils.status = this.errorCodes.NONE;
}
for (let i = 0; i < this.selectedCommunityIds.length; i++) {
this.getZenodoCommunityById(this.selectedCommunityIds[i]);
this.getZenodoCommunityById(
this.selectedCommunityIds[i]['zenodoid'],
this.selectedCommunityIds[i]['id']);
}
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.okButtonText = "Done";
this.fullscreen.okButton = true;
}
ngOnDestroy() {
this.subscriptions.forEach(subscription => {
if (subscription instanceof Subscription) {
@ -102,32 +115,28 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy {
}
});
}
getZenodoCommunityById(zenodoid) {
getZenodoCommunityById(zenodoid, openaireId) {
this.subscriptions.push(this._zenodoCommunitieService.getZenodoCommunityById(this.properties,
zenodoid).subscribe(
this.properties.zenodoCommunities + zenodoid, openaireId).subscribe(
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++;
if (this.zenodocommunitiesloadedCount >= this.selectedCommunityIds.length) {
this.searchUtils.status = this.errorCodes.DONE;
this.zenodoSearchUtils.status = this.errorCodes.DONE;
}
},
error => {
const emptyCommunity: ZenodoCommunityInfo = new ZenodoCommunityInfo();
emptyCommunity.id = zenodoid;
emptyCommunity.openaireId = openaireId;
emptyCommunity.title = zenodoid;
this.selectedCommunities.push(emptyCommunity);
this.zenodocommunitiesloadedCount++;
if (this.zenodocommunitiesloadedCount >= this.selectedCommunityIds.length) {
this.searchUtils.status = this.errorCodes.DONE;
this.zenodoSearchUtils.status = this.errorCodes.DONE;
}
console.log('Zenodo community\'' + zenodoid + '\' couldn\'t be loaded');
}
@ -144,150 +153,11 @@ export class ZenodoCommunitiesComponent implements OnInit, OnDestroy {
}
public zenodoCommunitiesChanged($event) {
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.selectedCommunities = $event.value;
this.showLoadingInRemove = false;
if (this.fullscreen.isOpen) {
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();
}
));
this.manage.filterPreviewCommunities(this.manage.filterForm.value);
}
}
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,8 +2,10 @@ import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';
import {FormsModule} from '@angular/forms';
import {RouterModule} from '@angular/router';
import {ManageZenodoCommunitiesComponent} from './manage-zenodo-communities.component';
import {AddZenodoCommunitiesComponent} from './add-zenodo-communities.component';
import {ZenodoCommunitiesComponent} from './zenodo-communities.component';
import {SearchZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunitiesService.module';
import {ManageZenodoCommunitiesService} from '../../services/manageZenodoCommunities.service';
import {ZenodoCommunitiesServiceModule} from '../../openaireLibrary/connect/zenodoCommunities/zenodo-communitiesService.module';
import {AlertModalModule} from '../../openaireLibrary/utils/modal/alertModal.module';
@ -17,15 +19,14 @@ import {PageContentModule} from '../../openaireLibrary/dashboard/sharedComponent
import {FullScreenModalModule} from '../../openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.module';
import {HTMLToStringPipeModule} from '../../openaireLibrary/utils/pipes/HTMLToStringPipe.module';
import {PagingModule} from "../../openaireLibrary/utils/paging.module";
import {ValidateEnabledPageModule} from "../../utils/validateEnabledPage.module";
@NgModule({
imports: [
CommonModule, FormsModule, RouterModule, ZenodoCommunitiesServiceModule,
AlertModalModule, ZenodoCommunitiesRoutingModule, PageContentModule, SearchInputModule, IconsModule, NoLoadPaging, LoadingModule, FullScreenModalModule, HTMLToStringPipeModule, PagingModule, ValidateEnabledPageModule
CommonModule, FormsModule, RouterModule, SearchZenodoCommunitiesServiceModule, ZenodoCommunitiesServiceModule,
AlertModalModule, ZenodoCommunitiesRoutingModule, PageContentModule, SearchInputModule, IconsModule, NoLoadPaging, LoadingModule, FullScreenModalModule, HTMLToStringPipeModule, PagingModule
],
declarations: [
ZenodoCommunitiesComponent, AddZenodoCommunitiesComponent, PreviewZenodoCommunityComponent
ManageZenodoCommunitiesComponent, ZenodoCommunitiesComponent, AddZenodoCommunitiesComponent, PreviewZenodoCommunityComponent
],
providers: [
ManageZenodoCommunitiesService

View File

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

View File

@ -12,9 +12,9 @@ export class ManageCommunityProjectsService {
let headers = new HttpHeaders({'Content-Type': 'application/json', 'accept': 'application/json'});
let url = properties.communityAPI+pid+"/projects?projectId="+id;
let url = properties.communityAPI+pid+"/projects";
//return this.http.delete(url, options)
return this.http.request('delete', url, { headers: headers})
return this.http.request('delete', url, { body: id, headers: headers})
}
addProject(properties:EnvProperties, pid: string, project: any) {

View File

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

View File

@ -1,93 +0,0 @@
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

@ -1,17 +0,0 @@
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 3b437aafda7a716a0a89785a106456cbe520dce3
Subproject commit d8e7e5439fbd606301b51fdd5ed5115d9ad75c22

@ -1 +1 @@
Subproject commit 99ab54cdd7b973a2ba047f0a6b37667270b58439
Subproject commit 64c5ed3d459df4947b0ab93917960c7fb8d1e507

View File

@ -1,14 +1,91 @@
import {EnvProperties} from '../app/openaireLibrary/utils/properties/env-properties';
import {common, commonBeta, commonProd} from "../app/openaireLibrary/utils/properties/environments/environment";
let props: EnvProperties = {
isDashboard: true,
enablePiwikTrack: false,
useCache: false,
domain:'https://beta.admin.connect.openaire.eu',
monitorStatsFrameUrl:"https://beta.services.openaire.eu/stats-tool/"
};
export let properties: EnvProperties = {
...common, ...commonBeta, ...props
}
environment: "beta",
dashboard: 'connect',
isDashboard: true,
adminToolsPortalType: "community",
enablePiwikTrack: false,
useCache: false,
framesAPIURL: "https://beta.openaire.eu/stats3/",
claimsAPIURL: "https://beta.services.openaire.eu/claims/rest/claimsService/",
statisticsAPIURL: "https://beta.services.openaire.eu/stats-api/",
statisticsFrameAPIURL: "https://beta.openaire.eu/stats/",
statisticsFrameNewAPIURL: "https://stats.madgik.di.uoa.gr/stats-api/",
useNewStatistisTool: true,
searchAPIURLLAst: "https://beta.services.openaire.eu/search/v2/api/",
searchResourcesAPIURL: "https://beta.services.openaire.eu/search/v2/api/resources",
openCitationsAPIURL: "https://services.openaire.eu/opencitations/getCitations?id=",
csvAPIURL: "https://beta.services.openaire.eu/search/v2/api/reports",
searchCrossrefAPIURL: "https://api.crossref.org/works",
searchDataciteAPIURL: "https://api.datacite.org/works",
searchOrcidURL: "https://pub.orcid.org/",
orcidURL: "https://orcid.org/",
doiURL: "https://dx.doi.org/",
cordisURL: "http://cordis.europa.eu/projects/",
openDoarURL: "http://v2.sherpa.ac.uk/id/repository/",
r3DataURL: "http://service.re3data.org/repository/",
sherpaURL: "http://www.sherpa.ac.uk/romeo/search.php?issn=",
zenodo: "https://zenodo.org/",
zenodoCommunities: "https://zenodo.org/api/communities/",
openAccess: "https://www.openaire.eu/support/faq#article-id-234",
openAccessRepo: "https://www.openaire.eu/support/faq#article-id-310",
fp7Guidlines: "https://www.openaire.eu/open-access-in-fp7-seventh-research-framework-programme",
h2020Guidlines: "https://www.openaire.eu/oa-publications/h2020/open-access-in-horizon-2020",
ercGuidlines: "http://erc.europa.eu/sites/default/files/document/file/ERC_Open_Access_Guidelines-revised_2014.pdf",
helpdesk: "https://www.openaire.eu/support/helpdesk",
helpdeskEmail: "helpdesk@openaire.eu",
utilsService: "https://demo.openaire.eu/utils-service",
vocabulariesAPI: "https://beta.services.openaire.eu/provision/mvc/vocabularies/",
piwikBaseUrl: " https://analytics.openaire.eu/piwik.php?idsite=6",
registryUrl: 'https://beta.services.openaire.eu/uoa-user-management/api/registry/',
loginUrl: "https://beta.services.openaire.eu/login-service/openid_connect_login",
userInfoUrl: "https://beta.services.openaire.eu/login-service/userInfo",
logoutUrl: "https://beta.services.openaire.eu/login-service/openid_logout",
cookieDomain: ".openaire.eu",
feedbackmail: "feedback@openaire.eu",
feedbackmailForMissingEntities: "feedback@openaire.eu",
cacheUrl: "https://demo.openaire.eu/cache/get?url=",
deleteCacheUrl: 'https://demo.openaire.eu/cache/clear',
deleteBrowserCacheUrl: 'https://beta.services.openaire.eu/uoa-admin-tools/cache',
adminToolsAPIURL: "https://beta.services.openaire.eu/uoa-admin-tools/",
adminToolsCommunity: "openaire",
communityAPI: "https://beta.services.openaire.eu/openaire/community/",
miningBackendURL: "https://beta.services.openaire.eu/interactive-mining",
csvLimit: 2000,
pagingLimit: 20,
resultsPerPage: 10,
baseLink: "",
domain: "https://beta.admin.connect.openaire.eu/",
baseOpenaireLink: "https://beta.explore.openaire.eu",
searchLinkToPublication: "/search/publication?articleId=",
searchLinkToProject: "/search/project?projectId=",
searchLinkToDataProvider: "/search/dataprovider?datasourceId=",
searchLinkToDataset: "/search/dataset?datasetId=",
searchLinkToOrganization: "/search/organization?organizationId=",
searchLinkToPublications: "/search/find/publications",
searchLinkToDataProviders: "/search/find/dataproviders",
searchLinkToProjects: "/search/find/projects",
searchLinkToDatasets: "/search/find/datasets",
searchLinkToSoftware: "/search/find/software",
searchLinkToOrganizations: "/search/find/organizations",
searchLinkToCompatibleDataProviders: "/search/content-providers",
searchLinkToEntityRegistriesDataProviders: "/search/entity-registries",
searchLinkToJournals: "/search/journals",
searchLinkToAdvancedPublications: "/search/advanced/publications",
searchLinkToAdvancedProjects: "/search/advanced/projects",
searchLinkToAdvancedDatasets: "/search/advanced/datasets",
searchLinkToAdvancedSoftware: "/search/advanced/software",
searchLinkToAdvancedDataProviders: "/search/advanced/dataproviders",
searchLinkToAdvancedOrganizations: "/search/advanced/organizations",
lastIndexInformationLink: "https://beta.openaire.eu/aggregation-and-content-provision-workflows",
showLastIndexInformationLink: false,
widgetLink: "https://beta.openaire.eu/index.php?option=com_openaire&view=widget&format=raw&projectId=",
claimsInformationLink: "https://beta.openaire.eu/linking",
lastIndexUpdate: "2020-05-06",
indexInfoAPI: "https://beta.services.openaire.eu/openaire/info/",
admins: ["rcd@openaire.eu"],
adminPortalURL: "https://beta.admin.connect.openaire.eu",
errorLink: '/error',
connectPortalUrl: 'https://beta.connect.openaire.eu'
};

View File

@ -1,16 +1,91 @@
import {EnvProperties} from '../app/openaireLibrary/utils/properties/env-properties';
import {common, commonProd} from "../app/openaireLibrary/utils/properties/environments/environment";
let props: EnvProperties = {
isDashboard: true,
enablePiwikTrack: false,
useCache: false,
domain:'https://admin.connect.openaire.eu',
monitorStatsFrameUrl:"https://services.openaire.eu/stats-tool/"
};
export let properties: EnvProperties = {
...common, ...commonProd, ...props
}
environment:"production",
dashboard: 'connect',
isDashboard: true,
adminToolsPortalType: "community",
enablePiwikTrack: false,
useCache: false,
framesAPIURL: "https://www.openaire.eu/stats3/",
claimsAPIURL: "https://services.openaire.eu/claims/rest/claimsService/",
statisticsAPIURL: "https://beta.services.openaire.eu/stats-api/",
statisticsFrameAPIURL:"https://www.openaire.eu/stats/",
statisticsFrameNewAPIURL: "http://marilyn.athenarc.gr:8080/stats-api/",
useNewStatistisTool:false,
searchAPIURLLAst: "https://services.openaire.eu/search/v2/api/",
searchResourcesAPIURL: "https://services.openaire.eu/search/v2/api/resources",
openCitationsAPIURL: "https://services.openaire.eu/opencitations/getCitations?id=",
csvAPIURL: "https://services.openaire.eu/search/v2/api/reports",
searchCrossrefAPIURL: "https://api.crossref.org/works",
searchDataciteAPIURL: "https://api.datacite.org/works",
searchOrcidURL: "https://pub.orcid.org/",
orcidURL: "https://orcid.org/",
doiURL: "https://dx.doi.org/",
cordisURL: "http://cordis.europa.eu/projects/",
openDoarURL: "http://v2.sherpa.ac.uk/id/repository/",
r3DataURL: "http://service.re3data.org/repository/",
sherpaURL: "http://www.sherpa.ac.uk/romeo/search.php?issn=",
zenodo: "https://zenodo.org/",
zenodoCommunities: "https://zenodo.org/api/communities/",
openAccess: "https://www.openaire.eu/support/faq#article-id-234",
openAccessRepo: "https://www.openaire.eu/support/faq#article-id-310",
fp7Guidlines: "https://www.openaire.eu/open-access-in-fp7-seventh-research-framework-programme",
h2020Guidlines: "https://www.openaire.eu/oa-publications/h2020/open-access-in-horizon-2020",
ercGuidlines: "http://erc.europa.eu/sites/default/files/document/file/ERC_Open_Access_Guidelines-revised_2014.pdf",
helpdesk: "https://www.openaire.eu/support/helpdesk",
helpdeskEmail: "helpdesk@openaire.eu",
utilsService: "https://explore.openaire.eu/utils-service",
vocabulariesAPI:"https://services.openaire.eu/provision/mvc/vocabularies/",
piwikBaseUrl:" https://analytics.openaire.eu/piwik.php?idsite=6",
loginUrl: "https://services.openaire.eu/login-service/openid_connect_login",
registryUrl: 'https://services.openaire.eu/uoa-user-management/api/registry/',
userInfoUrl: "https://services.openaire.eu/login-service/userInfo",
logoutUrl: "https://services.openaire.eu/login-service/openid_logout",
cookieDomain:".openaire.eu",
feedbackmail:"openaire.test@gmail.com",
feedbackmailForMissingEntities: "feedback@openaire.eu",
cacheUrl:"https://explore.openaire.eu/cache/get?url=",
deleteCacheUrl: 'https://explore.openaire.eu/cache/clear',
deleteBrowserCacheUrl: 'https://services.openaire.eu/uoa-admin-tools/cache',
adminToolsAPIURL:"https://services.openaire.eu/uoa-admin-tools/",
adminToolsCommunity:"openaire",
communityAPI: "https://services.openaire.eu/openaire/community/",
miningBackendURL: "https://beta.services.openaire.eu/interactive-mining",
csvLimit: 2000,
pagingLimit: 20,
resultsPerPage: 10,
baseLink: "",
domain: "https://admin.explore.openaire.eu/",
baseOpenaireLink: "https://explore.openaire.eu",
searchLinkToPublication: "/search/publication?articleId=",
searchLinkToProject: "/search/project?projectId=",
searchLinkToDataProvider: "/search/dataprovider?datasourceId=",
searchLinkToDataset: "/search/dataset?datasetId=",
searchLinkToOrganization: "/search/organization?organizationId=",
searchLinkToPublications: "/search/find/publications",
searchLinkToDataProviders: "/search/find/dataproviders",
searchLinkToProjects: "/search/find/projects",
searchLinkToDatasets: "/search/find/datasets",
searchLinkToSoftware: "/search/find/software",
searchLinkToOrganizations: "/search/find/organizations",
searchLinkToCompatibleDataProviders: "/search/content-providers",
searchLinkToEntityRegistriesDataProviders: "/search/entity-registries",
searchLinkToJournals: "/search/journals",
searchLinkToAdvancedPublications: "/search/advanced/publications",
searchLinkToAdvancedProjects: "/search/advanced/projects",
searchLinkToAdvancedDatasets: "/search/advanced/datasets",
searchLinkToAdvancedSoftware: "/search/advanced/software",
searchLinkToAdvancedDataProviders: "/search/advanced/dataproviders",
searchLinkToAdvancedOrganizations: "/search/advanced/organizations",
lastIndexInformationLink: "https://www.openaire.eu/aggregation-and-content-provision-workflows",
showLastIndexInformationLink: false,
widgetLink: "https://www.openaire.eu/index.php?option=com_openaire&view=widget&format=raw&projectId=",
claimsInformationLink: "https://www.openaire.eu/linking",
lastIndexUpdate: "2020-12-17",
indexInfoAPI: "https://services.openaire.eu/openaire/info/",
admins: ["rcd@openaire.eu"],
adminPortalURL: "https://admin.connect.openaire.eu",
errorLink: '/error',
connectPortalUrl: 'https://connect.openaire.eu'
};

View File

@ -4,23 +4,93 @@
// The list of which env maps to which file can be found in `.angular-cli.json`.
import {EnvProperties} from '../app/openaireLibrary/utils/properties/env-properties';
import {common, commonDev, commonProd} from "../app/openaireLibrary/utils/properties/environments/environment";
let props: EnvProperties = {
isDashboard: true,
enablePiwikTrack: false,
useCache: false,
connectPortalUrl: 'http://scoobydoo.di.uoa.gr:4200',
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 = {
...common, ...commonDev, ...props
}
environment: 'development',
dashboard: 'connect',
isDashboard: true,
adminToolsPortalType: "community",
enablePiwikTrack: false,
useCache: false,
framesAPIURL: 'https://beta.openaire.eu/stats3/',
claimsAPIURL: 'http://scoobydoo.di.uoa.gr:8080/dnet-claims-service-2.0.0-SNAPSHOT/rest/claimsService/',
statisticsAPIURL: 'https://beta.services.openaire.eu/stats-api/',
statisticsFrameAPIURL: 'https://beta.openaire.eu/stats/',
statisticsFrameNewAPIURL: "https://stats.madgik.di.uoa.gr/stats-api/",
useNewStatistisTool: true,
searchAPIURLLAst: 'https://beta.services.openaire.eu/search/v2/api/',
searchResourcesAPIURL: 'https://beta.services.openaire.eu/search/v2/api/resources',
openCitationsAPIURL: 'https://services.openaire.eu/opencitations/getCitations?id=',
csvAPIURL: 'http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/reports',
searchCrossrefAPIURL: 'https://api.crossref.org/works',
searchDataciteAPIURL: 'https://api.datacite.org/works',
searchOrcidURL: 'https://pub.orcid.org/',
orcidURL: 'https://orcid.org/',
doiURL: 'https://dx.doi.org/',
cordisURL: 'http://cordis.europa.eu/projects/',
openDoarURL: 'http://v2.sherpa.ac.uk/id/repository/',
r3DataURL: 'http://service.re3data.org/repository/',
sherpaURL: 'http://www.sherpa.ac.uk/romeo/search.php?issn=',
zenodo: 'https://zenodo.org/',
zenodoCommunities: 'https://zenodo.org/api/communities/',
openAccess: 'https://www.openaire.eu/support/faq#article-id-234',
openAccessRepo: 'https://www.openaire.eu/support/faq#article-id-310',
fp7Guidlines: 'https://www.openaire.eu/open-access-in-fp7-seventh-research-framework-programme',
h2020Guidlines: 'https://www.openaire.eu/oa-publications/h2020/open-access-in-horizon-2020',
ercGuidlines: 'http://erc.europa.eu/sites/default/files/document/file/ERC_Open_Access_Guidelines-revised_2014.pdf',
helpdesk: 'https://www.openaire.eu/support/helpdesk',
helpdeskEmail: 'helpdesk@openaire.eu',
utilsService: 'http://mpagasas.di.uoa.gr:8000',
vocabulariesAPI: 'https://beta.services.openaire.eu/provision/mvc/vocabularies/',
piwikBaseUrl: ' https://analytics.openaire.eu/piwik.php?idsite=6',
registryUrl: 'http://mpagasas.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/api/registry/',
loginUrl: "http://mpagasas.di.uoa.gr:19080/login-service/openid_connect_login",
userInfoUrl: "http://mpagasas.di.uoa.gr:19080/login-service/userInfo",
logoutUrl: "http://mpagasas.di.uoa.gr:19080/login-service/openid_logout",
cookieDomain: '.di.uoa.gr',
feedbackmail: 'openaire.test@gmail.com',
feedbackmailForMissingEntities: 'feedback@openaire.eu',
cacheUrl: 'http://scoobydoo.di.uoa.gr:3000/get?url=',
// deleteCacheUrl: 'http://duffy.di.uoa.gr:3000/clear',
// deleteBrowserCacheUrl: 'http://duffy.di.uoa.gr:19280/uoa-admin-tools/cache',
adminToolsAPIURL: 'http://duffy.di.uoa.gr:19280/uoa-admin-tools/',
adminToolsCommunity: 'openaire',
communityAPI: 'https://dev-openaire.d4science.org/openaire/community/',
miningBackendURL: 'https://beta.services.openaire.eu/interactive-mining',
csvLimit: 2000,
pagingLimit: 20,
resultsPerPage: 10,
baseLink: "",
domain:'https://beta.admin.connect.openaire.eu',
baseOpenaireLink: 'https://beta.explore.openaire.eu',
searchLinkToPublication: '/search/publication?articleId=',
searchLinkToProject: '/search/project?projectId=',
searchLinkToDataProvider: '/search/dataprovider?datasourceId=',
searchLinkToDataset: '/search/dataset?datasetId=',
searchLinkToOrganization: '/search/organization?organizationId=',
searchLinkToPublications: '/search/find/publications',
searchLinkToDataProviders: '/search/find/dataproviders',
searchLinkToProjects: '/search/find/projects',
searchLinkToDatasets: '/search/find/datasets',
searchLinkToSoftware: '/search/find/software',
searchLinkToOrganizations: '/search/find/organizations',
searchLinkToCompatibleDataProviders: '/search/content-providers',
searchLinkToEntityRegistriesDataProviders: '/search/entity-registries',
searchLinkToJournals: '/search/journals',
searchLinkToAdvancedPublications: '/search/advanced/publications',
searchLinkToAdvancedProjects: '/search/advanced/projects',
searchLinkToAdvancedDatasets: '/search/advanced/datasets',
searchLinkToAdvancedSoftware: '/search/advanced/software',
searchLinkToAdvancedDataProviders: '/search/advanced/dataproviders',
searchLinkToAdvancedOrganizations: '/search/advanced/organizations',
lastIndexInformationLink: 'https://www.openaire.eu/aggregation-and-content-provision-workflows',
showLastIndexInformationLink: false,
widgetLink: 'https://beta.openaire.eu/index.php?option=com_openaire&view=widget&format=raw&projectId=',
claimsInformationLink: 'https://www.openaire.eu/linking-beta',
lastIndexUpdate: '2019-05-16',
indexInfoAPI: 'http://beta.services.openaire.eu/openaire/info/',
admins: ['kostis30fylloy@gmail.com'],
adminPortalURL: 'https://beta.admin.connect.openaire.eu',
errorLink: '/error',
connectPortalUrl: 'http://scoobydoo.di.uoa.gr:4200'
};

View File

@ -1,5 +1,5 @@
@use "sass:meta";
@import "node_modules/interactiveminingv3/assets/css/variables.css";
@import "~interactiveminingv3/assets/css/variables.css";
.mining {

View File

@ -7,6 +7,8 @@ import {
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: any;
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
@ -14,3 +16,7 @@ getTestBed().initTestEnvironment(
teardown: { destroyAfterEach: false }
}
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

View File

@ -10,14 +10,13 @@
"moduleResolution": "node",
"experimentalDecorators": true,
"importHelpers": true,
"target": "ES2022",
"target": "es2020",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2018",
"dom"
],
"useDefineForClassFields": false
]
}
}