1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-26 12:25:20 +01:00

lint fixes

This commit is contained in:
Kyle Spearrin 2018-02-08 10:37:54 -05:00
parent 7d8b00904a
commit 58e39c0c81
22 changed files with 100 additions and 90 deletions

View File

@ -6,8 +6,8 @@ import {
Output, Output,
} from '@angular/core'; } from '@angular/core';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster'; import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { EnvironmentService } from 'jslib/abstractions/environment.service'; import { EnvironmentService } from 'jslib/abstractions/environment.service';
import { I18nService } from 'jslib/abstractions/i18n.service'; import { I18nService } from 'jslib/abstractions/i18n.service';

View File

@ -1,13 +1,10 @@
import * as template from './hint.component.html'; import * as template from './hint.component.html';
import { import { Component } from '@angular/core';
Component,
} from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster'; import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { PasswordHintRequest } from 'jslib/models/request/passwordHintRequest'; import { PasswordHintRequest } from 'jslib/models/request/passwordHintRequest';

View File

@ -6,14 +6,13 @@ import {
ViewChild, ViewChild,
ViewContainerRef, ViewContainerRef,
} from '@angular/core'; } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster'; import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { EnvironmentComponent } from './environment.component';
import { ModalComponent } from '../modal.component'; import { ModalComponent } from '../modal.component';
import { EnvironmentComponent } from './environment.component';
import { AuthResult } from 'jslib/models/domain/authResult'; import { AuthResult } from 'jslib/models/domain/authResult';

View File

@ -1,13 +1,10 @@
import * as template from './register.component.html'; import * as template from './register.component.html';
import { import { Component } from '@angular/core';
Component,
} from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster'; import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { RegisterRequest } from 'jslib/models/request/registerRequest'; import { RegisterRequest } from 'jslib/models/request/registerRequest';

View File

@ -7,11 +7,10 @@ import {
OnInit, OnInit,
Output, Output,
} from '@angular/core'; } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster'; import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { TwoFactorProviderType } from 'jslib/enums/twoFactorProviderType'; import { TwoFactorProviderType } from 'jslib/enums/twoFactorProviderType';

View File

@ -10,11 +10,12 @@ import {
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster'; import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { ModalComponent } from '../modal.component';
import { TwoFactorOptionsComponent } from './two-factor-options.component'; import { TwoFactorOptionsComponent } from './two-factor-options.component';
import { ModalComponent } from '../modal.component';
import { TwoFactorProviderType } from 'jslib/enums/twoFactorProviderType'; import { TwoFactorProviderType } from 'jslib/enums/twoFactorProviderType';
@ -79,26 +80,26 @@ export class TwoFactorComponent implements OnInit {
break; break;
} }
const challenges = JSON.parse(params['Challenges']); const challenges = JSON.parse(params.Challenges);
// TODO: init u2f // TODO: init u2f
break; break;
case TwoFactorProviderType.Duo: case TwoFactorProviderType.Duo:
setTimeout(() => { setTimeout(() => {
(window as any).Duo.init({ (window as any).Duo.init({
host: params['Host'], host: params.Host,
sig_request: params['Signature'], sig_request: params.Signature,
submit_callback: async (f: HTMLFormElement) => { submit_callback: async (f: HTMLFormElement) => {
const sig = f.querySelector('input[name="sig_response"]') as HTMLInputElement; const sig = f.querySelector('input[name="sig_response"]') as HTMLInputElement;
if (sig != null) { if (sig != null) {
this.token = sig.value; this.token = sig.value;
await this.submit(); await this.submit();
} }
} },
}); });
}); });
break; break;
case TwoFactorProviderType.Email: case TwoFactorProviderType.Email:
this.twoFactorEmail = params['Email']; this.twoFactorEmail = params.Email;
if (this.authService.twoFactorProviders.size > 1) { if (this.authService.twoFactorProviders.size > 1) {
await this.sendEmail(false); await this.sendEmail(false);
} }

View File

@ -1,5 +1,8 @@
import {
ToasterConfig,
ToasterContainerComponent,
} from 'angular2-toaster';
import { Angulartics2GoogleAnalytics } from 'angulartics2/ga'; import { Angulartics2GoogleAnalytics } from 'angulartics2/ga';
import { ToasterContainerComponent, ToasterConfig } from 'angular2-toaster';
import { Component } from '@angular/core'; import { Component } from '@angular/core';

