[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:
parent
bd7925772f
commit
6302cce3e9
|
@ -13,7 +13,8 @@
|
|||
[activeItem]="activeTopic?activeTopic.alias:null" [showHeader]=true
|
||||
[specialMenuItem]="specialSideBarMenuItem"
|
||||
[searchParams]="createSearchParameters()"
|
||||
[headerUrl]="properties.domain + properties.baseLink" queryParamsHandling="preserve"
|
||||
[headerUrl]="'https://' + (properties.environment == 'beta' ? 'beta.' : '') +
|
||||
'monitor.openaire.eu'" queryParamsHandling="preserve"
|
||||
></dashboard-sidebar>
|
||||
<dashboard-sidebar *ngIf="hasAdminMenu" [items]="adminMenuItems" headerName="Admin"
|
||||
headerDashboard="Administration Panel" [headerUrl]="properties.domain + properties.baseLink"
|
||||
|
|
|
@ -193,17 +193,22 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
|
||||
private setSideBar() {
|
||||
let items: MenuItem[] = [];
|
||||
this.stakeholder.topics.forEach((topic) => {
|
||||
if (this.isPublicOrIsMember(topic.visibility)) {
|
||||
let topicItem: MenuItem = new MenuItem(topic.alias, topic.name, "", (
|
||||
'/' + this.stakeholder.alias + '/' + topic.alias),
|
||||
null, [], [], {});
|
||||
topicItem.icon = topic.icon;
|
||||
items.push(topicItem);
|
||||
if(this.isPublicOrIsMember(this.stakeholder.visibility)) {
|
||||
this.stakeholder.topics.forEach((topic) => {
|
||||
if (this.isPublicOrIsMember(topic.visibility)) {
|
||||
let topicItem: MenuItem = new MenuItem(topic.alias, topic.name, "", (
|
||||
'/' + this.stakeholder.alias + '/' + topic.alias),
|
||||
null, [], [], {});
|
||||
topicItem.icon = topic.icon;
|
||||
items.push(topicItem);
|
||||
}
|
||||
});
|
||||
if (items.length === 0) {
|
||||
items.push(new MenuItem('noTopics', 'No topics available yet', "", "", false, [], [], {}));
|
||||
}
|
||||
});
|
||||
if (items.length === 0) {
|
||||
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;
|
||||
}
|
||||
|
@ -238,8 +243,13 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
|
||||
}
|
||||
this.specialSideBarMenuItem = new MenuItem("search", "Search research outcomes", "", this.properties.searchLinkToResults, false, [], null, {})
|
||||
this.specialSideBarMenuItem.icon = '<span uk-icon="search"></span>';
|
||||
|
||||
if(this.isPublicOrIsMember(this.stakeholder.visibility)) {
|
||||
this.specialSideBarMenuItem = new MenuItem("search", "Search research outcomes", "", this.properties.searchLinkToResults, false, [], null, {})
|
||||
this.specialSideBarMenuItem.icon = '<span uk-icon="search"></span>';
|
||||
}else{
|
||||
this.specialSideBarMenuItem =null;
|
||||
}
|
||||
|
||||
} else {
|
||||
this.menuHeader = {
|
||||
|
@ -338,20 +348,10 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
public isPublicOrIsMember(visibility: Visibility): boolean {
|
||||
if (visibility == "PRIVATE") {
|
||||
return false;
|
||||
}
|
||||
if (visibility == "PUBLIC") {
|
||||
return true;
|
||||
} else {
|
||||
if (this.isViewPublic) { // preview for not members
|
||||
if (visibility == "PRIVATE" || (this.isViewPublic && visibility != "PUBLIC")) {
|
||||
return false;
|
||||
} else if (this.isManager(this.stakeholder)) {
|
||||
// if user is member, return true
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
createSearchParameters() {
|
||||
|
|
|
@ -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 {
|
||||
if(visibility == "PRIVATE"){
|
||||
return false;
|
||||
}
|
||||
if (visibility == "PUBLIC") {
|
||||
return true;
|
||||
} else {
|
||||
if (this.isViewPublic) { // preview for not members
|
||||
return false;
|
||||
} else if(this.isAdmin()) {
|
||||
// if user is member, return true
|
||||
return true;
|
||||
}
|
||||
if(visibility == "PRIVATE" || (this.isViewPublic && visibility != "PUBLIC")) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public countSubCategoriesToShow(category:Category): number {
|
||||
let counter = 0;
|
||||
for (let sub of category.subCategories) {
|
||||
if(sub.visibility != "PRIVATE") {
|
||||
if (sub.visibility == "PUBLIC") {
|
||||
// return true;
|
||||
counter++;
|
||||
}else if (this.isAdmin()) {
|
||||
counter++;
|
||||
}
|
||||
if(this.isPublicOrIsMember(sub.visibility)) {
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
return counter;
|
||||
|
|
|
@ -1,23 +1,4 @@
|
|||
<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">
|
||||
<h6 class="uk-text-bold">Number Indicators</h6>
|
||||
<ng-template ngFor [ngForOf]="displayNumbers" let-number let-i="index">
|
||||
|
|
|
@ -61,6 +61,34 @@
|
|||
</li>
|
||||
</ul>
|
||||
</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 *ngIf="!isSmallScreen" id="sidebar_switcher_toggle" class="clickable "
|
||||
|
|
Loading…
Reference in New Issue