[develop | DONE | ADDED] add public logs page
This commit is contained in:
parent
55c4337539
commit
143f1c0ba1
|
@ -53,6 +53,7 @@ const routes: Routes = [
|
|||
},
|
||||
{path: 'orcid', loadChildren: () => import('./orcid/orcid.module').then(m => m.LibOrcidModule)},
|
||||
{path: 'my-orcid-links', loadChildren: () => import('./orcid/my-orcid-links/myOrcidLinks.module').then(m => m.LibMyOrcidLinksModule)},
|
||||
{path: 'public-logs', loadChildren: () => import('./public-logs/public-logs.module').then(m => m.PublicLogsModule)},
|
||||
{path: 'error', component: ErrorPageComponent},
|
||||
{path: '**', pathMatch: 'full', component: ErrorPageComponent}
|
||||
];
|
||||
|
|
|
@ -108,6 +108,8 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit {
|
|||
new MenuItem("rfo", this.stakeholderUtils.entities.funder + ' ' + this.stakeholderUtils.entities.stakeholders, "", "/rfo", false, [], null, {}, null, null, null, "/rfo"),
|
||||
new MenuItem("researcher", "Researcher Monitors", "", "/researcher", false, [], null, {}, null, null, null, "/researcher"),
|
||||
new MenuItem("repository", "Repository Monitors", "", "/repository", false, [], null, {}, null, null, null, "/repository"),
|
||||
new MenuItem("resources", "Resources", "", "", false, [], null, {}, null, null, null,
|
||||
"/resources","_blank", "internal", false, [new MenuItem("public-logs", "Public logs", "", "/public-logs", false, [], null, {}, null, null, null, "/repository")]),
|
||||
];
|
||||
if (this.user) {
|
||||
this.userMenuItems = [];
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
import {NgModule} from "@angular/core";
|
||||
import {RouterModule} from "@angular/router";
|
||||
import {PublicLogsComponent} from "./public-logs.component";
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{
|
||||
path: '',
|
||||
component: PublicLogsComponent
|
||||
}
|
||||
])
|
||||
]
|
||||
})
|
||||
export class PublicLogsRoutingModule {
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
import {Component, OnInit} from '@angular/core';
|
||||
import {BaseComponent} from '../openaireLibrary/sharedComponents/base/base.component';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {SEOService} from '../openaireLibrary/sharedComponents/SEO/SEO.service';
|
||||
import {PiwikService} from '../openaireLibrary/utils/piwik/piwik.service';
|
||||
import {Meta, Title} from '@angular/platform-browser';
|
||||
import {LogService} from "../openaireLibrary/utils/log/log.service";
|
||||
|
||||
@Component({
|
||||
selector: 'public-logs',
|
||||
template: `
|
||||
<div class="uk-container uk-container-large uk-margin-top">
|
||||
<h3>Public logs</h3>
|
||||
<ng-container *ngIf="allLogs">
|
||||
<ul class="uk-tab " uk-switcher>
|
||||
<li><a href="#">Linking</a></li>
|
||||
<li><a href="#">ORCID Claim</a></li>
|
||||
<li><a href="#">Upload DOIs</a></li>
|
||||
<li><a href="#">OpenOrgs</a></li>
|
||||
<li><a href="#"> Web stats from Matomo</a></li>
|
||||
</ul>
|
||||
<ul class="uk-switcher uk-margin">
|
||||
<li>
|
||||
<ng-container *ngTemplateOutlet="formattedLogs; context: { logs: claimsLogs}"></ng-container>
|
||||
<a [href]="properties.logServiceUrl + 'prettyLog'" target="_blank">View all logs</a> <a [href]="properties.logServiceUrl + 'log'" target="_blank">[json]</a>
|
||||
</li>
|
||||
<li>
|
||||
<ng-container *ngTemplateOutlet="formattedLogs; context: { logs: orcidClaimsLogs}"></ng-container>
|
||||
<a [href]="properties.logServiceUrl + 'prettyLog'" target="_blank">View all logs</a> <a [href]="properties.logServiceUrl + 'log'" target="_blank">[json]</a>
|
||||
</li>
|
||||
<li>
|
||||
<ng-container *ngTemplateOutlet="formattedLogs; context: { logs: uploadDoisLogs}"></ng-container>
|
||||
<a [href]="properties.logServiceUrl + 'prettyLog'" target="_blank">View all logs</a> <a [href]="properties.logServiceUrl + 'log'" target="_blank">[json]</a>
|
||||
</li>
|
||||
<li>Bazinga!
|
||||
<br>
|
||||
<a href="https://beta.orgs.openaire.eu/public-api/logs/IE/0/50" target="_blank"> View OpenOrgs logs</a>
|
||||
</li>
|
||||
<li>Bazinga!
|
||||
<br>
|
||||
<a target="_blank" href="https://beta.analytics.openaire.eu/index.php?apiAction=get&apiModule=API&date=2022-01-01,2023-12-31&expanded=1&filter_limit=-1&force_api_session=1&format=JSON&format_metrics=1&idSite=407&method=API.getProcessedReport&module=API&period=month&token_auth=anonymous"> View Matomo logs</a>
|
||||
</li>
|
||||
</ul>
|
||||
</ng-container>
|
||||
</div>
|
||||
<ng-template #formattedLogs let-logs="logs">
|
||||
<div class="uk-text-meta "> Viewing last {{logs.length}} actions.</div>
|
||||
<div *ngFor="let log of logs">
|
||||
On {{log.date | date: 'd/M/yyyy, hh:mm':'GMT' }} {{log.message}}
|
||||
</div>
|
||||
|
||||
</ng-template>
|
||||
|
||||
`
|
||||
})
|
||||
export class PublicLogsComponent extends BaseComponent implements OnInit {
|
||||
allLogs;
|
||||
uploadDoisLogs;
|
||||
claimsLogs;
|
||||
orcidClaimsLogs;
|
||||
constructor(protected _router: Router,
|
||||
protected _route: ActivatedRoute,
|
||||
protected seoService: SEOService,
|
||||
protected _piwikService: PiwikService,
|
||||
protected _title: Title,
|
||||
protected _meta: Meta,
|
||||
private _logService:LogService) {
|
||||
super();
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.title = 'Public logs';
|
||||
this.description = 'Public logs of user actions in OA monitor - Ireland';
|
||||
this.setMetadata();
|
||||
this.subscriptions.push(this._logService.getLogs(this.properties).subscribe(logs => {
|
||||
this.allLogs = logs.slice(logs.length -10 ,logs.length);
|
||||
this.uploadDoisLogs = [];
|
||||
this.claimsLogs = [];
|
||||
this.orcidClaimsLogs = [];
|
||||
for(let i=logs.length; i--; i==0){
|
||||
let log = logs[i];
|
||||
log.date = new Date(log.date);
|
||||
|
||||
if(log.action == 'upload-dois' && this.uploadDoisLogs.length <10){
|
||||
this.uploadDoisLogs.push(log);
|
||||
}else if(log.action == 'link' && this.claimsLogs.length <10){
|
||||
this.claimsLogs.push(log);
|
||||
} else if(log.action == 'orcid-link' && this.orcidClaimsLogs.length <10){
|
||||
this.orcidClaimsLogs.push(log);
|
||||
}
|
||||
}
|
||||
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
import {NgModule} from '@angular/core';
|
||||
import {CommonModule} from '@angular/common';
|
||||
import {PublicLogsComponent} from "./public-logs.component";
|
||||
import {PublicLogsRoutingModule} from "./public-logs-routing.module";
|
||||
import {LogServiceModule} from "../openaireLibrary/utils/log/LogService.module";
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [PublicLogsComponent],
|
||||
imports: [
|
||||
CommonModule, PublicLogsRoutingModule, LogServiceModule
|
||||
|
||||
],
|
||||
})
|
||||
export class PublicLogsModule { }
|
Loading…
Reference in New Issue