mirror of
https://github.com/bitwarden/browser
synced 2025-12-28 06:03:40 +00:00
SG-680 - Domain verification progress - (1) CopyDnsTxt added to state service (2) Refactored dialog to use async actions (3) Dialog form changes now mark form controls as touched for more responsive error handling
This commit is contained in:
@@ -609,7 +609,7 @@ import { AbstractThemingService } from "./theming/theming.service.abstraction";
|
||||
{
|
||||
provide: OrgDomainServiceAbstraction,
|
||||
useClass: OrgDomainService,
|
||||
deps: [],
|
||||
deps: [PlatformUtilsServiceAbstraction, I18nServiceAbstraction],
|
||||
},
|
||||
{
|
||||
provide: OrgDomainInternalServiceAbstraction,
|
||||
|
||||
@@ -6,6 +6,8 @@ export abstract class OrgDomainServiceAbstraction {
|
||||
orgDomains$: Observable<OrganizationDomainResponse[]>;
|
||||
|
||||
get: (orgDomainId: string) => Promise<OrganizationDomainResponse>;
|
||||
|
||||
copyDnsTxt: (dnsTxt: string) => void;
|
||||
}
|
||||
|
||||
// Note: this separate class is designed to hold methods that are not
|
||||
|
||||
@@ -2,14 +2,18 @@ import { BehaviorSubject } from "rxjs";
|
||||
|
||||
import { OrgDomainInternalServiceAbstraction } from "../../abstractions/organization-domain/org-domain.service.abstraction";
|
||||
import { OrganizationDomainResponse } from "../../abstractions/organization-domain/responses/organization-domain.response";
|
||||
import { PlatformUtilsService } from "../../abstractions/platformUtils.service";
|
||||
import { I18nService } from "../i18n.service";
|
||||
|
||||
export class OrgDomainService implements OrgDomainInternalServiceAbstraction {
|
||||
protected _orgDomains$: BehaviorSubject<OrganizationDomainResponse[]> = new BehaviorSubject([]);
|
||||
|
||||
orgDomains$ = this._orgDomains$.asObservable();
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
constructor() {}
|
||||
constructor(
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private i18nService: I18nService
|
||||
) {}
|
||||
|
||||
async get(orgDomainId: string): Promise<OrganizationDomainResponse> {
|
||||
const orgDomains: OrganizationDomainResponse[] = this._orgDomains$.getValue();
|
||||
@@ -17,6 +21,15 @@ export class OrgDomainService implements OrgDomainInternalServiceAbstraction {
|
||||
return orgDomains.find((orgDomain) => orgDomain.id === orgDomainId);
|
||||
}
|
||||
|
||||
copyDnsTxt(dnsTxt: string): void {
|
||||
this.platformUtilsService.copyToClipboard(dnsTxt);
|
||||
this.platformUtilsService.showToast(
|
||||
"success",
|
||||
null,
|
||||
this.i18nService.t("valueCopied", this.i18nService.t("dnsTxtRecord"))
|
||||
);
|
||||
}
|
||||
|
||||
upsert(orgDomains: OrganizationDomainResponse[]): void {
|
||||
const existingOrgDomains: OrganizationDomainResponse[] = this._orgDomains$.getValue();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user