[Monitor Dashboard| Trunk]

Admin: Enable Delete profiles  only for administrators
	Enable delete only for non-default elements
	Add tooltip for active/public status of topics/categories/subcategories in sidebars
	




git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@58960 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
Argiro Kokogiannaki 2020-06-18 12:03:26 +00:00
parent e70567e079
commit cdcf946958
8 changed files with 67 additions and 31 deletions

View File

@ -62,8 +62,9 @@
<li><a (click)="$event.stopPropagation();toggleStakeholderAccess(stakeholder);hide(element);$event.preventDefault()">
{{stakeholder.isPublic ? 'Private' : 'Public'}}</a>
</li>
<hr class="uk-nav-divider">
<li><a (click)="$event.stopPropagation();deleteStakeholderOpen(stakeholder);hide(element);$event.preventDefault()">Delete</a>
<hr *ngIf="isAdministrator()" class="uk-nav-divider">
<li *ngIf="isAdministrator()"><a
(click)="$event.stopPropagation();deleteStakeholderOpen(stakeholder);hide(element);$event.preventDefault()">Delete</a>
</li>
</ul>
</div>

View File

@ -10,6 +10,8 @@ import {AlertModal} from "../openaireLibrary/utils/modal/alert";
import {StakeholderCreator} from "../utils/entities/stakeholderCreator";
import {Option} from "../openaireLibrary/dashboard/sharedComponents/input/input.component";
import {Title} from "@angular/platform-browser";
import {UserManagementService} from "../openaireLibrary/services/user-management.service";
import {Session} from "../openaireLibrary/login/utils/helper.class";
declare var UIkit;
@ -27,7 +29,7 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
public stakeholder: Stakeholder;
public stakeholderFb: FormGroup;
public index: number;
public user = null;
/**
* Filtered Stakeholders
*/
@ -54,7 +56,7 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
@ViewChild('editStakeholderModal') editStakeholderModal: AlertModal;
@ViewChild('deleteStakeholderModal') deleteStakeholderModal: AlertModal;
constructor(private stakeholderService: StakeholderService,
constructor(private stakeholderService: StakeholderService,private userManagementService: UserManagementService,
private propertiesService: EnvironmentSpecificService,
private title: Title,
private fb: FormBuilder) {
@ -66,6 +68,9 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
.then(properties => {
this.properties = properties;
this.title.setTitle('Manage Stakeholders');
this.userManagementService.getUserInfo().subscribe(user => {
this.user = user;
});
let data = zip(
this.stakeholderService.getDefaultStakeholders(this.properties.monitorServiceAPIURL),
this.stakeholderService.getStakeholders(this.properties.monitorServiceAPIURL)
@ -307,4 +312,8 @@ export class ManageStakeholdersComponent implements OnInit, OnDestroy {
stakeholder.isPublic = isPublic;
});
}
public isAdministrator(): boolean {
return Session.isPortalAdministrator(this.user);
}
}

View File

@ -131,7 +131,7 @@
<div *ngIf="indicator.isActive && isPublicOrIsMember(indicator.isPublic)"
[class.uk-width-1-5@m]="indicator.width === 'small'"
[class.uk-width-1-3@m]="indicator.width === 'medium'"
[class.uk-width-1-2]="indicator.width === 'large'">
[class.uk-width-1-2]="indicator.width === 'large'" class=" uk-margin-bottom">
<div class="md-card" [attr.uk-tooltip]="indicator.description">
<div class="md-card-content">
<h2 *ngIf="numberResults.get(i + '-' + j)" class="">
@ -154,7 +154,7 @@
<div *ngIf="indicator.isActive && isPublicOrIsMember(indicator.isPublic) && chartsActiveType.get(i + '-' + j)"
[class.uk-width-1-3@m]="indicator.width === 'small'"
[class.uk-width-1-2@m]="indicator.width === 'medium'"
[class.uk-width-1-1]="indicator.width === 'large'">
[class.uk-width-1-1]="indicator.width === 'large'" class="uk-margin-bottom">
<div class="indicatorBox">
<h4 class="uk-margin-bottom chartTitle uk-flex uk-flex-bottom ">
<div>{{indicator.name + " "}}</div>

View File

@ -27,13 +27,17 @@
</a>
<ul [style.display]="(analysisOpen?'block':'none')">
<ng-template ngFor [ngForOf]="stakeholder.topics" let-topic let-i="index">
<li>
<li [title]="topic.name+': '+(topic.isActive?'Active':'Inactive')+', '+(topic.isPublic?'Public':'Private')">
<a [routerLink]="topic.alias">
<span *ngIf="topic.icon" class="menu_icon">
<span [innerHTML]="satinizeHTML(topic.icon)"></span>
</span>
<div class="menu_title uk-width-expand">
{{topic.name}}
<!--<i
class="material-icons md-18 uk-margin-small-left">{{topic.isPublic ? 'public' : 'lock'}}</i>
<i class="material-icons md-18"
[class.md-color-green-300]="topic.isActive">brightness_1</i>-->
</div>
<div class="menu_on_hover" (click)="$event.stopPropagation();$event.preventDefault()">
<i class="material-icons onHover">more_vert</i>
@ -47,8 +51,8 @@
<li><a (click)="toggleTopicAccess(topic); hide(element)">
{{topic.isPublic?'Private':'Public'}}</a>
</li>
<hr class="uk-nav-divider">
<li><a (click)="deleteTopicOpen(i); hide(element)">Delete</a></li>
<hr *ngIf="!topic.defaultId" class="uk-nav-divider">
<li><a *ngIf="!topic.defaultId" (click)="deleteTopicOpen(i); hide(element)">Delete</a></li>
</ul>
</div>
</div>

View File

@ -70,9 +70,13 @@
uk-sortable="group: number" uk-grid>
<div *ngIf="grid" class="tools disable-sortable uk-sortable-nodrag">
<div class="md-btn-group">
<button [disabled]="editing" class="md-btn md-btn-mini" (click)="createSection(i, 'number')"><i class="material-icons">add</i></button>
<button [disabled]="editing" class="md-btn md-btn-mini" (click)="createSection(i, 'number')"
title="Create a new section"><i
class="material-icons">add</i></button>
<!--<button class="md-btn md-btn-mini"><i class="material-icons rotate-90">drag_indicator</i></button>-->
<button [disabled]="editing" class="md-btn md-btn-mini" (click)="deleteNumberSectionOpen(number, i)"><i class="material-icons">clear</i>
<button [disabled]="editing || number.defaultId " class="md-btn md-btn-mini"
[title]="(number.defaultId?'Default sections cannot be deleted':'Delete section')"
(click)="deleteNumberSectionOpen(number, i)"><i class="material-icons">clear</i>
</button>
</div>
</div>
@ -117,7 +121,7 @@
<div #element uk-dropdown="mode: click; pos: bottom-right; delay-hide: 0; flip: false"
class="uk-padding-remove-horizontal">
<ul class="uk-nav uk-dropdown-nav">
<li *ngIf="isAdministrator && !editing"><a
<li *ngIf="isAdministrator && !indicator.defaultId && !editing"><a
(click)="editNumberIndicatorOpen(number, indicator._id)">Edit</a></li>
<li *ngIf="!editing"><a (click)="toggleIndicatorStatus(number._id, indicator);hide(element)">
{{indicator.isActive ? 'Inactive' : 'Active'}}</a>
@ -125,8 +129,8 @@
<li *ngIf="!editing"><a (click)="toggleIndicatorAccess(number._id, indicator);hide(element)">
{{indicator.isPublic ? 'Private' : 'Public'}}</a>
</li>
<hr *ngIf="isAdministrator" class="uk-nav-divider">
<li *ngIf="isAdministrator && !editing"><a
<hr *ngIf="isAdministrator && !indicator.defaultId" class="uk-nav-divider">
<li *ngIf="isAdministrator && !indicator.defaultId && !editing"><a
(click)="deleteIndicatorOpen(number, indicator._id, 'number');hide(element)">Delete</a>
</li>
</ul>
@ -202,9 +206,13 @@
uk-sortable="group: chart" uk-grid>
<div *ngIf="grid" class="tools disable-sortable uk-sortable-nodrag">
<div class="md-btn-group">
<button [disabled]="editing" class="md-btn md-btn-mini" (click)="createSection(i)"><i class="material-icons">add</i></button>
<button [disabled]="editing" class="md-btn md-btn-mini" (click)="createSection(i)"
title="Create a new section"><i
class="material-icons">add</i></button>
<!--<button class="md-btn md-btn-mini"><i class="material-icons rotate-90">drag_indicator</i></button>-->
<button [disabled]="editing" class="md-btn md-btn-mini" (click)="deleteChartSectionOpen(chart, i)"><i class="material-icons">clear</i>
<button [disabled]="editing || chart.defaultId "
[title]="(chart.defaultId?'Default sections cannot be deleted':'Delete section')"
class="md-btn md-btn-mini" (click)="deleteChartSectionOpen(chart, i)"><i class="material-icons">clear</i>
</button>
</div>
</div>
@ -269,8 +277,9 @@
<li *ngIf="!editing"><a (click)="toggleIndicatorAccess(chart._id, indicator);hide(element)">
{{indicator.isPublic ? 'Private' : 'Public'}}</a>
</li>
<hr class="uk-nav-divider">
<li *ngIf="!editing"><a (click)="deleteIndicatorOpen(chart, indicator._id);hide(element)">Delete</a></li>
<hr *ngIf="!indicator.defaultId " class="uk-nav-divider">
<li *ngIf="!editing && !indicator.defaultId "><a (click)="deleteIndicatorOpen(chart, indicator._id);hide(element)">
Delete</a></li>
</ul>
</div>
</div>

View File

@ -29,8 +29,10 @@
<li><a (click)="toggleTopicAccess(); hide(element)">
{{stakeholder.topics[topicIndex].isPublic ? 'Private' : 'Public'}}</a>
</li>
<hr class="uk-nav-divider">
<li><a (click)="deleteTopicOpen(); hide(element)">Delete</a></li>
<hr *ngIf="!stakeholder.topics[topicIndex].defaultId" class="uk-nav-divider">
<li><a *ngIf="!stakeholder.topics[topicIndex].defaultId"
(click)="deleteTopicOpen(); hide(element)">Delete
</a></li>
</ul>
</div>
</div>
@ -39,13 +41,16 @@
<ng-template ngFor [ngForOf]="stakeholder.topics[topicIndex].categories" let-category let-i="index">
<li [class.current_section]="categoryIndex === i"
[class.act_section]="selectedCategoryIndex === i && toggle"
[title]="category.name"
[title]="category.name+': '+(category.isActive?'Active':'Inactive')+', '+(category.isPublic?'Public':'Private')"
class="submenu_trigger">
<a href="#" (click)="toggleCategory(i);$event.preventDefault()">
<span *ngIf="category.icon" class="menu_icon"><i
class="material-icons">{{category.icon}}</i></span>
<div class="menu_title uk-width-expand">
<div class="menu_title uk-width-expand" >
{{category.name}}
<!-- <i class="material-icons md-18 uk-margin-small-left">{{category.isPublic ? 'public' : 'lock'}}</i>-->
<!-- <i class="material-icons md-18"-->
<!-- [class.md-color-green-300]="category.isActive">brightness_1</i>-->
</div>
<div class="menu_on_hover"
(click)="$event.stopPropagation();$event.preventDefault()">
@ -60,8 +65,10 @@
<li><a (click)="toggleCategoryAccess(i); hide(element)">
{{category.isPublic ? 'Private' : 'Public'}}</a>
</li>
<hr class="uk-nav-divider">
<li><a (click)="deleteCategoryOpen(i); hide(element)">Delete</a></li>
<hr *ngIf="!stakeholder.topics[topicIndex].categories[i].defaultId" class="uk-nav-divider">
<li><a *ngIf="!stakeholder.topics[topicIndex].categories[i].defaultId"
(click)="deleteCategoryOpen(i);
hide(element)">Delete</a></li>
</ul>
</div>
</div>
@ -69,12 +76,16 @@
<ul [style.display]="((selectedCategoryIndex === i && toggle)?'block':'none')">
<ng-template ngFor [ngForOf]="stakeholder.topics[topicIndex].categories[i].subCategories"
let-subcategory let-j="index">
<li [class.act_item]="categoryIndex === i && subCategoryIndex === j">
<li [class.act_item]="categoryIndex === i && subCategoryIndex === j"
[title]="subcategory.name +': ' + (subcategory.isActive?'Active':'Inactive')+', '+(subcategory.isPublic?'Public':'Private')">
<a href="#" (click)="chooseSubcategory(i, j);$event.preventDefault()">
<span *ngIf="subcategory.icon" class="menu_icon uk-margin-small-right"><i
class="material-icons">{{subcategory.icon}}</i></span>
<div class="menu_title uk-width-expand">
<div class="menu_title uk-width-expand ">
{{subcategory.name}}
<!-- <i class="material-icons md-18 uk-margin-small-left">{{subcategory.isPublic ? 'public' : 'lock'}}</i>
<i class="material-icons md-18"
[class.md-color-green-300]="subcategory.isActive">brightness_1</i>-->
</div>
<div class="menu_on_hover"
(click)="$event.stopPropagation();$event.preventDefault()">
@ -89,8 +100,10 @@
<li><a (click)="toggleSubcategoryAccess(j); hide(element)">
{{subcategory.isPublic ? 'Private' : 'Public'}}</a>
</li>
<hr class="uk-nav-divider">
<li><a (click)="deleteSubcategoryOpen(j); hide(element)">Delete</a></li>
<hr *ngIf="!stakeholder.topics[topicIndex].categories[i].subCategories[j].defaultId"
class="uk-nav-divider">
<li><a *ngIf="!stakeholder.topics[topicIndex].categories[i].subCategories[j].defaultId"
(click)="deleteSubcategoryOpen(j); hide(element)">Delete</a></li>
</ul>
</div>
</div>

View File

@ -100,9 +100,9 @@ export class StakeholderUtils {
indicator.defaultId = indicator._id;
indicator._id = null;
for (let indicatorPath of indicator.indicatorPaths) {
indicatorPath.url = indicatorPath.url.replace("index_id", encodeURIComponent(funder.index_id));
/* indicatorPath.url = indicatorPath.url.replace("index_id", encodeURIComponent(funder.index_id));
indicatorPath.url = indicatorPath.url.replace("index_name", encodeURIComponent(funder.index_name));
indicatorPath.url = indicatorPath.url.replace("index_shortName", encodeURIComponent(funder.index_shortName));
indicatorPath.url = indicatorPath.url.replace("index_shortName", encodeURIComponent(funder.index_shortName));*/
// if(indicatorPath.parameters) {
// indicatorPath.parameters.forEach((value: string, key: string) => {
// if (value.indexOf("_funder_name_")!=-1) {

View File

@ -64,7 +64,7 @@
color: #000000B3;
/*text-transform: uppercase;*/
}
.dashboard #header_main.light_header circle, .dashboard #header_main.light_header .login svg * {
.dashboard #header_main.light_header user-mini svg * , .dashboard #header_main.light_header .login svg * {
stroke: #000000B3;
}
.stakeholderPage #hide_controls:hover #toggle:hover .material-icons, .stakeholderPage #hide_controls #toggle:not(.sidebar_main_open) .material-icons {