Public logs: update texts, update properties, add matomo logs section, update method to show month list, add method to get matomo report file from

This commit is contained in:
argirok 2024-01-08 13:51:28 +02:00
parent 1e7473eb2e
commit 3c05756cd8
7 changed files with 59 additions and 31 deletions

View File

@ -32,7 +32,16 @@ export function app(): express.Express {
// Example Express Rest API endpoints
// server.get('/api/**', (req, res) => { });
// Serve static files from /browser
server.get('/webstats/:year/:month', (req, res) => {
let today = new Date();
let filename = "oamonitor-"+ req.params['year']+ "-" + req.params['month'] ;
res.setHeader('content-disposition','attachment; filename='+'webstats-'+ req.params['year']+ '_' + req.params['month']+'.json');
let file = " ";
try {
file = readFileSync(properties.matomoLogFilesPath + filename +".json", 'utf-8');
}catch (e){}
res.status(200).send( file);
});
server.get('/public-logs/:year/:month', (req, res) => {
let today = new Date();
let filename = getFileName(req.params['year'], req.params['month'])

View File

@ -52,7 +52,7 @@ const routes: Routes = [
data: {title: Irish.METADATA_PREFIX + ' Admin | ', monitorCurator: true},
canActivateChild: [AdminLoginGuard, HasConsentGuard]
},
{path: 'public-logs', loadChildren: () => import('./public-logs/public-logs.module').then(m => m.PublicLogsModule)},
{path: 'stats-logs', loadChildren: () => import('./public-logs/public-logs.module').then(m => m.PublicLogsModule)},
{path: 'user-policy', loadChildren: () => import('./user-policy/user-policy.module').then(m => m.UserPolicyModule)},
{path: 'participate', loadChildren: () => import('./claims/claims.module').then(m => m.ClaimsModule), canActivate: [HasConsentGuard]},
{

View File

@ -139,7 +139,7 @@ export class AppComponent extends ResearcherBaseComponent implements OnInit {
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, "/public-logs")]),
"/resources","_blank", "internal", false, [new MenuItem("stats-logs", "Web statistics & Activity Logs ", "", "/stats-logs", false, [], null, {}, null, null, null, "/public-logs")]),
];
if (this.user) {
this.userMenuItems = [];

@ -1 +1 @@
Subproject commit f81f5d7bfb17dbaa5fd847926f70792e3631fd31
Subproject commit 9013db4b6bb9e6514e64e8ec3868a79add01dd50

View File

@ -10,31 +10,41 @@ import {LogService} from "../openaireLibrary/utils/log/log.service";
selector: 'public-logs',
template: `
<div class="uk-container uk-container-large uk-margin-top">
<h3>Public logs</h3>
<h3>Web statistics & Activity Logs </h3>
<ul class="uk-tab " uk-switcher>
<li><a href="#">Dashboard</a></li>
<!-- <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>
<li><a href="#">Web statistics</a></li>
<li><a href="#">Monitor logs</a></li>
<li><a href="#">OpenOrgs logs</a></li>
</ul>
<ul class="uk-switcher uk-margin">
<li>
<!-- <ng-container *ngTemplateOutlet="formattedLogs; context: { logs: claimsLogs}"></ng-container>-->
<div>
National Open Access Monitor - Ireland, creates public logs when users uploas dois, claim links to research outputs or claim a research output to their ORCID profile.<br>
</div>
<div>Get monthly logs for Dashboard:</div>
<ul class="uk-list">
<div>Explore analytics detailing the user engagement on the National Monitor. This section offers insights into traffic patterns, visitor demographics, page views, and other key metrics that help understand National Monitor usage and effectiveness.</div>
<div class="uk-alert uk-alert-warning">Current month web statistics will be available at the beginning of next month!</div>
<ul class="uk-list uk-margin-top">
<ng-container *ngFor="let year of years ">
<ng-container *ngFor="let month of months ">
<ng-container *ngIf="(year == today.getFullYear() && month <= today.getMonth()+1 && month >= startDate.getMonth()+1) || (year >startDate.getFullYear() || year < today.getFullYear()) ">
<ng-container *ngIf="show(year, month) ">
<li *ngIf=" !(year == today.getFullYear() && month == today.getMonth()+1)">
<a [href]="properties.logServiceUrl + 'webstats/' + year + '/' + month " target="_blank"> {{month}}/{{year}}</a>
</li>
</ng-container>
</ng-container>
</ng-container>
</ul>
</li>
<li>
<div>
Access monthly logs to see user activities such as uploading DOIs for metadata review, claiming links to ones ORCID profile, and linking research outputs. To understand the specifics of these activities, visit
<a routerLink="/user-actions">User Actions</a>. These logs offer a clear view of user interactions within the open access ecosystem.
</div>
<ul class="uk-list uk-margin-top">
<ng-container *ngFor="let year of years ">
<ng-container *ngFor="let month of months ">
<ng-container *ngIf="show(year, month) ">
<li>
<a [href]="properties.logServiceUrl + 'public-logs/' + year + '/' + month " target="_blank"> {{month}}/{{year}}</a>
</li>
@ -44,12 +54,13 @@ import {LogService} from "../openaireLibrary/utils/log/log.service";
</ul> </li>
<li>
<div>Get monthly logs for OpenOrgs:</div>
<ul class="uk-list">
<div> Review monthly logs from <a [href]="properties.openOrgsUrl" target="_blank">OpenOrgs</a>, focusing on the identification and disambiguation of Irish Research Performing Organisations (RPOs)
within the <a href="https://graph.openaire.eu" target="_blank">OpenAIRE Graph</a>. Access is exclusive to the primary RPO dashboard managers and IReL representatives, ensuring consistent and accurate information management. Each log provides a clear overview of a month's updates and changes in OpenOrgs.
<a routerLink="/contact-us">Contact us</a> if you would like to apply to be a manager for your RPO. </div>
<ul class="uk-list uk-margin-top">
<ng-container *ngFor="let year of years ">
<ng-container *ngFor="let month of months ">
<ng-container *ngIf="(year == today.getFullYear() && month <= today.getMonth()+1 && month >= startDate.getMonth()+1) || (year >startDate.getFullYear() || year < today.getFullYear()) "> <li>
<li>
<ng-container *ngIf="show(year, month) "> <li>
<a [href]="properties.openOrgsUrl + '/public-api/logs/' + year + '/' + month+ '/IE' " target="_blank"> {{month}}/{{year}}</a>
</li>
</ng-container>
@ -57,10 +68,7 @@ import {LogService} from "../openaireLibrary/utils/log/log.service";
</ng-container>
</ul>
</li>
<li>
<div class="uk-alert uk-alert-warning">Coming soon!</div>
<!-- <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>
</div>
@ -90,7 +98,7 @@ export class PublicLogsComponent extends BaseComponent implements OnInit {
protected _meta: Meta,
private _logService:LogService) {
super();
this.startDate.setFullYear(2023,11,1)
this.startDate.setFullYear(2024,0,10)
this.months = Array.from({ length:12 }, (_, index) => 12 - index);
this.years = Array.from({ length:this.today.getFullYear() + 1 - this.startDate.getFullYear() }, (_, index) => this.today.getFullYear() - index);
}
@ -100,4 +108,12 @@ export class PublicLogsComponent extends BaseComponent implements OnInit {
this.description = 'Public logs of user actions in OA monitor - Ireland';
this.setMetadata();
}
show(year, month){
return (year > this.startDate.getFullYear() && year < this.today.getFullYear()) ||
(year == this.startDate.getFullYear() && year < this.today.getFullYear() && month >= this.startDate.getMonth() + 1 ) ||
(year > this.startDate.getFullYear() && year == this.today.getFullYear() && month <= this.today.getMonth() + 1 ) ||
(year == this.startDate.getFullYear() && year == this.today.getFullYear() && month >= this.startDate.getMonth() + 1 && month <= this.today.getMonth()+1 ) ||
( year == this.today.getFullYear() && month < this.today.getMonth()+1 )
}
}

View File

@ -14,6 +14,7 @@ let props: EnvProperties = {
domain: "https://oamonitor.ireland.openaire.eu",
logServiceUrl: "https://oamonitor.ireland.openaire.eu/",
logFilesPath: "/srv/static/nodejs/irish-monitor-action-logs/",
matomoLogFilesPath: "/srv/www/static/oamonitor.ireland.openaire.eu/stats/",
myClaimsLink:"/participate/myclaims",
loginServiceURL: ["https://services.openaire.eu/irish-monitor-service/", <string>commonProd.loginServiceURL],
afterLoginRedirectLink: "/user-policy",

View File

@ -21,6 +21,8 @@ let props: EnvProperties = {
zenodoDumpUrl: "www.example.com/123dump",
logServiceUrl: "http://scoobydoo.di.uoa.gr:4200/",
logFilesPath: "/var/log/irish-log/",
matomoLogFilesPath: "/var/log/irish-log/",
myClaimsLink:"/participate/myclaims",
loginServiceURL: ["http://duffy.di.uoa.gr:19780/irish-monitor-service/", <string>commonDev.loginServiceURL],
afterLoginRedirectLink: "/user-policy",