Skip to content
Snippets Groups Projects
Commit d89b169d authored by Rafael László's avatar Rafael László :speech_balloon:
Browse files

Document rest of files and add prod environment

parent 9f1485ec
No related branches found
No related tags found
No related merge requests found
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { ErrorModel } from '../../models/error.model'; import { ErrorModel } from '../../models/error.model';
import { ErrorService } from '../../services/error.service'; import { ErrorService } from '../../services/error.service';
import { ModalDismissReasons, NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
/**
* Component that opens a new dialog if the errorService is updated
*/
@Component({ @Component({
selector: 'app-error-dialog', selector: 'app-error-dialog',
templateUrl: './error-dialog.component.html', templateUrl: './error-dialog.component.html',
styleUrls: ['./error-dialog.component.css'], styleUrls: ['./error-dialog.component.css'],
}) })
export class ErrorDialogComponent implements OnInit { export class ErrorDialogComponent implements OnInit {
/**
* Error that will be displayed
*/
error: ErrorModel; error: ErrorModel;
/**
* Get the modal from template
*/
@ViewChild('modalData') modalData: any; @ViewChild('modalData') modalData: any;
closeModal: string;
constructor(private errorService: ErrorService, private modalService: NgbModal, private router: Router) {} constructor(private errorService: ErrorService, private modalService: NgbModal, private router: Router) {}
/**
* Subscribe to the ErrorService and trigger the modal on change
*/
ngOnInit(): void { ngOnInit(): void {
this.errorService.errorData$.subscribe((e) => { this.errorService.errorData$.subscribe((e) => {
if (e) { if (e) {
...@@ -26,10 +36,16 @@ export class ErrorDialogComponent implements OnInit { ...@@ -26,10 +36,16 @@ export class ErrorDialogComponent implements OnInit {
}); });
} }
/**
* Open the modal
*/
triggerModal(): void { triggerModal(): void {
this.modalService.open(this.modalData, { ariaLabelledBy: 'modal-basic-title' }); this.modalService.open(this.modalData, { ariaLabelledBy: 'modal-basic-title' });
} }
/**
* Redirect to the given route in the error
*/
redirectToHome(): void { redirectToHome(): void {
if (this.error.navigate) { if (this.error.navigate) {
this.router.navigate(this.error.navigate); this.router.navigate(this.error.navigate);
......
import { Component, Input, OnInit } from '@angular/core'; import { Component, Input, OnInit } from '@angular/core';
/**
* Basic bootstrap loader component.
*/
@Component({ @Component({
selector: 'app-loader', selector: 'app-loader',
templateUrl: './loader.component.html', templateUrl: './loader.component.html',
styleUrls: ['./loader.component.css'] styleUrls: ['./loader.component.css']
}) })
export class LoaderComponent implements OnInit { export class LoaderComponent implements OnInit {
/**
* colorClass that can be overwritten
*/
@Input() colorClass?: string; @Input() colorClass?: string;
constructor() { } constructor() { }
......
import { AbstractControl, FormGroup, ValidationErrors, ValidatorFn } from '@angular/forms'; import { AbstractControl, FormGroup, ValidationErrors, ValidatorFn } from '@angular/forms';
/**
* A validator that can be used to specify which fields should equal in a formGroup
* @param controlName first control in formGroup
* @param matchingControlName the matching control in formGroup
*/
export const mustMatchValidator = (controlName: string, matchingControlName: string): ValidatorFn => ( export const mustMatchValidator = (controlName: string, matchingControlName: string): ValidatorFn => (
control: AbstractControl control: AbstractControl
): ValidationErrors | null => { ): ValidationErrors | null => {
......
export const environment = { export const environment = {
production: true production: true,
apiUrl: 'https://stat.maze.sch.bme.hu/api/v1',
jwtRefreshBeforeMinutes: 10
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment