From a13fb2eb40247858296b13684936cf168479fc12 Mon Sep 17 00:00:00 2001 From: LSmyrnaios Date: Wed, 15 Nov 2023 12:40:45 +0200 Subject: [PATCH 1/6] Add some information in README, about the "Building", "Deployment" and "Installation" of the project. --- README.md | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 120 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ce0e061e8..8c437b90f 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,124 @@ # UOA Repository Manager UI + + +## Introduction +## Architecture + + + +## Building + +The frontend has been developed and tested using Angular 12. + +#### Manual build + +###### Requirements: +- [Node.js version 16](https://nodejs.org/en/blog/release/v16.16.0) + +###### Build Instructions: +Follow the instructions below to download the source code and build the application. +For more information about building an Angular app you can refer to the official documentation: [Building and serving Angular apps](https://angular.io/guide/build#building-and-serving-angular-apps). + +1. Clone the repository and move inside the directory +
`git clone https://code-repo.d4science.org/MaDgIK/uoa-repository-manager-ui.git && cd uoa-repository-manager-ui` +2. Install Angular dependencies +
`npm install` +3. Build Angular app +
`ng build --configuration production` +
Produces the directory "dist/**uoa-repository-manager-ui**" which contains the compiled files. +
+
+ +## Deployment + +### Prerequisites +- Nginx + +### Instructions +To deploy the Frontend app: +1. Make sure that you have successfully built and installed the application on Nginx (or another Web Server). +2. _Start_ or _reload_ the Web Server service. +
e.g. `systemctl start nginx` or `systemctl reload nginx` + +## Installation + +### Prerequisites +- [Nginx](https://www.nginx.com/) (or another Web Server like [Apache HTTP Server](https://httpd.apache.org/)) + +### Dependencies +[...] + + +
+
+ + +### Installation + +#### Nginx Configuration +You have to create a [Server Block configuration](https://www.nginx.com/resources/wiki/start/topics/examples/server_blocks/) that will point to the directory "dist/**uoa-repository-manager-ui**" created by [building manually](./building.md#manual-build) the webapp. +It must also be configured as a reverse proxy for the Backend Application (to serve it under the path '/api') and for the list of [Dependencies](#dependencies) of the project. + +See the example below: +```nginx +server { + server_name ... + access_log ... + root /path/to/uoa-repository-manager-ui; # the directory of the application + + location / { + try_files $uri$args $uri$args/ /index.html /index.php; + } + + location ~* \.(eot|ttf|woff)$ { + add_header Access-Control-Allow-Origin *; + } + + # reverse proxy configuration for the backend application + location /api { + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_pass ; + proxy_read_timeout 3600; + proxy_send_timeout 3600; + } + + [...] +} +``` + +Lastly, we would advice to validate the configuration of the Nginx to make sure it does not contain errors. +
Execute `nginx -t` with elevated permissions to perform a validation. If the test is successful you can move on to [deploying](./deployment.md#frontend) the application. + +
+
+ +## Configuration + + + + +## Security +## Maintenance +## Recovery +## References + + + + + + + + + +----- +These we auto-generated many years back and may not be correct (for example the Angular-version) + + + This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.8 (Angular version 6.1.10). ## Minimum requirements for installing and building the project @@ -26,7 +145,7 @@ Navigate to the root folder of the server. Copy the contents of the uncompressed dist/uoa-repository-manager-ui folder into the `uoa-repository-manager-dashboard` folder (superuser privileges are normally required for this action).
-## Other topics +## Other topics ### Development server Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
From e9763e2f07d6d6765359b739e0b6d940516ac2fb Mon Sep 17 00:00:00 2001 From: Antonis Lempesis Date: Wed, 15 Nov 2023 12:00:59 +0100 Subject: [PATCH 2/6] Update 'README.md' --- README.md | 49 ++++--------------------------------------------- 1 file changed, 4 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 8c437b90f..edde75b39 100755 --- a/README.md +++ b/README.md @@ -9,11 +9,12 @@ ## Building -The frontend has been developed and tested using Angular 12. +This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.8 (Angular version 6.1.10). -#### Manual build +## Minimum requirements for installing and building the project -###### Requirements: +[Node.js](https://nodejs.org/en/) version 8.x or 10.x.
+[npm client](https://docs.npmjs.com/cli/install) command line interface (it is installed with Node.js by default). - [Node.js version 16](https://nodejs.org/en/blog/release/v16.16.0) ###### Build Instructions: @@ -46,10 +47,6 @@ To deploy the Frontend app: ### Prerequisites - [Nginx](https://www.nginx.com/) (or another Web Server like [Apache HTTP Server](https://httpd.apache.org/)) -### Dependencies -[...] - -

@@ -107,44 +104,6 @@ Lastly, we would advice to validate the configuration of the Nginx to make sure ## References - - - - - - - ------ -These we auto-generated many years back and may not be correct (for example the Angular-version) - - - -This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.8 (Angular version 6.1.10). - -## Minimum requirements for installing and building the project - -[Node.js](https://nodejs.org/en/) version 8.x or 10.x.
-[npm client](https://docs.npmjs.com/cli/install) command line interface (it is installed with Node.js by default). - -## Installing the project - -After checking out (or updating) the repository enter the created folder and run `npm ci`. -This will install the exact versions of the dependencies as mentioned in the `package-lock.json` file (inside the root folder). - -## Build for production - -Run `npm run build` (equivalent of `ng build --prod`) to build the project. The build artifacts will be stored in the `dist/uoa-repository-manager-ui` directory. - -## Deploy project to nginx server - -Run `tar -czvf dist.tar.gz dist/` to generate a compressed `.gz` file containing the built angular folder
-Run `scp dist.tar.gz path/to/server/` to copy the compressed file to the server.
-Connect to server (`ssh user@server.ip.address`).
-Uncompress `dist.tar.gz` file.
-Navigate to the root folder of the server. -Copy the contents of the uncompressed dist/uoa-repository-manager-ui folder -into the `uoa-repository-manager-dashboard` folder (superuser privileges are normally required for this action).
- ## Other topics ### Development server From d57ce31b524e0c082bcbf691fad517bd740f468e Mon Sep 17 00:00:00 2001 From: Antonis Lempesis Date: Wed, 15 Nov 2023 12:01:34 +0100 Subject: [PATCH 3/6] Update 'README.md' --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index edde75b39..e53a49c8b 100755 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.8 (Angular version 6.1.10). -## Minimum requirements for installing and building the project +#### Minimum requirements for installing and building the project [Node.js](https://nodejs.org/en/) version 8.x or 10.x.
[npm client](https://docs.npmjs.com/cli/install) command line interface (it is installed with Node.js by default). From 0c59e9a39cdab547fe8a5ee14dba7c50caee6bf5 Mon Sep 17 00:00:00 2001 From: jBalasis Date: Thu, 21 Dec 2023 14:40:07 +0200 Subject: [PATCH 4/6] fix for redirect url --- src/app/pages/landing/home/home.component.ts | 2 +- src/app/services/auth-guard.service.ts | 13 +++++++++---- src/app/services/authentication.service.ts | 10 +++------- src/app/services/usagestats.service.ts | 2 +- 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/app/pages/landing/home/home.component.ts b/src/app/pages/landing/home/home.component.ts index 8e7607ab2..d4b9dd35e 100755 --- a/src/app/pages/landing/home/home.component.ts +++ b/src/app/pages/landing/home/home.component.ts @@ -53,7 +53,7 @@ export class HomeComponent implements OnInit { if (this.authService.getIsUserLoggedIn()) { this.router.navigate([pageUrl]); } else { - this.authService.redirectUrl = pageUrl; + // this.authService.redirectUrl = pageUrl; this.login(); } } diff --git a/src/app/services/auth-guard.service.ts b/src/app/services/auth-guard.service.ts index 8b9fdbfff..ee23d6241 100755 --- a/src/app/services/auth-guard.service.ts +++ b/src/app/services/auth-guard.service.ts @@ -12,12 +12,17 @@ export class AuthGuardService implements CanActivate, CanLoad { canActivate (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { if ( this.authenticationService.getIsUserLoggedIn() ) { return true; } - /* If no cookie was found, clear the app's session. - The user may have logged out using another OpenAIRE portal */ - sessionStorage.clear(); + // Store the attempted URL for redirecting - sessionStorage.setItem('state.location', state.url); + if (state.url !== '/join') { + /* If no cookie was found, clear the app's session. + The user may have logged out using another OpenAIRE portal */ + sessionStorage.clear(); + this.authenticationService.redirectUrl = state.url; + sessionStorage.setItem('state.location', state.url); + } + console.log('redirect state: ' + sessionStorage.getItem('state.location')); // If we decide that in this case we will send the user back to the aai // this.authenticationService.redirectUrl = state.url; diff --git a/src/app/services/authentication.service.ts b/src/app/services/authentication.service.ts index 428b1cadb..63593e2f4 100755 --- a/src/app/services/authentication.service.ts +++ b/src/app/services/authentication.service.ts @@ -1,5 +1,5 @@ import { Injectable } from '@angular/core'; -import { ActivatedRoute, Router } from '@angular/router'; +import { Router } from '@angular/router'; import { HttpClient } from '@angular/common/http'; import { environment } from '../../environments/environment'; import { deleteCookie, getCookie } from '../domain/utils'; @@ -8,8 +8,7 @@ import { BehaviorSubject } from 'rxjs'; @Injectable() export class AuthenticationService { - constructor(private route: ActivatedRoute, - private router: Router, + constructor(private router: Router, private http: HttpClient) {} private apiUrl: string = environment.API_ENDPOINT; @@ -18,8 +17,6 @@ export class AuthenticationService { // store the URL so we can redirect after logging in public redirectUrl: string; - private _storage: Storage = sessionStorage; - private cookie: string = null; public isLoggedIn_ = new BehaviorSubject(false); @@ -33,7 +30,6 @@ export class AuthenticationService { if (this.redirectUrl) { const url = this.redirectUrl; this.redirectUrl = null; - console.log('stored location', url); sessionStorage.setItem('state.location', url); } else { /*sessionStorage.setItem("state.location", this.router.url);*/ @@ -108,7 +104,7 @@ export class AuthenticationService { sessionStorage.removeItem('state.location'); console.log(`tried to login - returning to state: ${state}`); if ( !this.getIsUserLoggedIn() ) { - // console.log('user hasn\'t logged in yet -- going to home'); + // console.log('user hasn't logged in yet -- redirecting to home'); this.router.navigate(['/home']); } else { this.router.navigate([state]); diff --git a/src/app/services/usagestats.service.ts b/src/app/services/usagestats.service.ts index f05a3f777..d7fefbf18 100755 --- a/src/app/services/usagestats.service.ts +++ b/src/app/services/usagestats.service.ts @@ -23,7 +23,7 @@ export class UsagestatsService { getReportResponse(page: String, pageSize: String, params: URLSearchParams): Observable { const url = `${this.apiUrl}/sushilite/getReportResults/${page}/${pageSize}?${params}`; - console.log(`knocking on: ${url}`); + // console.log(`knocking on: ${url}`); return this.httpClient.get(url, headerOptions); } From 131081f5e8b07e9b1278b5aebf113827a1915d92 Mon Sep 17 00:00:00 2001 From: amantas Date: Wed, 13 Mar 2024 12:49:23 +0200 Subject: [PATCH 5/6] rename sidemenu REPOSITORIES to DATASOURCES --- src/app/shared/sidemenu/sidemenu.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/shared/sidemenu/sidemenu.component.html b/src/app/shared/sidemenu/sidemenu.component.html index 3a7f59420..bb35a0390 100644 --- a/src/app/shared/sidemenu/sidemenu.component.html +++ b/src/app/shared/sidemenu/sidemenu.component.html @@ -61,7 +61,7 @@ -
  • +
  • @@ -82,7 +82,13 @@
    Number of records - {{ aggr.numberOfRecords }} + {{ aggr?.numberOfRecords>=0 ? aggr.numberOfRecords : 'NA' }} +
    +
  • +
  • +
    + Completed Successfully + {{ aggr.completedSuccessfully }}
  • diff --git a/src/app/pages/repository/dashboard/dashboard.component.html b/src/app/pages/repository/dashboard/dashboard.component.html index 30abbcab6..a4e49b35e 100755 --- a/src/app/pages/repository/dashboard/dashboard.component.html +++ b/src/app/pages/repository/dashboard/dashboard.component.html @@ -144,7 +144,7 @@ -
    +
    @@ -153,7 +153,14 @@
    Number of records
    -
    {{ aggr.numberOfRecords | number }}
    +
    {{ aggr?.numberOfRecords>=0 ? aggr.numberOfRecords : 'NA' }}
    +
    +
    + +
    +
    +
    Completed Successfully
    +
    {{ aggr.completedSuccessfully }}