addEditCipherInfo w/ collections from state

This commit is contained in:
Kyle Spearrin 2019-06-24 21:12:52 -04:00
parent db83b042ff
commit 6c7a0d90df
5 changed files with 12 additions and 4 deletions

2
jslib

@ -1 +1 @@
Subproject commit bc5a6e02c106dc87413f22b7c7cb0334c1fc6e88
Subproject commit 24ffb55ce0e781fb06cd04d318e9f70afe80d734

View File

@ -6,6 +6,7 @@
"sub:update": "git submodule update --remote",
"sub:pull": "git submodule foreach git pull",
"postinstall": "npm run sub:init && gulp postinstall",
"simlink:win": "rm -rf ./jslib && cmd /c mklink /J .\\jslib ..\\jslib",
"build": "gulp build && webpack",
"build:watch": "gulp build && webpack --watch",
"build:prod": "gulp build && cross-env NODE_ENV=production webpack",

View File

@ -144,7 +144,7 @@ export class AppComponent implements OnInit {
this.stateService.remove('CiphersComponent');
}
if (url.startsWith('/tabs/')) {
this.stateService.remove('addEditCipher');
this.stateService.remove('addEditCipherInfo');
}
(window as any).previousPopupUrl = url;

View File

@ -27,7 +27,10 @@ export class PasswordGeneratorComponent extends BasePasswordGeneratorComponent {
async ngOnInit() {
await super.ngOnInit();
this.cipherState = await this.stateService.get<CipherView>('addEditCipher');
const addEditCipherInfo = await this.stateService.get<any>('addEditCipherInfo');
if (addEditCipherInfo != null) {
this.cipherState = addEditCipherInfo.cipher;
}
this.showSelect = this.cipherState != null;
}

View File

@ -118,7 +118,11 @@ export class AddEditComponent extends BaseAddEditComponent {
async generatePassword(): Promise<boolean> {
const confirmed = await super.generatePassword();
if (confirmed) {
this.stateService.save('addEditCipher', this.cipher);
this.stateService.save('addEditCipherInfo', {
cipher: this.cipher,
collectionIds: this.collections == null ? [] :
this.collections.filter((c) => (c as any).checked).map((c) => c.id),
});
this.router.navigate(['generator']);
}
return confirmed;