diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index 8c59105..60d8126 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -8,9 +8,10 @@ import {StakeholderService} from "./openaireLibrary/monitor/services/stakeholder
import {BehaviorSubject, Subscriber} from "rxjs";
import {LayoutService} from "./openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
import {MenuItem, RootMenuItem} from "./openaireLibrary/sharedComponents/menu";
-import {Stakeholder, Topic} from "./openaireLibrary/monitor/entities/stakeholder";
+import {Stakeholder, Topic, Visibility} from "./openaireLibrary/monitor/entities/stakeholder";
import {LinksResolver} from "./search/links-resolver";
import {Header} from "./openaireLibrary/sharedComponents/navigationBar.component";
+import {arrow_left} from "./openaireLibrary/utils/icons/icons";
@Component({
@@ -107,9 +108,9 @@ export class AppComponent implements OnInit, OnDestroy {
if (isSearch) {
this.activeTopic = null;
} else if (params && params['topic'] && !this.activeTopic) {
- this.activeTopic = this.stakeholder.topics.find(topic => topic.alias === decodeURIComponent(params['topic']) && this.isPublicOrIsMember(topic.isPublic) && topic.isActive);
+ this.activeTopic = this.stakeholder.topics.find(topic => topic.alias === decodeURIComponent(params['topic']) && this.isPublicOrIsMember(topic.visibility));
} else {
- this.activeTopic = this.stakeholder.topics.find(topic => this.isPublicOrIsMember(topic.isPublic) && topic.isActive);
+ this.activeTopic = this.stakeholder.topics.find(topic => this.isPublicOrIsMember(topic.visibility));
}
this.setSideBar();
} else {
@@ -129,9 +130,9 @@ export class AppComponent implements OnInit, OnDestroy {
if(isSearch) {
this.activeTopic = null;
} else if (params && params['topic']) {
- this.activeTopic = this.stakeholder.topics.find(topic => topic.alias === decodeURIComponent(params['topic']) && this.isPublicOrIsMember(topic.isPublic) && topic.isActive);
+ this.activeTopic = this.stakeholder.topics.find(topic => topic.alias === decodeURIComponent(params['topic']) && this.isPublicOrIsMember(topic.visibility));
} else {
- this.activeTopic = this.stakeholder.topics.find(topic => this.isPublicOrIsMember(topic.isPublic) && topic.isActive);
+ this.activeTopic = this.stakeholder.topics.find(topic => this.isPublicOrIsMember(topic.visibility));
}
}
@@ -145,7 +146,9 @@ export class AppComponent implements OnInit, OnDestroy {
}));
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
this.user = user;
- this.buildMenu();
+ if(user){
+ this.buildMenu();
+ }
}, error => {
console.log("App couldn't fetch properties");
console.log(error);
@@ -177,7 +180,7 @@ export class AppComponent implements OnInit, OnDestroy {
private setSideBar() {
let items: MenuItem[] = [];
this.stakeholder.topics.forEach((topic) => {
- if (this.isPublicOrIsMember(topic.isPublic) && topic.isActive) {
+ if (this.isPublicOrIsMember(topic.visibility)) {
let topicItem: MenuItem = new MenuItem(topic.alias, topic.name, "", (
'/' + this.stakeholder.alias + '/' + topic.alias),
null, [], [], {});
@@ -234,7 +237,7 @@ export class AppComponent implements OnInit, OnDestroy {
this.adminMenuItems.push(new MenuItem("indicators", "Indicators", "", "/admin/"+this.stakeholder.alias + '/indicators', false, [], [], {}, ""));
this.adminMenuItems.push(new MenuItem("users", "Users", "", "/admin/"+this.stakeholder.alias+"/users", false, [], [], {}, ""));
this.specialSideBarMenuItem = new MenuItem("back", "Manage profiles", "", "/admin",false, [], null, {});
- this.specialSideBarMenuItem.icon = '';
+ this.specialSideBarMenuItem.icon = '' + arrow_left.data + ''; // '';
}
this.userMenuItems = [];
@@ -246,7 +249,6 @@ export class AppComponent implements OnInit, OnDestroy {
if (this.isAdmin()) {
this.userMenuItems.push(new MenuItem("", "Manage profiles",
"", "/admin", true, [], [], {}))
- this.specialSideBarMenuItem = null;
}
if (this.user) {
this.userMenuItems.push(new MenuItem("", "User information", "", "/user-info", false, [], [], {}));
@@ -282,14 +284,17 @@ export class AppComponent implements OnInit, OnDestroy {
public isAdmin() {
return this.user && (Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user) || Session.isMonitorCurator(this.user));
}
-
- public isPublicOrIsMember(isPublic: boolean): boolean {
- if (isPublic) {
+
+ public isPublicOrIsMember(visibility: Visibility): boolean {
+ if(visibility == "PRIVATE"){
+ return false;
+ }
+ if (visibility == "PUBLIC") {
return true;
} else {
if (this.isViewPublic) { // preview for not members
return false;
- } else if (this.isAdmin()) {
+ } else if(this.isAdmin()) {
// if user is member, return true
return true;
}
diff --git a/src/app/manageStakeholders/manageStakeholders.component.html b/src/app/manageStakeholders/manageStakeholders.component.html
index 7e61bbd..a3b3ef9 100644
--- a/src/app/manageStakeholders/manageStakeholders.component.html
+++ b/src/app/manageStakeholders/manageStakeholders.component.html
@@ -2,15 +2,10 @@
-
+ type="select" [options]="[all].concat(stakeholderUtils.visibility)"
+ label="Visibility">
@@ -18,189 +13,110 @@
search
-
-
- Default Profiles
- Default Profiles
+
Profiles
-
-
-
-
-
-
-
-
{{stakeholderUtils.isPublicIcon.get(stakeholder.isPublic)}}
-
{{(stakeholder.isPublic) ? 'Public' : 'Private'}}
-
-
-
{{stakeholderUtils.isActiveIcon}}
-
{{(stakeholder.isActive) ? 'Active' : 'Inactive'}}
-
-
-
-
-
+
+
+
+
+
{
- this.onPrivacyChange(value);
- }));
this.subscriptions.push(this.filters.get('status').valueChanges.subscribe(value => {
+ console.debug(value);
this.onStatusChange(value);
}));
this.subscriptions.push(this.filters.get('keyword').valueChanges.subscribe(value => {
this.onKeywordChange(value);
}));
}
-
- onPrivacyChange(value) {
- this.displayDefaultStakeholders = this.filterPrivacy(this.defaultStakeholders, value);
- this.displayStakeholders = this.filterPrivacy(this.stakeholders, value);
- }
-
+
onStatusChange(value) {
this.displayDefaultStakeholders = this.filterStatus(this.defaultStakeholders, value);
this.displayStakeholders = this.filterStatus(this.stakeholders, value);
@@ -136,21 +124,12 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
this.displayDefaultStakeholders = this.filterByKeyword(this.defaultStakeholders, value);
this.displayStakeholders = this.filterByKeyword(this.stakeholders, value);
}
-
-
- private filterPrivacy(stakeholders: Stakeholder[], value): Stakeholder[] {
- if (value === 'all') {
- return stakeholders;
- } else {
- return stakeholders.filter(stakeholder => stakeholder.isPublic === value);
- }
- }
-
+
private filterStatus(stakeholders: Stakeholder[], value): Stakeholder[] {
if (value === 'all') {
return stakeholders;
} else {
- return stakeholders.filter(stakeholder => stakeholder.isActive === value);
+ return stakeholders.filter(stakeholder => stakeholder.visibility == value);
}
}
@@ -227,7 +206,14 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
}
});
}
-
+ changeStakeholderStatus(stakeholder: Stakeholder, visibility:Visibility) {
+ let path = [
+ stakeholder._id
+ ];
+ this.stakeholderService.toggleStatus(this.properties.monitorServiceAPIURL, path).subscribe(isActive => {
+ stakeholder.isActive = isActive;
+ });
+ }
toggleStakeholderStatus(stakeholder: Stakeholder) {
let path = [
stakeholder._id
diff --git a/src/app/manageStakeholders/manageStakeholders.module.ts b/src/app/manageStakeholders/manageStakeholders.module.ts
index fc8fe72..d8a816a 100644
--- a/src/app/manageStakeholders/manageStakeholders.module.ts
+++ b/src/app/manageStakeholders/manageStakeholders.module.ts
@@ -10,6 +10,9 @@ import {AlertModalModule} from "../openaireLibrary/utils/modal/alertModal.module
import {ReactiveFormsModule} from "@angular/forms";
import {AdminDashboardGuard} from "../utils/adminDashboard.guard";
import {EditStakeholderModule} from "../general/edit-stakeholder/edit-stakeholder.module";
+import {IconsModule} from "../openaireLibrary/utils/icons/icons.module";
+import {IconsService} from "../openaireLibrary/utils/icons/icons.service";
+import {bullet} from "../openaireLibrary/utils/icons/icons";
@NgModule({
declarations: [ManageStakeholdersComponent],
@@ -21,7 +24,8 @@ import {EditStakeholderModule} from "../general/edit-stakeholder/edit-stakeholde
LoadingModule,
AlertModalModule,
ReactiveFormsModule,
- EditStakeholderModule
+ EditStakeholderModule,
+ IconsModule
],
providers: [
AdminDashboardGuard, PreviousRouteRecorder,
@@ -29,5 +33,7 @@ import {EditStakeholderModule} from "../general/edit-stakeholder/edit-stakeholde
exports: [ManageStakeholdersComponent]
})
export class ManageStakeholdersModule {
-
+ constructor(private iconsService: IconsService) {
+ this.iconsService.registerIcons([ bullet]);
+ }
}
diff --git a/src/app/monitor/monitor.component.html b/src/app/monitor/monitor.component.html
index 9d97080..0c9f83f 100644
--- a/src/app/monitor/monitor.component.html
+++ b/src/app/monitor/monitor.component.html
@@ -48,7 +48,9 @@
1"
class="categoriesTabs uk-tab ">
- -
+
-
{{category.name}}
@@ -60,7 +62,7 @@
1"
class="uk-subnav uk-subnav-pill subCategoriesTabs ">
- -
1?40:0)+(activeTopic &&
activeTopic.categories.length > 1?20:0)+(countSelectedFilters()
> 0?40:0))">
-
+
@@ -129,7 +131,7 @@
{{number.title}}
-
@@ -160,7 +162,7 @@
0" class="uk-width-1-1 uk-margin-top">{{chart.title}}
diff --git a/src/app/monitor/monitor.component.ts b/src/app/monitor/monitor.component.ts
index d3008a3..966a4eb 100644
--- a/src/app/monitor/monitor.component.ts
+++ b/src/app/monitor/monitor.component.ts
@@ -10,7 +10,14 @@ import {ErrorMessagesComponent} from '../openaireLibrary/utils/errorMessages.com
import {HelperService} from "../openaireLibrary/utils/helper/helper.service";
import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
import {StakeholderService} from "../openaireLibrary/monitor/services/stakeholder.service";
-import {Category, IndicatorPath, Stakeholder, SubCategory, Topic} from "../openaireLibrary/monitor/entities/stakeholder";
+import {
+ Category,
+ IndicatorPath,
+ Stakeholder,
+ SubCategory,
+ Topic,
+ Visibility
+} from "../openaireLibrary/monitor/entities/stakeholder";
import {StatisticsService} from "../utils/services/statistics.service";
import {IndicatorUtils, StakeholderUtils} from "../utils/indicator-utils";
import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
@@ -123,7 +130,7 @@ export class MonitorComponent implements OnInit, OnDestroy {
,filterOperator: "or", valueIsExact: true, filterType: "checkbox", radioValue:""});
}
this.initializeFilters();
- if(stakeholder.isActive && (stakeholder.isPublic || this.isPublicOrIsMember(stakeholder.isPublic))) {
+ if(this.isPublicOrIsMember(stakeholder.visibility)) {
this.seoService.createLinkForCanonicalURL(url, false);
this._meta.updateTag({content: url}, "property='og:url'");
var description = "Monitor Dashboard | " + this.stakeholder.name;
@@ -253,20 +260,20 @@ export class MonitorComponent implements OnInit, OnDestroy {
private setView(params: Params) {
this.loading = false;
if (params['topic']) {
- this.activeTopic = this.stakeholder.topics.find(topic => topic.alias === decodeURIComponent(params['topic']) && this.isPublicOrIsMember(topic.isPublic) && topic.isActive);
+ this.activeTopic = this.stakeholder.topics.find(topic => topic.alias === decodeURIComponent(params['topic']) && this.isPublicOrIsMember(topic.visibility));
if (this.activeTopic) {
if (params['category']) {
this.activeCategory = this.activeTopic.categories.find(category =>
- (category.alias === params['category']) && this.isPublicOrIsMember(category.isPublic) && category.isActive);
+ (category.alias === params['category']) && this.isPublicOrIsMember(category.visibility));
if (!this.activeCategory) {
this.navigateToError();
return;
}
} else {
- this.activeCategory = this.activeTopic.categories.find(category => this.isPublicOrIsMember(category.isPublic) && category.isActive);
+ this.activeCategory = this.activeTopic.categories.find(category => this.isPublicOrIsMember(category.visibility));
if (this.activeCategory) {
this.activeSubCategory = this.activeCategory.subCategories.find(subCategory =>
- this.isPublicOrIsMember(subCategory.isPublic) && subCategory.isActive);
+ this.isPublicOrIsMember(subCategory.visibility));
if (this.activeSubCategory) {
this.setIndicators();
}
@@ -276,14 +283,14 @@ export class MonitorComponent implements OnInit, OnDestroy {
if (this.activeCategory) {
if (params['subCategory']) {
this.activeSubCategory = this.activeCategory.subCategories.find(subCategory =>
- (subCategory.alias === params['subCategory'] && this.isPublicOrIsMember(subCategory.isPublic) && subCategory.isActive));
+ (subCategory.alias === params['subCategory'] && this.isPublicOrIsMember(subCategory.visibility)));
if (!this.activeSubCategory) {
this.navigateToError();
return;
}
} else {
this.activeSubCategory = this.activeCategory.subCategories.find(subCategory =>
- this.isPublicOrIsMember(subCategory.isPublic) && subCategory.isActive);
+ this.isPublicOrIsMember(subCategory.visibility));
}
if (this.activeSubCategory) {
this.setIndicators();
@@ -299,11 +306,11 @@ export class MonitorComponent implements OnInit, OnDestroy {
return;
}
} else {
- this.activeTopic = this.stakeholder.topics.find(topic => this.isPublicOrIsMember(topic.isPublic) && topic.isActive);
+ this.activeTopic = this.stakeholder.topics.find(topic => this.isPublicOrIsMember(topic.visibility));
if (this.activeTopic) {
- this.activeCategory = this.activeTopic.categories.find(category => this.isPublicOrIsMember(category.isPublic) && category.isActive);
+ this.activeCategory = this.activeTopic.categories.find(category => this.isPublicOrIsMember(category.visibility));
if (this.activeCategory) {
- this.activeSubCategory = this.activeCategory.subCategories.find(subCategory => this.isPublicOrIsMember(subCategory.isPublic) && subCategory.isActive);
+ this.activeSubCategory = this.activeCategory.subCategories.find(subCategory => this.isPublicOrIsMember(subCategory.visibility));
if (this.activeSubCategory) {
this.setIndicators();
}
@@ -362,7 +369,7 @@ export class MonitorComponent implements OnInit, OnDestroy {
let urls: Map
= new Map();
this.activeSubCategory.numbers.forEach((section, i) => {
section.indicators.forEach((number, j) => {
- if (number.isActive && this.isPublicOrIsMember(number.isPublic)) {
+ if (this.isPublicOrIsMember(number.visibility)) {
let url =this.indicatorUtils.getFullUrlWithFilters(this.stakeholder, number.indicatorPaths[0], this.getfl0(), this.periodFilter.selectedFromValue, this.periodFilter.selectedToValue, this.getCoFunded());
const pair = JSON.stringify([number.indicatorPaths[0].source, url]);
const indexes = urls.get(pair) ? urls.get(pair) : [];
@@ -433,8 +440,11 @@ export class MonitorComponent implements OnInit, OnDestroy {
return this.user && (Session.isPortalAdministrator(this.user) || Session.isCommunityCurator(this.user) || Session.isMonitorCurator(this.user));
}
- public isPublicOrIsMember(isPublic: boolean): boolean {
- if (isPublic) {
+ public isPublicOrIsMember(visibility: Visibility): boolean {
+ if(visibility == "PRIVATE"){
+ return false;
+ }
+ if (visibility == "PUBLIC") {
return true;
} else {
if (this.isViewPublic) { // preview for not members
@@ -449,8 +459,8 @@ export class MonitorComponent implements OnInit, OnDestroy {
public countSubCategoriesToShow(category:Category): number {
let counter = 0;
for (let sub of category.subCategories) {
- if(sub.isActive) {
- if (sub.isPublic) {
+ if(sub.visibility != "PRIVATE") {
+ if (sub.visibility == "PUBLIC") {
// return true;
counter++;
}else if (this.isAdmin()) {
diff --git a/src/app/stakeholder/stakeholder.component.html b/src/app/stakeholder/stakeholder.component.html
index 5c38b41..39c955a 100644
--- a/src/app/stakeholder/stakeholder.component.html
+++ b/src/app/stakeholder/stakeholder.component.html
@@ -40,7 +40,7 @@
{{topic.name}}
@@ -50,12 +50,12 @@
class="uk-padding-remove-horizontal">