1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-21 11:35:34 +01:00

Create import-browser-v2 component (#9214)

Copy existing `import-browser`-component
Add `popup-page` and -`header` and -`footer`
Add missing imports as page is marked as standalone
Fix no-floating-promise
Change to route OnSuccess to `vault-settings` instead of old `settings`-page

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
This commit is contained in:
Daniel James Smith 2024-05-28 16:47:35 +02:00 committed by GitHub
parent 5bdb42a44b
commit 49b59840a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 71 additions and 3 deletions

View File

@ -41,6 +41,7 @@ import { AboutPageComponent } from "../tools/popup/settings/about-page/about-pag
import { MoreFromBitwardenPageV2Component } from "../tools/popup/settings/about-page/more-from-bitwarden-page-v2.component"; import { MoreFromBitwardenPageV2Component } from "../tools/popup/settings/about-page/more-from-bitwarden-page-v2.component";
import { MoreFromBitwardenPageComponent } from "../tools/popup/settings/about-page/more-from-bitwarden-page.component"; import { MoreFromBitwardenPageComponent } from "../tools/popup/settings/about-page/more-from-bitwarden-page.component";
import { ExportComponent } from "../tools/popup/settings/export.component"; import { ExportComponent } from "../tools/popup/settings/export.component";
import { ImportBrowserV2Component } from "../tools/popup/settings/import/import-browser-v2.component";
import { ImportBrowserComponent } from "../tools/popup/settings/import/import-browser.component"; import { ImportBrowserComponent } from "../tools/popup/settings/import/import-browser.component";
import { SettingsV2Component } from "../tools/popup/settings/settings-v2.component"; import { SettingsV2Component } from "../tools/popup/settings/settings-v2.component";
import { SettingsComponent } from "../tools/popup/settings/settings.component"; import { SettingsComponent } from "../tools/popup/settings/settings.component";
@ -238,12 +239,11 @@ const routes: Routes = [
canActivate: [AuthGuard], canActivate: [AuthGuard],
data: { state: "generator-history" }, data: { state: "generator-history" },
}, },
{ ...extensionRefreshSwap(ImportBrowserComponent, ImportBrowserV2Component, {
path: "import", path: "import",
component: ImportBrowserComponent,
canActivate: [AuthGuard], canActivate: [AuthGuard],
data: { state: "import" }, data: { state: "import" },
}, }),
{ {
path: "export", path: "export",
component: ExportComponent, component: ExportComponent,

View File

@ -0,0 +1,28 @@
<popup-page>
<popup-header slot="header" [pageTitle]="'importData' | i18n" showBackButton>
<ng-container slot="end">
<app-pop-out></app-pop-out>
</ng-container>
</popup-header>
<tools-import
(formDisabled)="this.disabled = $event"
(formLoading)="this.loading = $event"
(onSuccessfulImport)="this.onSuccessfulImport($event)"
>
</tools-import>
<popup-footer slot="footer">
<button
[disabled]="disabled"
[loading]="loading"
form="import_form_importForm"
bitButton
type="submit"
bitFormButton
buttonType="primary"
>
{{ "importData" | i18n }}
</button>
</popup-footer>
</popup-page>

View File

@ -0,0 +1,40 @@
import { CommonModule } from "@angular/common";
import { Component } from "@angular/core";
import { Router, RouterLink } from "@angular/router";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { AsyncActionsModule, ButtonModule, DialogModule } from "@bitwarden/components";
import { ImportComponent } from "@bitwarden/importer/ui";
import { PopOutComponent } from "../../../../platform/popup/components/pop-out.component";
import { PopupFooterComponent } from "../../../../platform/popup/layout/popup-footer.component";
import { PopupHeaderComponent } from "../../../../platform/popup/layout/popup-header.component";
import { PopupPageComponent } from "../../../../platform/popup/layout/popup-page.component";
@Component({
templateUrl: "import-browser-v2.component.html",
standalone: true,
imports: [
CommonModule,
RouterLink,
JslibModule,
DialogModule,
AsyncActionsModule,
ButtonModule,
ImportComponent,
PopupPageComponent,
PopupFooterComponent,
PopupHeaderComponent,
PopOutComponent,
],
})
export class ImportBrowserV2Component {
protected disabled = false;
protected loading = false;
constructor(private router: Router) {}
protected async onSuccessfulImport(organizationId: string): Promise<void> {
await this.router.navigate(["/vault-settings"]);
}
}