View File

@ -1,39 +1,45 @@
import 'core-js'; import 'core-js';
import 'zone.js/dist/zone'; import 'zone.js/dist/zone';
import { ToasterModule } from 'angular2-toaster';
import { Angulartics2Module } from 'angulartics2'; import { Angulartics2Module } from 'angulartics2';
import { Angulartics2GoogleAnalytics } from 'angulartics2/ga'; import { Angulartics2GoogleAnalytics } from 'angulartics2/ga';
import { AppRoutingModule } from './app-routing.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule } from '@angular/forms';
import { NgModule } from '@angular/core';
import { ServicesModule } from './services/services.module';
import { ToasterModule } from 'angular2-toaster';
import { AddEditComponent } from './vault/add-edit.component'; import { AppRoutingModule } from './app-routing.module';
import { ApiActionDirective } from './directives/api-action.directive'; import { ServicesModule } from './services/services.module';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { AttachmentsComponent } from './vault/attachments.component'; import { ModalComponent } from './modal.component';
import { EnvironmentComponent } from './accounts/environment.component';
import { HintComponent } from './accounts/hint.component';
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 { ApiActionDirective } from './directives/api-action.directive';
import { AutofocusDirective } from './directives/autofocus.directive'; import { AutofocusDirective } from './directives/autofocus.directive';
import { BlurClickDirective } from './directives/blur-click.directive'; import { BlurClickDirective } from './directives/blur-click.directive';
import { BoxRowDirective } from './directives/box-row.directive'; import { BoxRowDirective } from './directives/box-row.directive';
import { CiphersComponent } from './vault/ciphers.component';
import { EnvironmentComponent } from './accounts/environment.component';
import { FallbackSrcDirective } from './directives/fallback-src.directive'; import { FallbackSrcDirective } from './directives/fallback-src.directive';
import { FolderAddEditComponent } from './vault/folder-add-edit.component';
import { GroupingsComponent } from './vault/groupings.component';
import { HintComponent } from './accounts/hint.component';
import { I18nPipe } from './pipes/i18n.pipe';
import { IconComponent } from './vault/icon.component';
import { LoginComponent } from './accounts/login.component';
import { ModalComponent } from './modal.component';
import { PasswordGeneratorComponent } from './vault/password-generator.component';
import { RegisterComponent } from './accounts/register.component';
import { SearchCiphersPipe } from './pipes/search-ciphers.pipe';
import { StopClickDirective } from './directives/stop-click.directive'; import { StopClickDirective } from './directives/stop-click.directive';
import { StopPropDirective } from './directives/stop-prop.directive'; import { StopPropDirective } from './directives/stop-prop.directive';
import { TwoFactorComponent } from './accounts/two-factor.component';
import { TwoFactorOptionsComponent } from './accounts/two-factor-options.component'; import { I18nPipe } from './pipes/i18n.pipe';
import { SearchCiphersPipe } from './pipes/search-ciphers.pipe';
import { AddEditComponent } from './vault/add-edit.component';
import { AttachmentsComponent } from './vault/attachments.component';
import { CiphersComponent } from './vault/ciphers.component';
import { FolderAddEditComponent } from './vault/folder-add-edit.component';
import { GroupingsComponent } from './vault/groupings.component';
import { IconComponent } from './vault/icon.component';
import { PasswordGeneratorComponent } from './vault/password-generator.component';
import { VaultComponent } from './vault/vault.component'; import { VaultComponent } from './vault/vault.component';
import { ViewComponent } from './vault/view.component'; import { ViewComponent } from './vault/view.component';

View File

