[Admin|Trunk]: Add entities and pages on admin Tools.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@56514 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2019-07-12 13:15:37 +00:00
parent d72989f3db
commit 391bdf290b
14 changed files with 97 additions and 65 deletions

View File

@ -170,22 +170,37 @@ export class AppComponent implements OnInit{
items: []
}
);
adminTools.items.push( {
adminTools.items.push({
rootItem: new MenuItem('pages', 'Pages', '/pages',
'/pages', false, [], [], null),
items: []
}
);
adminTools.items.push({
rootItem: new MenuItem('entities', 'Entities', '/entities',
'/entities', false, [], [], null),
items: []
}
);
this.sideMenuItems.push(adminTools);
this.sideMenuItems.push( {
rootItem: new MenuItem('communities', 'Manage Communities', '/',
'/', false, [], [], null),
items: [],
ukIcon: 'cog'
});
adminTools.items.push( {
this.sideMenuItems.push( {
rootItem: new MenuItem('communities', 'Manage Explore', '',
'/dashboard', false, [], [], {communityId: 'openaire'}),
items: [],
ukIcon: 'cog'
});
adminTools.items.push( {
this.sideMenuItems.push( {
rootItem: new MenuItem('communities', 'Manage Connect', '',
'/dashboard', false, [], [], {communityId: 'connect'}),
items: [],
ukIcon: 'cog'
});
this.sideMenuItems.push(adminTools);
} else if (this.communityId && this.communityId !== '') {
this.sideMenuItems.push({
rootItem: new MenuItem('overview', 'Overview', '/dashboard',

View File

@ -61,7 +61,7 @@
</td>
<td>
<div class="actions" href="#">
<input title="Edit" src="assets/imgs/icn_edit.png" class="edit" type="image" (click)="editCommunity(i)">
<input title="Edit" src="assets/imgs/icn_edit.png" class="edit uk-margin-small-right" type="image" (click)="editCommunity(i)">
<input title="Delete" src="assets/imgs/icn_trash.png" class="delete" type="image" (click)="confirmDeleteCommunity(check.community._id)">
</div>
</td>

View File

@ -80,7 +80,7 @@
</td>
<td>
<div class="actions" href="#">
<input title="Edit" src="assets/imgs/icn_edit.png" class="edit" type="image" (click)="editDivId(i)">
<input title="Edit" src="assets/imgs/icn_edit.png" class="edit uk-margin-small-right" type="image" (click)="editDivId(i)">
<input title="Delete" src="assets/imgs/icn_trash.png" class="delete" type="image" (click)="confirmDeleteDivId(check.divId._id)">
</div>
</td>

View File

@ -126,7 +126,7 @@
</td>
<td>
<div class="actions" href="#">
<input title="Edit" src="assets/imgs/icn_edit.png" class="edit" type="image" (click)="editDivHelpContent(check.divHelpContent._id)">
<input title="Edit" src="assets/imgs/icn_edit.png" class="edit uk-margin-small-right" type="image" (click)="editDivHelpContent(check.divHelpContent._id)">
<input title="Delete" src="assets/imgs/icn_trash.png" class="delete" type="image" (click)="confirmDeleteDivHelpContent(check.divHelpContent._id)">
</div>
</td>

View File

@ -1,13 +1,13 @@
import { NgModule } from '@angular/core';
import {RouterModule} from '@angular/router';
import {IsCommunity} from '../../openaireLibrary/connect/communityGuard/isCommunity.guard';
import {ConnectAdminLoginGuard} from '../../openaireLibrary/connect/communityGuard/connectAdminLoginGuard.guard';
import {EntitiesComponent} from './entities.component';
import {IsCommunityOrAdmin} from '../../openaireLibrary/connect/communityGuard/isCommunityOrAdmin';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', canActivate: [IsCommunity, ConnectAdminLoginGuard], component: EntitiesComponent}
{ path: '', canActivate: [IsCommunityOrAdmin, ConnectAdminLoginGuard], component: EntitiesComponent}
])
]
})

View File

@ -15,8 +15,8 @@
<ul class="uk-nav uk-nav-dropdown"
[attr.uk-tooltip]="getSelectedEntities().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
title="Select at least one entity">
<li><a [class]="getSelectedEntities().length == 0 ? 'uk-disabled' : ''" (click)="toggleEntities(true, getSelectedEntities())"><i></i> Activate </a></li>
<li><a [class]="getSelectedEntities().length == 0 ? 'uk-disabled' : ''" (click)="toggleEntities(false, getSelectedEntities())"><i></i> Deactivate </a></li>
<li *ngIf="!isPortalAdministrator"><a [class]="getSelectedEntities().length == 0 ? 'uk-disabled' : ''" (click)="toggleEntities(true, getSelectedEntities())"><i></i> Activate </a></li>
<li *ngIf="!isPortalAdministrator"><a [class]="getSelectedEntities().length == 0 ? 'uk-disabled' : ''" (click)="toggleEntities(false, getSelectedEntities())"><i></i> Deactivate </a></li>
<li *ngIf="isPortalAdministrator"><a [class]="getSelectedEntities().length == 0 ? 'uk-disabled' : ''" (click)="confirmDeleteSelectedEntities()"><i></i> Delete </a></li>
</ul>
</div>
@ -39,7 +39,7 @@
<div class="content-wrapper" id="contentWrapper">
<div>
<div class="contentPanel uk-margin-top">
<div class="uk-alert uk-alert-primary uk-margin-top-large">
<div *ngIf="!isPortalAdministrator" class="uk-alert uk-alert-primary uk-margin-top-large">
<div>
<span class="uk-margin-small-right uk-icon" uk-icon="warning"></span>
Disable an entity to hide it from community dashboard portal. </div>
@ -59,7 +59,7 @@
<tr>
<th><input id="allEntityCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)"></th>
<th>Name</th>
<th>Change status</th>
<th *ngIf="!isPortalAdministrator">Change status</th>
<th *ngIf="isPortalAdministrator">Actions</th>
</tr>
</thead>
@ -71,13 +71,13 @@
<td>
<div class="name" href="#">{{check.entity.name}}</div>
</td>
<td>
<td *ngIf="!isPortalAdministrator">
<mat-slide-toggle [checked]="check.entity.isEnabled"
(change)="($event.source.checked = check.entity.isEnabled);toggleEntities(!check.entity.isEnabled,[check.entity._id])"></mat-slide-toggle>
</td>
<td *ngIf="isPortalAdministrator">
<div class="actions" href="#">
<input title="Edit" src="assets/imgs/icn_edit.png" class="edit" type="image" (click)="editEntity(i)" value="Edit">
<input title="Edit" src="assets/imgs/icn_edit.png" class="edit uk-margin-small-right" type="image" (click)="editEntity(i)" value="Edit">
<input title="Delete" src="assets/imgs/icn_trash.png" class="delete" type="image" (click)="confirmDeleteEntity(check.entity._id)" value="Delete">
</div>
</td>

View File

@ -66,7 +66,7 @@ export class EntitiesComponent implements OnInit {
this.selectedCommunityPid = params['communityId'];
this.applyCommunityFilter(this.selectedCommunityPid);
this.isPortalAdministrator = Session.isPortalAdministrator();
this.isPortalAdministrator = Session.isPortalAdministrator() && !this.selectedCommunityPid;
});
});
@ -83,20 +83,34 @@ export class EntitiesComponent implements OnInit {
this.showLoading = true;
this.updateErrorMessage = '';
this.errorMessage = '';
this._helpContentService.getCommunityEntities(community_pid, this.properties.adminToolsAPIURL).subscribe(
if(community_pid) {
this._helpContentService.getCommunityEntities(community_pid, this.properties.adminToolsAPIURL).subscribe(
entities => {
this.entities = entities;
this.checkboxes = [];
this.entities = entities;
this.checkboxes = [];
let self = this;
entities.forEach(_ => {
self.checkboxes.push(<CheckEntity>{entity : _, checked : false});
});
let self = this;
entities.forEach(_ => {
self.checkboxes.push(<CheckEntity>{entity: _, checked: false});
});
this.showLoading = false;
},
error => this.handleError('System error retrieving entities', error));
this.showLoading = false;
},
error => this.handleError('System error retrieving entities', error));
} else {
this._helpContentService.getEntities(this.properties.adminToolsAPIURL).subscribe(
entities => {
this.entities = entities;
this.checkboxes = [];
let self = this;
entities.forEach(_ => {
self.checkboxes.push(<CheckEntity>{entity: _, checked: false});
});
this.showLoading = false;
},
error => this.handleError('System error retrieving community entities', error));
}
}
}

