mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[PM 21106]Remove button not responsive for admin Console Remove Sponorship (#14743)
* Resolve the remove button inactive * Resolve the lint error
This commit is contained in:
@@ -179,7 +179,7 @@ export class FreeBitwardenFamiliesComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.apiService.deleteRevokeSponsorship(this.organizationId);
|
await this.organizationSponsorshipApiService.deleteRevokeSponsorship(this.organizationId, true);
|
||||||
|
|
||||||
this.toastService.showToast({
|
this.toastService.showToast({
|
||||||
variant: "success",
|
variant: "success",
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ export class SponsoringOrgRowComponent implements OnInit {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.apiService.deleteRevokeSponsorship(this.sponsoringOrg.id);
|
await this.organizationSponsorshipApiService.deleteRevokeSponsorship(this.sponsoringOrg.id);
|
||||||
this.toastService.showToast({
|
this.toastService.showToast({
|
||||||
variant: "success",
|
variant: "success",
|
||||||
title: null,
|
title: null,
|
||||||
|
|||||||
@@ -1079,7 +1079,7 @@ const safeProviders: SafeProvider[] = [
|
|||||||
safeProvider({
|
safeProvider({
|
||||||
provide: OrganizationSponsorshipApiServiceAbstraction,
|
provide: OrganizationSponsorshipApiServiceAbstraction,
|
||||||
useClass: OrganizationSponsorshipApiService,
|
useClass: OrganizationSponsorshipApiService,
|
||||||
deps: [ApiServiceAbstraction],
|
deps: [ApiServiceAbstraction, PlatformUtilsServiceAbstraction],
|
||||||
}),
|
}),
|
||||||
safeProvider({
|
safeProvider({
|
||||||
provide: OrganizationBillingApiServiceAbstraction,
|
provide: OrganizationBillingApiServiceAbstraction,
|
||||||
|
|||||||
@@ -475,7 +475,6 @@ export abstract class ApiService {
|
|||||||
getSponsorshipSyncStatus: (
|
getSponsorshipSyncStatus: (
|
||||||
sponsoredOrgId: string,
|
sponsoredOrgId: string,
|
||||||
) => Promise<OrganizationSponsorshipSyncStatusResponse>;
|
) => Promise<OrganizationSponsorshipSyncStatusResponse>;
|
||||||
deleteRevokeSponsorship: (sponsoringOrganizationId: string) => Promise<void>;
|
|
||||||
deleteRemoveSponsorship: (sponsoringOrgId: string) => Promise<void>;
|
deleteRemoveSponsorship: (sponsoringOrgId: string) => Promise<void>;
|
||||||
postPreValidateSponsorshipToken: (
|
postPreValidateSponsorshipToken: (
|
||||||
sponsorshipToken: string,
|
sponsorshipToken: string,
|
||||||
|
|||||||
@@ -10,4 +10,9 @@ export abstract class OrganizationSponsorshipApiServiceAbstraction {
|
|||||||
sponsoringOrgId: string,
|
sponsoringOrgId: string,
|
||||||
friendlyName?: string,
|
friendlyName?: string,
|
||||||
): Promise<void>;
|
): Promise<void>;
|
||||||
|
|
||||||
|
abstract deleteRevokeSponsorship: (
|
||||||
|
sponsoringOrganizationId: string,
|
||||||
|
isAdminInitiated?: boolean,
|
||||||
|
) => Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
import { ApiService } from "../../../abstractions/api.service";
|
import { ApiService } from "../../../abstractions/api.service";
|
||||||
import { ListResponse } from "../../../models/response/list.response";
|
import { ListResponse } from "../../../models/response/list.response";
|
||||||
|
import { PlatformUtilsService } from "../../../platform/abstractions/platform-utils.service";
|
||||||
import { OrganizationSponsorshipApiServiceAbstraction } from "../../abstractions/organizations/organization-sponsorship-api.service.abstraction";
|
import { OrganizationSponsorshipApiServiceAbstraction } from "../../abstractions/organizations/organization-sponsorship-api.service.abstraction";
|
||||||
import { OrganizationSponsorshipInvitesResponse } from "../../models/response/organization-sponsorship-invites.response";
|
import { OrganizationSponsorshipInvitesResponse } from "../../models/response/organization-sponsorship-invites.response";
|
||||||
|
|
||||||
export class OrganizationSponsorshipApiService
|
export class OrganizationSponsorshipApiService
|
||||||
implements OrganizationSponsorshipApiServiceAbstraction
|
implements OrganizationSponsorshipApiServiceAbstraction
|
||||||
{
|
{
|
||||||
constructor(private apiService: ApiService) {}
|
constructor(
|
||||||
|
private apiService: ApiService,
|
||||||
|
private platformUtilsService: PlatformUtilsService,
|
||||||
|
) {}
|
||||||
async getOrganizationSponsorship(
|
async getOrganizationSponsorship(
|
||||||
sponsoredOrgId: string,
|
sponsoredOrgId: string,
|
||||||
): Promise<ListResponse<OrganizationSponsorshipInvitesResponse>> {
|
): Promise<ListResponse<OrganizationSponsorshipInvitesResponse>> {
|
||||||
@@ -33,4 +37,21 @@ export class OrganizationSponsorshipApiService
|
|||||||
|
|
||||||
return await this.apiService.send("POST", url, null, true, false);
|
return await this.apiService.send("POST", url, null, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async deleteRevokeSponsorship(
|
||||||
|
sponsoringOrganizationId: string,
|
||||||
|
isAdminInitiated: boolean = false,
|
||||||
|
): Promise<void> {
|
||||||
|
const basePath = "/organization/sponsorship/";
|
||||||
|
const hostPath = this.platformUtilsService.isSelfHost() ? "self-hosted/" : "";
|
||||||
|
const queryParam = `?isAdminInitiated=${isAdminInitiated}`;
|
||||||
|
|
||||||
|
return await this.apiService.send(
|
||||||
|
"DELETE",
|
||||||
|
basePath + hostPath + sponsoringOrganizationId + queryParam,
|
||||||
|
null,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1621,18 +1621,6 @@ export class ApiService implements ApiServiceAbstraction {
|
|||||||
return new OrganizationSponsorshipSyncStatusResponse(response);
|
return new OrganizationSponsorshipSyncStatusResponse(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
async deleteRevokeSponsorship(sponsoringOrganizationId: string): Promise<void> {
|
|
||||||
return await this.send(
|
|
||||||
"DELETE",
|
|
||||||
"/organization/sponsorship/" +
|
|
||||||
(this.platformUtilsService.isSelfHost() ? "self-hosted/" : "") +
|
|
||||||
sponsoringOrganizationId,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async deleteRemoveSponsorship(sponsoringOrgId: string): Promise<void> {
|
async deleteRemoveSponsorship(sponsoringOrgId: string): Promise<void> {
|
||||||
return await this.send(
|
return await this.send(
|
||||||
"DELETE",
|
"DELETE",
|
||||||
|
|||||||
Reference in New Issue
Block a user