mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 22:33:35 +00:00
[PM-13325] Move CollectionDialog to AC Team (#13671)
* Refactor: use standalone component * Fix easy strict errors
This commit is contained in:
@@ -3,7 +3,7 @@ import { Component, EventEmitter, Input, Output } from "@angular/core";
|
|||||||
import { ButtonModule, NoItemsModule, svgIcon } from "@bitwarden/components";
|
import { ButtonModule, NoItemsModule, svgIcon } from "@bitwarden/components";
|
||||||
|
|
||||||
import { SharedModule } from "../../../shared";
|
import { SharedModule } from "../../../shared";
|
||||||
import { CollectionDialogTabType } from "../../../vault/components/collection-dialog";
|
import { CollectionDialogTabType } from "../shared/components/collection-dialog";
|
||||||
|
|
||||||
const icon = svgIcon`<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120" viewBox="10 -10 120 140" fill="none">
|
const icon = svgIcon`<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120" viewBox="10 -10 120 140" fill="none">
|
||||||
<rect class="tw-stroke-secondary-600" width="134" height="86" x="3" y="31.485" stroke-width="6" rx="11"/>
|
<rect class="tw-stroke-secondary-600" width="134" height="86" x="3" y="31.485" stroke-width="6" rx="11"/>
|
||||||
|
|||||||
@@ -28,11 +28,11 @@ import {
|
|||||||
|
|
||||||
import { HeaderModule } from "../../../../layouts/header/header.module";
|
import { HeaderModule } from "../../../../layouts/header/header.module";
|
||||||
import { SharedModule } from "../../../../shared";
|
import { SharedModule } from "../../../../shared";
|
||||||
import { CollectionDialogTabType } from "../../../../vault/components/collection-dialog";
|
|
||||||
import {
|
import {
|
||||||
All,
|
All,
|
||||||
RoutedVaultFilterModel,
|
RoutedVaultFilterModel,
|
||||||
} from "../../../../vault/individual-vault/vault-filter/shared/models/routed-vault-filter.model";
|
} from "../../../../vault/individual-vault/vault-filter/shared/models/routed-vault-filter.model";
|
||||||
|
import { CollectionDialogTabType } from "../../shared/components/collection-dialog";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
standalone: true,
|
standalone: true,
|
||||||
|
|||||||
@@ -84,11 +84,6 @@ import { TrialFlowService } from "../../../billing/services/trial-flow.service";
|
|||||||
import { FreeTrial } from "../../../billing/types/free-trial";
|
import { FreeTrial } from "../../../billing/types/free-trial";
|
||||||
import { SharedModule } from "../../../shared";
|
import { SharedModule } from "../../../shared";
|
||||||
import { AssignCollectionsWebComponent } from "../../../vault/components/assign-collections";
|
import { AssignCollectionsWebComponent } from "../../../vault/components/assign-collections";
|
||||||
import {
|
|
||||||
CollectionDialogAction,
|
|
||||||
CollectionDialogTabType,
|
|
||||||
openCollectionDialog,
|
|
||||||
} from "../../../vault/components/collection-dialog";
|
|
||||||
import {
|
import {
|
||||||
VaultItemDialogComponent,
|
VaultItemDialogComponent,
|
||||||
VaultItemDialogMode,
|
VaultItemDialogMode,
|
||||||
@@ -117,6 +112,11 @@ import { AdminConsoleCipherFormConfigService } from "../../../vault/org-vault/se
|
|||||||
import { getNestedCollectionTree } from "../../../vault/utils/collection-utils";
|
import { getNestedCollectionTree } from "../../../vault/utils/collection-utils";
|
||||||
import { GroupApiService, GroupView } from "../core";
|
import { GroupApiService, GroupView } from "../core";
|
||||||
import { openEntityEventsDialog } from "../manage/entity-events.component";
|
import { openEntityEventsDialog } from "../manage/entity-events.component";
|
||||||
|
import {
|
||||||
|
CollectionDialogAction,
|
||||||
|
CollectionDialogTabType,
|
||||||
|
openCollectionDialog,
|
||||||
|
} from "../shared/components/collection-dialog";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
BulkCollectionsDialogComponent,
|
BulkCollectionsDialogComponent,
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ import { NgModule } from "@angular/core";
|
|||||||
|
|
||||||
import { LooseComponentsModule } from "../../../shared/loose-components.module";
|
import { LooseComponentsModule } from "../../../shared/loose-components.module";
|
||||||
import { SharedModule } from "../../../shared/shared.module";
|
import { SharedModule } from "../../../shared/shared.module";
|
||||||
import { CollectionDialogModule } from "../../../vault/components/collection-dialog";
|
|
||||||
import { OrganizationBadgeModule } from "../../../vault/individual-vault/organization-badge/organization-badge.module";
|
import { OrganizationBadgeModule } from "../../../vault/individual-vault/organization-badge/organization-badge.module";
|
||||||
import { ViewComponent } from "../../../vault/individual-vault/view.component";
|
import { ViewComponent } from "../../../vault/individual-vault/view.component";
|
||||||
|
import { CollectionDialogComponent } from "../shared/components/collection-dialog";
|
||||||
|
|
||||||
import { CollectionBadgeModule } from "./collection-badge/collection-badge.module";
|
import { CollectionBadgeModule } from "./collection-badge/collection-badge.module";
|
||||||
import { GroupBadgeModule } from "./group-badge/group-badge.module";
|
import { GroupBadgeModule } from "./group-badge/group-badge.module";
|
||||||
@@ -19,7 +19,7 @@ import { VaultComponent } from "./vault.component";
|
|||||||
GroupBadgeModule,
|
GroupBadgeModule,
|
||||||
CollectionBadgeModule,
|
CollectionBadgeModule,
|
||||||
OrganizationBadgeModule,
|
OrganizationBadgeModule,
|
||||||
CollectionDialogModule,
|
CollectionDialogComponent,
|
||||||
VaultComponent,
|
VaultComponent,
|
||||||
ViewComponent,
|
ViewComponent,
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -35,10 +35,11 @@ import { getUserId } from "@bitwarden/common/auth/services/account.service";
|
|||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
|
||||||
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
import { Utils } from "@bitwarden/common/platform/misc/utils";
|
||||||
import { BitValidators, DialogService, ToastService } from "@bitwarden/components";
|
import { SelectModule, BitValidators, DialogService, ToastService } from "@bitwarden/components";
|
||||||
|
|
||||||
import { GroupApiService, GroupView } from "../../../admin-console/organizations/core";
|
import { SharedModule } from "../../../../../shared";
|
||||||
import { PermissionMode } from "../../../admin-console/organizations/shared/components/access-selector/access-selector.component";
|
import { GroupApiService, GroupView } from "../../../core";
|
||||||
|
import { PermissionMode } from "../access-selector/access-selector.component";
|
||||||
import {
|
import {
|
||||||
AccessItemType,
|
AccessItemType,
|
||||||
AccessItemValue,
|
AccessItemValue,
|
||||||
@@ -46,7 +47,8 @@ import {
|
|||||||
CollectionPermission,
|
CollectionPermission,
|
||||||
convertToPermission,
|
convertToPermission,
|
||||||
convertToSelectionView,
|
convertToSelectionView,
|
||||||
} from "../../../admin-console/organizations/shared/components/access-selector/access-selector.models";
|
} from "../access-selector/access-selector.models";
|
||||||
|
import { AccessSelectorModule } from "../access-selector/access-selector.module";
|
||||||
|
|
||||||
export enum CollectionDialogTabType {
|
export enum CollectionDialogTabType {
|
||||||
Info = 0,
|
Info = 0,
|
||||||
@@ -80,6 +82,8 @@ export enum CollectionDialogAction {
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: "collection-dialog.component.html",
|
templateUrl: "collection-dialog.component.html",
|
||||||
|
standalone: true,
|
||||||
|
imports: [SharedModule, AccessSelectorModule, SelectModule],
|
||||||
})
|
})
|
||||||
export class CollectionDialogComponent implements OnInit, OnDestroy {
|
export class CollectionDialogComponent implements OnInit, OnDestroy {
|
||||||
private destroy$ = new Subject<void>();
|
private destroy$ = new Subject<void>();
|
||||||
@@ -289,7 +293,6 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
|||||||
if (this.tabIndex === CollectionDialogTabType.Access && !accessTabError) {
|
if (this.tabIndex === CollectionDialogTabType.Access && !accessTabError) {
|
||||||
this.toastService.showToast({
|
this.toastService.showToast({
|
||||||
variant: "error",
|
variant: "error",
|
||||||
title: null,
|
|
||||||
message: this.i18nService.t(
|
message: this.i18nService.t(
|
||||||
"fieldOnTabRequiresAttention",
|
"fieldOnTabRequiresAttention",
|
||||||
this.i18nService.t("collectionInfo"),
|
this.i18nService.t("collectionInfo"),
|
||||||
@@ -298,7 +301,6 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
|||||||
} else if (this.tabIndex === CollectionDialogTabType.Info && accessTabError) {
|
} else if (this.tabIndex === CollectionDialogTabType.Info && accessTabError) {
|
||||||
this.toastService.showToast({
|
this.toastService.showToast({
|
||||||
variant: "error",
|
variant: "error",
|
||||||
title: null,
|
|
||||||
message: this.i18nService.t("fieldOnTabRequiresAttention", this.i18nService.t("access")),
|
message: this.i18nService.t("fieldOnTabRequiresAttention", this.i18nService.t("access")),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -327,7 +329,6 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this.toastService.showToast({
|
this.toastService.showToast({
|
||||||
variant: "success",
|
variant: "success",
|
||||||
title: null,
|
|
||||||
message: this.i18nService.t(
|
message: this.i18nService.t(
|
||||||
this.editMode ? "editedCollectionId" : "createdCollectionId",
|
this.editMode ? "editedCollectionId" : "createdCollectionId",
|
||||||
collectionView.name,
|
collectionView.name,
|
||||||
@@ -357,7 +358,6 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
this.toastService.showToast({
|
this.toastService.showToast({
|
||||||
variant: "success",
|
variant: "success",
|
||||||
title: null,
|
|
||||||
message: this.i18nService.t("deletedCollectionId", this.collection?.name),
|
message: this.i18nService.t("deletedCollectionId", this.collection?.name),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -493,10 +493,7 @@ function mapUserToAccessItemView(
|
|||||||
*/
|
*/
|
||||||
export function openCollectionDialog(
|
export function openCollectionDialog(
|
||||||
dialogService: DialogService,
|
dialogService: DialogService,
|
||||||
config: DialogConfig<CollectionDialogParams>,
|
config: DialogConfig<CollectionDialogParams, DialogRef<CollectionDialogResult>>,
|
||||||
) {
|
) {
|
||||||
return dialogService.open<CollectionDialogResult, CollectionDialogParams>(
|
return dialogService.open(CollectionDialogComponent, config);
|
||||||
CollectionDialogComponent,
|
|
||||||
config,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
@@ -1,2 +1 @@
|
|||||||
export * from "./collection-dialog.component";
|
export * from "./collection-dialog.component";
|
||||||
export * from "./collection-dialog.module";
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
import { NgModule } from "@angular/core";
|
|
||||||
|
|
||||||
import { SelectModule } from "@bitwarden/components";
|
|
||||||
|
|
||||||
import { AccessSelectorModule } from "../../../admin-console/organizations/shared/components/access-selector/access-selector.module";
|
|
||||||
import { SharedModule } from "../../../shared";
|
|
||||||
|
|
||||||
import { CollectionDialogComponent } from "./collection-dialog.component";
|
|
||||||
@NgModule({
|
|
||||||
imports: [SharedModule, AccessSelectorModule, SelectModule],
|
|
||||||
declarations: [CollectionDialogComponent],
|
|
||||||
exports: [CollectionDialogComponent],
|
|
||||||
})
|
|
||||||
export class CollectionDialogModule {}
|
|
||||||
@@ -18,9 +18,9 @@ import { CipherType } from "@bitwarden/common/vault/enums";
|
|||||||
import { TreeNode } from "@bitwarden/common/vault/models/domain/tree-node";
|
import { TreeNode } from "@bitwarden/common/vault/models/domain/tree-node";
|
||||||
import { BreadcrumbsModule, MenuModule } from "@bitwarden/components";
|
import { BreadcrumbsModule, MenuModule } from "@bitwarden/components";
|
||||||
|
|
||||||
|
import { CollectionDialogTabType } from "../../../admin-console/organizations/shared/components/collection-dialog";
|
||||||
import { HeaderModule } from "../../../layouts/header/header.module";
|
import { HeaderModule } from "../../../layouts/header/header.module";
|
||||||
import { SharedModule } from "../../../shared";
|
import { SharedModule } from "../../../shared";
|
||||||
import { CollectionDialogTabType } from "../../components/collection-dialog";
|
|
||||||
import { PipesModule } from "../pipes/pipes.module";
|
import { PipesModule } from "../pipes/pipes.module";
|
||||||
import {
|
import {
|
||||||
All,
|
All,
|
||||||
|
|||||||
@@ -75,15 +75,15 @@ import {
|
|||||||
PasswordRepromptService,
|
PasswordRepromptService,
|
||||||
} from "@bitwarden/vault";
|
} from "@bitwarden/vault";
|
||||||
|
|
||||||
import { TrialFlowService } from "../../billing/services/trial-flow.service";
|
|
||||||
import { FreeTrial } from "../../billing/types/free-trial";
|
|
||||||
import { SharedModule } from "../../shared/shared.module";
|
|
||||||
import { AssignCollectionsWebComponent } from "../components/assign-collections";
|
|
||||||
import {
|
import {
|
||||||
CollectionDialogAction,
|
CollectionDialogAction,
|
||||||
CollectionDialogTabType,
|
CollectionDialogTabType,
|
||||||
openCollectionDialog,
|
openCollectionDialog,
|
||||||
} from "../components/collection-dialog";
|
} from "../../admin-console/organizations/shared/components/collection-dialog";
|
||||||
|
import { TrialFlowService } from "../../billing/services/trial-flow.service";
|
||||||
|
import { FreeTrial } from "../../billing/types/free-trial";
|
||||||
|
import { SharedModule } from "../../shared/shared.module";
|
||||||
|
import { AssignCollectionsWebComponent } from "../components/assign-collections";
|
||||||
import {
|
import {
|
||||||
VaultItemDialogComponent,
|
VaultItemDialogComponent,
|
||||||
VaultItemDialogMode,
|
VaultItemDialogMode,
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ import { NgModule } from "@angular/core";
|
|||||||
|
|
||||||
import { CollectionBadgeModule } from "../../admin-console/organizations/collections/collection-badge/collection-badge.module";
|
import { CollectionBadgeModule } from "../../admin-console/organizations/collections/collection-badge/collection-badge.module";
|
||||||
import { GroupBadgeModule } from "../../admin-console/organizations/collections/group-badge/group-badge.module";
|
import { GroupBadgeModule } from "../../admin-console/organizations/collections/group-badge/group-badge.module";
|
||||||
|
import { CollectionDialogComponent } from "../../admin-console/organizations/shared/components/collection-dialog";
|
||||||
import { LooseComponentsModule, SharedModule } from "../../shared";
|
import { LooseComponentsModule, SharedModule } from "../../shared";
|
||||||
import { CollectionDialogModule } from "../components/collection-dialog";
|
|
||||||
|
|
||||||
import { BulkDialogsModule } from "./bulk-action-dialogs/bulk-dialogs.module";
|
import { BulkDialogsModule } from "./bulk-action-dialogs/bulk-dialogs.module";
|
||||||
import { OrganizationBadgeModule } from "./organization-badge/organization-badge.module";
|
import { OrganizationBadgeModule } from "./organization-badge/organization-badge.module";
|
||||||
@@ -22,7 +22,7 @@ import { ViewComponent } from "./view.component";
|
|||||||
SharedModule,
|
SharedModule,
|
||||||
LooseComponentsModule,
|
LooseComponentsModule,
|
||||||
BulkDialogsModule,
|
BulkDialogsModule,
|
||||||
CollectionDialogModule,
|
CollectionDialogComponent,
|
||||||
VaultComponent,
|
VaultComponent,
|
||||||
ViewComponent,
|
ViewComponent,
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user