View File

@ -1,7 +1,6 @@
import { NgModule } from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {IsCommunity} from '../../openaireLibrary/connect/communityGuard/isCommunity.guard';
import {ConnectAdminLoginGuard} from '../../openaireLibrary/connect/communityGuard/connectAdminLoginGuard.guard';
import {EntitiesComponent} from './entities.component';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
@ -10,6 +9,7 @@ import {EntityFormComponent} from './entity-form.component';
import {AlertModalModule} from '../../openaireLibrary/utils/modal/alertModal.module';
import {EntitiesRoutingModule} from './entities-routing.module';
import {MatSlideToggleModule} from '@angular/material';
import {IsCommunityOrAdmin} from '../../openaireLibrary/connect/communityGuard/isCommunityOrAdmin';
@NgModule({
imports: [
@ -17,7 +17,7 @@ import {MatSlideToggleModule} from '@angular/material';
AlertModalModule, ReactiveFormsModule, EntitiesRoutingModule, MatSlideToggleModule
],
declarations: [EntitiesComponent, EntityFormComponent],
providers: [IsCommunity, ConnectAdminLoginGuard],
providers: [IsCommunityOrAdmin, ConnectAdminLoginGuard],
exports: [EntitiesComponent]
})
export class EntitiesModule { }

View File

