1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-08 11:33:28 +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:
cyprain-okeke
2024-07-11 18:05:17 +01:00
committed by GitHub
parent 39eed02904
commit cc206d4c3f
8 changed files with 39 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
<form [formGroup]="updateLicenseForm" [bitSubmit]="submit">
<bit-form-field>
<bit-label>{{ "licenseFile" | i18n }}</bit-label>
<bit-label *ngIf="showAutomaticSyncAndManualUpload">{{ "licenseFile" | i18n }}</bit-label>
<div>
<button bitButton type="button" buttonType="secondary" (click)="fileSelector.click()">
{{ "chooseFile" | i18n }}

View File

@@ -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 { ApiService } from "@bitwarden/common/abstractions/api.service";
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 { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
@@ -12,16 +13,17 @@ import { UpdateLicenseDialogResult } from "./update-license-types";
selector: "app-update-license",
templateUrl: "update-license.component.html",
})
export class UpdateLicenseComponent {
export class UpdateLicenseComponent implements OnInit {
@Input() organizationId: string;
@Input() showCancel = true;
@Input() showAutomaticSyncAndManualUpload: boolean;
@Output() onUpdated = new EventEmitter();
@Output() onCanceled = new EventEmitter();
formPromise: Promise<void>;
title: string = this.i18nService.t("updateLicense");
updateLicenseForm = this.formBuilder.group({
file: [null, Validators.required],
file: [null],
});
licenseFile: File = null;
constructor(
@@ -31,6 +33,13 @@ export class UpdateLicenseComponent {
private organizationApiService: OrganizationApiServiceAbstraction,
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) {
const fileInputEl = <HTMLInputElement>event.target;
const file: File = fileInputEl.files.length > 0 ? fileInputEl.files[0] : null;