1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 16:23:44 +00: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}} {{'changeBillingPlan' | i18n}}
</button> </button>
<button type="button" class="btn btn-outline-secondary btn-submit ml-1" #licenseBtn [appApiAction]="licensePromise" [disabled]="licenseBtn.loading" <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> <i class="fa fa-spinner fa-spin" title="{{'loading' | i18n}}"></i>
<span>{{'downloadLicense' | i18n}}</span> <span>{{'downloadLicense' | i18n}}</span>
</button> </button>

View File

@@ -2,10 +2,7 @@ import {
Component, Component,
OnInit, OnInit,
} from '@angular/core'; } from '@angular/core';
import { import { ActivatedRoute } from '@angular/router';
ActivatedRoute,
Router,
} from '@angular/router';
import { ToasterService } from 'angular2-toaster'; import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2'; import { Angulartics2 } from 'angulartics2';
@@ -51,7 +48,7 @@ export class OrganizationBillingComponent implements OnInit {
constructor(private tokenService: TokenService, private apiService: ApiService, constructor(private tokenService: TokenService, private apiService: ApiService,
private platformUtilsService: PlatformUtilsService, private i18nService: I18nService, private platformUtilsService: PlatformUtilsService, private i18nService: I18nService,
private analytics: Angulartics2, private toasterService: ToasterService, private analytics: Angulartics2, private toasterService: ToasterService,
private router: Router, private route: ActivatedRoute) { private route: ActivatedRoute) {
this.selfHosted = platformUtilsService.isSelfHost(); this.selfHosted = platformUtilsService.isSelfHost();
} }
@@ -270,4 +267,9 @@ export class OrganizationBillingComponent implements OnInit {
this.billing.planType === PlanType.EnterpriseAnnually || this.billing.planType === PlanType.EnterpriseAnnually ||
this.billing.planType === PlanType.TeamsMonthly || this.billing.planType === PlanType.TeamsAnnually; 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> </div>
</ng-container> </ng-container>
<ng-container *ngIf="!selfHosted"> <ng-container *ngIf="!selfHosted">
<ng-container *ngIf="subscription && !subscription.cancelled || subscriptionMarkedForCancel"> <div class="d-flex">
<div class="d-flex"> <button type="button" class="btn btn-outline-secondary" (click)="downloadLicense()" *ngIf="!subscription || !subscription.cancelled">
<button type="button" class="btn btn-outline-secondary" (click)="downloadLicense()" *ngIf="!subscription.cancelled"> {{'downloadLicense' | i18n}}
{{'downloadLicense' | i18n}} </button>
</button> <button #cancelBtn type="button" class="btn btn-outline-danger btn-submit ml-auto" (click)="cancel()" [appApiAction]="cancelPromise"
<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">
[disabled]="cancelBtn.loading" *ngIf="!subscription.cancelled && !subscriptionMarkedForCancel"> <i class="fa fa-spinner fa-spin" title="{{'loading' | i18n}}"></i>
<i class="fa fa-spinner fa-spin" title="{{'loading' | i18n}}"></i> <span>{{'cancelSubscription' | i18n}}</span>
<span>{{'cancelSubscription' | i18n}}</span> </button>
</button> </div>
</div>
</ng-container>
<h2 class="spaced-header">{{'storage' | i18n}}</h2> <h2 class="spaced-header">{{'storage' | i18n}}</h2>
<p>{{'subscriptionStorage' | i18n : billing.maxStorageGb || 0 : billing.storageName || '0 MB'}}</p> <p>{{'subscriptionStorage' | i18n : billing.maxStorageGb || 0 : billing.storageName || '0 MB'}}</p>
<div class="progress"> <div class="progress">