Skip to content

Commit

Permalink
Merge branch 'master' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
Johaney-s committed Jan 16, 2023
2 parents 273b1af + 24e20e8 commit ea3f09c
Show file tree
Hide file tree
Showing 200 changed files with 26,620 additions and 12,499 deletions.
33 changes: 23 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,35 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: 16
- name: Cache node modules
uses: actions/cache@v2
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
path: ./node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies and build
run: |
npm ci
npm run build
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache Eslint
uses: actions/cache@v3
with:
path: ./.eslintcache
key: eslintcache-${{github.sha}}
restore-keys: |
eslintcache-
- name: Install Dependencies
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci
- name: Build
run: npm run build
- name: Run Prettier
run: npm run format:check
- name: Run ESLint
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
Expand Down
397 changes: 397 additions & 0 deletions .openapi-generator/templates/api.service.mustache

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# PerunWebApps

This repository contains Perun web applications.
## How to contribute
1) You need to have the Nodejs installed
2) You need to have the Angular CLI installed
3) Fork and clone this repository
## Tools and dependencies
1) Install NVM (Node Version Manager) `curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash` (check [NVM GitHub repository](https://github.com/nvm-sh/nvm) for the newest version)
2) Install NodeJS `nvm install node`
3) Install AngularCLI `npm install -g @angular/cli`
4) Run `npm install`
## Configuration
Further documentation on how to configure the application is [here](https://perunaai.atlassian.net/wiki/external/3440714/ZTRlMzIyY2ZjNzk1NDE3MzhkMzVkZDNmODIwN2UyYmY?atlOrigin=eyJpIjoiZGI5YTc5ZjE4M2ExNDk4YWExNjQ4ZTIyMTU1N2RmZGQiLCJwIjoiYyJ9)
## [Releases](https://github.com/CESNET/perun-web-apps/releases)
3 changes: 0 additions & 3 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -1619,8 +1619,5 @@
},
"tags": []
}
},
"cli": {
"analytics": false
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
<h1 class="page-subtitle">{{'ADMIN.AUDIT_LOG.TITLE'|translate}}</h1>
<perun-web-apps-refresh-button (refresh)="refreshTable()"></perun-web-apps-refresh-button>
<app-audit-messages-list [refresh]="refresh" [tableId]="tableId"></app-audit-messages-list>
<div class="align-elements">
<div class="d-flex align-items-center">
<perun-web-apps-refresh-button (refresh)="refreshTable()"></perun-web-apps-refresh-button>
<perun-web-apps-audit-log-search-select
[auditLogs]="eventOptions"
(auditLogsSelected)="toggleEvent($event)"
(selectClosed)="refreshOnClosed()"></perun-web-apps-audit-log-search-select>
</div>

<app-audit-messages-list
[refresh]="refresh"
[tableId]="tableId"
[selectedEvents]="selectedEvents"></app-audit-messages-list>
</div>
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
import { Component } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { TABLE_AUDIT_MESSAGES } from '@perun-web-apps/config/table-config';
import { AuditMessagesManagerService } from '@perun-web-apps/perun/openapi';

@Component({
selector: 'app-admin-audit-log',
templateUrl: './admin-audit-log.component.html',
styleUrls: ['./admin-audit-log.component.scss'],
})
export class AdminAuditLogComponent {
export class AdminAuditLogComponent implements OnInit {
tableId = TABLE_AUDIT_MESSAGES;
refresh = false;

selectedEvents: string[] = [];
eventOptions: string[] = [];

constructor(private auditMessagesManagerService: AuditMessagesManagerService) {}

ngOnInit(): void {
this.auditMessagesManagerService.findAllPossibleEvents().subscribe((res) => {
this.eventOptions = res.sort();
});
}

refreshTable(): void {
this.refresh = !this.refresh;
}

toggleEvent(events: string[]): void {
// Replace array in-place so it won't trigger ngOnChanges
this.selectedEvents.splice(0, this.selectedEvents.length, ...events);
}

refreshOnClosed(): void {
this.selectedEvents = [...this.selectedEvents];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ import { Component, OnInit } from '@angular/core';
import { ConsentHub, ConsentsManagerService } from '@perun-web-apps/perun/openapi';
import { TABLE_CONSENT_HUBS } from '@perun-web-apps/config/table-config';
import { SelectionModel } from '@angular/cdk/collections';
import { GuiAuthResolver, NotificatorService, StoreService } from '@perun-web-apps/perun/services';
import {
GuiAuthResolver,
NotificatorService,
PerunTranslateService,
StoreService,
} from '@perun-web-apps/perun/services';
import { getDefaultDialogConfig } from '@perun-web-apps/perun/utils';
import { UniversalConfirmationItemsDialogComponent } from '@perun-web-apps/perun/dialogs';
import { TranslateService } from '@ngx-translate/core';
import { MatDialog } from '@angular/material/dialog';

@Component({
Expand All @@ -25,7 +29,7 @@ export class AdminConsentHubsComponent implements OnInit {
private consentsManager: ConsentsManagerService,
public authResolver: GuiAuthResolver,
private notificator: NotificatorService,
private translate: TranslateService,
private translate: PerunTranslateService,
private store: StoreService,
private dialog: MatDialog
) {}
Expand All @@ -52,11 +56,9 @@ export class AdminConsentHubsComponent implements OnInit {
const config = getDefaultDialogConfig();
config.width = '500px';
config.data = {
title: this.translate.instant('ADMIN.CONSENT_HUBS.CONFIRM_DIALOG_TITLE') as string,
title: this.translate.instant('ADMIN.CONSENT_HUBS.CONFIRM_DIALOG_TITLE'),
theme: 'admin-theme',
description: this.translate.instant(
'ADMIN.CONSENT_HUBS.CONFIRM_DIALOG_DESCRIPTION'
) as string,
description: this.translate.instant('ADMIN.CONSENT_HUBS.CONFIRM_DIALOG_DESCRIPTION'),
items: this.selection.selected.map((hub) => hub.name),
type: 'confirmation',
showAsk: false,
Expand All @@ -65,24 +67,24 @@ export class AdminConsentHubsComponent implements OnInit {
const dialogRef = this.dialog.open(UniversalConfirmationItemsDialogComponent, config);
dialogRef.afterClosed().subscribe((result) => {
if (result) {
this.evaluateConsentsForConsentHub(0);
this.evaluateConsentsForConsentHubs();
}
});
}

evaluateConsentsForConsentHub(index: number): void {
if (index === this.selection.selected.length) {
this.notificator.showSuccess(
this.translate.instant('ADMIN.CONSENT_HUBS.EVALUATION_FINISH') as string
);
this.selection.clear();
return;
}
evaluateConsentsForConsentHubs(): void {
this.loading = true;

this.consentsManager
.evaluateConsentsForConsentHub(this.selection.selected[index].id)
.subscribe(() => {
this.evaluateConsentsForConsentHub(++index);
});
const consentHubIds = this.selection.selected.map((consentHub) => consentHub.id);
this.consentsManager.evaluateConsentsForConsentHubs(consentHubIds).subscribe({
next: () => {
this.notificator.showSuccess(
this.translate.instant('ADMIN.CONSENT_HUBS.EVALUATION_FINISH')
);
this.selection.clear();
this.loading = false;
},
error: () => (this.loading = false),
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ <h1 class="page-subtitle">{{'ADMIN.SEARCHER.TITLE' | translate}}</h1>
*ngIf="!loadingEntityData"
[tableId]="tableId"
[displayedColumns]="['id', 'voId', 'userId', 'status']"
[disableStatusChange]="true"
[disableExpirationChange]="true"
(updateTable)="searchEntities(searchInput, 'member')"
[members]="entities">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
EntityStorageService,
GuiAuthResolver,
NotificatorService,
PerunTranslateService,
} from '@perun-web-apps/perun/services';
import { TranslateService } from '@ngx-translate/core';
import { getDefaultDialogConfig } from '@perun-web-apps/perun/utils';
import { RemoveDestinationDialogComponent } from '../../../../../../shared/components/dialogs/remove-destination-dialog/remove-destination-dialog.component';

Expand All @@ -28,7 +28,7 @@ export class ServiceDestinationsComponent implements OnInit {
constructor(
private serviceManager: ServicesManagerService,
private notificator: NotificatorService,
private translate: TranslateService,
private translate: PerunTranslateService,
private dialog: MatDialog,
public authResolver: GuiAuthResolver,
private entityStorageService: EntityStorageService
Expand Down Expand Up @@ -84,38 +84,28 @@ export class ServiceDestinationsComponent implements OnInit {
}

private blockServiceOnDestinations(destinations: RichDestination[]): void {
if (destinations.length === 0) {
this.notificator.showSuccess(
this.translate.instant('SERVICE_DETAIL.DESTINATIONS.BLOCK_SUCCESS') as string
);
this.refreshTable();
return;
}

const destination = destinations.pop();
this.serviceManager.blockServiceOnDestination(this.service.id, destination.id).subscribe(
() => {
this.blockServiceOnDestinations(destinations);
this.serviceManager.blockServicesOnDestinations({ richDestinations: destinations }).subscribe({
next: () => {
this.notificator.showSuccess(
this.translate.instant('SERVICE_DETAIL.DESTINATIONS.BLOCK_SUCCESS')
);
this.refreshTable();
},
() => (this.loading = false)
);
error: () => (this.loading = false),
});
}

private allowServiceOnDestinations(destinations: RichDestination[]): void {
if (destinations.length === 0) {
this.notificator.showSuccess(
this.translate.instant('SERVICE_DETAIL.DESTINATIONS.ALLOW_SUCCESS') as string
);
this.refreshTable();
return;
}

const destination = destinations.pop();
this.serviceManager.unblockServiceOnDestinationById(this.service.id, destination.id).subscribe(
() => {
this.allowServiceOnDestinations(destinations);
},
() => (this.loading = false)
);
this.serviceManager
.unblockServicesOnDestinations({ richDestinations: destinations })
.subscribe({
next: () => {
this.notificator.showSuccess(
this.translate.instant('SERVICE_DETAIL.DESTINATIONS.ALLOW_SUCCESS')
);
this.refreshTable();
},
error: () => (this.loading = false),
});
}
}
9 changes: 1 addition & 8 deletions apps/admin-gui/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import { NoPreloading, RouterModule, Routes } from '@angular/router';
import { AuthCallbackComponent } from './core/components/auth-callback/auth-callback.component';
import { UserDashboardComponent } from './users/pages/user-detail-page/user-dashboard/user-dashboard.component';
import { NotFoundPageComponent } from './shared/components/not-found-page/not-found-page.component';
import {
RedirectPageComponent,
NotAuthorizedPageComponent,
} from '@perun-web-apps/perun/components';
import { NotAuthorizedPageComponent } from '@perun-web-apps/perun/components';
import { LoginScreenComponent } from '@perun-web-apps/perun/login';
import { LoginScreenServiceAccessComponent } from '@perun-web-apps/perun/login';

Expand All @@ -16,10 +13,6 @@ const routes: Routes = [
redirectTo: 'home',
pathMatch: 'full',
},
{
path: 'redirect',
component: RedirectPageComponent,
},
{
path: 'api-callback',
component: AuthCallbackComponent,
Expand Down
4 changes: 2 additions & 2 deletions apps/admin-gui/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{{ warningMessage }}
</div>
<perun-web-apps-notificator [displayWarning]="displayWarning"></perun-web-apps-notificator>
<ng-template [ngIf]="!isLoginScreenShow && !isServiceAccess && !isServiceLogin()">
<ng-template [ngIf]="!isLoginScreenShow && !isServiceAccess && !isLoggedIn()">
<perun-web-apps-header
(sidenavToggle)="sidenav.toggle()"
[ngStyle]="{'top': getNavMenuTop(), 'background': navBackgroundColor}"
Expand Down Expand Up @@ -39,6 +39,6 @@
</mat-sidenav-container>
</ng-template>

<ng-template [ngIf]="isLoginScreenShow || isServiceAccess || isServiceLogin()">
<ng-template [ngIf]="isLoginScreenShow || isServiceAccess || isLoggedIn()">
<perun-web-apps-login-screen-base [application]="'admin-gui'"></perun-web-apps-login-screen-base>
</ng-template>
7 changes: 4 additions & 3 deletions apps/admin-gui/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
ViewChild,
} from '@angular/core';
import { CacheHelperService } from './core/services/common/cache-helper.service';
import { InitAuthService, StoreService } from '@perun-web-apps/perun/services';
import { AuthService, InitAuthService, StoreService } from '@perun-web-apps/perun/services';
import { PerunPrincipal } from '@perun-web-apps/perun/openapi';
import { interval } from 'rxjs';
import { HttpClient, HttpHeaders } from '@angular/common/http';
Expand Down Expand Up @@ -63,6 +63,7 @@ export class AppComponent implements OnInit, AfterViewInit {
private dialog: MatDialog,
private router: Router,
private initAuth: InitAuthService,
private authService: AuthService,
private cd: ChangeDetectorRef
) {
this.cache.init();
Expand All @@ -76,8 +77,8 @@ export class AppComponent implements OnInit, AfterViewInit {
this.lastScreenWidth = window.innerWidth;
}

isServiceLogin(): boolean {
return !!sessionStorage.getItem('baLogout');
isLoggedIn(): boolean {
return !this.authService.isLoggedIn() && !this.initAuth.isServiceAccess();
}

isMobile(): boolean {
Expand Down
Loading

0 comments on commit ea3f09c

Please sign in to comment.