download license for org

This commit is contained in:
Kyle Spearrin 2018-07-17 11:25:41 -04:00
parent 6fcda290c7
commit e4f12ed47f
4 changed files with 22 additions and 4 deletions

2
jslib

@ -1 +1 @@
Subproject commit 9c0b4b897387045d08c5e9651ba4c103379d3ac6
Subproject commit 4228277d23503d563560b44a652293d23233aa1b

View File

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

View File

@ -40,6 +40,7 @@ export class OrganizationBillingComponent implements OnInit {
cancelPromise: Promise<any>;
reinstatePromise: Promise<any>;
licensePromise: Promise<any>;
constructor(private tokenService: TokenService, private apiService: ApiService,
private platformUtilsService: PlatformUtilsService, private i18nService: I18nService,
@ -113,10 +114,22 @@ export class OrganizationBillingComponent implements OnInit {
}
}
downloadLicense() {
async downloadLicense() {
if (this.loading) {
return;
}
const installationId = window.prompt(this.i18nService.t('enterInstallationId'));
if (installationId == null || installationId === '') {
return;
}
try {
this.licensePromise = this.apiService.getOrganizationLicense(this.organizationId, installationId);
const license = await this.licensePromise;
const licenseString = JSON.stringify(license, null, 2);
this.platformUtilsService.saveFile(window, licenseString, null, 'bitwarden_organization_license.json');
} catch { }
}
updateLicense() {

View File

@ -2219,5 +2219,8 @@
},
"bankAccountTypeIndividual": {
"message": "Individual (Personal)"
},
"enterInstallationId": {
"message": "Enter your installation id"
}
}