1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-28 12:45:45 +01:00

[PM-4198][TechDebt] Split up import and export modules (#6483)

* Split up import/export into separate modules

* Fix routing and apply PR feedback

* Renamed OrganizationExport exports to OrganizationVaultExport

* Renamed filenames according to export rename

---------

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
Daniel James Smith 2023-10-10 19:12:13 +02:00 committed by GitHub
parent ad867150a0
commit 3e720c05f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 103 additions and 44 deletions

View File

@ -45,13 +45,23 @@ const routes: Routes = [
},
{
path: "tools",
children: [
{
path: "import",
loadChildren: () =>
import("../tools/import-export/org-import-export.module").then(
(m) => m.OrganizationImportExportModule
import("../tools/import/org-import.module").then((m) => m.OrganizationImportModule),
},
{
path: "export",
loadChildren: () =>
import("../tools/vault-export/org-vault-export.module").then(
(m) => m.OrganizationVaultExportModule
),
},
],
},
],
},
];
function getSettingsRoute(organization: Organization) {

View File

@ -3,14 +3,13 @@ import { RouterModule, Routes } from "@angular/router";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { OrganizationPermissionsGuard } from "../../../../admin-console/organizations/guards/org-permissions.guard";
import { OrganizationPermissionsGuard } from "../../guards/org-permissions.guard";
import { OrganizationExportComponent } from "./org-export.component";
import { OrganizationImportComponent } from "./org-import.component";
const routes: Routes = [
{
path: "import",
path: "",
component: OrganizationImportComponent,
canActivate: [OrganizationPermissionsGuard],
data: {
@ -18,18 +17,9 @@ const routes: Routes = [
organizationPermissions: (org: Organization) => org.canAccessImportExport,
},
},
{
path: "export",
component: OrganizationExportComponent,
canActivate: [OrganizationPermissionsGuard],
data: {
titleId: "exportVault",
organizationPermissions: (org: Organization) => org.canAccessImportExport,
},
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
})
export class OrganizationImportExportRoutingModule {}
export class OrganizationImportRoutingModule {}

View File

@ -18,11 +18,11 @@ import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.serv
import { DialogService } from "@bitwarden/components";
import { ImportServiceAbstraction } from "@bitwarden/importer";
import { ImportComponent } from "../../../../tools/import-export/import.component";
import { ImportComponent } from "../../../../tools/import/import.component";
@Component({
selector: "app-org-import",
templateUrl: "../../../../tools/import-export/import.component.html",
templateUrl: "../../../../tools/import/import.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class OrganizationImportComponent extends ImportComponent {

View File

@ -15,13 +15,12 @@ import {
import { LooseComponentsModule, SharedModule } from "../../../../shared";
import { OrganizationExportComponent } from "./org-export.component";
import { OrganizationImportExportRoutingModule } from "./org-import-export-routing.module";
import { OrganizationImportRoutingModule } from "./org-import-routing.module";
import { OrganizationImportComponent } from "./org-import.component";
@NgModule({
imports: [SharedModule, LooseComponentsModule, OrganizationImportExportRoutingModule],
declarations: [OrganizationImportComponent, OrganizationExportComponent],
imports: [SharedModule, LooseComponentsModule, OrganizationImportRoutingModule],
declarations: [OrganizationImportComponent],
providers: [
{
provide: ImportApiServiceAbstraction,
@ -42,4 +41,4 @@ import { OrganizationImportComponent } from "./org-import.component";
},
],
})
export class OrganizationImportExportModule {}
export class OrganizationImportModule {}

View File

@ -0,0 +1,25 @@
import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { OrganizationPermissionsGuard } from "../../guards/org-permissions.guard";
import { OrganizationVaultExportComponent } from "./org-vault-export.component";
const routes: Routes = [
{
path: "",
component: OrganizationVaultExportComponent,
canActivate: [OrganizationPermissionsGuard],
data: {
titleId: "exportVault",
organizationPermissions: (org: Organization) => org.canAccessImportExport,
},
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
})
export class OrganizationVaultExportRoutingModule {}

View File

@ -14,14 +14,14 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
import { DialogService } from "@bitwarden/components";
import { VaultExportServiceAbstraction } from "@bitwarden/exporter/vault-export";
import { ExportComponent } from "../../../../tools/import-export/export.component";
import { ExportComponent } from "../../../../tools/vault-export/export.component";
@Component({
selector: "app-org-export",
templateUrl: "../../../../tools/import-export/export.component.html",
templateUrl: "../../../../tools/vault-export/export.component.html",
})
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
export class OrganizationExportComponent extends ExportComponent {
export class OrganizationVaultExportComponent extends ExportComponent {
constructor(
cryptoService: CryptoService,
i18nService: I18nService,

View File

@ -0,0 +1,12 @@
import { NgModule } from "@angular/core";
import { LooseComponentsModule, SharedModule } from "../../../../shared";
import { OrganizationVaultExportRoutingModule } from "./org-vault-export-routing.module";
import { OrganizationVaultExportComponent } from "./org-vault-export.component";
@NgModule({
imports: [SharedModule, LooseComponentsModule, OrganizationVaultExportRoutingModule],
declarations: [OrganizationVaultExportComponent],
})
export class OrganizationVaultExportModule {}

View File

@ -254,11 +254,13 @@ const routes: Routes = [
children: [
{ path: "", pathMatch: "full", redirectTo: "generator" },
{
path: "",
path: "import",
loadChildren: () => import("./tools/import/import.module").then((m) => m.ImportModule),
},
{
path: "export",
loadChildren: () =>
import("./tools/import-export/import-export.module").then(
(m) => m.ImportExportModule
),
import("./tools/vault-export/export.module").then((m) => m.ExportModule),
},
{
path: "generator",

View File

@ -0,0 +1,17 @@
import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
import { ImportComponent } from "./import.component";
const routes: Routes = [
{
path: "",
component: ImportComponent,
data: { titleId: "importData" },
},
];
@NgModule({
imports: [RouterModule.forChild(routes)],
})
export class ImportRoutingModule {}

View File

@ -20,15 +20,13 @@ import {
ImportSuccessDialogComponent,
FilePasswordPromptComponent,
} from "./dialog";
import { ExportComponent } from "./export.component";
import { ImportExportRoutingModule } from "./import-export-routing.module";
import { ImportRoutingModule } from "./import-routing.module";
import { ImportComponent } from "./import.component";
@NgModule({
imports: [SharedModule, LooseComponentsModule, ImportExportRoutingModule],
imports: [SharedModule, LooseComponentsModule, ImportRoutingModule],
declarations: [
ImportComponent,
ExportComponent,
FilePasswordPromptComponent,
ImportErrorDialogComponent,
ImportSuccessDialogComponent,
@ -53,4 +51,4 @@ import { ImportComponent } from "./import.component";
},
],
})
export class ImportExportModule {}
export class ImportModule {}

View File

@ -2,16 +2,10 @@ import { NgModule } from "@angular/core";
import { RouterModule, Routes } from "@angular/router";
import { ExportComponent } from "./export.component";
import { ImportComponent } from "./import.component";
const routes: Routes = [
{
path: "import",
component: ImportComponent,
data: { titleId: "importData" },
},
{
path: "export",
path: "",
component: ExportComponent,
data: { titleId: "exportVault" },
},
@ -20,4 +14,4 @@ const routes: Routes = [
@NgModule({
imports: [RouterModule.forChild(routes)],
})
export class ImportExportRoutingModule {}
export class ExportRoutingModule {}

View File

@ -0,0 +1,12 @@
import { NgModule } from "@angular/core";
import { LooseComponentsModule, SharedModule } from "../../shared";
import { ExportRoutingModule } from "./export-routing.module";
import { ExportComponent } from "./export.component";
@NgModule({
imports: [SharedModule, LooseComponentsModule, ExportRoutingModule],
declarations: [ExportComponent],
})
export class ExportModule {}