fix(bundles): simplify features block

This commit is contained in:
Dmitry Nehaychik 2019-02-06 11:47:51 +03:00
parent 0949ecc67c
commit 9fc42b19c0
5 changed files with 20 additions and 38 deletions

View file

@ -4,22 +4,22 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
import { AfterViewInit, Component, ElementRef, Inject, OnDestroy } from '@angular/core';
import { Descriptions, DescriptionsService } from '../../../@core/data/service/descriptions.service';
import { delay, filter, take, takeWhile } from 'rxjs/operators';
import { AfterViewInit, Component, ElementRef, Inject } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Observable } from 'rxjs';
import { delay, filter, take } from 'rxjs/operators';
import { NB_WINDOW } from '@nebular/theme';
import { Descriptions, DescriptionsService } from '../../../@core/data/service/descriptions.service';
@Component({
selector: 'ngx-backend-bundles-section',
templateUrl: 'backend-bundles-section.component.html',
styleUrls: ['./backend-bundles-section.component.scss'],
})
export class BackendBundlesSectionComponent implements AfterViewInit {
export class BackendBundlesSectionComponent implements OnDestroy, AfterViewInit {
private alive = true;
descriptions: Descriptions[];
descriptions: Observable<Descriptions[]> = this.descriptionsService.getDescriptions();
selectedLicenseType = 'Personal';
personalLicense = 'Personal';
@ -56,9 +56,6 @@ export class BackendBundlesSectionComponent implements OnDestroy, AfterViewInit
private activatedRoute: ActivatedRoute,
private el: ElementRef<HTMLElement>,
@Inject(NB_WINDOW) private window) {
this.descriptionsService.getBundleDescriptions()
.pipe(takeWhile(() => this.alive))
.subscribe((descriptions) => this.descriptions = descriptions);
}
isCommercial() {
@ -77,10 +74,6 @@ export class BackendBundlesSectionComponent implements OnDestroy, AfterViewInit
});
}
ngOnDestroy() {
this.alive = false;
}
private getMailToText(bundleName: string) {
return 'mailto:support@akveo.com' +
`?subject=${this.selectedLicenseType} ${bundleName} Bundle` +