@ -125,7 +125,7 @@
</td>
<td>
<div class="actions" href="#">
<input title="Edit" src="assets/imgs/icn_edit.png" class="edit" type="image" (click)="editPageHelpContent(check.pageHelpContent._id)">
<input title="Edit" src="assets/imgs/icn_edit.png" class="edit uk-margin-small-right" type="image" (click)="editPageHelpContent(check.pageHelpContent._id)">
<input title="Delete" src="assets/imgs/icn_trash.png" class="delete" type="image" (click)="confirmDeletePageHelpContent(check.pageHelpContent._id)">
</div>
</td>

View File

@ -48,15 +48,15 @@
<div class="form-group uk-grid">
<label class="uk-width-2-3">Select if this page exists in OpenAIRE portal</label>
<label class="uk-width-1-3 checkbox">
<span style="font-weight: normal;">openaire</span>
<span class="uk-margin-small-right" style="font-weight: normal;">openaire</span>
<input tabindex="0" type="checkbox" formControlName="openaire">
</label>
</div>
<div class="form-group uk-grid uk-margin-remove-top">
<label class="uk-width-2-3">Select if this page exists in connect portals</label>
<label class="uk-width-2-3">Select if this page exists in OpenAIRE Connect portal</label>
<label class="uk-width-1-3 checkbox">
<span style="font-weight: normal;">connect</span>
<span class="uk-margin-small-right" style="font-weight: normal;">connect</span>
<input tabindex="0" type="checkbox" formControlName="connect">
</label>
</div>
@ -64,7 +64,7 @@
<div class="form-group uk-grid uk-margin-remove-top">
<label class="uk-width-2-3">Select if this page exists in connect portals (community specific)</label>
<label class="uk-width-1-3 checkbox">
<span style="font-weight: normal;">communities</span>
<span class="uk-margin-small-right" style="font-weight: normal;">communities</span>
<input tabindex="0" type="checkbox" formControlName="communities">
</label>
</div>

View File

@ -3,11 +3,12 @@ import {RouterModule} from '@angular/router';
import {IsCommunity} from '../../openaireLibrary/connect/communityGuard/isCommunity.guard';
import {ConnectAdminLoginGuard} from '../../openaireLibrary/connect/communityGuard/connectAdminLoginGuard.guard';
import {PagesComponent} from './pages.component';
import {IsCommunityOrAdmin} from '../../openaireLibrary/connect/communityGuard/isCommunityOrAdmin';
@NgModule({
imports: [
RouterModule.forChild([
{ path: '', canActivate: [IsCommunity, ConnectAdminLoginGuard], component: PagesComponent}
{ path: '', canActivate: [IsCommunityOrAdmin, ConnectAdminLoginGuard], component: PagesComponent}
])
]
})

View File

