mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 00:33:44 +00:00
Fix org api service refactor and linting after pulling in master
This commit is contained in:
@@ -1,22 +1,27 @@
|
|||||||
import { Component, OnInit } from "@angular/core";
|
import { Component, OnInit } from "@angular/core";
|
||||||
import { ActivatedRoute } from "@angular/router";
|
import { ActivatedRoute } from "@angular/router";
|
||||||
|
|
||||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
|
||||||
import { BillingHistoryResponse } from "@bitwarden/common/models/response/billingHistoryResponse";
|
import { BillingHistoryResponse } from "@bitwarden/common/models/response/billingHistoryResponse";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-org-billing-history-view",
|
selector: "app-org-billing-history-view",
|
||||||
templateUrl: "organization-billing-history-view.component.html",
|
templateUrl: "organization-billing-history-view.component.html",
|
||||||
})
|
})
|
||||||
|
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
||||||
export class OrgBillingHistoryViewComponent implements OnInit {
|
export class OrgBillingHistoryViewComponent implements OnInit {
|
||||||
loading = false;
|
loading = false;
|
||||||
firstLoaded = false;
|
firstLoaded = false;
|
||||||
billing: BillingHistoryResponse;
|
billing: BillingHistoryResponse;
|
||||||
organizationId: string;
|
organizationId: string;
|
||||||
|
|
||||||
constructor(private apiService: ApiService, private route: ActivatedRoute) {}
|
constructor(
|
||||||
|
private organizationApiService: OrganizationApiServiceAbstraction,
|
||||||
|
private route: ActivatedRoute
|
||||||
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
|
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
|
||||||
this.route.params.subscribe(async (params) => {
|
this.route.params.subscribe(async (params) => {
|
||||||
this.organizationId = params.organizationId;
|
this.organizationId = params.organizationId;
|
||||||
await this.load();
|
await this.load();
|
||||||
@@ -29,7 +34,7 @@ export class OrgBillingHistoryViewComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.billing = await this.apiService.getOrganizationBilling(this.organizationId);
|
this.billing = await this.organizationApiService.getBilling(this.organizationId);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { Organization } from "@bitwarden/common/models/domain/organization";
|
|||||||
selector: "app-org-reporting",
|
selector: "app-org-reporting",
|
||||||
templateUrl: "reporting.component.html",
|
templateUrl: "reporting.component.html",
|
||||||
})
|
})
|
||||||
|
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
||||||
export class ReportingComponent implements OnInit {
|
export class ReportingComponent implements OnInit {
|
||||||
organization: Organization;
|
organization: Organization;
|
||||||
accessEvents = false;
|
accessEvents = false;
|
||||||
@@ -16,6 +17,7 @@ export class ReportingComponent implements OnInit {
|
|||||||
constructor(private route: ActivatedRoute, private organizationService: OrganizationService) {}
|
constructor(private route: ActivatedRoute, private organizationService: OrganizationService) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
|
||||||
this.route.parent.params.subscribe(async (params) => {
|
this.route.parent.params.subscribe(async (params) => {
|
||||||
this.organization = await this.organizationService.get(params.organizationId);
|
this.organization = await this.organizationService.get(params.organizationId);
|
||||||
this.accessEvents = this.showLeftNav = this.organization.useEvents;
|
this.accessEvents = this.showLeftNav = this.organization.useEvents;
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ export class ReportsHomeComponent implements OnInit, OnDestroy {
|
|||||||
constructor(private stateService: StateService, router: Router) {
|
constructor(private stateService: StateService, router: Router) {
|
||||||
router.events
|
router.events
|
||||||
.pipe(
|
.pipe(
|
||||||
takeUntil(this.destrory$),
|
filter((event) => event instanceof NavigationEnd),
|
||||||
filter((event) => event instanceof NavigationEnd)
|
takeUntil(this.destrory$)
|
||||||
)
|
)
|
||||||
.subscribe((event) => {
|
.subscribe((event) => {
|
||||||
this.homepage = (event as NavigationEnd).urlAfterRedirects.endsWith("/reports");
|
this.homepage = (event as NavigationEnd).urlAfterRedirects.endsWith("/reports");
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { ActivatedRoute, Router } from "@angular/router";
|
|||||||
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
import { ApiService } from "@bitwarden/common/abstractions/api.service";
|
||||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
import { LogService } from "@bitwarden/common/abstractions/log.service";
|
||||||
|
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/abstractions/organization/organization-api.service.abstraction";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||||
import { PaymentMethodType } from "@bitwarden/common/enums/paymentMethodType";
|
import { PaymentMethodType } from "@bitwarden/common/enums/paymentMethodType";
|
||||||
import { VerifyBankRequest } from "@bitwarden/common/models/request/verifyBankRequest";
|
import { VerifyBankRequest } from "@bitwarden/common/models/request/verifyBankRequest";
|
||||||
@@ -17,6 +18,7 @@ import { TaxInfoComponent } from "./tax-info.component";
|
|||||||
selector: "app-payment-method",
|
selector: "app-payment-method",
|
||||||
templateUrl: "payment-method.component.html",
|
templateUrl: "payment-method.component.html",
|
||||||
})
|
})
|
||||||
|
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
||||||
export class PaymentMethodComponent implements OnInit {
|
export class PaymentMethodComponent implements OnInit {
|
||||||
@ViewChild(TaxInfoComponent) taxInfo: TaxInfoComponent;
|
@ViewChild(TaxInfoComponent) taxInfo: TaxInfoComponent;
|
||||||
|
|
||||||
@@ -47,6 +49,7 @@ export class PaymentMethodComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected apiService: ApiService,
|
protected apiService: ApiService,
|
||||||
|
protected organizationApiService: OrganizationApiServiceAbstraction,
|
||||||
protected i18nService: I18nService,
|
protected i18nService: I18nService,
|
||||||
protected platformUtilsService: PlatformUtilsService,
|
protected platformUtilsService: PlatformUtilsService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
@@ -56,6 +59,7 @@ export class PaymentMethodComponent implements OnInit {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
|
// eslint-disable-next-line rxjs-angular/prefer-takeuntil, rxjs/no-async-subscribe
|
||||||
this.route.params.subscribe(async (params) => {
|
this.route.params.subscribe(async (params) => {
|
||||||
if (params.organizationId) {
|
if (params.organizationId) {
|
||||||
this.organizationId = params.organizationId;
|
this.organizationId = params.organizationId;
|
||||||
@@ -76,8 +80,8 @@ export class PaymentMethodComponent implements OnInit {
|
|||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
||||||
if (this.forOrganization) {
|
if (this.forOrganization) {
|
||||||
const billingPromise = this.apiService.getOrganizationBilling(this.organizationId);
|
const billingPromise = this.organizationApiService.getBilling(this.organizationId);
|
||||||
const orgPromise = this.apiService.getOrganization(this.organizationId);
|
const orgPromise = this.organizationApiService.get(this.organizationId);
|
||||||
|
|
||||||
[this.billing, this.org] = await Promise.all([billingPromise, orgPromise]);
|
[this.billing, this.org] = await Promise.all([billingPromise, orgPromise]);
|
||||||
} else {
|
} else {
|
||||||
@@ -138,10 +142,7 @@ export class PaymentMethodComponent implements OnInit {
|
|||||||
const request = new VerifyBankRequest();
|
const request = new VerifyBankRequest();
|
||||||
request.amount1 = this.verifyBankForm.value.amount1;
|
request.amount1 = this.verifyBankForm.value.amount1;
|
||||||
request.amount2 = this.verifyBankForm.value.amount2;
|
request.amount2 = this.verifyBankForm.value.amount2;
|
||||||
this.verifyBankPromise = this.apiService.postOrganizationVerifyBank(
|
this.verifyBankPromise = this.organizationApiService.verifyBank(this.organizationId, request);
|
||||||
this.organizationId,
|
|
||||||
request
|
|
||||||
);
|
|
||||||
await this.verifyBankPromise;
|
await this.verifyBankPromise;
|
||||||
this.platformUtilsService.showToast(
|
this.platformUtilsService.showToast(
|
||||||
"success",
|
"success",
|
||||||
|
|||||||
Reference in New Issue
Block a user