diff --git a/SystemKonkursow/4.2.1/angular/package-lock.json b/SystemKonkursow/4.2.1/angular/package-lock.json index 748f017..db6a031 100644 --- a/SystemKonkursow/4.2.1/angular/package-lock.json +++ b/SystemKonkursow/4.2.1/angular/package-lock.json @@ -8434,6 +8434,11 @@ "tslib": "1.9.2" } }, + "rxjs-compat": { + "version": "6.3.3", + "resolved": "https://registry.npmjs.org/rxjs-compat/-/rxjs-compat-6.3.3.tgz", + "integrity": "sha512-caGN7ixiabHpOofginKEquuHk7GgaCrC7UpUQ9ZqGp80tMc68msadOeP/2AKy2R4YJsT1+TX5GZCtxO82qWkyA==" + }, "safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", diff --git a/SystemKonkursow/4.2.1/angular/package.json b/SystemKonkursow/4.2.1/angular/package.json index 8b33e5f..4031707 100644 --- a/SystemKonkursow/4.2.1/angular/package.json +++ b/SystemKonkursow/4.2.1/angular/package.json @@ -58,6 +58,7 @@ "push.js": "1.0.4", "raphael": "^2.2.7", "rxjs": "^6.2.0", + "rxjs-compat": "^6.3.3", "simple-line-icons": "^2.4.1", "spin.js": "^2.3.2", "sweetalert": "^2.1.2", diff --git a/SystemKonkursow/4.2.1/angular/src/app/categories-list/categories-list.component.html b/SystemKonkursow/4.2.1/angular/src/app/categories-list/categories-list.component.html index 5d4e812..fcef52e 100644 --- a/SystemKonkursow/4.2.1/angular/src/app/categories-list/categories-list.component.html +++ b/SystemKonkursow/4.2.1/angular/src/app/categories-list/categories-list.component.html @@ -1,4 +1,4 @@ -
+
{{ category.name }}
diff --git a/SystemKonkursow/4.2.1/angular/src/app/categories-list/categories-list.component.ts b/SystemKonkursow/4.2.1/angular/src/app/categories-list/categories-list.component.ts index dac2a26..f2fddd2 100644 --- a/SystemKonkursow/4.2.1/angular/src/app/categories-list/categories-list.component.ts +++ b/SystemKonkursow/4.2.1/angular/src/app/categories-list/categories-list.component.ts @@ -1,29 +1,45 @@ -import { Component, OnInit, Injector } from '@angular/core'; +import { Component, OnInit, Injector, OnDestroy } from '@angular/core'; import { appModuleAnimation } from '@shared/animations/routerTransition'; import { CompetitionCategoryServiceProxy, CompetitionCategoryDto } from '@shared/service-proxies/service-proxies'; import { List } from 'lodash'; +import { AppComponentBase } from '@shared/app-component-base'; +import { Subscription } from 'rxjs/Rx'; +import { finalize } from 'rxjs/operators'; @Component({ templateUrl: './categories-list.component.html', styleUrls: ['./categories-list.component.css'], animations: [appModuleAnimation()] }) -export class CategoriesListComponent implements OnInit { +export class CategoriesListComponent extends AppComponentBase implements OnInit, OnDestroy { public competitionCategoriesList: List = []; + public categoriesListAreaId: string = 'categories-list-area'; + + private categoryListSubscription: Subscription; constructor( injector: Injector, private _competitionCategoryService: CompetitionCategoryServiceProxy ) { + super(injector); } - public ngOnInit(){ + public ngOnInit() { this.getCompetitionCategories(); } + public ngOnDestroy() { + if (this.categoryListSubscription) { + this.categoryListSubscription.unsubscribe(); + } + } + private getCompetitionCategories(): void { - this._competitionCategoryService.getAllCompetitionCategories() + this.setBusy(this.categoriesListAreaId); + + this.categoryListSubscription = this._competitionCategoryService.getAllCompetitionCategories() + .pipe(finalize(() => { this.clearBusy(this.categoriesListAreaId); })) .subscribe((result: List) => { this.competitionCategoriesList = result; }); diff --git a/SystemKonkursow/4.2.1/angular/src/app/layout/topbar.component.html b/SystemKonkursow/4.2.1/angular/src/app/layout/topbar.component.html index 5a20e25..61bd8c8 100644 --- a/SystemKonkursow/4.2.1/angular/src/app/layout/topbar.component.html +++ b/SystemKonkursow/4.2.1/angular/src/app/layout/topbar.component.html @@ -14,7 +14,7 @@