+ [userMenuItems]=userMenuItems [menuItems]="menuItems" [user]="user">
-
+
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 104215e..74d22ca 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -32,7 +32,7 @@ export class AppComponent implements OnInit {
hasAdminMenu: boolean = false;
isFrontPage: boolean = false;
sideBarItems: MenuItem[] = [];
- specialSideBarMenuItem: MenuItem = null;
+ backItem: MenuItem = null;
menuItems: MenuItem[] = [];
menuHeader: Header = {
route: "/",
@@ -179,6 +179,10 @@ export class AppComponent implements OnInit {
return this.layoutService.open;
}
+ public get hover() {
+ return this.layoutService.hover;
+ }
+
private buildMenu() {
this.userMenuItems = [];
this.sideBarItems = [];
@@ -211,14 +215,26 @@ export class AppComponent implements OnInit {
position: 'left',
badge: true
};
- this.sideBarItems.push(new MenuItem("community", "Community Info", "", "/" + this.community.communityId, false, [], [], {}, {name: 'badge'}, null, null, "/" + this.community.communityId + "/info"));
+ let communityInfo = new MenuItem("community", "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")
+ ]
+ 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"))
+ }
+ this.sideBarItems.push(communityInfo);
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'}));
if (this.community.type === 'ri') {
this.sideBarItems.push(new MenuItem("mining", "Mining", "", "/" + this.community.communityId + "/mining/manage-profiles", false, [], [], {}, {svg: mining.data}, null, null, "/" + this.community.communityId + "/mining"));
}
- this.specialSideBarMenuItem = new MenuItem("back", "Manage communities", "", "/", false, [], null, {}, {name: 'search', class: 'uk-text-secondary'});
+ this.backItem = new MenuItem("back", "Manage Communities", "", "/", false, [], null, {}, {name: 'west'});
this.menuItems = [];
this.menuItems.push(new MenuItem("home", "Home",
@@ -306,7 +322,7 @@ export class AppComponent implements OnInit {
this.sideBarItems.push(new MenuItem("connect", "Connect Options", "", "/connect/admin-tools/pages", false, [], [], {}, {name: 'settings'}, null, null, '/connect/admin-tools'));
this.sideBarItems.push(new MenuItem("explore", "Explore Options", "", "/openaire/admin-tools/pages", false, [], [], {}, {name: 'settings'}, null, null, '/openaire/admin-tools'));
}
- this.specialSideBarMenuItem = null;
+ this.backItem = null;
}
this.hasSidebar = this.hasSidebar && this.sideBarItems.length > 1;
}
diff --git a/src/app/openaireLibrary b/src/app/openaireLibrary
index faa57d9..d410335 160000
--- a/src/app/openaireLibrary
+++ b/src/app/openaireLibrary
@@ -1 +1 @@
-Subproject commit faa57d99d193f6904c6a57363718d3269c843c13
+Subproject commit d4103354aa0254475df4aa29382999bc2f25bf29
diff --git a/src/app/pages/advanced-criteria/advanced-criteria.component.ts b/src/app/pages/advanced-criteria/advanced-criteria.component.ts
new file mode 100644
index 0000000..1294a59
--- /dev/null
+++ b/src/app/pages/advanced-criteria/advanced-criteria.component.ts
@@ -0,0 +1,120 @@
+import {ChangeDetectorRef, Component, OnDestroy, OnInit, ViewChild} from "@angular/core";
+import {CommunityService} from "../../openaireLibrary/connect/community/community.service";
+import {AdvancedCriteriaService} from "./advanced-criteria.service";
+import {Subscription} from "rxjs";
+import {SelectionCriteria} from "../../openaireLibrary/utils/entities/contentProvider";
+import {
+ FullScreenModalComponent
+} from "../../openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.component";
+import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler";
+import {CriteriaComponent} from "../content-providers/criteria/criteria.component";
+import {CriteriaUtils} from "../content-providers/criteria-utils";
+import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
+
+@Component({
+ selector: 'advanced-criteria',
+ template: `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
0" class="uk-margin-small-bottom">
+
Criteria
+
+
+
+
No criteria yet
+
+ Add multiple constraints in AND to define a criterion: results that satisfy at least one of the criteria will be included in your community.
+
+
+
+
+
+
+
+
+
+
No Criteria yet
+
+ Add multiple constraints in AND to define a criterion: results that satisfy at least one of the criteria will be included in your community.
+
+
+
+
+
+ `
+})
+export class AdvancedCriteriaComponent implements OnInit, OnDestroy {
+ public loading = true;
+ public selectionCriteria: SelectionCriteria;
+ public community: CommunityInfo;
+ public criteriaUtils: CriteriaUtils = new CriteriaUtils();
+ private subscriptions: any[] = [];
+ @ViewChild('criteria') criteria: CriteriaComponent;
+ @ViewChild('filtersModal', { static: true }) filtersModal: FullScreenModalComponent;
+
+ constructor(private communityService: CommunityService,
+ private cdr: ChangeDetectorRef,
+ private advancedCriteriaService: AdvancedCriteriaService) {}
+
+ ngOnInit() {
+ this.loading = true;
+ this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(community => {
+ this.community = community;
+ this.selectionCriteria = community.selectionCriteria;
+ this.loading = false;
+ }));
+ }
+
+ saveCriteria() {
+ let callback = (selectionCriteria): void => {
+ this.advancedCriteriaService.saveAdvancedCriteria(this.community.communityId, selectionCriteria).subscribe(() => {
+ this.criteria.reset();
+ this.criteria.loading = false;
+ NotificationHandler.rise('Filters have been
successfully updated');
+ }, error => {
+ this.criteria.loading = false;
+ this.criteria.handeError('An error has been occurred. Try again later!', error);
+ });
+ }
+ this.loading = true;
+ this.criteria.save(callback);
+ }
+
+ public openCriteria() {
+ this.criteria.reset();
+ this.filtersModal.title = 'Criteria';
+ this.filtersModal.okButtonText = "Save";
+ this.filtersModal.back = true;
+ this.filtersModal.okButton = true;
+ this.filtersModal.open();
+ this.cdr.detectChanges();
+ }
+
+ ngOnDestroy() {
+ this.subscriptions.forEach(subscription => {
+ if(subscription instanceof Subscription) {
+ subscription.unsubscribe();
+ }
+ })
+ }
+}
diff --git a/src/app/pages/advanced-criteria/advanced-criteria.module.ts b/src/app/pages/advanced-criteria/advanced-criteria.module.ts
new file mode 100644
index 0000000..1645825
--- /dev/null
+++ b/src/app/pages/advanced-criteria/advanced-criteria.module.ts
@@ -0,0 +1,18 @@
+import {NgModule} from "@angular/core";
+import {CommonModule} from "@angular/common";
+import {RouterModule} from "@angular/router";
+import {AdvancedCriteriaComponent} from "./advanced-criteria.component";
+import {PageContentModule} from "../../openaireLibrary/dashboard/sharedComponents/page-content/page-content.module";
+import {FullScreenModalModule} from "../../openaireLibrary/utils/modal/full-screen-modal/full-screen-modal.module";
+import {CriteriaModule} from "../content-providers/criteria/criteria.module";
+import {IconsModule} from "../../openaireLibrary/utils/icons/icons.module";
+import {LoadingModule} from "../../openaireLibrary/utils/loading/loading.module";
+
+@NgModule({
+ imports: [CommonModule, RouterModule.forChild([
+ {path: '', component: AdvancedCriteriaComponent,}
+ ]), PageContentModule, FullScreenModalModule, CriteriaModule, IconsModule, LoadingModule],
+ declarations: [AdvancedCriteriaComponent],
+ exports: [AdvancedCriteriaComponent]
+})
+export class AdvancedCriteriaModule {}
diff --git a/src/app/pages/advanced-criteria/advanced-criteria.service.ts b/src/app/pages/advanced-criteria/advanced-criteria.service.ts
new file mode 100644
index 0000000..703bd80
--- /dev/null
+++ b/src/app/pages/advanced-criteria/advanced-criteria.service.ts
@@ -0,0 +1,25 @@
+import {Injectable} from "@angular/core";
+import {SelectionCriteria} from "../../openaireLibrary/utils/entities/contentProvider";
+import {Observable} from "rxjs";
+import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
+import {HttpClient} from "@angular/common/http";
+import {properties} from "../../../environments/environment";
+import {map} from "rxjs/operators";
+import {CommunityService} from "../../openaireLibrary/connect/community/community.service";
+
+@Injectable({
+ providedIn: 'root'
+})
+export class AdvancedCriteriaService {
+
+ constructor(private httpClient: HttpClient,
+ private communityService: CommunityService) {
+ }
+
+ public saveAdvancedCriteria(communityId, selectionCriteria: SelectionCriteria): Observable
{
+ return this.httpClient.post(properties.communityAPI + communityId + '/advancedConstraint', selectionCriteria).pipe(map(community => {
+ this.communityService.updateAdvancedCriteria(this.communityService.parseCommunity(community).selectionCriteria);
+ }));
+ }
+
+}
diff --git a/src/app/pages/affiliations/affiliations.component.html b/src/app/pages/affiliations/affiliations.component.html
index 5144275..ccfdef9 100644
--- a/src/app/pages/affiliations/affiliations.component.html
+++ b/src/app/pages/affiliations/affiliations.component.html
@@ -1,16 +1,6 @@
-
-
-
-
Admin Dashboard - Manage Organizations
-
-
{{community.shortTitle}}
-
-
-
-
-
+