-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PM-12425] Remove FF: AC-2828_provider-portal-members-page (#11241)
* Remove FF: AC-2828_provider-portal-members-page * Thomas' feedback: Fix provider layout
- Loading branch information
1 parent
9a1879b
commit 470ddf7
Showing
18 changed files
with
164 additions
and
775 deletions.
There are no files selected for viewing
File renamed without changes.
87 changes: 87 additions & 0 deletions
87
.../app/admin-console/organizations/members/components/bulk/bulk-confirm-dialog.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import { DIALOG_DATA, DialogConfig } from "@angular/cdk/dialog"; | ||
import { Component, Inject } from "@angular/core"; | ||
import { takeUntilDestroyed } from "@angular/core/rxjs-interop"; | ||
import { firstValueFrom, map, Observable, switchMap } from "rxjs"; | ||
|
||
import { | ||
OrganizationUserApiService, | ||
OrganizationUserBulkConfirmRequest, | ||
OrganizationUserBulkPublicKeyResponse, | ||
OrganizationUserBulkResponse, | ||
} from "@bitwarden/admin-console/common"; | ||
import { OrganizationUserStatusType } from "@bitwarden/common/admin-console/enums"; | ||
import { ProviderUserBulkPublicKeyResponse } from "@bitwarden/common/admin-console/models/response/provider/provider-user-bulk-public-key.response"; | ||
import { ProviderUserBulkResponse } from "@bitwarden/common/admin-console/models/response/provider/provider-user-bulk.response"; | ||
import { ListResponse } from "@bitwarden/common/models/response/list.response"; | ||
import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service"; | ||
import { EncryptService } from "@bitwarden/common/platform/abstractions/encrypt.service"; | ||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; | ||
import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key"; | ||
import { StateProvider } from "@bitwarden/common/platform/state"; | ||
import { OrganizationId } from "@bitwarden/common/types/guid"; | ||
import { OrgKey } from "@bitwarden/common/types/key"; | ||
import { DialogService } from "@bitwarden/components"; | ||
|
||
import { BaseBulkConfirmComponent } from "./base-bulk-confirm.component"; | ||
import { BulkUserDetails } from "./bulk-status.component"; | ||
|
||
type BulkConfirmDialogParams = { | ||
organizationId: string; | ||
users: BulkUserDetails[]; | ||
}; | ||
|
||
@Component({ | ||
templateUrl: "bulk-confirm-dialog.component.html", | ||
}) | ||
export class BulkConfirmDialogComponent extends BaseBulkConfirmComponent { | ||
organizationId: string; | ||
organizationKey$: Observable<OrgKey>; | ||
users: BulkUserDetails[]; | ||
|
||
constructor( | ||
protected cryptoService: CryptoService, | ||
@Inject(DIALOG_DATA) protected dialogParams: BulkConfirmDialogParams, | ||
protected encryptService: EncryptService, | ||
private organizationUserApiService: OrganizationUserApiService, | ||
protected i18nService: I18nService, | ||
private stateProvider: StateProvider, | ||
) { | ||
super(cryptoService, encryptService, i18nService); | ||
|
||
this.organizationId = dialogParams.organizationId; | ||
this.organizationKey$ = this.stateProvider.activeUserId$.pipe( | ||
switchMap((userId) => this.cryptoService.orgKeys$(userId)), | ||
map((organizationKeysById) => organizationKeysById[this.organizationId as OrganizationId]), | ||
takeUntilDestroyed(), | ||
); | ||
this.users = dialogParams.users; | ||
} | ||
|
||
protected getCryptoKey = async (): Promise<SymmetricCryptoKey> => | ||
await firstValueFrom(this.organizationKey$); | ||
|
||
protected getPublicKeys = async (): Promise< | ||
ListResponse<OrganizationUserBulkPublicKeyResponse | ProviderUserBulkPublicKeyResponse> | ||
> => | ||
await this.organizationUserApiService.postOrganizationUsersPublicKey( | ||
this.organizationId, | ||
this.filteredUsers.map((user) => user.id), | ||
); | ||
|
||
protected isAccepted = (user: BulkUserDetails) => | ||
user.status === OrganizationUserStatusType.Accepted; | ||
|
||
protected postConfirmRequest = async ( | ||
userIdsWithKeys: { id: string; key: string }[], | ||
): Promise<ListResponse<OrganizationUserBulkResponse | ProviderUserBulkResponse>> => { | ||
const request = new OrganizationUserBulkConfirmRequest(userIdsWithKeys); | ||
return await this.organizationUserApiService.postOrganizationUserBulkConfirm( | ||
this.organizationId, | ||
request, | ||
); | ||
}; | ||
|
||
static open(dialogService: DialogService, config: DialogConfig<BulkConfirmDialogParams>) { | ||
return dialogService.open(BulkConfirmDialogComponent, config); | ||
} | ||
} |
132 changes: 0 additions & 132 deletions
132
...web/src/app/admin-console/organizations/members/components/bulk/bulk-confirm.component.ts
This file was deleted.
Oops, something went wrong.
File renamed without changes.
54 changes: 54 additions & 0 deletions
54
...c/app/admin-console/organizations/members/components/bulk/bulk-remove-dialog.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { DIALOG_DATA, DialogConfig } from "@angular/cdk/dialog"; | ||
import { Component, Inject } from "@angular/core"; | ||
|
||
import { | ||
OrganizationUserApiService, | ||
OrganizationUserBulkResponse, | ||
} from "@bitwarden/admin-console/common"; | ||
import { OrganizationUserStatusType } from "@bitwarden/common/admin-console/enums"; | ||
import { ListResponse } from "@bitwarden/common/models/response/list.response"; | ||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; | ||
import { DialogService } from "@bitwarden/components"; | ||
|
||
import { BaseBulkRemoveComponent } from "./base-bulk-remove.component"; | ||
import { BulkUserDetails } from "./bulk-status.component"; | ||
|
||
type BulkRemoveDialogParams = { | ||
organizationId: string; | ||
users: BulkUserDetails[]; | ||
}; | ||
|
||
@Component({ | ||
templateUrl: "bulk-remove-dialog.component.html", | ||
}) | ||
export class BulkRemoveDialogComponent extends BaseBulkRemoveComponent { | ||
organizationId: string; | ||
users: BulkUserDetails[]; | ||
|
||
constructor( | ||
@Inject(DIALOG_DATA) protected dialogParams: BulkRemoveDialogParams, | ||
protected i18nService: I18nService, | ||
private organizationUserApiService: OrganizationUserApiService, | ||
) { | ||
super(i18nService); | ||
this.organizationId = dialogParams.organizationId; | ||
this.users = dialogParams.users; | ||
this.showNoMasterPasswordWarning = this.users.some( | ||
(u) => u.status > OrganizationUserStatusType.Invited && u.hasMasterPassword === false, | ||
); | ||
} | ||
|
||
protected deleteUsers = (): Promise<ListResponse<OrganizationUserBulkResponse>> => | ||
this.organizationUserApiService.removeManyOrganizationUsers( | ||
this.organizationId, | ||
this.users.map((user) => user.id), | ||
); | ||
|
||
protected get removeUsersWarning() { | ||
return this.i18nService.t("removeOrgUsersConfirmation"); | ||
} | ||
|
||
static open(dialogService: DialogService, config: DialogConfig<BulkRemoveDialogParams>) { | ||
return dialogService.open(BulkRemoveDialogComponent, config); | ||
} | ||
} |
76 changes: 0 additions & 76 deletions
76
.../web/src/app/admin-console/organizations/members/components/bulk/bulk-remove.component.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.