diff --git a/jslib b/jslib index 2782ae33fc..df9074a0e5 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 2782ae33fcd60f9b84396e54a7d08cfa583f47be +Subproject commit df9074a0e58a1b4a499a0682e964013b546d786f diff --git a/src/popup/app-routing.animations.ts b/src/popup/app-routing.animations.ts index f3a175169a..615a4407fb 100644 --- a/src/popup/app-routing.animations.ts +++ b/src/popup/app-routing.animations.ts @@ -129,6 +129,12 @@ export const routerTransition = trigger('routerTransition', [ transition('tabs => export', inSlideLeft), transition('export => tabs', outSlideRight), + transition('tabs => folders', inSlideLeft), + transition('folders => tabs', outSlideRight), + + transition('folders => edit-folder, folders => add-folder', inSlideUp), + transition('edit-folder => folders, add-folder => folders', outSlideDown), + transition('tabs => lock', inSlideDown), transition('lock => tabs', outSlideUp), ]); diff --git a/src/popup/app-routing.module.ts b/src/popup/app-routing.module.ts index a372c5af93..8660a7a59f 100644 --- a/src/popup/app-routing.module.ts +++ b/src/popup/app-routing.module.ts @@ -16,11 +16,13 @@ import { LoginComponent } from './accounts/login.component'; import { RegisterComponent } from './accounts/register.component'; import { TwoFactorOptionsComponent } from './accounts/two-factor-options.component'; import { TwoFactorComponent } from './accounts/two-factor.component'; +import { PasswordGeneratorHistoryComponent } from './generator/password-generator-history.component'; +import { PasswordGeneratorComponent } from './generator/password-generator.component'; +import { ExportComponent } from './settings/export.component'; +import { FolderAddEditComponent } from './settings/folder-add-edit.component'; +import { FoldersComponent } from './settings/folders.component'; import { SettingsComponent } from './settings/settings.component'; import { TabsComponent } from './tabs.component'; -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'; @@ -134,6 +136,24 @@ const routes: Routes = [ canActivate: [AuthGuardService], data: { state: 'export' }, }, + { + path: 'folders', + component: FoldersComponent, + canActivate: [AuthGuardService], + data: { state: 'folders' }, + }, + { + path: 'add-folder', + component: FolderAddEditComponent, + canActivate: [AuthGuardService], + data: { state: 'add-folder' }, + }, + { + path: 'edit-folder', + component: FolderAddEditComponent, + canActivate: [AuthGuardService], + data: { state: 'edit-folder' }, + }, { path: 'tabs', component: TabsComponent, diff --git a/src/popup/app.module.ts b/src/popup/app.module.ts index 7215f98400..e465e41aeb 100644 --- a/src/popup/app.module.ts +++ b/src/popup/app.module.ts @@ -24,11 +24,13 @@ import { LoginComponent } from './accounts/login.component'; import { RegisterComponent } from './accounts/register.component'; import { TwoFactorOptionsComponent } from './accounts/two-factor-options.component'; import { TwoFactorComponent } from './accounts/two-factor.component'; +import { PasswordGeneratorHistoryComponent } from './generator/password-generator-history.component'; +import { PasswordGeneratorComponent } from './generator/password-generator.component'; +import { ExportComponent } from './settings/export.component'; +import { FolderAddEditComponent } from './settings/folder-add-edit.component'; +import { FoldersComponent } from './settings/folders.component'; import { SettingsComponent } from './settings/settings.component'; import { TabsComponent } from './tabs.component'; -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'; @@ -83,6 +85,8 @@ import { IconComponent } from 'jslib/angular/components/icon.component'; EnvironmentComponent, ExportComponent, FallbackSrcDirective, + FolderAddEditComponent, + FoldersComponent, GroupingsComponent, HomeComponent, HintComponent, diff --git a/src/popup/tools/password-generator-history.component.html b/src/popup/generator/password-generator-history.component.html similarity index 100% rename from src/popup/tools/password-generator-history.component.html rename to src/popup/generator/password-generator-history.component.html diff --git a/src/popup/tools/password-generator-history.component.ts b/src/popup/generator/password-generator-history.component.ts similarity index 100% rename from src/popup/tools/password-generator-history.component.ts rename to src/popup/generator/password-generator-history.component.ts diff --git a/src/popup/tools/password-generator.component.html b/src/popup/generator/password-generator.component.html similarity index 100% rename from src/popup/tools/password-generator.component.html rename to src/popup/generator/password-generator.component.html diff --git a/src/popup/tools/password-generator.component.ts b/src/popup/generator/password-generator.component.ts similarity index 100% rename from src/popup/tools/password-generator.component.ts rename to src/popup/generator/password-generator.component.ts diff --git a/src/popup/tools/export.component.html b/src/popup/settings/export.component.html similarity index 100% rename from src/popup/tools/export.component.html rename to src/popup/settings/export.component.html diff --git a/src/popup/tools/export.component.ts b/src/popup/settings/export.component.ts similarity index 100% rename from src/popup/tools/export.component.ts rename to src/popup/settings/export.component.ts diff --git a/src/popup/settings/folder-add-edit.component.html b/src/popup/settings/folder-add-edit.component.html new file mode 100644 index 0000000000..e5e93aca74 --- /dev/null +++ b/src/popup/settings/folder-add-edit.component.html @@ -0,0 +1,41 @@ +
+
+
+ +
+
+ {{title}} +
+
+ +
+
+ +
+
+
+ + +
+
+
+ +
+
diff --git a/src/popup/settings/folder-add-edit.component.ts b/src/popup/settings/folder-add-edit.component.ts new file mode 100644 index 0000000000..0af1359d74 --- /dev/null +++ b/src/popup/settings/folder-add-edit.component.ts @@ -0,0 +1,60 @@ +import { Location } from '@angular/common'; +import { Component } from '@angular/core'; +import { + ActivatedRoute, + Router, +} from '@angular/router'; + +import { ToasterService } from 'angular2-toaster'; +import { Angulartics2 } from 'angulartics2'; + +import { FolderService } from 'jslib/abstractions/folder.service'; +import { I18nService } from 'jslib/abstractions/i18n.service'; +import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; + +import { + FolderAddEditComponent as BaseFolderAddEditComponent, +} from 'jslib/angular/components/folder-add-edit.component'; + +@Component({ + selector: 'app-folder-add-edit', + templateUrl: 'folder-add-edit.component.html', +}) +export class FolderAddEditComponent extends BaseFolderAddEditComponent { + constructor(folderService: FolderService, i18nService: I18nService, + analytics: Angulartics2, toasterService: ToasterService, + platformUtilsService: PlatformUtilsService, private location: Location, + private router: Router, private route: ActivatedRoute) { + super(folderService, i18nService, analytics, toasterService, platformUtilsService); + } + + async ngOnInit() { + this.route.queryParams.subscribe(async (params) => { + if (params.folderId) { + this.folderId = params.folderId; + } + await super.ngOnInit(); + }); + } + + async submit(): Promise { + if (await super.submit()) { + this.location.back(); + return true; + } + + return false; + } + + cancel() { + this.location.back(); + } + + async delete(): Promise { + const confirmed = await super.delete(); + if (confirmed) { + this.location.back(); + } + return confirmed; + } +} diff --git a/src/popup/settings/folders.component.html b/src/popup/settings/folders.component.html new file mode 100644 index 0000000000..926dc1310b --- /dev/null +++ b/src/popup/settings/folders.component.html @@ -0,0 +1,27 @@ +
+
+ +
+
+ {{'folders' | i18n}} +
+
+ +
+
+ +
+ +
+
+

{{'noFolders' | i18n}}

+
+
diff --git a/src/popup/settings/folders.component.ts b/src/popup/settings/folders.component.ts new file mode 100644 index 0000000000..69aa31319a --- /dev/null +++ b/src/popup/settings/folders.component.ts @@ -0,0 +1,38 @@ +import { Location } from '@angular/common'; +import { + Component, + OnInit, +} from '@angular/core'; +import { Router } from '@angular/router'; + +import { FolderView } from 'jslib/models/view/folderView'; + +import { FolderService } from 'jslib/abstractions/folder.service'; + +@Component({ + selector: 'app-folders', + templateUrl: 'folders.component.html', +}) +export class FoldersComponent implements OnInit { + folders: FolderView[]; + + constructor(private folderService: FolderService, private location: Location, + private router: Router) { + } + + async ngOnInit() { + this.folders = await this.folderService.getAllDecrypted(); + } + + folderSelected(folder: FolderView) { + this.router.navigate(['/edit-folder'], { queryParams: { folderId: folder.id } }); + } + + addFolder() { + this.router.navigate(['/add-folder']); + } + + close() { + this.location.back(); + } +}