[Monitor Dashboard|Trunk]

preview:
	move preview button to topic.component
monitor.component, app
	update methods to show the profile based on the preview value and the visibility



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@59765 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
Argiro Kokogiannaki 2020-11-04 11:16:47 +00:00
parent bd7925772f
commit 6302cce3e9
5 changed files with 58 additions and 67 deletions

View File

@ -13,7 +13,8 @@
[activeItem]="activeTopic?activeTopic.alias:null" [showHeader]=true [activeItem]="activeTopic?activeTopic.alias:null" [showHeader]=true
[specialMenuItem]="specialSideBarMenuItem" [specialMenuItem]="specialSideBarMenuItem"
[searchParams]="createSearchParameters()" [searchParams]="createSearchParameters()"
[headerUrl]="properties.domain + properties.baseLink" queryParamsHandling="preserve" [headerUrl]="'https://' + (properties.environment == 'beta' ? 'beta.' : '') +
'monitor.openaire.eu'" queryParamsHandling="preserve"
></dashboard-sidebar> ></dashboard-sidebar>
<dashboard-sidebar *ngIf="hasAdminMenu" [items]="adminMenuItems" headerName="Admin" <dashboard-sidebar *ngIf="hasAdminMenu" [items]="adminMenuItems" headerName="Admin"
headerDashboard="Administration Panel" [headerUrl]="properties.domain + properties.baseLink" headerDashboard="Administration Panel" [headerUrl]="properties.domain + properties.baseLink"

View File

