Skip to content

Commit

Permalink
Merge branch 'master' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
xkostka2 committed Sep 13, 2021
2 parents acef42c + e8bff01 commit fbbf685
Show file tree
Hide file tree
Showing 105 changed files with 39,356 additions and 794 deletions.
7 changes: 6 additions & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"branches": [ "production", "+([0-9])?(.{+([0-9]),x}).x"],
"branches": [
"production",
"+([0-9])?(.{+([0-9]),x}).x",
{ "name": "alpha", "prerelease": true },
{ "name": "beta", "prerelease": true }
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@
<span class="mt-1 entity-info">
{{'SERVICE_DETAIL.DESCRIPTION' | translate}}: {{service.description}}
</span>
<div class="mt-1 entity-info">
{{'SERVICE_DETAIL.STATUS' | translate}}:
<span>
{{service.enabled ? ('SERVICE_DETAIL.ENABLED' | translate) : ('SERVICE_DETAIL.DISABLED' | translate)}}
<button (click)="changeServiceStatus()" mat-icon-button>
<mat-icon class="align-content-center">
{{service.enabled ? "check_circle_outline" : "block"}}
</mat-icon>
</button>
</span>
</div>
</div>
</div>
<app-animated-router-outlet></app-animated-router-outlet>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { Component, OnInit } from '@angular/core';
import { fadeIn } from '@perun-web-apps/perun/animations';
import { Service, ServicesManagerService } from '@perun-web-apps/perun/openapi';
import { InputUpdateService, Service, ServicesManagerService } from '@perun-web-apps/perun/openapi';
import { ActivatedRoute, Router } from '@angular/router';
import { SideMenuService } from '../../../../../core/services/common/side-menu.service';
import { SideMenuItemService } from '../../../../../shared/side-menu/side-menu-item.service';
import { getDefaultDialogConfig } from '@perun-web-apps/perun/utils';
import { MatDialog } from '@angular/material/dialog';
import { CreateEditServiceDialogComponent } from '../../../../../shared/components/dialogs/create-edit-service-dialog/create-edit-service-dialog.component';
import { GuiAuthResolver } from '@perun-web-apps/perun/services';
import { GuiAuthResolver, NotificatorService } from '@perun-web-apps/perun/services';
import { DeleteServiceDialogComponent } from '../../../../../shared/components/dialogs/delete-service-dialog/delete-service-dialog.component';
import { TranslateService } from '@ngx-translate/core';

@Component({
selector: 'app-service-detail-page',
Expand All @@ -20,33 +21,40 @@ import { DeleteServiceDialogComponent } from '../../../../../shared/components/d
})
export class ServiceDetailPageComponent implements OnInit {

serviceId: number;

service: Service;

constructor(
private route: ActivatedRoute,
private router: Router,
private serviceManager: ServicesManagerService,
private sideMenuService: SideMenuService,
private sideMenuItemService: SideMenuItemService,
private dialog: MatDialog,
public authResolver: GuiAuthResolver
public authResolver: GuiAuthResolver,
private translate: TranslateService,
private notificator: NotificatorService
) {
}

service: Service;
loading = false;

ngOnInit(): void {
this.loading = true;
this.route.params.subscribe(params => {
const serviceId = params["serviceId"];
this.serviceId = params["serviceId"];
this.refresh();
});
}

this.serviceManager.getServiceById(serviceId).subscribe(service => {
this.service = service;
refresh() {
this.serviceManager.getServiceById(this.serviceId).subscribe(service => {
this.service = service;

const serviceItems = this.sideMenuItemService.parseService(this.service);
this.sideMenuService.setAdminItems([serviceItems]);
this.loading = false;
}, () => this.loading = false);
});
const serviceItems = this.sideMenuItemService.parseService(this.service);
this.sideMenuService.setAdminItems([serviceItems]);
this.loading = false;
}, () => this.loading = false);
}

editService() {
Expand Down Expand Up @@ -77,10 +85,28 @@ export class ServiceDetailPageComponent implements OnInit {

dialogRef.afterClosed().subscribe(result => {
if (result) {
console.log(result);
this.router.navigate(['/admin/services']);
}
});
}

changeServiceStatus() {
this.loading = true;
const inputService: InputUpdateService = {
service: {
name: this.service.name,
description: this.service.description,
delay: this.service.delay,
recurrence: this.service.recurrence,
enabled: !this.service.enabled,
script: this.service.script,
id: this.service.id,
beanName: this.service.beanName
}
};
this.serviceManager.updateService(inputService).subscribe(() => {
this.notificator.showSuccess(this.translate.instant('SERVICE_DETAIL.STATUS_CHANGE_SUCCESS'));
this.refresh();
}, () => this.loading = false);
}
}
5 changes: 5 additions & 0 deletions apps/admin-gui/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { UserDashboardComponent } from './users/pages/user-detail-page/user-dash
import { NotFoundPageComponent } from './shared/components/not-found-page/not-found-page.component';
import { RedirectPageComponent } from '@perun-web-apps/perun/components';
import { LoginScreenComponent } from '@perun-web-apps/perun/login';
import { LoginScreenServiceAccessComponent } from '@perun-web-apps/perun/login';

