Use new base components and adjust irish configuration.
This commit is contained in:
parent
dfa7c2a8c2
commit
a7114a39b0
|
@ -1,28 +1,47 @@
|
|||
import {Component, OnInit} from "@angular/core";
|
||||
import {BaseComponent} from "../openaireLibrary/sharedComponents/base/base.component";
|
||||
import {ChangeDetectorRef, Component, OnInit} from "@angular/core";
|
||||
import {StakeholderService} from "../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {SidebarBaseComponent} from "../openaireLibrary/dashboard/sharedComponents/sidebar/sidebar-base.component";
|
||||
import {LayoutService} from "../openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
|
||||
import {Stakeholder} from "../openaireLibrary/monitor/entities/stakeholder";
|
||||
import {MenuItem} from "../openaireLibrary/sharedComponents/menu";
|
||||
|
||||
@Component({
|
||||
selector: 'admin',
|
||||
template: `
|
||||
<router-outlet></router-outlet>
|
||||
<div class="sidebar_main_swipe uk-flex uk-background-default"
|
||||
[class.sidebar_main_active]="open && (hasSidebar || hasInternalSidebar)"
|
||||
[class.sidebar_mini]="!open && (hasSidebar || hasInternalSidebar)"
|
||||
[class.sidebar_hover]="hover">
|
||||
<dashboard-sidebar *ngIf="hasSidebar && !hasInternalSidebar && sideBarItems.length > 0" [items]="sideBarItems" [backItem]="backItem"></dashboard-sidebar>
|
||||
<div class="uk-width-1-1">
|
||||
<router-outlet></router-outlet>
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
})
|
||||
export class AdminComponent extends BaseComponent implements OnInit {
|
||||
export class AdminComponent extends SidebarBaseComponent implements OnInit {
|
||||
stakeholder: Stakeholder;
|
||||
|
||||
constructor(protected _route: ActivatedRoute,
|
||||
private stakeholderService: StakeholderService,
|
||||
protected _router: Router) {
|
||||
super()
|
||||
protected _router: Router,
|
||||
protected layoutService: LayoutService,
|
||||
protected cdr: ChangeDetectorRef,
|
||||
private stakeholderService: StakeholderService) {
|
||||
super();
|
||||
this.initRouterParams(this._route);
|
||||
}
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
super.ngOnInit();
|
||||
this.subscriptions.push(this.params.subscribe(params => {
|
||||
this.sideBarItems = [];
|
||||
if(params['alias']) {
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholder(params['alias']).subscribe());
|
||||
this.subscriptions.push(this.stakeholderService.getStakeholder(params['alias']).subscribe(stakeholder => {
|
||||
this.stakeholder = stakeholder;
|
||||
this.sideBarItems.push(new MenuItem("general", "General", "", "/admin/" + this.stakeholder.alias, false, [], [], {}, {name: 'badge'}));
|
||||
this.sideBarItems.push(new MenuItem("indicators", "Indicators", "", "/admin/" + this.stakeholder.alias + '/indicators', false, [], [], {}, {name: 'bar_chart'}, null, "uk-visible@m"));
|
||||
}));
|
||||
} else {
|
||||
this.stakeholderService.setStakeholder(null);
|
||||
}
|
||||
|
|
|
@ -2,17 +2,34 @@ import {NgModule} from "@angular/core";
|
|||
import {CommonModule} from "@angular/common";
|
||||
import {RouterModule} from "@angular/router";
|
||||
import {AdminComponent} from "./admin.component";
|
||||
import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
|
||||
import {SideBarModule} from "../openaireLibrary/dashboard/sharedComponents/sidebar/sideBar.module";
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule, RouterModule.forChild([
|
||||
{path: '', component: AdminComponent, children: [
|
||||
{path: '', loadChildren: () => import('../openaireLibrary/monitor-admin/manageStakeholders/manageStakeholders.module').then(m => m.ManageStakeholdersModule)},
|
||||
{path: ':alias', children: [
|
||||
{path: '', loadChildren: () => import('../openaireLibrary/monitor-admin/general/general.module').then(m => m.GeneralModule)}
|
||||
{
|
||||
path: '', component: AdminComponent, children: [
|
||||
{
|
||||
path: '',
|
||||
loadChildren: () => import('../openaireLibrary/monitor-admin/manageStakeholders/manageStakeholders.module').then(m => m.ManageStakeholdersModule)
|
||||
},
|
||||
{
|
||||
path: ':alias', children: [
|
||||
{
|
||||
path: '',
|
||||
loadChildren: () => import('../openaireLibrary/monitor-admin/general/general.module').then(m => m.GeneralModule)
|
||||
},
|
||||
{
|
||||
matcher: HelperFunctions.routingMatcher(['indicators', 'indicators/:topic']),
|
||||
loadChildren: () => import('../openaireLibrary/monitor-admin/topic/topic.module').then(m => m.TopicModule),
|
||||
data: {hasInternalSidebar: true},
|
||||
pathMatch: 'full'
|
||||
},
|
||||
]
|
||||
}
|
||||
]}
|
||||
])],
|
||||
]
|
||||
}
|
||||
]), SideBarModule],
|
||||
declarations: [AdminComponent],
|
||||
exports: [AdminComponent]
|
||||
})
|
||||
|
|
|
@ -2,13 +2,13 @@ import {Component, OnInit} from '@angular/core';
|
|||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {MenuItem} from "./openaireLibrary/sharedComponents/menu";
|
||||
import {Header} from "./openaireLibrary/sharedComponents/navigationBar.component";
|
||||
import {BaseComponent} from "./openaireLibrary/sharedComponents/base/base.component";
|
||||
import {StakeholderEntities} from "./openaireLibrary/monitor/entities/stakeholder";
|
||||
import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service";
|
||||
import {Irish} from "./shared/irish";
|
||||
import {CustomFilterService} from "./shared/customFilter.service";
|
||||
import {UserManagementService} from "./openaireLibrary/services/user-management.service";
|
||||
import {User} from "./openaireLibrary/login/utils/helper.class";
|
||||
import {SmoothScroll} from "./openaireLibrary/utils/smooth-scroll";
|
||||
import {StakeholderBaseComponent} from "./openaireLibrary/monitor-admin/utils/stakeholder-base.component";
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
|
@ -19,26 +19,17 @@ import {User} from "./openaireLibrary/login/utils/helper.class";
|
|||
<div *ngIf="!loading">
|
||||
<div>
|
||||
<div id="modal-container"></div>
|
||||
<navbar *ngIf="hasHeader" portal="irish_monitor" [menuItems]="menuItems" [showMenu]="true" [header]="header" [user]="user" [userMenuItems]="[]"></navbar>
|
||||
<div class="sidebar_main_swipe">
|
||||
<main>
|
||||
<router-outlet></router-outlet>
|
||||
</main>
|
||||
<bottom id="bottom" [centered]="true" [properties]="properties" [showMenuItems]="true"></bottom>
|
||||
</div>
|
||||
<div *ngIf="view" class="preview uk-text-small uk-flex uk-flex-middle">
|
||||
<span>You are currently in a <span class="uk-text-bold">"Preview"</span> mode. <span class="uk-visible@m"><a (click)="removeView()">The current view</a> of this dashboard may differ.</span></span>
|
||||
</div>
|
||||
<navbar *ngIf="hasHeader" portal="irish_monitor" [menuItems]="menuItems" [showMenu]="true"
|
||||
[header]="header" [user]="user" [userMenuItems]="[]"></navbar>
|
||||
<main>
|
||||
<router-outlet></router-outlet>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
`,
|
||||
styles: []
|
||||
`
|
||||
})
|
||||
export class AppComponent extends BaseComponent implements OnInit {
|
||||
title = 'irish-monitor';
|
||||
export class AppComponent extends StakeholderBaseComponent implements OnInit {
|
||||
loading: boolean = false;
|
||||
stakeholderEntities = StakeholderEntities;
|
||||
view: boolean = false;
|
||||
hasHeader: boolean = true;
|
||||
header: Header = {
|
||||
route: "/",
|
||||
|
@ -54,19 +45,18 @@ export class AppComponent extends BaseComponent implements OnInit {
|
|||
|
||||
constructor(protected _route: ActivatedRoute,
|
||||
protected _router: Router,
|
||||
private smoothScroll: SmoothScroll,
|
||||
private configurationService: ConfigurationService, private customFilterService:CustomFilterService,
|
||||
private userManagementService: UserManagementService) {
|
||||
super();
|
||||
this.configurationService.initStaticPortal(this.irish.portal);
|
||||
//Test track event
|
||||
// let json = {test: "json"}
|
||||
// this._piwikService.doTrackEvent(properties,"test", properties.piwikSiteId,location.href,"Linking", "Link", JSON.stringify(json) )
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
super.ngOnDestroy();
|
||||
this.customFilterService.clearSubscriptions();
|
||||
this.configurationService.clearSubscriptions()
|
||||
this.configurationService.clearSubscriptions();
|
||||
this.smoothScroll.clearSubscriptions();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
@ -78,16 +68,12 @@ export class AppComponent extends BaseComponent implements OnInit {
|
|||
|
||||
initialize() {
|
||||
this.menuItems = [
|
||||
new MenuItem("national", this.stakeholderEntities.COUNTRY + ' ' + this.stakeholderEntities.STAKEHOLDER, "", "/", false, [], null, {}, null, null, null, null),
|
||||
new MenuItem("rpo", this.stakeholderEntities.ORGANIZATION + ' ' + this.stakeholderEntities.STAKEHOLDERS, "", "/rpo", false, [], null, {}, null, null, null, null),
|
||||
new MenuItem("rfo", this.stakeholderEntities.FUNDER + ' ' + this.stakeholderEntities.STAKEHOLDERS, "", "/rfo", false, [], null, {}, null, null, null, null),
|
||||
new MenuItem("national", this.stakeholderUtils.entities.country + ' ' + this.stakeholderUtils.entities.stakeholders, "", "/", false, [], null, {}, null, null, null, null),
|
||||
new MenuItem("rpo", this.stakeholderUtils.entities.organization + ' ' + this.stakeholderUtils.entities.stakeholders, "", "/rpo", false, [], null, {}, null, null, null, null),
|
||||
new MenuItem("rfo", this.stakeholderUtils.entities.funder + ' ' + this.stakeholderUtils.entities.stakeholders, "", "/rfo", false, [], null, {}, null, null, null, null),
|
||||
new MenuItem("researcher", "Researcher Monitors", "", "/researcher", false, [], null, {}, null, null, null, null),
|
||||
new MenuItem("repository", "Repository Monitors", "", "/", false, [], null, {}, null, null, null, null),
|
||||
new MenuItem("upload-dois", "Upload DOIs", "", "/upload-dois", false, [], null, {}, null, null, null, null)
|
||||
];
|
||||
}
|
||||
|
||||
public removeView() {
|
||||
this._router.navigate([], {relativeTo: this._route});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 50a8d53221bab7f5cdadcec66d22032ac048281c
|
||||
Subproject commit e80f73f9a9ceb65bff5b326e5b187b943415d7ad
|
|
@ -6,7 +6,7 @@
|
|||
<ng-container *ngIf="!showLoading && stakeholders?.length">
|
||||
<div class="uk-flex uk-flex-middle uk-flex-center uk-position-relative">
|
||||
<div search-input [searchControl]="keywordControl" searchInputClass="border-bottom" iconPosition="left"
|
||||
placeholder="Search for {{typeAsLabel}} {{entities.STAKEHOLDERS}}" [disabled]="showLoading" class="uk-width-1-2@m uk-width-1-1">
|
||||
placeholder="Search for {{typeAsLabel}} {{entities.stakeholders}}" [disabled]="showLoading" class="uk-width-1-2@m uk-width-1-1">
|
||||
</div>
|
||||
<div class="uk-flex uk-flex-middle uk-position-right">
|
||||
<a (click)="gridView = true" [ngClass]="gridView ? 'active' : ''" class="uk-link-reset uk-margin-small-right">Grid</a>
|
||||
|
@ -38,7 +38,7 @@
|
|||
</div>
|
||||
<div class="uk-margin-large-top" id="target">
|
||||
<div *ngIf="!filteredStakeholders || filteredStakeholders?.length == 0" class="uk-text-center">
|
||||
No {{entities.STAKEHOLDERS}} available
|
||||
No {{entities.stakeholders}} available
|
||||
</div>
|
||||
<!-- STAKEHOLDERS -->
|
||||
<!-- Grid view -->
|
||||
|
|
|
@ -1,22 +1,19 @@
|
|||
import {ChangeDetectorRef, Component, OnInit} from "@angular/core";
|
||||
import {ActivatedRoute, Router} from "@angular/router";
|
||||
import {Stakeholder, StakeholderEntities, StakeholderType} from "../../openaireLibrary/monitor/entities/stakeholder";
|
||||
import {BaseComponent} from "../../openaireLibrary/sharedComponents/base/base.component";
|
||||
import {Stakeholder, StakeholderType} from "../../openaireLibrary/monitor/entities/stakeholder";
|
||||
import {StakeholderService} from "../../openaireLibrary/monitor/services/stakeholder.service";
|
||||
import {Option} from "../../openaireLibrary/sharedComponents/input/input.component";
|
||||
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
|
||||
import {LayoutService} from "src/app/openaireLibrary/dashboard/sharedComponents/sidebar/layout.service";
|
||||
import {FormBuilder, FormControl} from "@angular/forms";
|
||||
import {debounceTime, distinctUntilChanged} from "rxjs/operators";
|
||||
import {StakeholderUtils} from "src/app/openaireLibrary/monitor-admin/utils/indicator-utils";
|
||||
import {StakeholderBaseComponent} from "../../openaireLibrary/monitor-admin/utils/stakeholder-base.component";
|
||||
|
||||
@Component({
|
||||
selector: 'browse-stakeholder',
|
||||
templateUrl: `browse-stakeholder.component.html`
|
||||
})
|
||||
export class BrowseStakeholderComponent extends BaseComponent implements OnInit {
|
||||
entities = StakeholderEntities;
|
||||
stakeholderUtils: StakeholderUtils = new StakeholderUtils();
|
||||
export class BrowseStakeholderComponent extends StakeholderBaseComponent implements OnInit {
|
||||
stakeholderType: StakeholderType;
|
||||
stakeholders: Stakeholder[] = [];
|
||||
filteredStakeholders: Stakeholder[] = [];
|
||||
|
@ -32,9 +29,9 @@ export class BrowseStakeholderComponent extends BaseComponent implements OnInit
|
|||
pageSize: number = 10;
|
||||
keywordControl: FormControl;
|
||||
|
||||
constructor(private route: ActivatedRoute,
|
||||
private stakeholderService: StakeholderService,
|
||||
constructor(protected _route: ActivatedRoute,
|
||||
protected _router: Router,
|
||||
private stakeholderService: StakeholderService,
|
||||
private layoutService: LayoutService,
|
||||
private cdr: ChangeDetectorRef,
|
||||
private fb: FormBuilder) {
|
||||
|
@ -51,7 +48,7 @@ export class BrowseStakeholderComponent extends BaseComponent implements OnInit
|
|||
{value: 'alphDsc', label: 'Alphabetically Dsc. (Z-A)'},
|
||||
{value: 'oaDsc', label: '"Open Access %" Dsc.'}
|
||||
];
|
||||
this.stakeholderType = this.route.snapshot.data.type;
|
||||
this.stakeholderType = this._route.snapshot.data.type;
|
||||
if(!this.stakeholderType) {
|
||||
this.navigateToError();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {StakeholderEntities, stakeholderTypes} from "../openaireLibrary/monitor/entities/stakeholder";
|
||||
import {Portal} from "../openaireLibrary/utils/entities/adminTool/portal";
|
||||
import {StakeholderConfiguration} from "../openaireLibrary/monitor-admin/utils/indicator-utils";
|
||||
|
||||
export class Irish {
|
||||
public static METADATA_PREFIX = 'NOAMI | ';
|
||||
|
@ -7,19 +7,27 @@ export class Irish {
|
|||
public portal: Portal = Portal.getMockCommunityInfo("noami", "Noami",[],[]);
|
||||
|
||||
constructor() {
|
||||
(StakeholderEntities as any)['STAKEHOLDER'] = 'Monitor';
|
||||
(StakeholderEntities as any)['STAKEHOLDERS'] = 'Monitors';
|
||||
(StakeholderEntities as any)['FUNDER'] = 'RFO';
|
||||
(StakeholderEntities as any)['FUNDERS'] = 'RFOs';
|
||||
(StakeholderEntities as any)['ORGANIZATION'] = 'RPO';
|
||||
(StakeholderEntities as any)['ORGANIZATIONS'] = 'RPOs';
|
||||
StakeholderConfiguration.ENTITIES.stakeholder = 'Monitor';
|
||||
StakeholderConfiguration.ENTITIES.stakeholders = 'Monitors';
|
||||
StakeholderConfiguration.ENTITIES.funder = 'RFO';
|
||||
StakeholderConfiguration.ENTITIES.funders = 'RFOs';
|
||||
StakeholderConfiguration.ENTITIES.organization = 'RPO';
|
||||
StakeholderConfiguration.ENTITIES.organizations = 'RPOs';
|
||||
|
||||
stakeholderTypes.length = 0;
|
||||
stakeholderTypes.push(
|
||||
{value: 'funder', label: StakeholderEntities.FUNDER},
|
||||
{value: 'organization', label: StakeholderEntities.ORGANIZATION},
|
||||
{value: 'country', label: StakeholderEntities.COUNTRY}
|
||||
);
|
||||
StakeholderConfiguration.TYPES = [
|
||||
{value: 'funder', label: StakeholderConfiguration.ENTITIES.funder},
|
||||
{value: 'organization', label: StakeholderConfiguration.ENTITIES.organization},
|
||||
{value: 'country', label: StakeholderConfiguration.ENTITIES.country}
|
||||
]
|
||||
|
||||
StakeholderConfiguration.FUNDER_TYPES = [
|
||||
{value: 'private', label: 'Private'},
|
||||
{value: 'government', label: 'Government'}
|
||||
];
|
||||
|
||||
StakeholderConfiguration.VISIBILITIES = [
|
||||
{icon: 'earth', value: "PUBLIC", label: 'Public'},
|
||||
]
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,11 +10,16 @@ import {common, commonDev} from "../app/openaireLibrary/utils/properties/environ
|
|||
let props: EnvProperties = {
|
||||
monitorServiceAPIURL: "http://duffy.di.uoa.gr:19380/uoa-monitor-service",
|
||||
// monitorServiceAPIURL: "http://duffy.di.uoa.gr:19680/uoa-irish-monitor-service/",
|
||||
monitorStatsFrameUrl:"https://stats.madgik.di.uoa.gr/stats-api/",
|
||||
searchOrcidURL: "https://pub.orcid.org/v3.0/",
|
||||
piwikSiteId: "407",
|
||||
enablePiwikTrack:false,
|
||||
piwikBaseUrl: 'https://beta.analytics.openaire.eu/piwik.php?idsite=',
|
||||
disableFrameLoad: true,
|
||||
adminToolsPortalType: 'irish',
|
||||
adminToolsCommunity: 'irish'
|
||||
}
|
||||
|
||||
export let properties: EnvProperties = {
|
||||
...common, ...commonDev, ...props
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue