From 80e71d4923d5e5a7aaf5a9e633594ea568b2c94b Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 23 Oct 2018 12:16:27 -0400 Subject: [PATCH] collection management --- jslib | 2 +- src/popup/app-routing.animations.ts | 4 +-- src/popup/app-routing.module.ts | 7 +++++ src/popup/app.module.ts | 2 ++ src/popup/vault/add-edit.component.html | 5 ++++ src/popup/vault/add-edit.component.ts | 6 ++++ src/popup/vault/collections.component.html | 34 ++++++++++++++++++++++ src/popup/vault/collections.component.ts | 33 +++++++++++++++++++++ 8 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 src/popup/vault/collections.component.html create mode 100644 src/popup/vault/collections.component.ts diff --git a/jslib b/jslib index 89c23522d5..8e377050e9 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 89c23522d5697c722dcbe7d074cd12ebb6dc8783 +Subproject commit 8e377050e9bfddae46fa0a167771b670593eca16 diff --git a/src/popup/app-routing.animations.ts b/src/popup/app-routing.animations.ts index a1baf4535e..dea56a1819 100644 --- a/src/popup/app-routing.animations.ts +++ b/src/popup/app-routing.animations.ts @@ -123,8 +123,8 @@ export const routerTransition = trigger('routerTransition', [ transition('edit-cipher => share-cipher', inSlideUp), transition('share-cipher => edit-cipher', outSlideDown), - transition('edit-cipher => attachments', inSlideLeft), - transition('attachments => edit-cipher', outSlideRight), + transition('edit-cipher => attachments, edit-cipher => collections', inSlideLeft), + transition('attachments => edit-cipher, collections => 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 83fa66939c..4b0b2c7ea2 100644 --- a/src/popup/app-routing.module.ts +++ b/src/popup/app-routing.module.ts @@ -30,6 +30,7 @@ import { TabsComponent } from './tabs.component'; import { AddEditComponent } from './vault/add-edit.component'; import { AttachmentsComponent } from './vault/attachments.component'; import { CiphersComponent } from './vault/ciphers.component'; +import { CollectionsComponent } from './vault/collections.component'; import { CurrentTabComponent } from './vault/current-tab.component'; import { GroupingsComponent } from './vault/groupings.component'; import { PasswordHistoryComponent } from './vault/password-history.component'; @@ -130,6 +131,12 @@ const routes: Routes = [ canActivate: [AuthGuardService], data: { state: 'share-cipher' }, }, + { + path: 'collections', + component: CollectionsComponent, + canActivate: [AuthGuardService], + data: { state: 'collections' }, + }, { path: 'attachments', component: AttachmentsComponent, diff --git a/src/popup/app.module.ts b/src/popup/app.module.ts index b83b3c27f3..398165161d 100644 --- a/src/popup/app.module.ts +++ b/src/popup/app.module.ts @@ -37,6 +37,7 @@ import { TabsComponent } from './tabs.component'; import { AddEditComponent } from './vault/add-edit.component'; import { AttachmentsComponent } from './vault/attachments.component'; import { CiphersComponent } from './vault/ciphers.component'; +import { CollectionsComponent } from './vault/collections.component'; import { CurrentTabComponent } from './vault/current-tab.component'; import { GroupingsComponent } from './vault/groupings.component'; import { PasswordHistoryComponent } from './vault/password-history.component'; @@ -154,6 +155,7 @@ registerLocaleData(localeZhTw, 'zh-TW'); BoxRowDirective, CiphersComponent, CiphersListComponent, + CollectionsComponent, CurrentTabComponent, EnvironmentComponent, ExportComponent, diff --git a/src/popup/vault/add-edit.component.html b/src/popup/vault/add-edit.component.html index db285d8527..df10f4d322 100644 --- a/src/popup/vault/add-edit.component.html +++ b/src/popup/vault/add-edit.component.html @@ -258,6 +258,11 @@
{{'attachments' | i18n}}
+ +
{{'collections' | i18n}}
+ +
diff --git a/src/popup/vault/add-edit.component.ts b/src/popup/vault/add-edit.component.ts index 66d876441a..7a2a3a7c25 100644 --- a/src/popup/vault/add-edit.component.ts +++ b/src/popup/vault/add-edit.component.ts @@ -91,6 +91,12 @@ export class AddEditComponent extends BaseAddEditComponent { } } + editCollections() { + if (this.cipher.organizationId != null) { + this.router.navigate(['/collections'], { queryParams: { cipherId: this.cipher.id } }); + } + } + cancel() { super.cancel(); this.location.back(); diff --git a/src/popup/vault/collections.component.html b/src/popup/vault/collections.component.html new file mode 100644 index 0000000000..2da63fbcfe --- /dev/null +++ b/src/popup/vault/collections.component.html @@ -0,0 +1,34 @@ +
+
+
+ +
+
+ {{'collections' | i18n}} +
+
+ +
+
+ +
+
+ {{'noCollectionsInList' | i18n}} +
+
+
+ + +
+
+
+
+
diff --git a/src/popup/vault/collections.component.ts b/src/popup/vault/collections.component.ts new file mode 100644 index 0000000000..8d15361727 --- /dev/null +++ b/src/popup/vault/collections.component.ts @@ -0,0 +1,33 @@ +import { Location } from '@angular/common'; +import { Component } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; + +import { CipherService } from 'jslib/abstractions/cipher.service'; +import { CollectionService } from 'jslib/abstractions/collection.service'; +import { I18nService } from 'jslib/abstractions/i18n.service'; +import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; + +import { CollectionsComponent as BaseCollectionsComponent } from 'jslib/angular/components/collections.component'; + +@Component({ + selector: 'app-vault-collections', + templateUrl: 'collections.component.html', +}) +export class CollectionsComponent extends BaseCollectionsComponent { + constructor(collectionService: CollectionService, platformUtilsService: PlatformUtilsService, + i18nService: I18nService, cipherService: CipherService, + private route: ActivatedRoute, private location: Location) { + super(collectionService, platformUtilsService, i18nService, cipherService); + } + + async ngOnInit() { + this.route.queryParams.subscribe(async (params) => { + this.cipherId = params.cipherId; + await super.ngOnInit(); + }); + } + + back() { + this.location.back(); + } +}