@ -9,15 +9,15 @@ import {
}) })
export class AutofocusDirective { export class AutofocusDirective {
@Input() set appAutofocus(condition: boolean | string) { @Input() set appAutofocus(condition: boolean | string) {
this._autofocus = condition === '' || condition === true; this.autofocus = condition === '' || condition === true;
} }
private _autofocus: boolean; private autofocus: boolean;
constructor(private el: ElementRef) { } constructor(private el: ElementRef) { }
ngOnInit() { ngOnInit() {
if (this._autofocus) { if (this.autofocus) {
this.el.nativeElement.focus(); this.el.nativeElement.focus();
} }
} }

View File

@ -1,7 +1,9 @@
import { enableProdMode } from '@angular/core'; import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
// tslint:disable-next-line
require('../scss/styles.scss'); require('../scss/styles.scss');
// tslint:disable-next-line
require('../scripts/duo.js'); require('../scripts/duo.js');
import { AppModule } from './app.module'; import { AppModule } from './app.module';

View File

@ -19,7 +19,7 @@ export class SearchCiphersPipe implements PipeTransform {
} }
searchText = searchText.toLowerCase(); searchText = searchText.toLowerCase();
return ciphers.filter(c => { return ciphers.filter((c) => {
if (c.name != null && c.name.toLowerCase().indexOf(searchText) > -1) { if (c.name != null && c.name.toLowerCase().indexOf(searchText) > -1) {
return true; return true;
} }

View File

@ -9,8 +9,8 @@ import { ToasterModule } from 'angular2-toaster';
import { DesktopMessagingService } from '../../services/desktopMessaging.service'; import { DesktopMessagingService } from '../../services/desktopMessaging.service';
import { DesktopPlatformUtilsService } from '../../services/desktopPlatformUtils.service'; import { DesktopPlatformUtilsService } from '../../services/desktopPlatformUtils.service';
import { DesktopStorageService } from '../../services/desktopStorage.service';
import { DesktopSecureStorageService } from '../../services/desktopSecureStorage.service'; import { DesktopSecureStorageService } from '../../services/desktopSecureStorage.service';
import { DesktopStorageService } from '../../services/desktopStorage.service';
import { I18nService } from '../../services/i18n.service'; import { I18nService } from '../../services/i18n.service';
import { ValidationService } from './validation.service'; import { ValidationService } from './validation.service';
@ -102,12 +102,12 @@ environmentService.setUrlsFromStorage().then(() => {
return syncService.fullSync(true); return syncService.fullSync(true);
}); });
function initFactory(i18n: I18nService, platformUtilsService: DesktopPlatformUtilsService): Function { function initFactory(i18n: I18nService, platformUtils: DesktopPlatformUtilsService): Function {
return async () => { return async () => {
await i18n.init(); await i18n.init();
await authService.init(); await authService.init();
const htmlEl = window.document.documentElement; const htmlEl = window.document.documentElement;
htmlEl.classList.add('os_' + platformUtilsService.getDeviceString()); htmlEl.classList.add('os_' + platformUtils.getDeviceString());
htmlEl.classList.add('locale_' + i18n.translationLocale); htmlEl.classList.add('locale_' + i18n.translationLocale);
}; };
} }
@ -136,7 +136,7 @@ function initFactory(i18n: I18nService, platformUtilsService: DesktopPlatformUti
provide: APP_INITIALIZER, provide: APP_INITIALIZER,
useFactory: initFactory, useFactory: initFactory,
deps: [ deps: [
I18nServiceAbstraction, I18nServiceAbstraction,
PlatformUtilsServiceAbstraction, PlatformUtilsServiceAbstraction,
], ],
multi: true, multi: true,

View File

@ -8,8 +8,8 @@ import {
Output, Output,
} from '@angular/core'; } from '@angular/core';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster'; import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { CipherType } from 'jslib/enums/cipherType'; import { CipherType } from 'jslib/enums/cipherType';
import { FieldType } from 'jslib/enums/fieldType'; import { FieldType } from 'jslib/enums/fieldType';
@ -144,7 +144,8 @@ export class AddEditComponent implements OnChanges {
await this.formPromise; await this.formPromise;
this.cipher.id = cipher.id; this.cipher.id = cipher.id;
this.analytics.eventTrack.next({ action: this.editMode ? 'Edited Cipher' : 'Added Cipher' }); this.analytics.eventTrack.next({ action: this.editMode ? 'Edited Cipher' : 'Added Cipher' });
this.toasterService.popAsync('success', null, this.i18nService.t(this.editMode ? 'editedItem' : 'addedItem')); this.toasterService.popAsync('success', null,
this.i18nService.t(this.editMode ? 'editedItem' : 'addedItem'));
this.onSavedCipher.emit(this.cipher); this.onSavedCipher.emit(this.cipher);
} catch { } } catch { }
} }
@ -177,7 +178,7 @@ export class AddEditComponent implements OnChanges {
async delete() { async delete() {
const confirmed = await this.platformUtilsService.showDialog( const confirmed = await this.platformUtilsService.showDialog(
this.i18nService.t('deleteItemConfirmation'), this.i18nService.t('deleteItem'), this.i18nService.t('deleteItemConfirmation'), this.i18nService.t('deleteItem'),
this.i18nService.t('yes'), this.i18nService.t('no'), 'warning') this.i18nService.t('yes'), this.i18nService.t('no'), 'warning');
if (!confirmed) { if (!confirmed) {
return; return;
} }
@ -195,7 +196,7 @@ export class AddEditComponent implements OnChanges {
if (this.cipher.login != null && this.cipher.login.password != null && this.cipher.login.password.length) { if (this.cipher.login != null && this.cipher.login.password != null && this.cipher.login.password.length) {
const confirmed = await this.platformUtilsService.showDialog( const confirmed = await this.platformUtilsService.showDialog(
this.i18nService.t('overwritePasswordConfirmation'), this.i18nService.t('overwritePassword'), this.i18nService.t('overwritePasswordConfirmation'), this.i18nService.t('overwritePassword'),
this.i18nService.t('yes'), this.i18nService.t('no')) this.i18nService.t('yes'), this.i18nService.t('no'));
if (!confirmed) { if (!confirmed) {
return; return;
} }

View File

@ -8,8 +8,8 @@ import {
Output, Output,
} from '@angular/core'; } from '@angular/core';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster'; import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { CipherService } from 'jslib/abstractions/cipher.service'; import { CipherService } from 'jslib/abstractions/cipher.service';
import { CryptoService } from 'jslib/abstractions/crypto.service'; import { CryptoService } from 'jslib/abstractions/crypto.service';
@ -19,8 +19,8 @@ import { TokenService } from 'jslib/abstractions/token.service';
import { Cipher } from 'jslib/models/domain/cipher'; import { Cipher } from 'jslib/models/domain/cipher';
import { CipherView } from 'jslib/models/view/cipherView';
import { AttachmentView } from 'jslib/models/view/attachmentView'; import { AttachmentView } from 'jslib/models/view/attachmentView';
import { CipherView } from 'jslib/models/view/cipherView';
@Component({ @Component({
selector: 'app-vault-attachments', selector: 'app-vault-attachments',
@ -53,14 +53,14 @@ export class AttachmentsComponent implements OnInit {
if (!this.canAccessAttachments) { if (!this.canAccessAttachments) {
const confirmed = await this.platformUtilsService.showDialog( const confirmed = await this.platformUtilsService.showDialog(
this.i18nService.t('premiumRequiredDesc'), this.i18nService.t('premiumRequired'), this.i18nService.t('premiumRequiredDesc'), this.i18nService.t('premiumRequired'),
this.i18nService.t('learnMore'), this.i18nService.t('cancel')) this.i18nService.t('learnMore'), this.i18nService.t('cancel'));
if (confirmed) { if (confirmed) {
this.platformUtilsService.launchUri('https://vault.bitwarden.com/#/?premium=purchase'); this.platformUtilsService.launchUri('https://vault.bitwarden.com/#/?premium=purchase');
} }
} else if (!this.hasUpdatedKey) { } else if (!this.hasUpdatedKey) {
const confirmed = await this.platformUtilsService.showDialog( const confirmed = await this.platformUtilsService.showDialog(
this.i18nService.t('updateKey'), this.i18nService.t('featureUnavailable'), this.i18nService.t('updateKey'), this.i18nService.t('featureUnavailable'),
this.i18nService.t('learnMore'), this.i18nService.t('cancel'), 'warning') this.i18nService.t('learnMore'), this.i18nService.t('cancel'), 'warning');
if (confirmed) { if (confirmed) {
this.platformUtilsService.launchUri('https://help.bitwarden.com/article/update-encryption-key/'); this.platformUtilsService.launchUri('https://help.bitwarden.com/article/update-encryption-key/');
} }
@ -110,7 +110,7 @@ export class AttachmentsComponent implements OnInit {
const confirmed = await this.platformUtilsService.showDialog( const confirmed = await this.platformUtilsService.showDialog(
this.i18nService.t('deleteAttachmentConfirmation'), this.i18nService.t('deleteAttachment'), this.i18nService.t('deleteAttachmentConfirmation'), this.i18nService.t('deleteAttachment'),
this.i18nService.t('yes'), this.i18nService.t('no'), 'warning') this.i18nService.t('yes'), this.i18nService.t('no'), 'warning');
if (!confirmed) { if (!confirmed) {
return; return;
} }

View File

@ -7,10 +7,10 @@ import {
Output, Output,
} from '@angular/core'; } from '@angular/core';
import { CipherView } from 'jslib/models/view/cipherView';
import { CipherService } from 'jslib/abstractions/cipher.service'; import { CipherService } from 'jslib/abstractions/cipher.service';
import { CipherView } from 'jslib/models/view/cipherView';
@Component({ @Component({
selector: 'app-vault-ciphers', selector: 'app-vault-ciphers',
template: template, template: template,
@ -30,7 +30,7 @@ export class CiphersComponent {
async load(filter: (cipher: CipherView) => boolean = null) { async load(filter: (cipher: CipherView) => boolean = null) {
this.filter = filter; this.filter = filter;
let ciphers = await this.cipherService.getAllDecrypted(); const ciphers = await this.cipherService.getAllDecrypted();
if (this.filter == null) { if (this.filter == null) {
this.ciphers = ciphers; this.ciphers = ciphers;

View File

@ -8,8 +8,8 @@ import {
Output, Output,
} from '@angular/core'; } from '@angular/core';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster'; import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { FolderService } from 'jslib/abstractions/folder.service'; import { FolderService } from 'jslib/abstractions/folder.service';
import { I18nService } from 'jslib/abstractions/i18n.service'; import { I18nService } from 'jslib/abstractions/i18n.service';
@ -58,7 +58,7 @@ export class FolderAddEditComponent implements OnInit {
try { try {
const folder = await this.folderService.encrypt(this.folder); const folder = await this.folderService.encrypt(this.folder);
this.formPromise = this.folderService.saveWithServer(folder);; this.formPromise = this.folderService.saveWithServer(folder);
await this.formPromise; await this.formPromise;
this.analytics.eventTrack.next({ action: this.editMode ? 'Edited Folder' : 'Added Folder' }); this.analytics.eventTrack.next({ action: this.editMode ? 'Edited Folder' : 'Added Folder' });
this.toasterService.popAsync('success', null, this.toasterService.popAsync('success', null,
@ -70,7 +70,7 @@ export class FolderAddEditComponent implements OnInit {
async delete() { async delete() {
const confirmed = await this.platformUtilsService.showDialog( const confirmed = await this.platformUtilsService.showDialog(
this.i18nService.t('deleteFolderConfirmation'), this.i18nService.t('deleteFolder'), this.i18nService.t('deleteFolderConfirmation'), this.i18nService.t('deleteFolder'),
this.i18nService.t('yes'), this.i18nService.t('no'), 'warning') this.i18nService.t('yes'), this.i18nService.t('no'), 'warning');
if (!confirmed) { if (!confirmed) {
return; return;
} }

View File

@ -10,8 +10,8 @@ import {
import { CipherType } from 'jslib/enums/cipherType'; import { CipherType } from 'jslib/enums/cipherType';
import { FolderView } from 'jslib/models/view/folderView';
import { CollectionView } from 'jslib/models/view/collectionView'; import { CollectionView } from 'jslib/models/view/collectionView';
import { FolderView } from 'jslib/models/view/folderView';
import { CollectionService } from 'jslib/abstractions/collection.service'; import { CollectionService } from 'jslib/abstractions/collection.service';
import { FolderService } from 'jslib/abstractions/folder.service'; import { FolderService } from 'jslib/abstractions/folder.service';

View File

@ -1,7 +1,7 @@
import * as template from './password-generator.component.html'; import * as template from './password-generator.component.html';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster'; import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { import {
Component, Component,

View File

@ -1,5 +1,6 @@
import * as template from './vault.component.html'; import * as template from './vault.component.html';
import { Location } from '@angular/common';
import { import {
Component, Component,
ComponentFactoryResolver, ComponentFactoryResolver,
@ -7,21 +8,19 @@ import {
ViewChild, ViewChild,
ViewContainerRef, ViewContainerRef,
} from '@angular/core'; } from '@angular/core';
import { import {
ActivatedRoute, ActivatedRoute,
Router, Router,
} from '@angular/router'; } from '@angular/router';
import { Location } from '@angular/common'; import { ModalComponent } from '../modal.component';
import { AttachmentsComponent } from './attachments.component';
import { AddEditComponent } from './add-edit.component'; import { AddEditComponent } from './add-edit.component';
import { AttachmentsComponent } from './attachments.component';
import { CiphersComponent } from './ciphers.component'; import { CiphersComponent } from './ciphers.component';
import { FolderAddEditComponent } from './folder-add-edit.component'; import { FolderAddEditComponent } from './folder-add-edit.component';
import { GroupingsComponent } from './groupings.component'; import { GroupingsComponent } from './groupings.component';
import { PasswordGeneratorComponent } from './password-generator.component'; import { PasswordGeneratorComponent } from './password-generator.component';
import { ModalComponent } from '../modal.component';
import { CipherType } from 'jslib/enums/cipherType'; import { CipherType } from 'jslib/enums/cipherType';
@ -56,32 +55,32 @@ export class VaultComponent implements OnInit {
async ngOnInit() { async ngOnInit() {
this.route.queryParams.subscribe(async (params) => { this.route.queryParams.subscribe(async (params) => {
if (params['cipherId']) { if (params.cipherId) {
const cipherView = new CipherView(); const cipherView = new CipherView();
cipherView.id = params['cipherId']; cipherView.id = params.cipherId;
if (params['action'] === 'edit') { if (params.action === 'edit') {
this.editCipher(cipherView); this.editCipher(cipherView);
} else { } else {
this.viewCipher(cipherView); this.viewCipher(cipherView);
} }
} else if (params['action'] === 'add') { } else if (params.action === 'add') {
this.addCipher(); this.addCipher();
} }
if (params['favorites']) { if (params.favorites) {
this.groupingsComponent.selectedFavorites = true; this.groupingsComponent.selectedFavorites = true;
await this.filterFavorites(); await this.filterFavorites();
} else if (params['type']) { } else if (params.type) {
const t = parseInt(params['type']); const t = parseInt(params.type, null);
this.groupingsComponent.selectedType = t; this.groupingsComponent.selectedType = t;
await this.filterCipherType(t); await this.filterCipherType(t);
} else if (params['folderId']) { } else if (params.folderId) {
this.groupingsComponent.selectedFolder = true; this.groupingsComponent.selectedFolder = true;
this.groupingsComponent.selectedFolderId = params['folderId']; this.groupingsComponent.selectedFolderId = params.folderId;
await this.filterFolder(params['folderId']); await this.filterFolder(params.folderId);
} else if (params['collectionId']) { } else if (params.collectionId) {
this.groupingsComponent.selectedCollectionId = params['collectionId']; this.groupingsComponent.selectedCollectionId = params.collectionId;
await this.filterCollection(params['collectionId']); await this.filterCollection(params.collectionId);
} else { } else {
this.groupingsComponent.selectedAll = true; this.groupingsComponent.selectedAll = true;
await this.ciphersComponent.load(); await this.ciphersComponent.load();

View File

@ -9,8 +9,8 @@ import {
Output, Output,
} from '@angular/core'; } from '@angular/core';
import { Angulartics2 } from 'angulartics2';
import { ToasterService } from 'angular2-toaster'; import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { CipherType } from 'jslib/enums/cipherType'; import { CipherType } from 'jslib/enums/cipherType';
import { FieldType } from 'jslib/enums/fieldType'; import { FieldType } from 'jslib/enums/fieldType';

View File

@ -1,5 +1,6 @@
import { StorageService } from 'jslib/abstractions'; import { StorageService } from 'jslib/abstractions';
// tslint:disable-next-line
const Store = require('electron-store'); const Store = require('electron-store');
const store = new Store(); const store = new Store();

View File

@ -116,6 +116,11 @@ const renderer = {
path: 'fonts/', path: 'fonts/',
filename: 'css/fonts.css' filename: 'css/fonts.css'
}), }),
// ref: https://github.com/angular/angular/issues/20357
new webpack.ContextReplacementPlugin(
/\@angular(\\|\/)core(\\|\/)esm5/,
path.resolve(__dirname, './src')
),
new webpack.optimize.CommonsChunkPlugin({ new webpack.optimize.CommonsChunkPlugin({
name: 'app/vendor', name: 'app/vendor',
chunks: ['app/main'], chunks: ['app/main'],