@ -193,6 +193,7 @@ export class AppComponent implements OnInit, OnDestroy {
private setSideBar() { private setSideBar() {
let items: MenuItem[] = []; let items: MenuItem[] = [];
if(this.isPublicOrIsMember(this.stakeholder.visibility)) {
this.stakeholder.topics.forEach((topic) => { this.stakeholder.topics.forEach((topic) => {
if (this.isPublicOrIsMember(topic.visibility)) { if (this.isPublicOrIsMember(topic.visibility)) {
let topicItem: MenuItem = new MenuItem(topic.alias, topic.name, "", ( let topicItem: MenuItem = new MenuItem(topic.alias, topic.name, "", (
@ -205,6 +206,10 @@ export class AppComponent implements OnInit, OnDestroy {
if (items.length === 0) { if (items.length === 0) {
items.push(new MenuItem('noTopics', 'No topics available yet', "", "", false, [], [], {})); items.push(new MenuItem('noTopics', 'No topics available yet', "", "", false, [], [], {}));
} }
}else{
let topicItem: MenuItem = new MenuItem("private", "Private Data", "","", null, [], [], {});
items.push(topicItem);
}
this.sideBarItems = items; this.sideBarItems = items;
} }
@ -238,8 +243,13 @@ export class AppComponent implements OnInit, OnDestroy {
}); });
} }
if(this.isPublicOrIsMember(this.stakeholder.visibility)) {
this.specialSideBarMenuItem = new MenuItem("search", "Search research outcomes", "", this.properties.searchLinkToResults, false, [], null, {}) this.specialSideBarMenuItem = new MenuItem("search", "Search research outcomes", "", this.properties.searchLinkToResults, false, [], null, {})
this.specialSideBarMenuItem.icon = '<span uk-icon="search"></span>'; this.specialSideBarMenuItem.icon = '<span uk-icon="search"></span>';
}else{
this.specialSideBarMenuItem =null;
}
} else { } else {
this.menuHeader = { this.menuHeader = {
@ -338,20 +348,10 @@ export class AppComponent implements OnInit, OnDestroy {
} }
public isPublicOrIsMember(visibility: Visibility): boolean { public isPublicOrIsMember(visibility: Visibility): boolean {
if (visibility == "PRIVATE") { if (visibility == "PRIVATE" || (this.isViewPublic && visibility != "PUBLIC")) {
return false; return false;
} }
if (visibility == "PUBLIC") {
return true; return true;
} else {
if (this.isViewPublic) { // preview for not members
return false;
} else if (this.isManager(this.stakeholder)) {
// if user is member, return true
return true;
}
return false;
}
} }
createSearchParameters() { createSearchParameters() {

View File

@ -435,36 +435,17 @@ export class MonitorComponent implements OnInit, OnDestroy {
} }
} }
isAdmin(){
return this.user && (Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user));
}
public isPublicOrIsMember(visibility: Visibility): boolean { public isPublicOrIsMember(visibility: Visibility): boolean {
if(visibility == "PRIVATE"){ if(visibility == "PRIVATE" || (this.isViewPublic && visibility != "PUBLIC")) {
return false; return false;
} }
if (visibility == "PUBLIC") {
return true; return true;
} else {
if (this.isViewPublic) { // preview for not members
return false;
} else if(this.isAdmin()) {
// if user is member, return true
return true;
}
return false;
}
} }
public countSubCategoriesToShow(category:Category): number { public countSubCategoriesToShow(category:Category): number {
let counter = 0; let counter = 0;
for (let sub of category.subCategories) { for (let sub of category.subCategories) {
if(sub.visibility != "PRIVATE") { if(this.isPublicOrIsMember(sub.visibility)) {
if (sub.visibility == "PUBLIC") {
// return true;
counter++; counter++;
}else if (this.isAdmin()) {
counter++;
}
} }
} }
return counter; return counter;

View File

@ -1,23 +1,4 @@
<div *ngIf="stakeholder && canEdit"> <div *ngIf="stakeholder && canEdit">
<div>
<div class="uk-flex uk-flex-right">
<a class="uk-button uk-button-primary">
<icon name="preview"></icon>
Preview
<i uk-icon="chevron-down" class="uk-icon"></i>
</a>
<div #element uk-dropdown="mode: click; pos: bottom-right; offset: 5; delay-hide: 0; flip: false"
class="uk-padding-remove-horizontal">
<ul class="uk-nav uk-dropdown-nav uk-margin-left">
<li><a target="_blank" [routerLink]="preview" [queryParams]="{view: 'public'}"
(click)="hide(element)">Public</a>
</li>
<li><a target="_blank" [routerLink]="preview" [queryParams]="{view: 'private'}" (click)="hide(element)">Private</a>
</li>
</ul>
</div>
</div>
</div>
<div *ngIf="numberSections"> <div *ngIf="numberSections">
<h6 class="uk-text-bold">Number Indicators</h6> <h6 class="uk-text-bold">Number Indicators</h6>
<ng-template ngFor [ngForOf]="displayNumbers" let-number let-i="index"> <ng-template ngFor [ngForOf]="displayNumbers" let-number let-i="index">

View File

@ -61,6 +61,34 @@
</li> </li>
</ul> </ul>
</div> </div>
<div class="uk-position-bottom uk-margin-bottom">
<div class="uk-flex uk-flex-center">
<!--<a class="portal-icon-button uk-icon-button icon-button-small uk-margin-right" uk-tooltip="Help">
<i uk-icon="icon:question;ratio:0.7" class="uk-icon"></i>
</a>-->
<a class="portal-icon-button uk-icon-button icon-button-small" uk-tooltip="Preview">
<icon name="preview" [ratio]="0.7"></icon>
</a>
<div #element uk-dropdown="mode: click; pos: top-left; offset: 5; delay-hide: 0; flip: false"
class="uk-padding-remove-horizontal">
<ul class="uk-nav uk-dropdown-nav">
<li><a target="_blank" [routerLink]="'/' + stakeholder.alias + '/' + stakeholder.topics[topicIndex].alias"
[queryParams]="{view: 'public'}"
(click)="hide(element)">Public view</a>
</li>
<li><a target="_blank" [routerLink]="'/' + stakeholder.alias + '/' +
stakeholder.topics[topicIndex].alias"
[queryParams]="{view: 'restricted'}"
(click)="hide(element)">Restricted view</a>
</li>
<!--<li class="disabled"><a class="uk-disabled uk-text-muted"
uk-tooltip="Note: available only in administration dashboard"
(click)="hide(element)">Private view</a>
</li>-->
</ul>
</div>
</div>
</div>
</div> </div>
</div> </div>
<div *ngIf="!isSmallScreen" id="sidebar_switcher_toggle" class="clickable " <div *ngIf="!isSmallScreen" id="sidebar_switcher_toggle" class="clickable "