1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-23 11:56:00 +01:00

allow custom plans to download license

This commit is contained in:
Kyle Spearrin 2018-07-20 12:16:41 -04:00
parent b9ea3de860
commit e3e94ede65
3 changed files with 18 additions and 18 deletions

View File

@ -80,7 +80,7 @@
{{'changeBillingPlan' | i18n}}
</button>
<button type="button" class="btn btn-outline-secondary btn-submit ml-1" #licenseBtn [appApiAction]="licensePromise" [disabled]="licenseBtn.loading"
(click)="downloadLicense()" *ngIf="subscription && !subscription.cancelled">
(click)="downloadLicense()" *ngIf="canDownloadLicense">
<i class="fa fa-spinner fa-spin" title="{{'loading' | i18n}}"></i>
<span>{{'downloadLicense' | i18n}}</span>
</button>

View File

@ -2,10 +2,7 @@ import {
Component,
OnInit,
} from '@angular/core';
import {
ActivatedRoute,
Router,
} from '@angular/router';
import { ActivatedRoute } from '@angular/router';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
@ -51,7 +48,7 @@ export class OrganizationBillingComponent implements OnInit {
constructor(private tokenService: TokenService, private apiService: ApiService,
private platformUtilsService: PlatformUtilsService, private i18nService: I18nService,
private analytics: Angulartics2, private toasterService: ToasterService,
private router: Router, private route: ActivatedRoute) {
private route: ActivatedRoute) {
this.selfHosted = platformUtilsService.isSelfHost();
}
@ -270,4 +267,9 @@ export class OrganizationBillingComponent implements OnInit {
this.billing.planType === PlanType.EnterpriseAnnually ||
this.billing.planType === PlanType.TeamsMonthly || this.billing.planType === PlanType.TeamsAnnually;
}
get canDownloadLicense() {
return (this.billing.planType !== PlanType.Free && this.subscription == null) ||
(this.subscription != null && !this.subscription.cancelled);
}
}

View File

@ -73,18 +73,16 @@
</div>
</ng-container>
<ng-container *ngIf="!selfHosted">
<ng-container *ngIf="subscription && !subscription.cancelled || subscriptionMarkedForCancel">
<div class="d-flex">
<button type="button" class="btn btn-outline-secondary" (click)="downloadLicense()" *ngIf="!subscription.cancelled">
{{'downloadLicense' | i18n}}
</button>
<button #cancelBtn type="button" class="btn btn-outline-danger btn-submit ml-auto" (click)="cancel()" [appApiAction]="cancelPromise"
[disabled]="cancelBtn.loading" *ngIf="!subscription.cancelled && !subscriptionMarkedForCancel">
<i class="fa fa-spinner fa-spin" title="{{'loading' | i18n}}"></i>
<span>{{'cancelSubscription' | i18n}}</span>
</button>
</div>
</ng-container>
<div class="d-flex">
<button type="button" class="btn btn-outline-secondary" (click)="downloadLicense()" *ngIf="!subscription || !subscription.cancelled">
{{'downloadLicense' | i18n}}
</button>
<button #cancelBtn type="button" class="btn btn-outline-danger btn-submit ml-auto" (click)="cancel()" [appApiAction]="cancelPromise"
[disabled]="cancelBtn.loading" *ngIf="subscription && !subscription.cancelled && !subscriptionMarkedForCancel">
<i class="fa fa-spinner fa-spin" title="{{'loading' | i18n}}"></i>
<span>{{'cancelSubscription' | i18n}}</span>
</button>
</div>
<h2 class="spaced-header">{{'storage' | i18n}}</h2>
<p>{{'subscriptionStorage' | i18n : billing.maxStorageGb || 0 : billing.storageName || '0 MB'}}</p>
<div class="progress">