const routes: Routes = [
{
Expand All @@ -22,6 +23,10 @@ const routes: Routes = [
path: 'login',
component: LoginScreenComponent
},
{
path: 'service-access',
component: LoginScreenServiceAccessComponent
},
{
path: 'organizations',
loadChildren: () => import('./vos/vos.module').then(m => m.VosModule),
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">
<ng-template [ngIf]="!isLoginScreenShow && !isServiceAccess && !isServiceLogin()">
<app-perun-nav-menu
id="nav-menu"
[ngStyle]="{'top': getNavMenuTop(), 'background': navBackgroundColor}"
Expand Down Expand Up @@ -39,6 +39,6 @@
</mat-sidenav-container>
</ng-template>

<ng-template [ngIf]="isLoginScreenShow">
<ng-template [ngIf]="isLoginScreenShow || isServiceAccess || isServiceLogin()">
<perun-web-apps-login-screen-base [application]="'admin-gui'"></perun-web-apps-login-screen-base>
</ng-template>
7 changes: 7 additions & 0 deletions apps/admin-gui/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class AppComponent implements OnInit {
lastScreenWidth: number;

isLoginScreenShow: boolean;
isServiceAccess: boolean;

principal: PerunPrincipal;
navBackgroundColor = this.store.get('theme', 'nav_bg_color');
Expand All @@ -55,12 +56,18 @@ export class AppComponent implements OnInit {
this.lastScreenWidth = window.innerWidth;
}

isServiceLogin(): boolean {
return !!sessionStorage.getItem("baLogout");
}

isMobile(): boolean {
return window.innerWidth <= AppComponent.minWidth;
}

ngOnInit(): void {
this.isLoginScreenShow = this.initAuth.isLoginScreenShown();
this.isServiceAccess = this.initAuth.isServiceAccessLoginScreenShown();
sessionStorage.removeItem("baLogout");

if (sessionStorage.getItem("initPage") === null) {
sessionStorage.setItem("initPage", location.pathname);
Expand Down
15 changes: 3 additions & 12 deletions apps/admin-gui/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
} from 'ngx-perfect-scrollbar';
import { PerunSharedComponentsModule } from '@perun-web-apps/perun/components';
import { PerunLoginModule } from '@perun-web-apps/perun/login';
import { OAuthModule } from 'angular-oauth2-oidc';


export const API_INTERCEPTOR_PROVIDER: Provider = {
Expand All @@ -40,12 +41,6 @@ export function httpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}

// export function ApiConfigurationFactory(store: StoreService): ApiConfiguration {
// return {
// rootUrl: store.get('api_url')
// };
// }

export function apiConfigFactory(store: StoreService): Configuration {
const params: ConfigurationParameters = {
basePath: store.get('api_url')
Expand Down Expand Up @@ -84,7 +79,8 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
ApiModule,
PerfectScrollbarModule,
PerunSharedComponentsModule,
PerunLoginModule
PerunLoginModule,
OAuthModule.forRoot()
],
providers: [
AdminGuiConfigService,
Expand All @@ -94,11 +90,6 @@ const DEFAULT_PERFECT_SCROLLBAR_CONFIG: PerfectScrollbarConfigInterface = {
multi: true,
deps: [AdminGuiConfigService]
},
// {
// provide: ApiConfiguration,
// useFactory: ApiConfigurationFactory,
// deps: [StoreService]
// },
{
provide: Configuration,
useFactory: apiConfigFactory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ export class AdminGuiConfigService {
*/
private setApiUrl() {
return new Promise<void>((resolve) => {
this.authzSevice.configuration.basePath = this.store.get('api_url');
let apiUrl = this.store.get('api_url');
if (location.pathname === '/service-access' || sessionStorage.getItem("baPrincipal")) {
apiUrl = apiUrl.replace("oauth", "ba");
}
this.authzSevice.configuration.basePath = apiUrl;
this.titleService.setTitle(this.store.get('document_title'));
resolve();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class ResourceAttributesComponent implements OnInit {
this.resource = resource;

this.resourceGroupAttAuth = this.authResolver.isAuthorized('getAssignedGroups_Resource_policy', [this.resource]);
this.resourceMemberAttAuth = this.authResolver.isAuthorized('getAssignedRichMembers_Resource_policy', [this.resource]);
this.resourceMemberAttAuth = this.authResolver.isAuthorized('getAssignedMembersWithStatus_Resource_policy', [this.resource]);
});
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { NotificatorService } from '@perun-web-apps/perun/services';
import { OwnersManagerService } from '@perun-web-apps/perun/openapi';
import { TranslateService } from '@ngx-translate/core';
import { FormControl, Validators } from '@angular/forms';
import { emailRegexString } from '@perun-web-apps/perun/utils';

@Component({
selector: 'app-add-owner-dialog',
Expand All @@ -28,11 +29,9 @@ export class AddOwnerDialogComponent implements OnInit {
contactCtrl: FormControl;
type = '1';

emailRegex = /^(([^<>+()[\]\\.,;:\s@"-#$%&=]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,3}))$/;

ngOnInit() {
this.nameCtrl = new FormControl(null, [Validators.required, Validators.pattern('^[\\w.-]+( [\\w.-]+)*$')]);
this.contactCtrl = new FormControl(null, [Validators.required, Validators.pattern(this.emailRegex)]);
this.contactCtrl = new FormControl(null, [Validators.required, Validators.pattern(emailRegexString)]);
}

onCancel() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface AddApplicationFormItemDialogComponentData {
})
export class AddApplicationFormItemDialogComponent implements OnInit {

languages = this.store.get('supportedLanguages');
languages = this.store.get('supported_languages');

items: string[] = [];
selectedItem: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class AddEditNotificationDialogComponent implements OnInit {
}

ngOnInit() {
this.languages = this.store.get('supportedLanguages');
this.languages = this.store.get('supported_languages');
this.applicationMail = this.data.applicationMail;
this.theme = this.data.theme;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export class AddMemberDialogComponent implements OnInit {
}

ngOnInit(): void {
this.languages = this.store.get('supportedLanguages');
this.languages = this.store.get('supported_languages');
this.pageSize = this.tableConfigService.getTablePageSize(this.tableId);
this.theme = this.data.theme;
if (this.data.type === 'group') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
ServicesManagerService
} from '@perun-web-apps/perun/openapi';
import { AbstractControl, FormControl, ValidatorFn, Validators } from '@angular/forms';
import { emailRegexString } from '@perun-web-apps/perun/utils';

export interface AddServicesDestinationDialogData {
facility: Facility;
Expand Down Expand Up @@ -46,7 +47,7 @@ export class AddServicesDestinationDialogComponent implements OnInit {
loading = false;
emailControl: FormControl;

emailRegex = new RegExp(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);
emailRegex = new RegExp(emailRegexString);
hostPattern = new RegExp("^(?!:\\/\\/)(?=.{1,255}$)((.{1,63}\\.){1,127}(?![0-9]*$)[a-z0-9-]+\\.?)$|^(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}$");
urlPattern = new RegExp("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;()*$']*[-a-zA-Z0-9+&@#/%=~_|()*$']$");
userAtHostPattern = new RegExp("^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\\$)@(?:(?!:\\/\\/)(?=.{1,255}$)((.{1,63}\\.){1,127}(?![0-9]*$)[a-z0-9-]+\\.?)$|(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}$)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
<h1 mat-dialog-title>{{'DIALOGS.ASSIGN_SERVICE_TO_RESOURCE.TITLE' | translate}}</h1>
<mat-spinner *ngIf="loading" class="mr-auto ml-auto"></mat-spinner>
<div *ngIf="!loading" mat-dialog-content>
<p><strong>{{'DIALOGS.ASSIGN_SERVICE_TO_RESOURCE.SELECT_PACKAGE' | translate}}</strong></p>
<perun-web-apps-service-package-search-select
(packageSelected)="servicePackageSelected($event)"
[servicePackages]="servicePackages">
</perun-web-apps-service-package-search-select>
<p><strong>{{'DIALOGS.ASSIGN_SERVICE_TO_RESOURCE.SELECT_SERVICE' | translate}}</strong></p>
<perun-web-apps-debounce-filter
placeholder="{{'DIALOGS.ASSIGN_SERVICE_TO_RESOURCE.FILTER_DESCRIPTION' | translate}}"
(filter)="applyFilter($event)">
Expand All @@ -28,7 +34,7 @@ <h1 mat-dialog-title>{{'DIALOGS.ASSIGN_SERVICE_TO_RESOURCE.TITLE' | translate}}<
class="ml-2"
color="accent"
(click)="onAdd()"
[disabled]="selection.selected.length === 0 || loading">
[disabled]="(selection.selected.length === 0 && selectedPackage.id === -1) || loading">
{{'DIALOGS.ASSIGN_SERVICE_TO_RESOURCE.ADD_BUTTON' | translate}}
</button>
</div>
Expand Down
Loading

0 comments on commit fbbf685

Please sign in to comment.