update menu | use guards in routes

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@50608 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2018-02-06 11:35:16 +00:00
parent 44daac0654
commit f062319cbe
8 changed files with 49 additions and 427 deletions

View File

@ -1,4 +1,4 @@
<navbar portal="connect" logoPath="imgs/" onlyTop=true userMenu=true [userMenuItems]=userMenuItems [menuItems]=menuItems [logInUrl]=logInUrl [logOutUrl]=logOutUrl></navbar>
<navbar portal="connect" logoPath="imgs/" onlyTop=true userMenu=true [userMenuItems]=userMenuItems [menuItems]=menuItems [(logInUrl)]=logInUrl [(logOutUrl)]=logOutUrl></navbar>
<!--div class="">
<div class="uk-navbar-left uk-visible@l ">

View File

@ -4,6 +4,7 @@
import { Component } from '@angular/core';
import {Properties} from './utils/properties';
import{MenuItem, RootMenuItem} from 'ng-openaire-library';
@Component({
selector: 'metadata-registry-service',
templateUrl: './app.component.html',
@ -13,20 +14,30 @@ export class AppComponent {
title = 'Metadata Registry Service';
isClient:boolean = false;
userMenuItems = [
{title: "My profile",
url:"",
route:"",
needsAuthorization:false}
];
menuItems = [];
loginUrl = Properties.getLoginURL();
logOutUrl = Properties.getLogoutURL();
userMenuItems:MenuItem[] = [ new MenuItem("","My profile","","",false,[],[],{})];
menuItems:RootMenuItem [] = [];
// menuItems:RootMenuItem [] = [
// {rootItem: new MenuItem("search","Search","","/search/find",false,[],["/search/find"],{}),
// items: [new MenuItem("","Publications","","/search/find/publications",false,["publication"],["/search/find/publications"],{}),
// new MenuItem("","Research Data","","/search/find/datasets",false,["dataset"],["/search/find/datasets"],{}),
// new MenuItem("","Software","","/search/find/software",false,["software"],["/search/find/software"],{}),
// new MenuItem("","Projects","","/search/find/projects/",false,["project"],["/search/find/projects"],{}),
// new MenuItem("","Content Providers","","/search/find/dataproviders",false,["datasource"],["/search/find/dataproviders"],{}),
// new MenuItem("","Organizations","","/search/find/organizations/",false,["organization"],["/search/find/organizations"],{})
// ]}
//
// ];
logInUrl = null;
logOutUrl = null;
constructor( ) {}
ngOnInit() {
this.logInUrl = Properties.getLoginURL();
this.logOutUrl = Properties.getLogoutURL();
console.log("login url "+this.logInUrl)
if (typeof document !== 'undefined') {
try{
this.isClient = true;

View File

@ -39,6 +39,7 @@ import { NewDivHelpContentComponent } from "./pages/divhelpcontent/new-div-help-
import { DivContentFormComponent } from "./pages/divhelpcontent/div-help-content-form.component";
import { EditDivHelpContentComponent } from "./pages/divhelpcontent/edit-div-help-content.component";
import {BottomModule, FeedbackModule, NavigationBarModule, CookieLawModule} from 'ng-openaire-library';
import {FreeGuard, AdminLoginGuard} from 'ng-openaire-library';
//, , ErrorModule CookieLawModule
@NgModule({
@ -87,7 +88,8 @@ import {BottomModule, FeedbackModule, NavigationBarModule, CookieLawModule} from
providers: [
FAQService,
HelpContentService,
appRoutingProviders
appRoutingProviders,
FreeGuard, AdminLoginGuard
],
bootstrap: [ AppComponent ]
})

View File

@ -5,8 +5,6 @@ import { ModuleWithProviders } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { DashboardComponent } from "./dashboard.component";
import { TopicsComponent } from "./pages/faq/topics.components";
import { QuestionsComponent } from "./pages/faq/questions.component";
import { CommunitiesComponent } from './pages/community/communities.component';
import { CommunityEditFormComponent } from "./pages/community/community-edit-form.component";
import { EntitiesComponent } from "./pages/helpcontent/entities.component";
@ -19,6 +17,9 @@ import { DivHelpContentsComponent } from "./pages/divhelpcontent/div-help-conten
import { NewDivHelpContentComponent } from "./pages/divhelpcontent/new-div-help-content.component";
import { EditDivHelpContentComponent } from "./pages/divhelpcontent/edit-div-help-content.component";
import {FreeGuard, AdminLoginGuard} from 'ng-openaire-library';
const appRoutes: Routes = [
{
path: '',
@ -28,26 +29,23 @@ const appRoutes: Routes = [
{
path: 'dashboard',
component: DashboardComponent,
canActivate: [FreeGuard]
},
{
path: 'topics',
component: TopicsComponent,
},
{
path: 'questions',
component: QuestionsComponent,
},
{
path: 'communities',
component: CommunitiesComponent,
canActivate: [FreeGuard]
},
{
path: 'community-edit-form',
component: CommunityEditFormComponent,
canActivate: [FreeGuard]
},
{
path: 'entities',
component: EntitiesComponent,
canActivate: [FreeGuard]
},
{
path: 'classes',
@ -56,20 +54,25 @@ const appRoutes: Routes = [
{
path: 'pages',
component: PagesComponent,
canActivate: [FreeGuard]
},
{
path: 'pageContents',
component: PageHelpContentsComponent,
canActivate: [FreeGuard]
},
{
path: 'pageContents/new',
component: NewPageHelpContentComponent,
canActivate: [FreeGuard]
},
{
//path: 'pageContents/edit/:id',
path: 'pageContents/edit',
component: EditPageHelpContentComponent,
canActivate: [FreeGuard]
},
{
path: 'classContents',
component: DivHelpContentsComponent,
@ -81,8 +84,10 @@ const appRoutes: Routes = [
{
path: 'classContents/edit',
component: EditDivHelpContentComponent,
}
];
},
{ path: '**',pathMatch: 'full',component: DashboardComponent }
];
export const appRoutingProviders: any[] = [
];

View File

@ -82,7 +82,7 @@
<div class="col-sm-1 header hidden-xs"><label><a href="#">Actions</a></label></div>
</div>
<template [ngIf]="checkboxes && checkboxes.length>0">
<ng-template [ngIf]="checkboxes && checkboxes.length>0">
<div *ngFor="let check of checkboxes; let i=index" class="row user">
<div class="col-sm-1 avatar"><input id="{{check.pageHelpContent._id}}" class="checkBox" type="checkbox"
name="pageHelpContentscb[]" value="{{check.pageHelpContent._id}}" [(ngModel)]="check.checked">
@ -119,7 +119,7 @@
</div>
</div>
</div>
</template>
</ng-template>
<div *ngIf="checkboxes.length==0" class="col-md-12">
<div class="alert alert-warning">No page contents found</div>
</div>

View File

@ -60,7 +60,7 @@
<div class="col-sm-1 header hidden-xs"><label><a href="#">Help Contents</a></label></div>
</div>
<template [ngIf]="pagesCheckboxes && pagesCheckboxes.length>0">
<ng-template [ngIf]="pagesCheckboxes && pagesCheckboxes.length>0">
<div *ngFor="let check of pagesCheckboxes; let i=index" class="row user">
<div class="col-sm-1 avatar"><input id="{{check.page._id}}" class="checkBox" type="checkbox"
name="pagescb[]" value="{{check.page._id}}" [(ngModel)]="check.checked">
@ -97,7 +97,7 @@
<a class="helpContents" [queryParams]="{community: selectedCommunityId, page: check.page._id}" routerLink="/pageContents">edit</a>
</div>
</div>
</template>
</ng-template>
<div *ngIf="pagesCheckboxes.length==0" class="col-md-12">
<div class="alert alert-warning">No pages found</div>
</div>

View File

@ -1,364 +1,10 @@
export class Properties {
private static productionMode:boolean = false;
private static enablePiwikTrack:boolean = false;
private static enableHelper:boolean = false;
private static useCache:boolean = true;
//base url
private static baseLink = "https://demo.openaire.eu";
//landing Pages
private static baseSearchLink="/";
private static searchLinkToPublication = "search/publication?articleId=";
private static searchLinkToProject = "search/project?projectId=";
private static searchLinkToDataProvider = "search/dataprovider?datasourceId=";
private static searchLinkToDataset = "search/dataset?datasetId=";
private static searchLinkToOrganization = "search/organization?organizationId=";
//Search pages
private static searchLinkToPublications = "search/find/publications";
private static searchLinkToDataProviders = "search/find/dataproviders";
private static searchLinkToProjects = "search/find/projects";
private static searchLinkToDatasets = "search/find/datasets";
private static searchLinkToSoftware = "search/find/software";
private static searchLinkToOrganizations = "search/find/organizations";
private static searchLinkToPeople = "search/find/people";
public static searchLinkToCompatibleDataProviders = "search/content-providers";
public static searchLinkToCompatibleDataProvidersTable = "search/content-providers-table";
public static searchLinkToEntityRegistriesDataProviders = "search/entity-registries";
public static searchLinkToEntityRegistriesDataProvidersTable = "search/entity-registries-table";
public static searchLinkToJournals = "search/journals";
public static searchLinkToJournalsTable = "search/journals-table";
//Advanced Search for pages
public static searchLinkToAdvancedPublications = "search/advanced/publications";
public static searchLinkToAdvancedProjects = "search/advanced/projects";
public static searchLinkToAdvancedDatasets = "search/advanced/datasets";
public static searchLinkToAdvancedSoftware = "search/advanced/software";
public static searchLinkToAdvancedDataProviders = "search/advanced/dataproviders";
public static searchLinkToAdvancedOrganizations = "search/advanced/organizations";
public static searchLinkToAdvancedPeople = "search/advanced/people";
private static metricsAPIURL = "https://beta.services.openaire.eu/usagestats/";
private static framesAPIURL = "https://beta.openaire.eu/stats3/";
private static loginAPIURL = "http://rudie.di.uoa.gr:8080/dnet%2Dopenaire%2Dusers%2D1.0.0%2DSNAPSHOT/api/users/authenticates"
//"http://scoobydoo.di.uoa.gr:8080/uoa-user-management-1.0.0-SNAPSHOT/api/users/authenticates";
private static loginAPIURL_pm = "https://beta.services.openaire.eu/uoa-user-management/api/users/authenticates";
private static claimsAPIURL = "http://scoobydoo.di.uoa.gr:8080/dnet-claims-service-2.0.0-SNAPSHOT/rest/claimsService/";
private static claimsAPIURL_pm = "https://beta.services.openaire.eu/claims/rest/claimsService/";
private static searchAPIURLLAst_pm = "https://beta.services.openaire.eu/search/v2/api/";
private static searchAPIURLLAst = "https://beta.services.openaire.eu/search/v2/api/";
// private static searchAPIURLLAst = "http://scoobydoo.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";
private static searchResourcesAPIURL_pm = "https://beta.services.openaire.eu/search/v2/api/resources";
private static searchResourcesAPIURL = "https://beta.services.openaire.eu/search/v2/api/resources";
// private static searchResourcesAPIURL = "http://scoobydoo.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/resources";
private static csvAPIURL_pm = "https://beta.services.openaire.eu/search/v2/api/";//publications?format=csv
// private static csvAPIURL = "http://rudie.di.uoa.gr:8080/dnet-functionality-services-2.0.0-SNAPSHOT/rest/v2/api/";//publications?format=csv
private static csvAPIURL = "https://beta.services.openaire.eu/search/v2/api/";//publications?format=csv
private static searchCrossrefAPIURL = "https://api.crossref.org/works";
// private static searchDataciteAPIURL = "https://search.datacite.org/api";
private static searchDataciteAPIURL = "https://api.datacite.org/works";
private static searchOrcidURL = "https://pub.orcid.org/";
// Identifiers
private static pmidURL = "http://www.ncbi.nlm.nih.gov/pubmed/";
private static doiURL = "https://dx.doi.org/";
private static cordisURL = "http://cordis.europa.eu/projects/";
private static pmcURL = "http://europepmc.org/articles/";
private static handleURL = "http://hdl.handle.net/";
// Zenodo's url
private static zenodo = "https://zenodo.org/";
// Open access link
private static openAccess = "https://www.openaire.eu/support/faq#article-id-234";
// Open access repository link
private static openAccessRepo = "https://www.openaire.eu/support/faq#article-id-310";
// FP7 link
private static fp7Guidlines = "https://www.openaire.eu/open-access-in-fp7-seventh-research-framework-programme";
// H2020 link
private static h2020Guidlines = "https://www.openaire.eu/oa-publications/h2020/open-access-in-horizon-2020";
// ERC Guidlines
private static ercGuidlines = "http://erc.europa.eu/sites/default/files/document/file/ERC_Open_Access_Guidelines-revised_2014.pdf";
// helpdesk link
private static helpdesk = "https://www.openaire.eu/support/helpdesk";
private static uploadService_pm = "https://demo.openaire.eu/upload";
private static uploadService = "http://scoobydoo.di.uoa.gr:8000/upload";
private static vocabulariesAPI ="https://beta.services.openaire.eu/provision/mvc/vocabularies/";
private static piwikBaseUrl =" https://analytics.openaire.eu/piwik.php?idsite=6";
private static loginUrl ="http://rudie.di.uoa.gr:8080/dnet-openaire-users-2.0.0-SNAPSHOT/openid_connect_login";
//"http://mpagasas.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/openid_connect_login";
private static productionMode=false;
private static loginUrl ="http://mpagasas.di.uoa.gr:8080/dnet-openaire-users-1.0.0-SNAPSHOT/openid_connect_login";
private static loginUrl_pm ="https://beta.services.openaire.eu/uoa-user-management/openid_connect_login";
private static logoutUrl ="https://aai.openminted.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=";
private static logoutUrl_pm ="https://aai.openminted.eu/proxy/saml2/idp/SingleLogoutService.php?ReturnTo=";
private static logoutOpenaireUrl ="http://dl067.madgik.di.uoa.gr/idp/profile/Logout";
private static logoutOpenaireUrl_pm ="http://dl067.madgik.di.uoa.gr/idp/profile/Logout";
private static cookieDomain =".di.uoa.gr";
private static cookieDomain_pm =".openaire.eu";
private static feedbackmail ="openaire.test@gmail.com";
private static helperPageUrl ="http://scoobydoo.di.uoa.gr:16000/api/page/route";
private static cache ="http://scoobydoo.di.uoa.gr:3000/get?url=";
private static cache_pm ="https://demo.openaire.eu/cache/get?url=";
public static getBaseLink():string{
return this.baseLink;
}
//landing Pages' getters
public static getsearchLinkToPublication():string{
return this.baseSearchLink + this.searchLinkToPublication;
}
public static getsearchLinkToDataset():string{
return this.baseSearchLink + this.searchLinkToDataset;
}
public static getsearchLinkToProject():string{
return this.baseSearchLink + this.searchLinkToProject;
}
public static getsearchLinkToOrganization():string{
return this.searchLinkToOrganization;
}
public static getsearchLinkToDataProvider():string{
return this.searchLinkToDataProvider;
}
//searchPages
public static getLinkToSearchPublications():string{
return this.baseSearchLink + this.searchLinkToPublications;
}
public static getLinkToSearchProjects():string{
return this.baseSearchLink + this.searchLinkToProjects;
}
public static getLinkToSearchDataProviders():string{
return this.baseSearchLink + this.searchLinkToDataProviders;
}
public static getLinkToSearchCompatibleDataProviders():string{
return this.baseSearchLink + this.searchLinkToCompatibleDataProviders;
}
public static getLinkToSearchCompatibleDataProvidersTable():string{
return this.baseSearchLink + this.searchLinkToCompatibleDataProvidersTable;
}
public static getLinkToSearchEntityRegistries():string{
return this.baseSearchLink + this.searchLinkToEntityRegistriesDataProviders;
}
public static getLinkToSearchEntityRegistriesTable():string{
return this.baseSearchLink + this.searchLinkToEntityRegistriesDataProvidersTable;
}
public static getLinkToSearchJournals():string{
return this.baseSearchLink + this.searchLinkToJournals;
}
public static getLinkToSearchJournalsTable():string{
return this.baseSearchLink + this.searchLinkToJournalsTable;
}
public static getLinkToSearchDatasets():string{
return this.baseSearchLink + this.searchLinkToDatasets;
}
public static getLinkToSearchSoftware():string{
return this.baseSearchLink + this.searchLinkToSoftware;
}
public static getLinkToSearchOrganizations():string{
return this.baseSearchLink + this.searchLinkToOrganizations;
}
public static getLinkToSearchPeople():string{
return this.baseSearchLink + this.searchLinkToPeople;
}
//Advanced searchPages
public static getLinkToAdvancedSearchPublications():string{
return this.baseSearchLink + this.searchLinkToAdvancedPublications;
}
public static getLinkToAdvancedSearchProjects():string{
return this.baseSearchLink + this.searchLinkToAdvancedProjects;
}
public static getLinkToAdvancedSearchDataProviders():string{
return this.baseSearchLink + this.searchLinkToAdvancedDataProviders;
}
public static getLinkToAdvancedSearchDatasets():string{
return this.baseSearchLink + this.searchLinkToAdvancedDatasets;
}
public static getLinkToAdvancedSearchSoftware():string{
return this.baseSearchLink + this.searchLinkToAdvancedSoftware;
}
public static getLinkToAdvancedSearchOrganizations():string{
return this.baseSearchLink + this.searchLinkToAdvancedOrganizations;
}
public static getLinkToAdvancedSearchPeople():string{
return this.baseSearchLink + this.searchLinkToAdvancedPeople;
}
// Services - APIs' getters
// public static getSearchAPIURL():string{
// return this.searchAPIURL;
// }
// Services - APIs' getters
public static getCsvAPIURL(): string {
if(this.productionMode){
return this.csvAPIURL_pm;
}else{
return this.csvAPIURL;
}
// return this.csvAPIURL;
}
public static getFramesAPIURL(): string {
return this.framesAPIURL;
}
public static getMetricsAPIURL(): string {
return this.metricsAPIURL;
}
public static getLoginAPIURL(): string {
if(this.productionMode){
return this.loginAPIURL_pm;
}else{
return this.loginAPIURL;
}
// return this.loginAPIURL;
}
public static getSearchAPIURLLast():string{
if(this.productionMode){
return this.searchAPIURLLAst_pm;
}else{
return this.searchAPIURLLAst;
}
// return this.searchAPIURLLAst;
}
//query using full query:
//
public static getSearchResourcesAPIURL():string{
if(this.productionMode){
return this.searchResourcesAPIURL_pm;
}else{
return this.searchResourcesAPIURL;
}
// return this.searchResourcesAPIURL;
}
public static getSearchAPIURLForEntity(entityType:string):string{
var suffix = "";
if(entityType == "project"){
suffix="projects/";
}else if(entityType == "publication"){
suffix="publications/";
}else if(entityType == "dataset"){
suffix="datasets/";
} else if(entityType == "software"){
suffix="software/";
}else if(entityType == "organization"){
suffix="organizations/";
}else if(entityType == "dataprovider"){
suffix="datasources/";
}else if(entityType == "person"){
suffix="people/";
}
return (this.productionMode?this.searchAPIURLLAst_pm:this.searchAPIURLLAst) + suffix;
}
public static getClaimsAPIURL():string{
if(this.productionMode){
return this.claimsAPIURL_pm;
}else{
return this.claimsAPIURL;
}
}
public static getSearchCrossrefAPIURL():string{
return this.searchCrossrefAPIURL;
}
public static getSearchDataciteAPIURL():string{
return this.searchDataciteAPIURL;
}
public static getSearchOrcidURL():string{
return this.searchOrcidURL;
}
// Identifiers' getters
public static getPmidURL():string{
return this.pmidURL;
}
public static getDoiURL():string{
return this.doiURL;
}
public static getCordisURL():string{
return this.cordisURL;
}
public static getPmcURL():string{
return this.pmcURL;
}
public static getHandleURL():string{
return this.handleURL;
}
// Zenodo's getter
public static getZenodoURL():string{
return this.zenodo;
}
// Open access getter
public static getOpenAccess():string{
return this.openAccess;
}
// Open access repository getter
public static getOpenAccessRepo():string{
return this.openAccessRepo;
}
// FP7 link getter
public static getFP7Guidlines():string{
return this.fp7Guidlines;
}
// H2020 link getter
public static getH2020Guidlines():string{
return this.h2020Guidlines;
}
// ERC Guidlines getter
public static getERCGuidlines():string{
return this.ercGuidlines;
}
// helpdesk link getter
public static getHelpdesk():string{
return this.helpdesk;
}
//upload service for bulk claim - upload csv file
public static getUploadServiceUrl():string{
if(this.productionMode){
return this.uploadService_pm;
}else{
return this.uploadService;
}
}
//vocabularies API
public static getVocabulariesAPI():string{
return this.vocabulariesAPI;
}
public static getPiwikBaseURL():string{
return this.piwikBaseUrl;
}
public static isPiwikTrackEnabled():boolean{
return this.enablePiwikTrack;
}
public static getLoginURL():string{
if(this.productionMode){
return this.loginUrl_pm;
@ -373,46 +19,4 @@ export class Properties {
return this.logoutUrl;
}
}
public static getLogoutOpenaireURL():string{
if(this.productionMode){
return this.logoutOpenaireUrl_pm;
}else{
return this.logoutOpenaireUrl;
}
}
public static getCookieDomain():string{
if(this.productionMode){
return this.cookieDomain_pm;
}else{
return this.cookieDomain;
}
}
public static getFeedbackMail():string{
return this.feedbackmail;
}
public static getHelperPageUrl():string{
return this.helperPageUrl;
}
public static isHelperEnabled():boolean{
return this.enableHelper;
}
public static getCacheUrl():string{
if(this.productionMode){
return this.cache_pm;
}else{
return this.cache;
}
}
public static isCacheEnabled():boolean{
return this.useCache;
}
}
export class ErrorCodes {
public LOADING = 0;
public DONE = 1;
public NONE = 2;
public ERROR = 3;
public NOT_AVAILABLE = 4;
public OUT_OF_BOUND = 5;
public NOT_FOUND = 6;
}

View File

@ -9,7 +9,7 @@
"deploy:server": "docker rm -f omtd-platform && docker run --name omtd-platform -d -p 80:80 omtd-platform",
"deploy:complete": "npm run build:docker && npm run deploy:server",
"watch": "npm run build --watch",
"server": "webpack-dev-server --inline --progress --port 3000 --content-base . --disable-host-check --host 0.0.0.0",
"server": "webpack-dev-server --inline --progress --port 3200 --content-base . --disable-host-check --host 0.0.0.0",
"start": "npm run server "
},
"license": "ISC",