mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 16:23:44 +00:00
integrate add cipher with admin console vault
This commit is contained in:
@@ -89,12 +89,6 @@ import {
|
|||||||
} from "../components/vault-item-dialog/vault-item-dialog.component";
|
} from "../components/vault-item-dialog/vault-item-dialog.component";
|
||||||
import { VaultItemEvent } from "../components/vault-items/vault-item-event";
|
import { VaultItemEvent } from "../components/vault-items/vault-item-event";
|
||||||
import { VaultItemsModule } from "../components/vault-items/vault-items.module";
|
import { VaultItemsModule } from "../components/vault-items/vault-items.module";
|
||||||
import {
|
|
||||||
AddEditCipherDialogCloseResult,
|
|
||||||
AddEditCipherDialogResult,
|
|
||||||
AddEditComponentV2,
|
|
||||||
openAddEditCipherDialog,
|
|
||||||
} from "../individual-vault/add-edit-v2.component";
|
|
||||||
import {
|
import {
|
||||||
BulkDeleteDialogResult,
|
BulkDeleteDialogResult,
|
||||||
openBulkDeleteDialog,
|
openBulkDeleteDialog,
|
||||||
@@ -139,7 +133,6 @@ enum AddAccessStatusType {
|
|||||||
VaultItemsModule,
|
VaultItemsModule,
|
||||||
SharedModule,
|
SharedModule,
|
||||||
NoItemsModule,
|
NoItemsModule,
|
||||||
AddEditComponentV2,
|
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
RoutedVaultFilterService,
|
RoutedVaultFilterService,
|
||||||
@@ -784,28 +777,14 @@ export class VaultComponent implements OnInit, OnDestroy {
|
|||||||
cipherType,
|
cipherType,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const collectionId: CollectionId | undefined = this.activeFilter.collectionId as CollectionId;
|
||||||
|
|
||||||
cipherFormConfig.initialValues = {
|
cipherFormConfig.initialValues = {
|
||||||
organizationId: this.organization.id as OrganizationId,
|
organizationId: this.organization.id as OrganizationId,
|
||||||
collectionIds: this.collections.map((c) => c.id as CollectionId),
|
collectionIds: collectionId ? [collectionId] : [],
|
||||||
};
|
};
|
||||||
|
|
||||||
// Open the dialog.
|
await this.openVaultItemDialog("form", cipherFormConfig);
|
||||||
const dialogRef = openAddEditCipherDialog(this.dialogService, {
|
|
||||||
data: cipherFormConfig,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Wait for the dialog to close.
|
|
||||||
const result: AddEditCipherDialogCloseResult = await lastValueFrom(dialogRef.closed);
|
|
||||||
|
|
||||||
// Refresh the vault to show the new cipher.
|
|
||||||
if (result?.action === AddEditCipherDialogResult.Added) {
|
|
||||||
this.refresh();
|
|
||||||
this.go({ itemId: result.id, action: "view" });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If the dialog was closed by any other action navigate back to the vault.
|
|
||||||
this.go({ cipherId: null, itemId: null, action: null });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async editCipher(
|
async editCipher(
|
||||||
|
|||||||
Reference in New Issue
Block a user