@ -14,8 +14,8 @@
<ul class="uk-nav uk-nav-dropdown"
[attr.uk-tooltip]="getSelectedPages().length == 0 ? 'pos:left; cls: uk-active' : 'cls: uk-invisible'"
title="Select at least one page">
<li><a [class]="getSelectedPages().length == 0 ? 'uk-disabled' : ''" (click)="togglePages(true, getSelectedPages())"><i></i> Activate </a></li>
<li><a [class]="getSelectedPages().length == 0 ? 'uk-disabled' : ''" (click)="togglePages(false, getSelectedPages())"><i></i> Deactivate </a></li>
<li *ngIf="!isPortalAdministrator"><a [class]="getSelectedPages().length == 0 ? 'uk-disabled' : ''" (click)="togglePages(true, getSelectedPages())"><i></i> Activate </a></li>
<li *ngIf="!isPortalAdministrator"><a [class]="getSelectedPages().length == 0 ? 'uk-disabled' : ''" (click)="togglePages(false, getSelectedPages())"><i></i> Deactivate </a></li>
<li *ngIf="isPortalAdministrator"><a (click)="confirmDeleteSelectedPages()"><i></i> Delete </a></li>
</ul>
</div>
@ -40,7 +40,7 @@
<div class="contentPanel uk-margin-top">
<div class="uk-alert uk-alert-primary uk-margin-top-large">
<div *ngIf="!isPortalAdministrator" class="uk-alert uk-alert-primary uk-margin-top-large">
<div>
<span class="uk-margin-small-right uk-icon" uk-icon="warning"></span>
Disable a page to hide it from community dashboard portal. </div>
@ -53,28 +53,19 @@
<div class="gwt-HTML">
<div class="users-list"> <!--"row" class removed"-->
<div class="col-md-12">
<!-- <div class="filters marginBottom20">
<div class="links form-group form-inline">
<span>Filter by community:</span>
<select class="uk-select uk-width-medium" (change)="filterByCommunity($event)">
<option *ngFor="let community of communities" value="{{community.pid}}">{{community.name}}</option>
</select>
</div>
</div> -->
<table class="uk-table uk-table-striped">
<thead>
<tr>
<th><input id="allPageCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)"></th>
<th>Name</th>
<th>Change status</th>
<th *ngIf="!isPortalAdministrator">Change status</th>
<th *ngIf="!pagesType">Type</th>
<th>Related Entities</th>
<th *ngIf="!isPortalAdministrator">Related Entities</th>
<th>Route</th>
<th *ngIf="isPortalAdministrator" >Actions</th>
<th *ngIf="!pagesType || (pagesType!='other' && pagesType!='html')" class="uk-text-center">Page help texts</th>
<th *ngIf="pageWithDivIds && pageWithDivIds.length > 0" class="uk-text-center">Class help texts</th>
<th *ngIf="!pagesType || pagesType=='html'" class="uk-text-center">Html Content</th>
<th *ngIf="!isPortalAdministrator && (!pagesType || (pagesType!='other' && pagesType!='html'))" class="uk-text-center">Page help texts</th>
<th *ngIf="!isPortalAdministrator && (pageWithDivIds && pageWithDivIds.length > 0)" class="uk-text-center">Class help texts</th>
<th *ngIf="!isPortalAdministrator && (!pagesType || pagesType=='html')" class="uk-text-center">Html Content</th>
</tr>
</thead>
<tbody >
@ -85,14 +76,14 @@
<td>
<div class="name" href="#">{{check.page.name}}</div>
</td>
<td>
<td *ngIf="!isPortalAdministrator">
<mat-slide-toggle [checked]="check.page.isEnabled"
(change)="($event.source.checked = check.page.isEnabled);togglePages(!check.page.isEnabled,[check.page._id])"></mat-slide-toggle>
</td>
<td *ngIf="!pagesType">
<div class="type" href="#">{{check.page.type}}</div>
</td>
<td>
<td *ngIf="!isPortalAdministrator">
<div class="entities" href="#">
<span *ngFor="let entity of check.page.entities let i=index">{{entity.name}}<span *ngIf="i<(check.page.entities.length-1)">, </span></span>
</div>
@ -103,19 +94,19 @@
<td *ngIf="isPortalAdministrator" >
<div class="actions" href="#">
<input title="Edit" src="assets/imgs/icn_edit.png" class="edit" type="image" (click)="editPage(i)">
<input title="Edit" src="assets/imgs/icn_edit.png" class="edit uk-margin-small-right" type="image" (click)="editPage(i)">
<input title="Delete" src="assets/imgs/icn_trash.png" class="delete" type="image" (click)="confirmDeletePage(check.page._id)">
</div>
</td>
<td *ngIf="!pagesType || (pagesType!='other' && pagesType!='html')" class="uk-text-center">
<td *ngIf="!isPortalAdministrator && (!pagesType || (pagesType!='other' && pagesType!='html'))" class="uk-text-center">
<a *ngIf="check.page.type != 'html' && check.page.type != 'other'" class="helpContents" [queryParams]="{communityId: selectedCommunityPid, pageId: check.page._id}" routerLink="/pageContents">add page contents</a>
<span *ngIf="check.page.type == 'html' || check.page.type == 'other'">-</span>
</td>
<td *ngIf="pageWithDivIds && pageWithDivIds.length > 0" class="uk-text-center">
<td *ngIf="!isPortalAdministrator && (pageWithDivIds && pageWithDivIds.length > 0)" class="uk-text-center">
<a *ngIf="pageWithDivIds.includes(check.page._id)" class="classHelpContents" [queryParams]="{communityId: selectedCommunityPid, pageId: check.page._id}" routerLink="/classContents">add class contents</a>
<span *ngIf="!pageWithDivIds.includes(check.page._id)">-</span>
</td>
<td *ngIf="!pagesType || pagesType=='html'" class="uk-text-center">
<td *ngIf="!isPortalAdministrator && (!pagesType || pagesType=='html')" class="uk-text-center">
<a *ngIf="check.page.type == 'html'" class="htmlContents" [queryParams]="{communityId: selectedCommunityPid, pageId: check.page._id}" routerLink="/htmlPageContent/edit">edit html contents</a>
<span *ngIf="check.page.type != 'html'">-</span>
</td>

