mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
[AC-1102]Automatic Sync is visible for self hosted Families Orgs (#9565)
* Add the changes to remove automasync for family org * Remove changes to the form field file * Rename productType to productTierType * Add Upload license and License file * Hide the License and upload License label * Resolve the issue of Validation required for family org
This commit is contained in:
@@ -224,6 +224,14 @@
|
|||||||
<h2 bitTypography="h2" class="tw-mt-7">{{ "selfHostingTitle" | i18n }}</h2>
|
<h2 bitTypography="h2" class="tw-mt-7">{{ "selfHostingTitle" | i18n }}</h2>
|
||||||
<p bitTypography="body1">
|
<p bitTypography="body1">
|
||||||
{{ "selfHostingEnterpriseOrganizationSectionCopy" | i18n }}
|
{{ "selfHostingEnterpriseOrganizationSectionCopy" | i18n }}
|
||||||
|
<a
|
||||||
|
href="https://bitwarden.com/help/licensing-on-premise/#retrieve-organization-license"
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
|
appA11yTitle="{{ 'learnMore' | i18n }}"
|
||||||
|
>
|
||||||
|
<i class="bwi bwi-question-circle" aria-hidden="true"></i
|
||||||
|
></a>
|
||||||
</p>
|
</p>
|
||||||
<div class="tw-flex tw-space-x-2">
|
<div class="tw-flex tw-space-x-2">
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -74,6 +74,7 @@
|
|||||||
[value]="licenseOptions.SYNC"
|
[value]="licenseOptions.SYNC"
|
||||||
[disabled]="disableLicenseSyncControl"
|
[disabled]="disableLicenseSyncControl"
|
||||||
class="tw-block"
|
class="tw-block"
|
||||||
|
*ngIf="showAutomaticSyncAndManualUpload"
|
||||||
>
|
>
|
||||||
<bit-label
|
<bit-label
|
||||||
>{{ "automaticSync" | i18n }}
|
>{{ "automaticSync" | i18n }}
|
||||||
@@ -114,6 +115,7 @@
|
|||||||
id="manual-upload"
|
id="manual-upload"
|
||||||
[value]="licenseOptions.UPLOAD"
|
[value]="licenseOptions.UPLOAD"
|
||||||
class="tw-mt-6 tw-block"
|
class="tw-mt-6 tw-block"
|
||||||
|
*ngIf="showAutomaticSyncAndManualUpload"
|
||||||
>
|
>
|
||||||
<bit-label>{{ "manualUpload" | i18n }}</bit-label>
|
<bit-label>{{ "manualUpload" | i18n }}</bit-label>
|
||||||
<bit-hint>
|
<bit-hint>
|
||||||
@@ -121,8 +123,14 @@
|
|||||||
</bit-hint>
|
</bit-hint>
|
||||||
</bit-radio-button>
|
</bit-radio-button>
|
||||||
<ng-container *ngIf="updateMethod === licenseOptions.UPLOAD">
|
<ng-container *ngIf="updateMethod === licenseOptions.UPLOAD">
|
||||||
<h3 class="tw-font-semibold">{{ "uploadLicense" | i18n }}</h3>
|
<bit-label class="tw-mb-6 tw-block" *ngIf="!showAutomaticSyncAndManualUpload">
|
||||||
|
{{ "licenseAndBillingManagementDesc" | i18n }}
|
||||||
|
</bit-label>
|
||||||
|
<h3 *ngIf="showAutomaticSyncAndManualUpload" class="tw-font-semibold">
|
||||||
|
{{ "uploadLicense" | i18n }}
|
||||||
|
</h3>
|
||||||
<app-update-license
|
<app-update-license
|
||||||
|
[showAutomaticSyncAndManualUpload]="showAutomaticSyncAndManualUpload"
|
||||||
[organizationId]="organizationId"
|
[organizationId]="organizationId"
|
||||||
[showCancel]="false"
|
[showCancel]="false"
|
||||||
(onUpdated)="licenseUploaded()"
|
(onUpdated)="licenseUploaded()"
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { OrganizationService } from "@bitwarden/common/admin-console/abstraction
|
|||||||
import { OrganizationConnectionType } from "@bitwarden/common/admin-console/enums";
|
import { OrganizationConnectionType } from "@bitwarden/common/admin-console/enums";
|
||||||
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
|
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
|
||||||
import { OrganizationConnectionResponse } from "@bitwarden/common/admin-console/models/response/organization-connection.response";
|
import { OrganizationConnectionResponse } from "@bitwarden/common/admin-console/models/response/organization-connection.response";
|
||||||
|
import { ProductTierType } from "@bitwarden/common/billing/enums";
|
||||||
import { BillingSyncConfigApi } from "@bitwarden/common/billing/models/api/billing-sync-config.api";
|
import { BillingSyncConfigApi } from "@bitwarden/common/billing/models/api/billing-sync-config.api";
|
||||||
import { SelfHostedOrganizationSubscriptionView } from "@bitwarden/common/billing/models/view/self-hosted-organization-subscription.view";
|
import { SelfHostedOrganizationSubscriptionView } from "@bitwarden/common/billing/models/view/self-hosted-organization-subscription.view";
|
||||||
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
|
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
|
||||||
@@ -32,6 +33,7 @@ export class OrganizationSubscriptionSelfhostComponent implements OnInit, OnDest
|
|||||||
organizationId: string;
|
organizationId: string;
|
||||||
userOrg: Organization;
|
userOrg: Organization;
|
||||||
cloudWebVaultUrl: string;
|
cloudWebVaultUrl: string;
|
||||||
|
showAutomaticSyncAndManualUpload: boolean;
|
||||||
|
|
||||||
licenseOptions = LicenseOptions;
|
licenseOptions = LicenseOptions;
|
||||||
form = new FormGroup({
|
form = new FormGroup({
|
||||||
@@ -111,6 +113,8 @@ export class OrganizationSubscriptionSelfhostComponent implements OnInit, OnDest
|
|||||||
}
|
}
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.userOrg = await this.organizationService.get(this.organizationId);
|
this.userOrg = await this.organizationService.get(this.organizationId);
|
||||||
|
this.showAutomaticSyncAndManualUpload =
|
||||||
|
this.userOrg.productTierType == ProductTierType.Families ? false : true;
|
||||||
if (this.userOrg.canViewSubscription) {
|
if (this.userOrg.canViewSubscription) {
|
||||||
const subscriptionResponse = await this.organizationApiService.getSubscription(
|
const subscriptionResponse = await this.organizationApiService.getSubscription(
|
||||||
this.organizationId,
|
this.organizationId,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<form [formGroup]="updateLicenseForm" [bitSubmit]="submit">
|
<form [formGroup]="updateLicenseForm" [bitSubmit]="submit">
|
||||||
<bit-form-field>
|
<bit-form-field>
|
||||||
<bit-label>{{ "licenseFile" | i18n }}</bit-label>
|
<bit-label *ngIf="showAutomaticSyncAndManualUpload">{{ "licenseFile" | i18n }}</bit-label>
|
||||||
<div>
|
<div>
|
||||||
<button bitButton type="button" buttonType="secondary" (click)="fileSelector.click()">
|
<button bitButton type="button" buttonType="secondary" (click)="fileSelector.click()">
|
||||||
{{ "chooseFile" | i18n }}
|
{{ "chooseFile" | i18n }}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import { Component, EventEmitter, Input, Output } from "@angular/core";
|
import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core";
|
||||||
import { FormBuilder, Validators } from "@angular/forms";
|
import { FormBuilder, Validators } from "@angular/forms";
|
||||||
|
|
||||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||||
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction";
|
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction";
|
||||||
|
import { ProductTierType } from "@bitwarden/common/billing/enums";
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
|
|
||||||
@@ -12,16 +13,17 @@ import { UpdateLicenseDialogResult } from "./update-license-types";
|
|||||||
selector: "app-update-license",
|
selector: "app-update-license",
|
||||||
templateUrl: "update-license.component.html",
|
templateUrl: "update-license.component.html",
|
||||||
})
|
})
|
||||||
export class UpdateLicenseComponent {
|
export class UpdateLicenseComponent implements OnInit {
|
||||||
@Input() organizationId: string;
|
@Input() organizationId: string;
|
||||||
@Input() showCancel = true;
|
@Input() showCancel = true;
|
||||||
|
@Input() showAutomaticSyncAndManualUpload: boolean;
|
||||||
@Output() onUpdated = new EventEmitter();
|
@Output() onUpdated = new EventEmitter();
|
||||||
@Output() onCanceled = new EventEmitter();
|
@Output() onCanceled = new EventEmitter();
|
||||||
|
|
||||||
formPromise: Promise<void>;
|
formPromise: Promise<void>;
|
||||||
title: string = this.i18nService.t("updateLicense");
|
title: string = this.i18nService.t("updateLicense");
|
||||||
updateLicenseForm = this.formBuilder.group({
|
updateLicenseForm = this.formBuilder.group({
|
||||||
file: [null, Validators.required],
|
file: [null],
|
||||||
});
|
});
|
||||||
licenseFile: File = null;
|
licenseFile: File = null;
|
||||||
constructor(
|
constructor(
|
||||||
@@ -31,6 +33,13 @@ export class UpdateLicenseComponent {
|
|||||||
private organizationApiService: OrganizationApiServiceAbstraction,
|
private organizationApiService: OrganizationApiServiceAbstraction,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
) {}
|
) {}
|
||||||
|
async ngOnInit() {
|
||||||
|
const org = await this.organizationApiService.get(this.organizationId);
|
||||||
|
if (org.plan.productTier !== ProductTierType.Families) {
|
||||||
|
this.updateLicenseForm.setValidators([Validators.required]);
|
||||||
|
this.updateLicenseForm.updateValueAndValidity();
|
||||||
|
}
|
||||||
|
}
|
||||||
protected setSelectedFile(event: Event) {
|
protected setSelectedFile(event: Event) {
|
||||||
const fileInputEl = <HTMLInputElement>event.target;
|
const fileInputEl = <HTMLInputElement>event.target;
|
||||||
const file: File = fileInputEl.files.length > 0 ? fileInputEl.files[0] : null;
|
const file: File = fileInputEl.files.length > 0 ? fileInputEl.files[0] : null;
|
||||||
|
|||||||
@@ -8544,5 +8544,8 @@
|
|||||||
},
|
},
|
||||||
"sponsored": {
|
"sponsored": {
|
||||||
"message": "Sponsored"
|
"message": "Sponsored"
|
||||||
|
},
|
||||||
|
"licenseAndBillingManagementDesc": {
|
||||||
|
"message": "After making updates in the Bitwarden cloud server, upload your license file to apply the most recent changes."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2420,7 +2420,7 @@
|
|||||||
"message": "Licence file"
|
"message": "Licence file"
|
||||||
},
|
},
|
||||||
"licenseFileDesc": {
|
"licenseFileDesc": {
|
||||||
"message": "Your licence file will be named something like $FILE_NAME$",
|
"message": "Your license file will be named something like $FILE_NAME$",
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
"file_name": {
|
"file_name": {
|
||||||
"content": "$1",
|
"content": "$1",
|
||||||
|
|||||||
@@ -2420,7 +2420,7 @@
|
|||||||
"message": "Licence file"
|
"message": "Licence file"
|
||||||
},
|
},
|
||||||
"licenseFileDesc": {
|
"licenseFileDesc": {
|
||||||
"message": "Your licence file will be named something like $FILE_NAME$",
|
"message": "Your license file will be named something like $FILE_NAME$",
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
"file_name": {
|
"file_name": {
|
||||||
"content": "$1",
|
"content": "$1",
|
||||||
|
|||||||
Reference in New Issue
Block a user