Compare commits
18 Commits
Author | SHA1 | Date |
---|---|---|
Konstantina Galouni | 6a7ae34f2d | |
argirok | 3c8540db4c | |
Alex Martzios | 400cda2022 | |
argirok | 63062eb5a7 | |
argirok | 7e25f3204d | |
argirok | eb469d068e | |
argirok | b7e1fb3965 | |
argirok | 2777d4ccc3 | |
Konstantina Galouni | 56045fba35 | |
argirok | a21ba8af98 | |
Alex Martzios | 98110670b2 | |
argirok | ee100b2583 | |
argirok | 31e217dc7f | |
argirok | 378ea26f83 | |
argirok | 82ade5e137 | |
Alex Martzios | 597d409290 | |
argirok | 4bd736bd25 | |
argirok | 05db374254 |
|
@ -220,19 +220,23 @@ export class AppComponent implements OnInit {
|
|||
position: 'left',
|
||||
badge: true
|
||||
};
|
||||
let communityInfo = new MenuItem("community", "Community Info", "", "/" + this.community.communityId, false, [], [], {}, {name: 'badge'}, null, null, "/" + this.community.communityId + "/info");
|
||||
let communityInfo = new MenuItem("communityInfo", "Community Info", "", "/" + this.community.communityId, false, [], [], {}, {name: 'badge'}, null, null, "/" + this.community.communityId + "/info");
|
||||
communityInfo.items = [
|
||||
new MenuItem("profile", "Profile", "", "/" + this.community.communityId + "/info/profile", false, [], [], {}, null, null, null, "/" + this.community.communityId + "/info/profile"),
|
||||
new MenuItem("organizations", "Organizations", "", "/" + this.community.communityId + "/info/organizations", false, [], [], {}, null, null, null, "/" + this.community.communityId + "/info/organizations"),
|
||||
new MenuItem("projects", OpenaireEntities.PROJECTS, "", "/" + this.community.communityId + "/info/projects", false, [], [], {}, null, null, null, "/" + this.community.communityId + "/info/projects"),
|
||||
new MenuItem("content-providers", OpenaireEntities.DATASOURCES, "", "/" + this.community.communityId + "/info/content-providers", false, [], [], {}, null, null, null, "/" + this.community.communityId + "/info/content-providers"),
|
||||
new MenuItem("zenodo-communities", "Zenodo Communities ", "", "/" + this.community.communityId + "/info/zenodo-communities", false, [], [], {}, null, null, null, "/" + this.community.communityId + "/info/zenodo-communities"),
|
||||
new MenuItem("advanced-criteria", "Advanced Criteria", "", "/" + this.community.communityId + "/info/advanced-criteria", false, [], [], {}, null, null, null, "/" + this.community.communityId + "/info/advanced-criteria")
|
||||
new MenuItem("organizations", "Organizations", "", "/" + this.community.communityId + "/info/organizations", false, [], [], {}, null, null, null, "/" + this.community.communityId + "/info/organizations")
|
||||
]
|
||||
this.sideBarItems.push(communityInfo);
|
||||
let contentConfiguration = new MenuItem("contentConfiguration", "Content configuration", "", "/" + this.community.communityId +"/config", false, [], [], {}, {name: 'badge'}, null, null, "/" + this.community.communityId + "/config");
|
||||
contentConfiguration.items = [
|
||||
new MenuItem("projects", OpenaireEntities.PROJECTS, "", "/" + this.community.communityId + "/config/projects", false, [], [], {}, null, null, null, "/" + this.community.communityId + "/config/projects"),
|
||||
new MenuItem("content-providers", OpenaireEntities.DATASOURCES, "", "/" + this.community.communityId + "/config/content-providers", false, [], [], {}, null, null, null, "/" + this.community.communityId + "/config/content-providers"),
|
||||
new MenuItem("zenodo-communities", "Zenodo Communities ", "", "/" + this.community.communityId + "/config/zenodo-communities", false, [], [], {}, null, null, null, "/" + this.community.communityId + "/config/zenodo-communities"),
|
||||
new MenuItem("advanced-criteria", "Advanced Criteria", "", "/" + this.community.communityId + "/config/advanced-criteria", false, [], [], {}, null, null, null, "/" + this.community.communityId + "/config/advanced-criteria")
|
||||
]
|
||||
if(this.community.type === 'community') {
|
||||
communityInfo.items.splice(4, 0, new MenuItem("subjects", "Subjects", "", "/" + this.community.communityId + "/info/subjects", false, [], [], {}, null, null, null, "/" + this.community.communityId + "/info/subjects"))
|
||||
contentConfiguration.items.splice(2, 0, new MenuItem("subjects", "Subjects", "", "/" + this.community.communityId + "/config/subjects", false, [], [], {}, null, null, null, "/" + this.community.communityId + "/config/subjects"))
|
||||
}
|
||||
this.sideBarItems.push(communityInfo);
|
||||
this.sideBarItems.push(contentConfiguration);
|
||||
this.sideBarItems.push(new MenuItem("users", "Users", "", "/" + this.community.communityId + "/users", false, [], [], {}, {name: 'group'}, null, null, "/" + this.community.communityId + "/users"));
|
||||
this.sideBarItems.push(new MenuItem("admin-tools", "Pages & Menus", "", "/" + this.community.communityId + "/admin-tools/pages", false, [], [], {}, {name: 'description'}, null, null, "/" + this.community.communityId + "/admin-tools"));
|
||||
this.sideBarItems.push(new MenuItem("customization", "Customization", "", "/" + this.community.communityId + "/customize-layout", false, [], [], {}, {name: 'brush'}));
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e5a98845a76ffdaeeceaa7bd87f14fc427c7df29
|
||||
Subproject commit 503ab40616c53a071cd74fb2802cd3de130923f6
|
|
@ -7,12 +7,7 @@ import {ConnectCommunityGuard} from "../../openaireLibrary/connect/communityGuar
|
|||
RouterModule.forChild([
|
||||
{path: '', redirectTo: 'profile', pathMatch: 'full'},
|
||||
{path: 'profile', loadChildren: () => import('./profile/profile.module').then(m => m.ProfileModule)},
|
||||
{path: 'organizations', loadChildren: () => import('../affiliations/affiliations.module').then(m => m.AffiliationsModule)},
|
||||
{path: 'projects', loadChildren: () => import('../projects/communityProjects.module').then(m => m.CommunityProjectsModule)},
|
||||
{path: 'content-providers', loadChildren: () => import('../content-providers/communityContentProviders.module').then(m => m.CommunityContentProvidersModule)},
|
||||
{path: 'zenodo-communities', loadChildren: () => import('../zenodo-communities/zenodo-communities.module').then(m => m.ZenodoCommunitiesModule)},
|
||||
{path: 'advanced-criteria', loadChildren: () => import('../advanced-criteria/advanced-criteria.module').then(m => m.AdvancedCriteriaModule)},
|
||||
{path: 'subjects', canActivateChild: [ConnectCommunityGuard], loadChildren: () => import('../subjects/subjects-edit-form/subjects-edit-form.module').then(m => m.SubjectsEditFormModule)},
|
||||
{path: 'organizations', loadChildren: () => import('../affiliations/affiliations.module').then(m => m.AffiliationsModule)}
|
||||
])
|
||||
],
|
||||
providers: [ConnectCommunityGuard]
|
||||
|
|
|
@ -248,7 +248,7 @@ 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.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 +261,7 @@ 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.purgeBrowserCache("Community saved",this.community.communityId);
|
||||
this.communityService.getCommunity(this.community.communityId, true).subscribe(community => {
|
||||
NotificationHandler.rise(community.shortTitle + ' has been <b>successfully saved</b>');
|
||||
callback(community);
|
||||
|
|
|
@ -8,6 +8,10 @@ import {ConnectRIGuard} from "../openaireLibrary/connect/communityGuard/connectR
|
|||
path: 'info',
|
||||
loadChildren: () => import('./community-info/community-info-routing.module').then(m => m.CommunityInfoRoutingModule),
|
||||
},
|
||||
{
|
||||
path: 'config',
|
||||
loadChildren: () => import('./content-config/community-content-config-routing.module').then(m => m.CommunityContentConfigRoutingModule),
|
||||
},
|
||||
{
|
||||
path: 'users',
|
||||
loadChildren: () => import('./users/users-routing.module').then(m => m.UsersRoutingModule)
|
||||
|
|
|
@ -26,8 +26,10 @@ declare var UIkit;
|
|||
</div>
|
||||
<div class="uk-margin-medium-top">
|
||||
<div>Purge ICM cache for all communities</div>
|
||||
|
||||
|
||||
<button (click)="purgeBrowserCache()" class="uk-button uk-button-danger uk-margin-top" [class.uk-disabled]="savingChanges"> Purge Browser Cache</button>
|
||||
<button (click)="purgeBrowserCache()" class="uk-button uk-button-danger uk-margin-top"
|
||||
[class.uk-disabled]="savingChanges || !properties.deleteBrowserCacheUrl"> Purge Browser Cache</button>
|
||||
<hr>
|
||||
</div>
|
||||
<div class="uk-margin-medium-top">
|
||||
|
@ -81,7 +83,7 @@ export class ConnectAdminCustomizationComponent implements OnInit {
|
|||
this.savingChanges = true;
|
||||
let connectCssIsSaved = false;
|
||||
let defaultCssIsSaved = false;
|
||||
this.subscriptions.push(this.customizationService.getLayouts(properties, ).subscribe(layouts => {
|
||||
this.subscriptions.push(this.customizationService.getLayouts(properties, ).subscribe(async layouts => {
|
||||
|
||||
this.totalLayouts = layouts ? layouts.length : 0;
|
||||
for(let layout of layouts){
|
||||
|
@ -95,6 +97,8 @@ export class ConnectAdminCustomizationComponent implements OnInit {
|
|||
}else {
|
||||
this.callSaveAndCreate(layout, "community");
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
|
||||
}
|
||||
if(!connectCssIsSaved){
|
||||
this.totalLayouts++;
|
||||
|
@ -129,16 +133,20 @@ export class ConnectAdminCustomizationComponent implements OnInit {
|
|||
}
|
||||
|
||||
purgeBrowserCache() {
|
||||
this.savingChanges = true;
|
||||
this.subscriptions.push(this.communitiesService.getCommunities(this.properties, this.properties.communityAPI + 'communities').subscribe(
|
||||
communities => {
|
||||
communities.forEach(community => {
|
||||
this._clearCacheService.purgeBrowserCache("Layout added/ updated", community.communityId);
|
||||
});
|
||||
this.savingChanges = false;
|
||||
}
|
||||
));
|
||||
this._clearCacheService.purgeBrowserCache("Layout added/ updated", "connect");
|
||||
if(properties.deleteBrowserCacheUrl) {
|
||||
this.savingChanges = true;
|
||||
this.subscriptions.push(this.communitiesService.getCommunities(this.properties, this.properties.communityAPI + 'communities').subscribe(
|
||||
async communities => {
|
||||
for (const community1 of communities) {
|
||||
this._clearCacheService.purgeBrowserCache("Layout added/ updated", community1.communityId);
|
||||
await new Promise((resolve) => setTimeout(resolve, 100));
|
||||
|
||||
}
|
||||
this.savingChanges = false;
|
||||
}
|
||||
));
|
||||
this._clearCacheService.purgeBrowserCache("Layout added/ updated", "connect");
|
||||
}
|
||||
}
|
||||
|
||||
deleteLayout(){
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
import {NgModule} from '@angular/core';
|
||||
import {RouterModule} from '@angular/router';
|
||||
import {ConnectCommunityGuard} from "../../openaireLibrary/connect/communityGuard/connectCommunityGuard.guard";
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{path: '', redirectTo: 'projects', pathMatch: 'full'},
|
||||
{path: 'projects', loadChildren: () => import('../projects/communityProjects.module').then(m => m.CommunityProjectsModule)},
|
||||
{path: 'content-providers', loadChildren: () => import('../content-providers/communityContentProviders.module').then(m => m.CommunityContentProvidersModule)},
|
||||
{path: 'zenodo-communities', loadChildren: () => import('../zenodo-communities/zenodo-communities.module').then(m => m.ZenodoCommunitiesModule)},
|
||||
{path: 'advanced-criteria', loadChildren: () => import('../advanced-criteria/advanced-criteria.module').then(m => m.AdvancedCriteriaModule)},
|
||||
{path: 'subjects', canActivateChild: [ConnectCommunityGuard], loadChildren: () => import('../subjects/subjects-edit-form/subjects-edit-form.module').then(m => m.SubjectsEditFormModule)}
|
||||
])
|
||||
],
|
||||
providers: [ConnectCommunityGuard]
|
||||
})
|
||||
export class CommunityContentConfigRoutingModule {
|
||||
}
|
|
@ -68,10 +68,10 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="uk-margin-small-top">
|
||||
<paging-no-load [currentPage]="openaireSearchUtils.page"
|
||||
[totalResults]="openaireSearchUtils.totalResults" [size]="resultsPerPage"
|
||||
(pageChange)="goTo($event)" customClasses="uk-flex-right@m uk-flex-center">
|
||||
</paging-no-load>
|
||||
<no-load-paging [type]="openaireContentProviders.length === 1?openAIREEntities.DATASOURCE:openAIREEntities.DATASOURCES"
|
||||
[page]="openaireSearchUtils.page" [pageSize]="resultsPerPage" (pageChange)="goTo($event.value)"
|
||||
[totalResults]="openaireSearchUtils.totalResults">
|
||||
</no-load-paging>
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<loading></loading>
|
||||
</div>
|
||||
<ng-container *ngIf="!loading">
|
||||
<div class="criteria uk-overflow-auto uk-position-relative" [ngStyle]="{'height.px': criteriaHeight?criteriaHeight:null}">
|
||||
<div class="criteria uk-position-relative uk-margin-large-bottom" >
|
||||
<div *ngIf="criteria.length == 0" class="uk-text-center uk-position-center">
|
||||
<ng-content select="[no-criteria]"></ng-content>
|
||||
</div>
|
||||
|
|
|
@ -87,7 +87,6 @@ export class RemoveContentProvidersComponent implements OnInit {
|
|||
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({
|
||||
|
|
|
@ -57,8 +57,8 @@
|
|||
<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>Note: Custom background style settings will override any settings that affect the
|
||||
visualisation of backgrounds.
|
||||
</div>
|
||||
|
||||
<div class="uk-margin-large-top uk-margin-small-bottom uk-h5"> Quick look
|
||||
|
@ -78,8 +78,8 @@
|
|||
<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>Note: Custom buttons style settings will override any settings that affect the
|
||||
visualisation of buttons.
|
||||
</div>
|
||||
|
||||
<div class="uk-margin-large-top uk-margin-small-bottom uk-h5"> Quick look
|
||||
|
@ -102,7 +102,7 @@
|
|||
<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
|
||||
<div>Note: Custom identity style settings will affect the visualisation of the whole gateway. That
|
||||
includes <span class="uk-text-bold">buttons, links, tabs, backgrounds, etc.</span></div>
|
||||
|
||||
</div>
|
||||
|
@ -171,6 +171,20 @@
|
|||
" draftCustomizationOptions.identity.secondaryColor= $event; updateBackgroundsBasedOnIdentity(); updateButtonsBasedOnIdentity()"
|
||||
label="Secondary"></color>
|
||||
</div>
|
||||
<div *ngIf="draftCustomizationOptions.identityIsCustom && community && (this.community.plan == 'Premium' || this.community.plan == 'Advanced') " class=" uk-margin-large-top uk-margin-medium-bottom">
|
||||
<div class=" uk-margin-xsmall-bottom uk-text-uppercase uk-text-meta uk-text-bold uk-flex uk-flex-middle">
|
||||
Custom css
|
||||
<a *ngIf="hasChanges(publishedCustomizationOptions.identity.customCss, draftCustomizationOptions.identity.customCss) &&
|
||||
draftCustomizationOptions.identityIsCustom" class="uk-margin-small-left uk-button-link"
|
||||
uk-tooltip="title:<div class='uk-width-large'>Reset to previously saved options</div>"
|
||||
(click)="resetCustomCssTo(publishedCustomizationOptions.identity.customCss);">
|
||||
<icon name="settings_backup_restore" flex="true"></icon>
|
||||
</a>
|
||||
</div>
|
||||
<textarea [ngModel]="this.draftCustomizationOptions.identity.customCss" type="textarea"
|
||||
[rows]="5" style="resize: vertical; font-size: 12px; width: calc(100% - 7px);" placeholder="Add custom css here."
|
||||
(ngModelChange)="this.draftCustomizationOptions.identity.customCss =$event"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
<ng-template #backgroundOptions>
|
||||
|
|
|
@ -14,6 +14,8 @@ import {Subscription} from 'rxjs';
|
|||
import {UserManagementService} from "../../openaireLibrary/services/user-management.service";
|
||||
import {AlertModal} from "../../openaireLibrary/utils/modal/alert";
|
||||
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
|
||||
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
|
||||
import {CommunityService} from "../../openaireLibrary/connect/community/community.service";
|
||||
|
||||
declare var UIkit;
|
||||
|
||||
|
@ -69,6 +71,9 @@ declare var UIkit;
|
|||
.menu_section.uk-overflow-auto:hover {
|
||||
overflow-y: scroll;
|
||||
}
|
||||
:host >>>.input-wrapper > .input-box{
|
||||
padding:0 !important;
|
||||
}
|
||||
`]
|
||||
})
|
||||
|
||||
|
@ -93,7 +98,7 @@ sidebarItems = [{name:"Identity", id : "identity", icon: "desktop_windows" },
|
|||
{name:"Backgrounds", id : "backgrounds", icon: "wallpaper" },
|
||||
{name:"Buttons", id : "buttons", icon: "smart_button" }]
|
||||
@ViewChild('leaveModal') closeModal: AlertModal;
|
||||
|
||||
public community: CommunityInfo = null;
|
||||
constructor(private element: ElementRef,
|
||||
private route: ActivatedRoute,
|
||||
private _router: Router,
|
||||
|
@ -102,7 +107,8 @@ sidebarItems = [{name:"Identity", id : "identity", icon: "desktop_windows" },
|
|||
private layoutService: CustomizationService,
|
||||
private utilsService: UtilitiesService,
|
||||
private userManagementService: UserManagementService,
|
||||
private _clearCacheService: ClearCacheService) {
|
||||
private _clearCacheService: ClearCacheService,
|
||||
private communityService: CommunityService,) {
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
@ -132,6 +138,9 @@ sidebarItems = [{name:"Identity", id : "identity", icon: "desktop_windows" },
|
|||
|
||||
this.subscriptions.push(this.route.params.subscribe((params) => {
|
||||
this.communityId = params['community'];
|
||||
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(community => {
|
||||
this.community = community;
|
||||
}))
|
||||
if(this.communityId == "covid-19"){
|
||||
this.defaultCustomizationOptions= new CustomizationOptions(CustomizationOptions.getIdentity(this.communityId).mainColor,CustomizationOptions.getIdentity(this.communityId).secondaryColor);
|
||||
}
|
||||
|
@ -302,6 +311,9 @@ sidebarItems = [{name:"Identity", id : "identity", icon: "desktop_windows" },
|
|||
this.updateBackgroundsBasedOnIdentity();
|
||||
|
||||
}
|
||||
resetCustomCssTo(cutomCss:string) {
|
||||
this.draftCustomizationOptions.identity.customCss = cutomCss;
|
||||
}
|
||||
updateButtonsBasedOnIdentity(){
|
||||
let tmp = new CustomizationOptions(this.draftCustomizationOptions.identity.mainColor, this.draftCustomizationOptions.identity.secondaryColor);
|
||||
if(!this.draftCustomizationOptions.buttonsIsCustom) {
|
||||
|
|
|
@ -84,12 +84,23 @@
|
|||
<div class="uk-margin-small-top" [innerHTML]="infoMessage"></div>
|
||||
</div>
|
||||
<ng-container *ngIf="openaireSearchUtils.totalResults > 0">
|
||||
<div>
|
||||
<label>
|
||||
<input id="checkAll" type="checkbox" (click)="selectAll()" class="uk-checkbox" title="Select all"
|
||||
[ngModel]="selectedIndexes.length == openaireProjects.length"/>
|
||||
</label>
|
||||
<button *ngIf="selectedIndexes.length > 0" class="uk-button uk-button-link uk-margin-xsmall-left" [class.uk-disabled]="selectedIndexes.length == 0"
|
||||
[disabled]="selectedIndexes.length == 0" (click)="addAll()" >
|
||||
Add ({{selectedIndexes.length}})
|
||||
</button>
|
||||
<hr class="uk-margin-remove-top">
|
||||
</div>
|
||||
<no-load-paging [type]="openaireEntities.PROJECTS"
|
||||
[page]="openaireSearchUtils.page" [pageSize]="resultsPerPage" (pageChange)="goTo($event.value, false)"
|
||||
[totalResults]="openaireSearchUtils.totalResults">
|
||||
</no-load-paging>
|
||||
<div class="uk-grid uk-child-width-1-1 uk-margin-medium-top uk-margin-bottom" uk-grid>
|
||||
<div *ngFor="let result of openaireProjects">
|
||||
<div *ngFor="let result of openaireProjects; let i = index">
|
||||
<div class="uk-card uk-card-default">
|
||||
<div class="uk-card-body">
|
||||
<result-preview [properties]="properties" [showOrganizations]="true"
|
||||
|
@ -99,6 +110,10 @@
|
|||
</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 class="uk-flex uk-flex-middle">
|
||||
<input [id]="result.id" class="uk-checkbox" type="checkbox" title="Select"
|
||||
value="{{selectedIndexes.indexOf(i) != -1}}" [ngModel]="selectedIndexes.indexOf(i)!=-1" (click)="toggleSelected(i)">
|
||||
</div>
|
||||
<div *ngIf="!result['isPart']">
|
||||
<div class="uk-padding-small uk-padding-remove-horizontal">
|
||||
<a (click)="addProject(result)" class="uk-button uk-button-link uk-flex uk-flex-middle">
|
||||
|
|
|
@ -12,7 +12,7 @@ import {ManageCommunityProjectsService} from '../../services/manageProjects.serv
|
|||
import {properties} from "../../../environments/environment";
|
||||
import {Subscriber} from "rxjs";
|
||||
import {UntypedFormBuilder, UntypedFormGroup} from "@angular/forms";
|
||||
import {debounceTime, distinctUntilChanged} from "rxjs/operators";
|
||||
import {debounceTime, distinctUntilChanged, skip} from "rxjs/operators";
|
||||
import {ResultPreview} from "../../openaireLibrary/utils/result-preview/result-preview";
|
||||
import {SearchInputComponent} from "../../openaireLibrary/sharedComponents/search-input/search-input.component";
|
||||
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
|
||||
|
@ -41,6 +41,7 @@ export class AddProjectsComponent implements OnInit {
|
|||
@Output() communityProjectsChanged = new EventEmitter();
|
||||
// @Input() communityProjects = [];
|
||||
public openaireProjects = [];
|
||||
public selectedIndexes = [];
|
||||
public queryParameters: string = "";
|
||||
|
||||
// public pagingLimit: number = properties.pagingLimit;
|
||||
|
@ -83,7 +84,7 @@ export class AddProjectsComponent implements OnInit {
|
|||
});
|
||||
|
||||
this.subscriptions.push(this.filterForm.get('keyword').valueChanges
|
||||
.pipe(debounceTime(1000), distinctUntilChanged())
|
||||
.pipe(debounceTime(1000), distinctUntilChanged(), skip(1))
|
||||
.subscribe(value => {
|
||||
this.keywordChanged(value);
|
||||
}));
|
||||
|
@ -123,7 +124,6 @@ export class AddProjectsComponent implements OnInit {
|
|||
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._clearCacheService.purgeBrowserCache(this.openaireEntities.PROJECT+" added", this.community.communityId);
|
||||
|
||||
UIkit.notification(this.openaireEntities.PROJECT+' successfully added!', {
|
||||
|
@ -283,6 +283,7 @@ export class AddProjectsComponent implements OnInit {
|
|||
goTo(page: number = 1, refineQuery: boolean = true) {
|
||||
this.openaireSearchUtils.page = page;
|
||||
this.openaireSearchUtils.status = this.errorCodes.LOADING;
|
||||
this.selectedIndexes = [];
|
||||
if(refineQuery) {
|
||||
this.openaireSearchUtils.refineStatus = this.errorCodes.LOADING;
|
||||
this.getFunders();
|
||||
|
@ -352,4 +353,47 @@ export class AddProjectsComponent implements OnInit {
|
|||
this.buildQueryParameters();
|
||||
this.goTo(1);
|
||||
}
|
||||
public toggleSelected(index){
|
||||
if (this.selectedIndexes.indexOf(index) != -1){
|
||||
this.selectedIndexes.splice(this.selectedIndexes.indexOf(index), 1);
|
||||
}else{
|
||||
this.selectedIndexes.push(index);
|
||||
}
|
||||
}
|
||||
public addAll(){
|
||||
let projectList = [];
|
||||
for(let index of this.selectedIndexes){
|
||||
projectList.push(this.openaireProjects[index]);
|
||||
}
|
||||
this.subscriptions.push(this._manageCommunityProjectsService.addProjectList(this.properties, this.community.communityId, projectList).subscribe(
|
||||
data => {
|
||||
// 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'
|
||||
});
|
||||
for(let index of this.selectedIndexes){
|
||||
this.openaireProjects[index]["isPart"] = true;
|
||||
|
||||
}
|
||||
this.selectedIndexes = [];
|
||||
this.communityProjectsChanged.emit({
|
||||
list: projectList,
|
||||
});
|
||||
},
|
||||
err => {
|
||||
this.handleError('An error has been occurred. Try again later!');
|
||||
console.error(err.status);
|
||||
}
|
||||
));
|
||||
}
|
||||
public selectAll(){
|
||||
if(this.selectedIndexes.length < this.openaireProjects.length) {
|
||||
this.selectedIndexes = Array.from(Array(this.openaireProjects.length).keys());
|
||||
}else{
|
||||
this.selectedIndexes = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,18 @@
|
|||
</div>
|
||||
</div>
|
||||
<div inner>
|
||||
|
||||
<div *ngIf="communitySearchUtils.totalResults > 0">
|
||||
<label>
|
||||
<input id="checkAll" type="checkbox" (click)="selectAll()" class="uk-checkbox" title="Select all"
|
||||
[ngModel]="selectedIndexes.length == previewCommunityProjects.length"/>
|
||||
</label>
|
||||
<button *ngIf="selectedIndexes.length > 0" class="uk-button uk-button-link uk-margin-xsmall-left" [class.uk-disabled]="selectedIndexes.length == 0"
|
||||
[disabled]="selectedIndexes.length == 0" (click)="promtToRemoveProjects()" >
|
||||
Remove ({{selectedIndexes.length}})
|
||||
</button>
|
||||
<hr class="uk-margin-remove-top">
|
||||
</div>
|
||||
<div class="uk-margin-top">
|
||||
<results-and-pages [type]="openaireEntiites.PROJECTS | lowercase" [page]="communitySearchUtils.page" [pageSize]="resultsPerPage"
|
||||
[totalResults]="communitySearchUtils.totalResults"></results-and-pages>
|
||||
|
@ -109,6 +121,10 @@
|
|||
</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 class="uk-flex uk-flex-middle">
|
||||
<input [id]="item.id" class="uk-checkbox" type="checkbox" title="Select"
|
||||
value="{{selectedIndexes.indexOf(i) != -1}}" [ngModel]="selectedIndexes.indexOf(i)!=-1" (click)="toggleSelected(i)">
|
||||
</div>
|
||||
<div>
|
||||
<div class="uk-padding-small uk-padding-remove-horizontal">
|
||||
<button class="uk-button uk-button-link uk-flex uk-flex-middle"
|
||||
|
|
|
@ -19,8 +19,9 @@ 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 {debounceTime, distinctUntilChanged, skip} from "rxjs/operators";
|
||||
import {IndexInfoService} from "../../openaireLibrary/utils/indexInfo.service";
|
||||
declare var UIkit;
|
||||
|
||||
@Component({
|
||||
selector: 'remove-projects',
|
||||
|
@ -65,6 +66,9 @@ export class RemoveProjectsComponent implements OnInit {
|
|||
|
||||
public openaireEntiites = OpenaireEntities;
|
||||
lastDBLoadDate = null;
|
||||
public selectedIndexes = [];
|
||||
openaireEntities = OpenaireEntities;
|
||||
|
||||
constructor(private route: ActivatedRoute, private _router: Router,
|
||||
private _fb: UntypedFormBuilder,
|
||||
private communityService: CommunityService,
|
||||
|
@ -87,13 +91,15 @@ export class RemoveProjectsComponent implements OnInit {
|
|||
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.pipe(debounceTime(500), distinctUntilChanged(), skip(1)).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.subscriptions.push(this.filterForm.get('sort').valueChanges.subscribe(value => {
|
||||
this.subscriptions.push(this.filterForm.get('sort').valueChanges.pipe(
|
||||
distinctUntilChanged(), skip(1)
|
||||
).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 );
|
||||
}));
|
||||
|
@ -129,21 +135,37 @@ export class RemoveProjectsComponent implements OnInit {
|
|||
}
|
||||
|
||||
public confirmedDeleteProject(data: any) {
|
||||
this.subscriptions.push(this._manageCommunityProjectsService.removeProject(this.properties, this.community.communityId, this.selectedCommunityProject.openaireId).subscribe(
|
||||
data => {
|
||||
this._clearCacheService.clearCacheInRoute(this.openaireEntiites.PROJECT+" removed", this.community.communityId);
|
||||
this._clearCacheService.purgeBrowserCache(this.openaireEntiites.PROJECT+" removed", this.community.communityId);
|
||||
NotificationHandler.rise(OpenaireEntities.PROJECT+' successfully removed!');
|
||||
this._getCommunityProjects(this.communitySearchUtils.page, this.keyword,null);
|
||||
if(this.selectedCommunityProject) {
|
||||
this.subscriptions.push(this._manageCommunityProjectsService.removeProject(this.properties, this.community.communityId, this.selectedCommunityProject.openaireId).subscribe(
|
||||
data => {
|
||||
this._clearCacheService.purgeBrowserCache(this.openaireEntiites.PROJECT + " removed", this.community.communityId);
|
||||
NotificationHandler.rise(OpenaireEntities.PROJECT + ' successfully removed!');
|
||||
this._getCommunityProjects(this.previewCommunityProjects.length == 1 && (this.communitySearchUtils.page - 1) >= 0 ? (this.communitySearchUtils.page -1 ): this.communitySearchUtils.page, this.keyword, null);
|
||||
|
||||
},
|
||||
err => {
|
||||
this.handleError('An error has been occurred. Try again later!');
|
||||
console.error(err);
|
||||
}
|
||||
));
|
||||
},
|
||||
err => {
|
||||
this.handleError('An error has been occurred. Try again later!');
|
||||
console.error(err);
|
||||
}
|
||||
));
|
||||
}else if(this.selectedIndexes.length > 0){
|
||||
this.removeAll();
|
||||
}
|
||||
}
|
||||
public promtToRemoveProjects() {
|
||||
this.selectedCommunityProject = null;
|
||||
this.alertModalDeleteCommunity.cancelButton = true;
|
||||
this.alertModalDeleteCommunity.okButton = true;
|
||||
this.alertModalDeleteCommunity.alertTitle = "Remove "+OpenaireEntities.PROJECTS;
|
||||
this.alertModalDeleteCommunity.message = "";
|
||||
let title = this.selectedIndexes.length + " " + OpenaireEntities.PROJECTS;
|
||||
if (title) {
|
||||
this.alertModalDeleteCommunity.message += " <b>" + title + "</b> ";
|
||||
}
|
||||
this.alertModalDeleteCommunity.message += " will be removed from your "+OpenaireEntities.COMMUNITY.toLowerCase()+". Are you sure?";
|
||||
this.alertModalDeleteCommunity.okButtonText = "Yes";
|
||||
this.alertModalDeleteCommunity.open();
|
||||
}
|
||||
|
||||
public removeProject(communityProject: any) {
|
||||
this.selectedCommunityProject = communityProject;
|
||||
this.alertModalDeleteCommunity.cancelButton = true;
|
||||
|
@ -177,6 +199,7 @@ export class RemoveProjectsComponent implements OnInit {
|
|||
this.communitySearchUtils.status = this.errorCodes.LOADING;
|
||||
this.communitySearchUtils.page = page;
|
||||
this.communitySearchUtils.keyword = keyword;
|
||||
this.communitySearchUtils.totalResults = 0;
|
||||
this.subscriptions.push(this._searchCommunityProjectsService.searchProjectsWithPaging(this.properties, this.community.communityId, this.communitySearchUtils.page, this.resultsPerPage, this.communitySearchUtils.keyword, funder, orderBy).subscribe(
|
||||
data => {
|
||||
this.previewCommunityProjects = data.content;
|
||||
|
@ -219,6 +242,7 @@ export class RemoveProjectsComponent implements OnInit {
|
|||
HelperFunctions.scroll();
|
||||
this.page = $event.value;
|
||||
this._getCommunityProjects(this.page, this.filterForm.get('keyword').value, null);
|
||||
this.selectedIndexes = [];
|
||||
}
|
||||
|
||||
addNew() {
|
||||
|
@ -259,5 +283,41 @@ export class RemoveProjectsComponent implements OnInit {
|
|||
return this.filterForm && this.filterForm.get('funder').value && this.filterForm.get('funder').value.id === value;
|
||||
}
|
||||
|
||||
|
||||
public selectAll(){
|
||||
if(this.selectedIndexes.length < this.previewCommunityProjects.length) {
|
||||
this.selectedIndexes = Array.from(Array(this.previewCommunityProjects.length).keys());
|
||||
}else{
|
||||
this.selectedIndexes = [];
|
||||
}
|
||||
}
|
||||
public toggleSelected(index){
|
||||
if (this.selectedIndexes.indexOf(index) != -1){
|
||||
this.selectedIndexes.splice(this.selectedIndexes.indexOf(index), 1);
|
||||
}else{
|
||||
this.selectedIndexes.push(index);
|
||||
}
|
||||
}
|
||||
public removeAll(){
|
||||
let projectList = [];
|
||||
for(let index of this.selectedIndexes){
|
||||
projectList.push(this.previewCommunityProjects[index].openaireId);
|
||||
}
|
||||
this.subscriptions.push(this._manageCommunityProjectsService.removeProjectList(this.properties, this.community.communityId, projectList).subscribe(
|
||||
data => {
|
||||
// this.communityProjects.push(data);
|
||||
this._clearCacheService.purgeBrowserCache(this.openaireEntities.PROJECT+" added", this.community.communityId);
|
||||
UIkit.notification(this.selectedIndexes.length + " " + this.openaireEntities.PROJECTS+' successfully removed!', {
|
||||
status: 'success',
|
||||
timeout: 6000,
|
||||
pos: 'bottom-right'
|
||||
});
|
||||
this._getCommunityProjects(projectList.length == this.previewCommunityProjects.length && (this.communitySearchUtils.page - 1) > 0 ? (this.communitySearchUtils.page -1 ): this.communitySearchUtils.page, this.keyword, null);
|
||||
this.selectedIndexes = [];
|
||||
},
|
||||
err => {
|
||||
this.handleError('An error has been occurred. Try again later!');
|
||||
console.error(err.status);
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {Component, OnInit, ElementRef} from '@angular/core';
|
||||
import {HelpContentService} from '../../services/help-content.service';
|
||||
import {HelpContentService} from '../../openaireLibrary/services/help-content.service';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties';
|
||||
import { Portal } from '../../domain/portal';
|
||||
|
@ -112,7 +112,7 @@ export class StatsComponent implements OnInit {
|
|||
if(!Session.isLoggedIn()){
|
||||
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} });
|
||||
} else {
|
||||
this.contentService.getCommunityAdminStatisticsChoices(this.properties.adminToolsAPIURL, this.communityId)
|
||||
this.contentService.getCommunityAdminStatisticsChoices(this.communityId)
|
||||
.subscribe(
|
||||
res => {
|
||||
this.statisticsDisplay = res;
|
||||
|
@ -202,7 +202,6 @@ export class StatsComponent implements OnInit {
|
|||
this.showAllInMonitor = !this.showAllInMonitor;
|
||||
|
||||
this.contentService.postCommunityAdminStatisticsChoices(
|
||||
this.properties.adminToolsAPIURL,
|
||||
this.communityId,
|
||||
entity,
|
||||
'charts',
|
||||
|
@ -220,7 +219,6 @@ export class StatsComponent implements OnInit {
|
|||
() => {
|
||||
|
||||
this.contentService.postCommunityAdminStatisticsChoices(
|
||||
this.properties.adminToolsAPIURL,
|
||||
this.communityId,
|
||||
entity,
|
||||
'charts',
|
||||
|
@ -238,7 +236,6 @@ export class StatsComponent implements OnInit {
|
|||
() => {
|
||||
|
||||
this.contentService.postCommunityAdminStatisticsChoices(
|
||||
this.properties.adminToolsAPIURL,
|
||||
this.communityId,
|
||||
entity,
|
||||
'charts',
|
||||
|
@ -321,7 +318,6 @@ export class StatsComponent implements OnInit {
|
|||
|
||||
//this.loadingMessage = 'Saving changes';
|
||||
this.contentService.postCommunityAdminStatisticsChoices(
|
||||
this.properties.adminToolsAPIURL,
|
||||
this.communityId,
|
||||
entity,
|
||||
'charts',
|
||||
|
@ -338,7 +334,6 @@ export class StatsComponent implements OnInit {
|
|||
() => {
|
||||
|
||||
this.contentService.postCommunityAdminStatisticsChoices(
|
||||
this.properties.adminToolsAPIURL,
|
||||
this.communityId,
|
||||
entity,
|
||||
'charts',
|
||||
|
@ -355,7 +350,6 @@ export class StatsComponent implements OnInit {
|
|||
() => {
|
||||
|
||||
this.contentService.postCommunityAdminStatisticsChoices(
|
||||
this.properties.adminToolsAPIURL,
|
||||
this.communityId,
|
||||
entity,
|
||||
'charts',
|
||||
|
@ -388,7 +382,7 @@ export class StatsComponent implements OnInit {
|
|||
}
|
||||
|
||||
toggleShowGraphAnalysisView() {
|
||||
this.contentService.statisticsIsActiveToggle(this.properties.adminToolsAPIURL, this.statisticsDisplay._id).subscribe(status => {
|
||||
this.contentService.statisticsIsActiveToggle(this.statisticsDisplay._id).subscribe(status => {
|
||||
this.statisticsDisplay.isActive = status;
|
||||
});
|
||||
}
|
||||
|
@ -400,7 +394,6 @@ export class StatsComponent implements OnInit {
|
|||
this.updateErrorMessage = "";
|
||||
|
||||
this.contentService.postCommunityAdminStatisticsChoices(
|
||||
this.properties.adminToolsAPIURL,
|
||||
this.communityId,
|
||||
entity,
|
||||
chartsOrNumbers,
|
||||
|
@ -423,7 +416,6 @@ export class StatsComponent implements OnInit {
|
|||
this.updateErrorMessage = "";
|
||||
|
||||
this.contentService.postCommunityAdminStatisticsChoices(
|
||||
this.properties.adminToolsAPIURL,
|
||||
this.communityId,
|
||||
entity,
|
||||
chartsOrNumbers,
|
||||
|
|
|
@ -295,34 +295,13 @@ export class SubjectsEditFormComponent implements OnInit {
|
|||
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.subscriptions.push(this._subjectsService.updateSubjects(this.communityId ,this.displayedSubjects, selectedFos, selectedSdg).subscribe(res => {
|
||||
this.community.subjects = this.displayedSubjects;
|
||||
this.community.fos = selectedFos;
|
||||
this.community.sdg = selectedSdg
|
||||
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) {
|
||||
|
@ -334,17 +313,7 @@ export class SubjectsEditFormComponent implements OnInit {
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import {HttpClient, HttpHeaders} from "@angular/common/http";
|
||||
import {map} from "rxjs/operators";
|
||||
import {properties} from "../../../environments/environment";
|
||||
|
||||
@Injectable()
|
||||
export class SubjectsService {
|
||||
|
@ -9,34 +10,10 @@ export class SubjectsService {
|
|||
|
||||
}
|
||||
|
||||
addSubjects(url: string, subjects: any) {
|
||||
updateSubjects(communityId: string, subjects: any, fos, sdgs) {
|
||||
let headers = new HttpHeaders({'Content-Type': 'application/json'});
|
||||
|
||||
const body = JSON.stringify(subjects);
|
||||
|
||||
return this.http.post(url, body, {headers: headers})
|
||||
// .do(request => console.log("Insert Response:"+request.status))
|
||||
//.map(res => res.json())
|
||||
.pipe(map(res => {
|
||||
res['method'] = 'post';
|
||||
return res;
|
||||
}));
|
||||
const body = JSON.stringify({subjects: subjects, fos: fos, sdg: sdgs});
|
||||
return this.http.post(properties.communityAPI + communityId , body, {headers: headers});
|
||||
}
|
||||
|
||||
removeSubjects(url: string, subjects: any) {
|
||||
//const headers = new Headers({'Content-Type': 'application/json'});
|
||||
let headers = new HttpHeaders({'Content-Type': 'application/json'});
|
||||
|
||||
const body = JSON.stringify(subjects);
|
||||
//const options = new RequestOptions({headers: headers, body: body});
|
||||
|
||||
//return this.http.delete(url, options)
|
||||
return this.http.request('delete', url, { body: body, headers: headers})
|
||||
// .do(request => console.log("Delete Response:"+request.status))
|
||||
//.map(res => res.json())
|
||||
.pipe(map(res => {
|
||||
res['method'] = 'delete';
|
||||
return res;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import {EnvProperties} from "../../../openaireLibrary/utils/properties/env-prope
|
|||
import {properties} from "../../../../environments/environment";
|
||||
import {User} from "../../../openaireLibrary/login/utils/helper.class";
|
||||
import {Affiliation, Curator} from "../../../openaireLibrary/utils/entities/CuratorInfo";
|
||||
import {HelpContentService} from "../../../services/help-content.service";
|
||||
import {HelpContentService} from "../../../openaireLibrary/services/help-content.service";
|
||||
import {Page} from "../../../domain/page";
|
||||
import {CommunityService} from "../../../openaireLibrary/connect/community/community.service";
|
||||
import {StringUtils} from "../../../openaireLibrary/utils/string-utils.class";
|
||||
|
@ -223,7 +223,7 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
|
|||
if (this.user) {
|
||||
this.title.setTitle(community.shortTitle.toUpperCase() + " | Personal Info");
|
||||
this.loading = true;
|
||||
this.subs.push(this.curatorService.getCurator(properties).subscribe(curator => {
|
||||
this.subs.push(this.curatorService.getCurator().subscribe(curator => {
|
||||
this.initCurator(curator);
|
||||
this.reset();
|
||||
this.loading = false;
|
||||
|
@ -307,7 +307,7 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
saveCurator() {
|
||||
this.curatorService.updateCurator(this.properties, this.curatorFb.value).subscribe((curator) => {
|
||||
this.curatorService.updateCurator(this.curatorFb.value).subscribe((curator) => {
|
||||
if (curator) {
|
||||
this._clearCacheService.purgeBrowserCache("Curator added/ updated", this.community.communityId);
|
||||
UIkit.notification('Your data has been <b>saved successfully</b>', {
|
||||
|
@ -357,7 +357,7 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
private curatorsPageStatus() {
|
||||
this.helpContentService.getCommunityPagesByRoute(this.community.communityId, '/curators', this.properties.adminToolsAPIURL).subscribe((page) => {
|
||||
this.helpContentService.getCommunityPagesByRoute(this.community.communityId, '/curators').subscribe((page) => {
|
||||
this.curatorsPage = page;
|
||||
});
|
||||
}
|
||||
|
@ -480,7 +480,7 @@ export class PersonalInfoComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
enableCurators() {
|
||||
this.helpContentService.togglePages(this.community.communityId, [this.curatorsPage._id], true, this.properties.adminToolsAPIURL).subscribe(() => {
|
||||
this.helpContentService.togglePages(this.community.communityId, [this.curatorsPage._id], true).subscribe(() => {
|
||||
this.curatorsPage.isEnabled = true;
|
||||
this._clearCacheService.purgeBrowserCache("Curators page enabled", this.community.communityId);
|
||||
UIkit.notification('Curators Page has been <b>enabled successfully</b>', {
|
||||
|
|
|
@ -464,7 +464,7 @@ export class HelpContentService {
|
|||
}
|
||||
|
||||
statisticsIsActiveToggle(apiURL: string, id: string): Observable<boolean> {
|
||||
const url = apiURL + '/statistics/' + encodeURIComponent(id) + '/toggle';
|
||||
const url = apiURL + 'statistics/' + encodeURIComponent(id) + '/toggle';
|
||||
return this.http.post<boolean>(url, {}, CustomOptions.getAuthOptionsWithBody()).pipe(catchError(this.handleError));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,30 +16,29 @@ export class ManageCommunityProjectsService {
|
|||
//return this.http.delete(url, options)
|
||||
return this.http.request('delete', url, { headers: headers})
|
||||
}
|
||||
|
||||
addProject(properties:EnvProperties, pid: string, project: any) {
|
||||
//let headers = new Headers({'Content-Type': 'application/json'});
|
||||
//let options = new RequestOptions({headers: headers});
|
||||
|
||||
removeProjectList(properties:EnvProperties, pid: string, projects: any[]) {
|
||||
let headers = new HttpHeaders({'Content-Type': 'application/json'});
|
||||
let url = properties.communityAPI+pid+"/projectList";
|
||||
|
||||
return this.http.delete<any>(url, { headers: headers, body: JSON.stringify(projects)});
|
||||
}
|
||||
addProject(properties:EnvProperties, pid: string, project: any) {
|
||||
let headers = new HttpHeaders({'Content-Type': 'application/json'});
|
||||
let url = properties.communityAPI+pid+"/projects";
|
||||
|
||||
let communityProject = this.convertSearchProjectToCommunityProject(project, pid);
|
||||
let testProject: any = {
|
||||
"acronym": "test",
|
||||
"communityId": "egi",
|
||||
"funder": "test",
|
||||
"grantId": "test",
|
||||
"name": "test",
|
||||
"openaireId": "test"
|
||||
};
|
||||
|
||||
return this.http.post<any>(url, JSON.stringify(communityProject), {headers: headers});
|
||||
//return this.http.post(url, JSON.stringify(communityProject), options)
|
||||
//.map(res => <any> res.json())
|
||||
let communityProject = this.convertSearchProjectToCommunityProject(project, pid);
|
||||
return this.http.post<any>(url, JSON.stringify(communityProject), {headers: headers});
|
||||
}
|
||||
|
||||
addProjectList(properties:EnvProperties, pid: string, projects: any[]) {
|
||||
let headers = new HttpHeaders({'Content-Type': 'application/json'});
|
||||
let url = properties.communityAPI+pid+"/projectList";
|
||||
let communityProjects = [];
|
||||
for(let project of projects) {
|
||||
communityProjects.push(this.convertSearchProjectToCommunityProject(project, pid));
|
||||
}
|
||||
return this.http.post<any>(url, JSON.stringify(communityProjects), {headers: headers});
|
||||
}
|
||||
|
||||
convertSearchProjectToCommunityProject(project: any, community: string) : any {
|
||||
let communityProject = {
|
||||
"acronym": "",
|
||||
|
|
|
@ -8,7 +8,7 @@ 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 {HelpContentService} from "../openaireLibrary/services/help-content.service";
|
||||
import {ClearCacheService} from "../openaireLibrary/services/clear-cache.service";
|
||||
import {Subscription} from "rxjs";
|
||||
import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
|
||||
|
@ -74,7 +74,7 @@ export class ValidateEnabledPageComponent implements OnInit, OnDestroy {
|
|||
|
||||
|
||||
private getPageStatus() {
|
||||
this.helpContentService.getCommunityPagesByRoute(this.community.communityId, this.pageRoute, this.properties.adminToolsAPIURL).subscribe((page) => {
|
||||
this.helpContentService.getCommunityPagesByRoute(this.community.communityId, this.pageRoute).subscribe((page) => {
|
||||
this.page = page;
|
||||
})
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ export class ValidateEnabledPageComponent implements OnInit, OnDestroy {
|
|||
|
||||
enablePage() {
|
||||
this.loading = true;
|
||||
this.helpContentService.togglePages(this.community.communityId, [this.page._id], true, this.properties.adminToolsAPIURL).subscribe(() => {
|
||||
this.helpContentService.togglePages(this.community.communityId, [this.page._id], true).subscribe(() => {
|
||||
this.page.isEnabled = true;
|
||||
this._clearCacheService.purgeBrowserCache("Page enabled", this.community.communityId);
|
||||
NotificationHandler.rise(this.page.name + ' has been <b>enabled successfully</b>');
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit ee22e97b114be823b7ab4e6c41a9cbff93b24e3a
|
||||
Subproject commit 038684a0dca02700164e467abd390bbd865df3d9
|
|
@ -1 +1 @@
|
|||
Subproject commit 52eca9abe84c941a7e78a5690f273d8c8e3194f9
|
||||
Subproject commit c6d21a6c027df56ae3bbf5c489b2ee9893924aef
|
Loading…
Reference in New Issue