View File

@ -72,7 +72,7 @@ export class PagesComponent implements OnInit {
this.selectedCommunityPid = params['communityId'];
this.applyCommunityFilter(this.selectedCommunityPid);
this.isPortalAdministrator = Session.isPortalAdministrator();
this.isPortalAdministrator = Session.isPortalAdministrator() && !this.selectedCommunityPid;
//this.getCommunities();
});
@ -95,17 +95,27 @@ export class PagesComponent implements OnInit {
if(this.pagesType) {
parameters = "?page_type="+this.pagesType;
}
this._helpContentService.getCommunityPages(community_pid, parameters, this.properties.adminToolsAPIURL).subscribe(
if(community_pid) {
this._helpContentService.getCommunityPages(community_pid, parameters, this.properties.adminToolsAPIURL).subscribe(
pages => {
this.pagesReturned(pages);
//if(!this.pagesType || this.pagesType == "link") {
this.getPagesWithDivIds(community_pid);
this.getPagesWithDivIds(community_pid);
//} else {
//this.showLoading = false;
//this.showLoading = false;
//}
},
error => this.handleError('System error retrieving pages', error)
);
);
} else {
this._helpContentService.getPages(this.properties.adminToolsAPIURL, null).subscribe(
pages => {
this.pagesReturned(pages);
this.showLoading = false;
},
error => this.handleError('System error retrieving pages', error)
);
}
}
}
@ -128,6 +138,7 @@ export class PagesComponent implements OnInit {
if(pages) {
pages.forEach(_ => {
console.log(_);
this.checkboxes.push(<CheckPage>{page : _, checked : false});
});
}

View File

@ -1,7 +1,6 @@
import { NgModule } from '@angular/core';
import {RouterModule} from '@angular/router';
import {CommonModule} from '@angular/common';
import {IsCommunity} from '../../openaireLibrary/connect/communityGuard/isCommunity.guard';
import {ConnectAdminLoginGuard} from '../../openaireLibrary/connect/communityGuard/connectAdminLoginGuard.guard';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {FABModule} from '../../utils/fabModule.module';
@ -10,6 +9,7 @@ import {PagesComponent} from './pages.component';
import {PageFormComponent} from './page-form.component';
import {PagesRoutingModule} from './pages-routing.module';
import {MatSlideToggleModule} from '@angular/material';
import {IsCommunityOrAdmin} from '../../openaireLibrary/connect/communityGuard/isCommunityOrAdmin';
@NgModule({
imports: [
@ -17,7 +17,7 @@ import {MatSlideToggleModule} from '@angular/material';
AlertModalModule, ReactiveFormsModule, PagesRoutingModule, MatSlideToggleModule
],
declarations: [PagesComponent, PageFormComponent],
providers: [IsCommunity, ConnectAdminLoginGuard],
providers: [IsCommunityOrAdmin, ConnectAdminLoginGuard],
exports: [PagesComponent]
})
export class PagesModule { }