[Monitor Dashboard|Trunk]
-app component: add monitor menu items for non admin pages update user menu items - add user info and manage profiles in any page -update role check check for stakeholder types git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@59751 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
95d2ba3475
commit
29537d917d
|
@ -43,7 +43,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
stickyAnimation: false
|
stickyAnimation: false
|
||||||
};
|
};
|
||||||
|
|
||||||
userMenuItems: MenuItem[] = [new MenuItem("", "My profile", "", "", false, [], [], {})];
|
userMenuItems: MenuItem[] = [];
|
||||||
adminMenuItems: MenuItem[] = [];
|
adminMenuItems: MenuItem[] = [];
|
||||||
stakeholder: Stakeholder = null;
|
stakeholder: Stakeholder = null;
|
||||||
activeTopic: Topic = null;
|
activeTopic: Topic = null;
|
||||||
|
@ -212,12 +212,12 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
this.menuItems = [];
|
this.menuItems = [];
|
||||||
this.adminMenuItems = [];
|
this.adminMenuItems = [];
|
||||||
this.userMenuItems = [];
|
this.userMenuItems = [];
|
||||||
if (this.isAdmin()) {
|
|
||||||
this.userMenuItems.push(new MenuItem("", "Manage profiles",
|
|
||||||
"", "/admin", true, [], [], {}))
|
|
||||||
}
|
|
||||||
if (this.user) {
|
if (this.user) {
|
||||||
this.userMenuItems.push(new MenuItem("", "User information", "", "/user-info", false, [], [], {}));
|
this.userMenuItems.push(new MenuItem("", "User information", "", "/user-info", false, [], [], {}));
|
||||||
|
if (this.isCurator()) {
|
||||||
|
this.userMenuItems.push(new MenuItem("", "Manage profiles",
|
||||||
|
"", "/admin", false, [], [], {}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (this.stakeholder) {
|
if (this.stakeholder) {
|
||||||
if (this.isFrontPage) {
|
if (this.isFrontPage) {
|
||||||
|
@ -231,7 +231,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
badge: false,
|
badge: false,
|
||||||
stickyAnimation: false
|
stickyAnimation: false
|
||||||
};
|
};
|
||||||
if (this.isAdmin()) {
|
if (this.isCurator()) {
|
||||||
this.menuItems.push({
|
this.menuItems.push({
|
||||||
rootItem: new MenuItem("manage", "Manage",
|
rootItem: new MenuItem("manage", "Manage",
|
||||||
"", "/admin", false, [], null, {}), items: []
|
"", "/admin", false, [], null, {}), items: []
|
||||||
|
@ -263,13 +263,6 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
this.specialSideBarMenuItem.icon = '<span class="uk-icon-button small uk-icon uk-button-secondary">' + arrow_left.data + '</span>'; // '<span class="uk-icon-button uk-icon portal-button " uk-icon="chevron-left"></span>';
|
this.specialSideBarMenuItem.icon = '<span class="uk-icon-button small uk-icon uk-button-secondary">' + arrow_left.data + '</span>'; // '<span class="uk-icon-button uk-icon portal-button " uk-icon="chevron-left"></span>';
|
||||||
this.specialSideBarMenuItem.customClass = 'uk-text-uppercase uk-text-bold uk-text-secondary';
|
this.specialSideBarMenuItem.customClass = 'uk-text-uppercase uk-text-bold uk-text-secondary';
|
||||||
}
|
}
|
||||||
this.userMenuItems = [];
|
|
||||||
/* if (Session.isPortalAdministrator(this.user)) {
|
|
||||||
this.userMenuItems.push(new MenuItem("", "Manage helptexts",
|
|
||||||
"", "/helptexts", true, [], [], {communityId:'openaire'}))
|
|
||||||
|
|
||||||
}*/
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (this.isFrontPage || !this.hasAdminMenu) {
|
if (this.isFrontPage || !this.hasAdminMenu) {
|
||||||
this.menuHeader = {
|
this.menuHeader = {
|
||||||
|
@ -282,8 +275,18 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
badge: true,
|
badge: true,
|
||||||
stickyAnimation: false
|
stickyAnimation: false
|
||||||
};
|
};
|
||||||
//TODO monitor menu items?
|
this.menuItems.push({
|
||||||
|
rootItem: new MenuItem("about", "About",
|
||||||
|
"https://" + (this.properties.environment == 'beta' ? 'beta.' : '') + 'monitor.openaire.eu/about/learn-how', "", false, [], null, {}), items: []
|
||||||
|
});
|
||||||
|
this.menuItems.push({
|
||||||
|
rootItem: new MenuItem("browse", "Browse",
|
||||||
|
"https://" + (this.properties.environment == 'beta' ? 'beta.' : '') + 'monitor.openaire.eu/browse', "", false, [], null, {}), items: []
|
||||||
|
});
|
||||||
|
this.menuItems.push({
|
||||||
|
rootItem: new MenuItem("contact", "Contact us",
|
||||||
|
"https://" + (this.properties.environment == 'beta' ? 'beta.' : '') + 'monitor.openaire.eu/contact-us', "", false, [], null, {}), items: []
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
this.menuHeader = {
|
this.menuHeader = {
|
||||||
route: "/",
|
route: "/",
|
||||||
|
@ -315,9 +318,11 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public isCurator() {
|
||||||
public isAdmin() {
|
return this.user && (Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user) || Session.isKindOfMonitorManager(this.user));
|
||||||
return this.user && (Session.isPortalAdministrator(this.user) || Session.isMonitorCurator(this.user) || (this.stakeholder && Session.isManager(this.stakeholder.type, this.stakeholder.alias, this.user)));
|
}
|
||||||
|
public isManager(stakeholder:Stakeholder) {
|
||||||
|
return this.user && (Session.isPortalAdministrator(this.user) || Session.isCurator(stakeholder.type, this.user) || Session.isManager(stakeholder.type, stakeholder.alias, this.user));
|
||||||
}
|
}
|
||||||
|
|
||||||
private resolvePageInner() {
|
private resolvePageInner() {
|
||||||
|
@ -341,7 +346,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||||
} else {
|
} else {
|
||||||
if (this.isViewPublic) { // preview for not members
|
if (this.isViewPublic) { // preview for not members
|
||||||
return false;
|
return false;
|
||||||
} else if (this.isAdmin()) {
|
} else if (this.isManager(this.stakeholder)) {
|
||||||
// if user is member, return true
|
// if user is member, return true
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ declare var UIkit;
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'edit-stakeholder',
|
selector: 'edit-stakeholder',
|
||||||
template: `
|
template: `
|
||||||
<div *ngIf="stakeholderFb" [ngStyle]="{'max-height': maxHeight}"
|
<div *ngIf="stakeholderFb && user" [ngStyle]="{'max-height': maxHeight}"
|
||||||
[class.uk-padding-small]="!paddingLarge" [class.uk-padding-large]="paddingLarge"
|
[class.uk-padding-small]="!paddingLarge" [class.uk-padding-large]="paddingLarge"
|
||||||
class="uk-overflow-auto"
|
class="uk-overflow-auto"
|
||||||
[formGroup]="stakeholderFb">
|
[formGroup]="stakeholderFb">
|
||||||
|
@ -81,7 +81,7 @@ declare var UIkit;
|
||||||
</div>
|
</div>
|
||||||
<div dashboard-input class="uk-width-1-3@m" [formInput]="stakeholderFb.get('type')"
|
<div dashboard-input class="uk-width-1-3@m" [formInput]="stakeholderFb.get('type')"
|
||||||
[placeholder]="'Select a type'" hint="Select the type of your profile"
|
[placeholder]="'Select a type'" hint="Select the type of your profile"
|
||||||
label="Type" [options]="stakeholderUtils.getTypesByUserRoles(user)" type="select">
|
label="Type" [options]="stakeholderUtils.getTypesByUserRoles(user, stakeholder.alias)" type="select">
|
||||||
</div>
|
</div>
|
||||||
<ng-container *ngIf="!stakeholderFb.get('isDefault').value && isNew && stakeholderFb.get('type').valid && defaultStakeholdersOptions">
|
<ng-container *ngIf="!stakeholderFb.get('isDefault').value && isNew && stakeholderFb.get('type').valid && defaultStakeholdersOptions">
|
||||||
<div [placeholder]="'Select a template'"
|
<div [placeholder]="'Select a template'"
|
||||||
|
@ -182,15 +182,9 @@ export class EditStakeholderComponent implements OnDestroy {
|
||||||
this.stakeholderFb.get('type').enable();
|
this.stakeholderFb.get('type').enable();
|
||||||
}, 0);
|
}, 0);
|
||||||
} else {
|
} else {
|
||||||
if (this.stakeholderFb.value.type) {
|
setTimeout(() => {
|
||||||
setTimeout(() => {
|
this.stakeholderFb.get('type').disable();
|
||||||
this.stakeholderFb.get('type').disable();
|
}, 0);
|
||||||
}, 0);
|
|
||||||
} else {
|
|
||||||
setTimeout(() => {
|
|
||||||
this.stakeholderFb.get('type').enable();
|
|
||||||
}, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,10 @@ export class StakeholderUtils {
|
||||||
{value: 'project', label: 'Project'},
|
{value: 'project', label: 'Project'},
|
||||||
{value: 'organization', label: 'Organization'}
|
{value: 'organization', label: 'Organization'}
|
||||||
];
|
];
|
||||||
getTypesByUserRoles(user):Option[]{
|
getTypesByUserRoles(user, id:string = null):Option[]{
|
||||||
let types = [];
|
let types = [];
|
||||||
for(let type of this.types){
|
for(let type of this.types){
|
||||||
if(Session.isCurator(type.value, user)|| Session.isPortalAdministrator(user)){
|
if(Session.isCurator(type.value, user)|| Session.isPortalAdministrator(user)|| Session.isManager(type.value, id, user)){
|
||||||
types.push(type);
|
types.push(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue