mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-25 12:15:18 +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:
parent
ad867150a0
commit
3e720c05f2
@ -45,10 +45,20 @@ const routes: Routes = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "tools",
|
path: "tools",
|
||||||
loadChildren: () =>
|
children: [
|
||||||
import("../tools/import-export/org-import-export.module").then(
|
{
|
||||||
(m) => m.OrganizationImportExportModule
|
path: "import",
|
||||||
),
|
loadChildren: () =>
|
||||||
|
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
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -3,14 +3,13 @@ import { RouterModule, Routes } from "@angular/router";
|
|||||||
|
|
||||||
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
|
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";
|
import { OrganizationImportComponent } from "./org-import.component";
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{
|
{
|
||||||
path: "import",
|
path: "",
|
||||||
component: OrganizationImportComponent,
|
component: OrganizationImportComponent,
|
||||||
canActivate: [OrganizationPermissionsGuard],
|
canActivate: [OrganizationPermissionsGuard],
|
||||||
data: {
|
data: {
|
||||||
@ -18,18 +17,9 @@ const routes: Routes = [
|
|||||||
organizationPermissions: (org: Organization) => org.canAccessImportExport,
|
organizationPermissions: (org: Organization) => org.canAccessImportExport,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
path: "export",
|
|
||||||
component: OrganizationExportComponent,
|
|
||||||
canActivate: [OrganizationPermissionsGuard],
|
|
||||||
data: {
|
|
||||||
titleId: "exportVault",
|
|
||||||
organizationPermissions: (org: Organization) => org.canAccessImportExport,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forChild(routes)],
|
imports: [RouterModule.forChild(routes)],
|
||||||
})
|
})
|
||||||
export class OrganizationImportExportRoutingModule {}
|
export class OrganizationImportRoutingModule {}
|
@ -18,11 +18,11 @@ import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.serv
|
|||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService } from "@bitwarden/components";
|
||||||
import { ImportServiceAbstraction } from "@bitwarden/importer";
|
import { ImportServiceAbstraction } from "@bitwarden/importer";
|
||||||
|
|
||||||
import { ImportComponent } from "../../../../tools/import-export/import.component";
|
import { ImportComponent } from "../../../../tools/import/import.component";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-org-import",
|
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
|
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
||||||
export class OrganizationImportComponent extends ImportComponent {
|
export class OrganizationImportComponent extends ImportComponent {
|
@ -15,13 +15,12 @@ import {
|
|||||||
|
|
||||||
import { LooseComponentsModule, SharedModule } from "../../../../shared";
|
import { LooseComponentsModule, SharedModule } from "../../../../shared";
|
||||||
|
|
||||||
import { OrganizationExportComponent } from "./org-export.component";
|
import { OrganizationImportRoutingModule } from "./org-import-routing.module";
|
||||||
import { OrganizationImportExportRoutingModule } from "./org-import-export-routing.module";
|
|
||||||
import { OrganizationImportComponent } from "./org-import.component";
|
import { OrganizationImportComponent } from "./org-import.component";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [SharedModule, LooseComponentsModule, OrganizationImportExportRoutingModule],
|
imports: [SharedModule, LooseComponentsModule, OrganizationImportRoutingModule],
|
||||||
declarations: [OrganizationImportComponent, OrganizationExportComponent],
|
declarations: [OrganizationImportComponent],
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
provide: ImportApiServiceAbstraction,
|
provide: ImportApiServiceAbstraction,
|
||||||
@ -42,4 +41,4 @@ import { OrganizationImportComponent } from "./org-import.component";
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class OrganizationImportExportModule {}
|
export class OrganizationImportModule {}
|
@ -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 {}
|
@ -14,14 +14,14 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
|
|||||||
import { DialogService } from "@bitwarden/components";
|
import { DialogService } from "@bitwarden/components";
|
||||||
import { VaultExportServiceAbstraction } from "@bitwarden/exporter/vault-export";
|
import { VaultExportServiceAbstraction } from "@bitwarden/exporter/vault-export";
|
||||||
|
|
||||||
import { ExportComponent } from "../../../../tools/import-export/export.component";
|
import { ExportComponent } from "../../../../tools/vault-export/export.component";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "app-org-export",
|
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
|
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
||||||
export class OrganizationExportComponent extends ExportComponent {
|
export class OrganizationVaultExportComponent extends ExportComponent {
|
||||||
constructor(
|
constructor(
|
||||||
cryptoService: CryptoService,
|
cryptoService: CryptoService,
|
||||||
i18nService: I18nService,
|
i18nService: I18nService,
|
@ -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 {}
|
@ -254,11 +254,13 @@ const routes: Routes = [
|
|||||||
children: [
|
children: [
|
||||||
{ path: "", pathMatch: "full", redirectTo: "generator" },
|
{ path: "", pathMatch: "full", redirectTo: "generator" },
|
||||||
{
|
{
|
||||||
path: "",
|
path: "import",
|
||||||
|
loadChildren: () => import("./tools/import/import.module").then((m) => m.ImportModule),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "export",
|
||||||
loadChildren: () =>
|
loadChildren: () =>
|
||||||
import("./tools/import-export/import-export.module").then(
|
import("./tools/vault-export/export.module").then((m) => m.ExportModule),
|
||||||
(m) => m.ImportExportModule
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "generator",
|
path: "generator",
|
||||||
|
17
apps/web/src/app/tools/import/import-routing.module.ts
Normal file
17
apps/web/src/app/tools/import/import-routing.module.ts
Normal 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 {}
|
@ -20,15 +20,13 @@ import {
|
|||||||
ImportSuccessDialogComponent,
|
ImportSuccessDialogComponent,
|
||||||
FilePasswordPromptComponent,
|
FilePasswordPromptComponent,
|
||||||
} from "./dialog";
|
} from "./dialog";
|
||||||
import { ExportComponent } from "./export.component";
|
import { ImportRoutingModule } from "./import-routing.module";
|
||||||
import { ImportExportRoutingModule } from "./import-export-routing.module";
|
|
||||||
import { ImportComponent } from "./import.component";
|
import { ImportComponent } from "./import.component";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [SharedModule, LooseComponentsModule, ImportExportRoutingModule],
|
imports: [SharedModule, LooseComponentsModule, ImportRoutingModule],
|
||||||
declarations: [
|
declarations: [
|
||||||
ImportComponent,
|
ImportComponent,
|
||||||
ExportComponent,
|
|
||||||
FilePasswordPromptComponent,
|
FilePasswordPromptComponent,
|
||||||
ImportErrorDialogComponent,
|
ImportErrorDialogComponent,
|
||||||
ImportSuccessDialogComponent,
|
ImportSuccessDialogComponent,
|
||||||
@ -53,4 +51,4 @@ import { ImportComponent } from "./import.component";
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
export class ImportExportModule {}
|
export class ImportModule {}
|
@ -2,16 +2,10 @@ import { NgModule } from "@angular/core";
|
|||||||
import { RouterModule, Routes } from "@angular/router";
|
import { RouterModule, Routes } from "@angular/router";
|
||||||
|
|
||||||
import { ExportComponent } from "./export.component";
|
import { ExportComponent } from "./export.component";
|
||||||
import { ImportComponent } from "./import.component";
|
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{
|
{
|
||||||
path: "import",
|
path: "",
|
||||||
component: ImportComponent,
|
|
||||||
data: { titleId: "importData" },
|
|
||||||
},
|
|
||||||
{
|
|
||||||
path: "export",
|
|
||||||
component: ExportComponent,
|
component: ExportComponent,
|
||||||
data: { titleId: "exportVault" },
|
data: { titleId: "exportVault" },
|
||||||
},
|
},
|
||||||
@ -20,4 +14,4 @@ const routes: Routes = [
|
|||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forChild(routes)],
|
imports: [RouterModule.forChild(routes)],
|
||||||
})
|
})
|
||||||
export class ImportExportRoutingModule {}
|
export class ExportRoutingModule {}
|
12
apps/web/src/app/tools/vault-export/export.module.ts
Normal file
12
apps/web/src/app/tools/vault-export/export.module.ts
Normal 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 {}
|
Loading…
Reference in New Issue
Block a user