Add admin component and irish class.

This commit is contained in:
Konstantinos Triantafyllou 2023-11-02 16:39:57 +02:00
parent 2b60f63d3d
commit 30da13b642
8 changed files with 89 additions and 18 deletions

View File

@ -0,0 +1,31 @@
import {Component, OnInit} from "@angular/core";
import {BaseComponent} from "../openaireLibrary/sharedComponents/base/base.component";
import {StakeholderService} from "../openaireLibrary/monitor/services/stakeholder.service";
import {ActivatedRoute, Router} from "@angular/router";
@Component({
selector: 'admin',
template: `
<router-outlet></router-outlet>
`
})
export class AdminComponent extends BaseComponent implements OnInit {
constructor(private route: ActivatedRoute,
private stakeholderService: StakeholderService,
protected _router: Router) {
super()
this.initRouterParams(this.route);
}
ngOnInit() {
this.subscriptions.push(this.params.subscribe(params => {
if(params['alias']) {
this.subscriptions.push(this.stakeholderService.getStakeholder(params['alias']).subscribe());
} else {
this.stakeholderService.setStakeholder(null);
}
}));
}
}

View File

@ -0,0 +1,20 @@
import {NgModule} from "@angular/core";
import {CommonModule} from "@angular/common";
import {RouterModule} from "@angular/router";
import {AdminComponent} from "./admin.component";
@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)}
]}
]}
])],
declarations: [AdminComponent],
exports: [AdminComponent]
})
export class AdminModule {
}

View File

@ -1,5 +1,6 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router'; import { RouterModule, Routes } from '@angular/router';
import {Irish} from "./shared/irish";
const routes: Routes = [ const routes: Routes = [
{ {
@ -23,7 +24,12 @@ const routes: Routes = [
{ {
path: 'upload-dois', path: 'upload-dois',
loadChildren: () => import('./upload-dois/upload-dois.module').then(m => m.UploadDoisModule) loadChildren: () => import('./upload-dois/upload-dois.module').then(m => m.UploadDoisModule)
} },
{
path: 'admin',
loadChildren: () => import('./admin/admin.module').then(m => m.AdminModule),
data: {title: Irish.METADATA_PREFIX + ' Admin | '}
},
]; ];
@NgModule({ @NgModule({

View File

@ -8,6 +8,7 @@ import {StakeholderEntities, stakeholderTypes} from "./openaireLibrary/monitor/e
import {Option} from "./openaireLibrary/sharedComponents/input/input.component"; import {Option} from "./openaireLibrary/sharedComponents/input/input.component";
import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service"; import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service";
import {Portal} from "./openaireLibrary/utils/entities/adminTool/portal"; import {Portal} from "./openaireLibrary/utils/entities/adminTool/portal";
import {Irish} from "./shared/irish";
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
@ -48,11 +49,12 @@ export class AppComponent extends BaseComponent implements OnInit {
badge: true, badge: true,
}; };
menuItems:MenuItem[] = []; menuItems:MenuItem[] = [];
irish: Irish = new Irish();
constructor(private route: ActivatedRoute, constructor(private route: ActivatedRoute,
private router: Router, private configurationService: ConfigurationService) { private router: Router, private configurationService: ConfigurationService) {
super(); super();
configurationService.initStaticPortal(Portal.getMockCommunityInfo("noami", "Noami",[],[])); configurationService.initStaticPortal(this.irish.portal);
//Test track event //Test track event
// let json = {test: "json"} // let json = {test: "json"}
// this._piwikService.doTrackEvent(properties,"test", properties.piwikSiteId,location.href,"Linking", "Link", JSON.stringify(json) ) // this._piwikService.doTrackEvent(properties,"test", properties.piwikSiteId,location.href,"Linking", "Link", JSON.stringify(json) )
@ -64,19 +66,6 @@ export class AppComponent extends BaseComponent implements OnInit {
} }
initialize() { initialize() {
(this.stakeholderEntities as any)['STAKEHOLDER'] = 'Monitor';
(this.stakeholderEntities as any)['STAKEHOLDERS'] = 'Monitors';
(this.stakeholderEntities as any)['FUNDER'] = 'RFO';
(this.stakeholderEntities as any)['FUNDERS'] = 'RFOs';
(this.stakeholderEntities as any)['ORGANIZATION'] = 'RPO';
(this.stakeholderEntities as any)['ORGANIZATIONS'] = 'RFOs';
stakeholderTypes.length = 0;
stakeholderTypes.push(
{value: 'funder', label: StakeholderEntities.FUNDER},
{value: 'organization', label: StakeholderEntities.ORGANIZATION},
{value: 'country', label: StakeholderEntities.COUNTRY});
this.menuItems = [ this.menuItems = [
new MenuItem("national", this.stakeholderEntities.COUNTRY + ' ' + this.stakeholderEntities.STAKEHOLDER, "", "/", false, [], null, {}, null, null, null, null), 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("rpo", this.stakeholderEntities.ORGANIZATION + ' ' + this.stakeholderEntities.STAKEHOLDERS, "", "/rpo", false, [], null, {}, null, null, null, null),

@ -1 +1 @@
Subproject commit 6492211dc364a215f1e422d1ab07d356644c3019 Subproject commit 5cd1e29871b2d76bae08243e65ccf446c5b6e516

25
src/app/shared/irish.ts Normal file
View File

@ -0,0 +1,25 @@
import {StakeholderEntities, stakeholderTypes} from "../openaireLibrary/monitor/entities/stakeholder";
import {Portal} from "../openaireLibrary/utils/entities/adminTool/portal";
export class Irish {
public static METADATA_PREFIX = 'NOAMI | ';
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';
stakeholderTypes.length = 0;
stakeholderTypes.push(
{value: 'funder', label: StakeholderEntities.FUNDER},
{value: 'organization', label: StakeholderEntities.ORGANIZATION},
{value: 'country', label: StakeholderEntities.COUNTRY}
);
}
}

@ -1 +1 @@
Subproject commit d1b2d5e585722751792d12645d17f820cd6a7860 Subproject commit 6bb1e61b059bef1bff3bfb0611b0df46f7840426

@ -1 +1 @@
Subproject commit 2dadcf85926bc0f11fff22ed94dc197ddd8587c6 Subproject commit 5e8c1addb1ebfa508aac8cb9540a755940c95b79