diff --git a/src/popup/app-routing.animations.ts b/src/popup/app-routing.animations.ts index 58b136466f6..f3a175169a1 100644 --- a/src/popup/app-routing.animations.ts +++ b/src/popup/app-routing.animations.ts @@ -123,6 +123,9 @@ export const routerTransition = trigger('routerTransition', [ transition('add-cipher => generator, edit-cipher => generator', inSlideUp), transition('generator => add-cipher, generator => edit-cipher', outSlideDown), + transition('edit-cipher => attachments', inSlideLeft), + transition('attachments => edit-cipher', outSlideRight), + transition('tabs => export', inSlideLeft), transition('export => tabs', outSlideRight), diff --git a/src/popup/app-routing.module.ts b/src/popup/app-routing.module.ts index d7faef86528..a372c5af931 100644 --- a/src/popup/app-routing.module.ts +++ b/src/popup/app-routing.module.ts @@ -22,6 +22,7 @@ import { ExportComponent } from './tools/export.component'; import { PasswordGeneratorHistoryComponent } from './tools/password-generator-history.component'; import { PasswordGeneratorComponent } from './tools/password-generator.component'; import { AddEditComponent } from './vault/add-edit.component'; +import { AttachmentsComponent } from './vault/attachments.component'; import { CiphersComponent } from './vault/ciphers.component'; import { CurrentTabComponent } from './vault/current-tab.component'; import { GroupingsComponent } from './vault/groupings.component'; @@ -109,6 +110,12 @@ const routes: Routes = [ canActivate: [AuthGuardService], data: { state: 'edit-cipher' }, }, + { + path: 'attachments', + component: AttachmentsComponent, + canActivate: [AuthGuardService], + data: { state: 'attachments' }, + }, { path: 'generator', component: PasswordGeneratorComponent, diff --git a/src/popup/app.module.ts b/src/popup/app.module.ts index 90c4805fec2..7215f98400c 100644 --- a/src/popup/app.module.ts +++ b/src/popup/app.module.ts @@ -27,10 +27,10 @@ import { TwoFactorComponent } from './accounts/two-factor.component'; import { SettingsComponent } from './settings/settings.component'; import { TabsComponent } from './tabs.component'; import { ExportComponent } from './tools/export.component'; -import { PasswordGeneratorComponent } from './tools/password-generator.component'; -// tslint:disable-next-line import { PasswordGeneratorHistoryComponent } from './tools/password-generator-history.component'; +import { PasswordGeneratorComponent } from './tools/password-generator.component'; import { AddEditComponent } from './vault/add-edit.component'; +import { AttachmentsComponent } from './vault/attachments.component'; import { CiphersComponent } from './vault/ciphers.component'; import { CurrentTabComponent } from './vault/current-tab.component'; import { GroupingsComponent } from './vault/groupings.component'; @@ -73,6 +73,7 @@ import { IconComponent } from 'jslib/angular/components/icon.component'; AddEditComponent, ApiActionDirective, AppComponent, + AttachmentsComponent, AutofocusDirective, BlurClickDirective, BoxRowDirective, diff --git a/src/popup/vault/add-edit.component.ts b/src/popup/vault/add-edit.component.ts index 0d59ebc926f..a3f5d6aa8d1 100644 --- a/src/popup/vault/add-edit.component.ts +++ b/src/popup/vault/add-edit.component.ts @@ -82,6 +82,11 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit { return false; } + attachments() { + super.attachments(); + this.router.navigate(['/attachments'], { queryParams: { cipherId: this.cipher.id } }); + } + cancel() { super.cancel(); this.location.back(); diff --git a/src/popup/vault/attachments.component.html b/src/popup/vault/attachments.component.html new file mode 100644 index 00000000000..641f47e2944 --- /dev/null +++ b/src/popup/vault/attachments.component.html @@ -0,0 +1,53 @@ +
diff --git a/src/popup/vault/attachments.component.ts b/src/popup/vault/attachments.component.ts new file mode 100644 index 00000000000..c99676f17b5 --- /dev/null +++ b/src/popup/vault/attachments.component.ts @@ -0,0 +1,40 @@ +import { Location } from '@angular/common'; +import { Component } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; + +import { ToasterService } from 'angular2-toaster'; +import { Angulartics2 } from 'angulartics2'; + +import { CipherService } from 'jslib/abstractions/cipher.service'; +import { CryptoService } from 'jslib/abstractions/crypto.service'; +import { I18nService } from 'jslib/abstractions/i18n.service'; +import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; +import { TokenService } from 'jslib/abstractions/token.service'; + +import { AttachmentsComponent as BaseAttachmentsComponent } from 'jslib/angular/components/attachments.component'; + +@Component({ + selector: 'app-vault-attachments', + templateUrl: 'attachments.component.html', +}) +export class AttachmentsComponent extends BaseAttachmentsComponent { + constructor(cipherService: CipherService, analytics: Angulartics2, + toasterService: ToasterService, i18nService: I18nService, + cryptoService: CryptoService, tokenService: TokenService, + platformUtilsService: PlatformUtilsService, private location: Location, + private route: ActivatedRoute) { + super(cipherService, analytics, toasterService, i18nService, cryptoService, tokenService, + platformUtilsService); + } + + async ngOnInit() { + this.route.queryParams.subscribe(async (params) => { + this.cipherId = params.cipherId; + await super.ngOnInit(); + }); + } + + back() { + this.location.back(); + } +}