Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2023-08-20 14:19:57 +03:00
parent 6d5ab6f208
commit eb4daf33f1
83 changed files with 2726 additions and 2116 deletions

View File

@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { ConfirmService } from './confirm.service';
describe('ConfirmService', () => {
let service: ConfirmService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ConfirmService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@@ -0,0 +1,28 @@
import { Injectable } from '@angular/core';
import { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material/dialog';
import { map, Observable, take } from 'rxjs';
import { ConfirmDialogComponent } from '../../components/confirm-dialog/confirm-dialog.component';
@Injectable({
providedIn: 'root'
})
export class ConfirmService {
dialogRef!: MatDialogRef<ConfirmDialogComponent>;
constructor(
private dialog: MatDialog
) { }
public open(options: MatDialogConfig) {
this.dialogRef = this.dialog.open(ConfirmDialogComponent, options);
}
public confirmed(): Observable<any> {
return this.dialogRef.afterClosed().pipe(take(1), map(res => {
return res;
}
));
}
}

View File

@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { MessageService } from './message.service';
describe('MessageService', () => {
let message: MessageService;
beforeEach(() => {
TestBed.configureTestingModule({});
message = TestBed.inject(MessageService);
});
it('should be created', () => {
expect(message).toBeTruthy();
});
});

View File

@@ -0,0 +1,22 @@
import { Injectable } from '@angular/core';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material/snack-bar';
@Injectable({
providedIn: 'root'
})
export class MessageService {
constructor(
private snackbar: MatSnackBar,
) {
}
showMessage(message: string, action?: string, config?: MatSnackBarConfig) {
let cfg = config
if (!cfg) {
cfg = { duration: 2000 }
}
this.snackbar.open(message, action, cfg);
}
}

View File

@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { ServicesService } from './packages.service';
describe('ServicesService', () => {
let service: ServicesService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ServicesService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@@ -0,0 +1,28 @@
import { Injectable } from '@angular/core';
import { MatDialog, MatDialogConfig, MatDialogRef } from '@angular/material/dialog';
import { map, Observable, take } from 'rxjs';
import { PackageDialogComponent } from '../../components/package-dialog/package-dialog.component';
@Injectable({
providedIn: 'root'
})
export class PackagesService {
dialogRef!: MatDialogRef<PackageDialogComponent>;
constructor(
private dialog: MatDialog
) { }
public open(options: MatDialogConfig) {
this.dialogRef = this.dialog.open(PackageDialogComponent, options);
}
public confirmed(): Observable<any> {
return this.dialogRef.afterClosed().pipe(take(1), map(res => {
return res;
}
));
}
}